diff --git a/.travis.yml b/.travis.yml index 1b528a51f7..ef48e6baec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,15 +28,16 @@ env: global: - TAS_SCRIPTS=../alfresco-community-repo/packaging/tests/scripts - TAS_ENVIRONMENT=./packaging/tests/environment - - LOG_WARN="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" stages: - name: test if: commit_message !~ /\[skip tests\]/ - name: release - if: commit_message !~ /\[no release\]/ AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND fork = false + if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no release\]/ - name: update_downstream - if: commit_message !~ /\[no downstream\]/ AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND fork = false + if: fork = false AND (branch = master OR branch =~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/ + - name: trigger_downstream + if: fork = false AND (branch != master AND branch !~ /release\/.*/) AND type != pull_request AND commit_message !~ /\[no downstream\]/ before_install: travis_retry bash scripts/travis/init.sh install: travis_retry travis_wait 40 bash scripts/travis/build.sh @@ -45,13 +46,11 @@ jobs: include: - name: "Core, Data-Model, Repository - AllUnitTestsSuite - Build and test" - if: commit_message !~ /\[skip repo\]/ script: - travis_retry mvn -B test -pl core,data-model - travis_retry mvn -B test -pl repository -Dtest=AllUnitTestsSuite - name: "Repository - AppContext01TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -59,14 +58,12 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - AppContext02TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - AppContext03TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -74,7 +71,6 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - AppContext04TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -82,7 +78,6 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - AppContext05TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -93,7 +88,6 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext05TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco "-Didentity-service.auth-server-url=http://${HOST_IP}:8999/auth" - name: "Repository - AppContext06TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -101,7 +95,6 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - AppContextExtraTestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -109,7 +102,6 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - MiscContextTestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -117,70 +109,68 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - SearchTestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=SearchTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco -Dindex.subsystem.name=solr6 - name: "Repository - MariaDB 10.2.18 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.2.18 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - name: "Repository - MariaDB 10.4 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.4 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - name: "Repository - MariaDB 10.5 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 3307:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mariadb:10.5 --transaction-isolation=READ-COMMITTED --max-connections=300 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.name=alfresco -Ddb.url=jdbc:mariadb://localhost:3307/alfresco?useUnicode=yes\&characterEncoding=UTF-8 -Ddb.username=alfresco -Ddb.password=alfresco -Ddb.driver=org.mariadb.jdbc.Driver - name: "Repository - MySQL 5.7.23 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:5.7.23 --transaction-isolation='READ-COMMITTED' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - MySQL 8 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=alfresco -e MYSQL_USER=alfresco -e MYSQL_DATABASE=alfresco -e MYSQL_PASSWORD=alfresco mysql:8 --transaction-isolation='READ-COMMITTED' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=com.mysql.jdbc.Driver -Ddb.name=alfresco -Ddb.url=jdbc:mysql://localhost:3307/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - PostgreSQL 10.9 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:10.9 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - PostgreSQL 11.7 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:11.7 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - PostgreSQL 12.4 tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip db\]/) OR commit_message =~ /\[db\]/ + if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:12.4 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - PostgreSQL 13.1 tests" - # We only run DB tests on the latest version of PostgreSQL on feature branches if: commit_message !~ /\[skip db\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' @@ -188,20 +178,17 @@ jobs: script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Repository - Messaging tests" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl repository -Dtest=CamelRoutesTest,CamelComponentsTest - name: "Remote-api - AppContext01TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Remote-api - AppContext02TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -209,7 +196,6 @@ jobs: script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Remote-api - AppContext03TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -217,7 +203,6 @@ jobs: script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Remote-api - AppContext04TestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 @@ -225,104 +210,82 @@ jobs: script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "Remote-api - AppContextExtraTestSuite" - if: commit_message !~ /\[skip repo\]/ before_script: - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1 script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - name: "REST API TAS tests part1" - # TAS tests are generally skipped on feature branches as they will be repeated on the enterprise repo or community packaging builds - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false + script: + - travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part1 -Denvironment=default -DrunBugs=false - name: "REST API TAS tests part2" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false + script: + - travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part2 -Denvironment=default -DrunBugs=false - name: "REST API TAS tests part3" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false + script: + - travis_wait 60 mvn -B install -f packaging/tests/tas-restapi/pom.xml -Pall-tas-tests,run-restapi-part3 -Denvironment=default -DrunBugs=false - name: "CMIS TAS tests - BROWSER binding" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-browser -Denvironment=default -DrunBugs=false + script: + - travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-browser -Denvironment=default -DrunBugs=false - name: "CMIS TAS tests - ATOM binding" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-atom -Denvironment=default -DrunBugs=false + script: + - travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-atom -Denvironment=default -DrunBugs=false - name: "CMIS TAS tests - WEBSERVICES binding" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal+transforms.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-webservices -Denvironment=default -DrunBugs=false + script: + - travis_wait 40 mvn -B install -f packaging/tests/tas-cmis/pom.xml -Pall-tas-tests,run-cmis-webservices -Denvironment=default -DrunBugs=false - name: "Email TAS tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 30 mvn -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false + script: + - travis_wait 30 mvn -B install -f packaging/tests/tas-email/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - name: "WebDAV TAS tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 30 mvn -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false + script: + - travis_wait 30 mvn -B install -f packaging/tests/tas-webdav/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - name: "Integration TAS tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip tas\]/) OR commit_message =~ /\[tas\]/ + if: branch = master OR commit_message =~ /\[tas\]/ before_script: - ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-minimal.yml - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco" - script: travis_wait 30 mvn -B install -f packaging/tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - - - name: "Share Services - ShareServicesTestSuite" - if: commit_message !~ /\[skip repo\]/ - before_script: - - docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300' - script: travis_wait 20 mvn -B test -pl :alfresco-share-services -Dtest=ShareServicesTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco - - - name: "AGS Unit & Integration Tests (PostgreSQL)" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/ - script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-postgres -f amps/ags/pom.xml ${LOG_WARN} - - - name: "AGS Unit & Integration Tests (MySQL) " - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags on MySQL\]/ - script: travis_retry travis_wait 80 mvn -B verify -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Pags -Pstart-mysql -f amps/ags/pom.xml ${LOG_WARN} - - - name: "AGS Community Rest API Tests" - if: (branch =~ /(release\/.*$|master)/ AND commit_message !~ /\[skip ags\]/) OR commit_message =~ /\[ags\]/ - addons: - artifacts: - paths: - - ./amps/ags/rm-automation/rm-automation-community-rest-api/target/reports/rm-automation-community-rest-api.log - - alfresco.log - - solr.log - target_paths: community/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NAME} - before_script: - - ${TAS_SCRIPTS}/start-compose.sh ./amps/ags/rm-community/rm-community-repo/docker-compose.yml - - ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8080/alfresco" - script: travis_wait 40 mvn -B test -pl :alfresco-governance-services-automation-community-rest-api -Dskip.automationtests=false -Pags - after_script: bash amps/ags/travis/scripts/getLogs.sh + script: + - travis_wait 30 mvn -B install -f packaging/tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false - name: "Push to Nexus" stage: release @@ -334,3 +297,9 @@ jobs: install: skip script: bash scripts/travis/update_downstream.sh + - name: "Trigger alfresco-enterprise-repo build" + stage: trigger_downstream + before_install: skip + install: skip + script: bash scripts/travis/trigger_travis.sh "Alfresco" "alfresco-enterprise-repo" "${TRAVIS_BRANCH}" + diff --git a/README.md b/README.md index 2acb5164ab..d4ff31e0ee 100644 --- a/README.md +++ b/README.md @@ -121,11 +121,11 @@ git clone git@github.com:Alfresco/acs-community-packaging.git If you wish to build these projects from the command line, use the following commands. ~~~ cd alfresco-community-repo -mvn clean install -Pbuild-docker-images -DskipTests=true -Dversion.edition=Community +mvn clean install -PcommunityDocker -DskipTests=true -Dversion.edition=Community cd .. cd acs-community-packaging -mvn clean install -Pbuild-docker-images -Dmaven.javadoc.skip=true +mvn clean install -PcommunityDocker -Dmaven.javadoc.skip=true cd .. ~~~ In Intellij IDEA, create a new project using the `work` directory as the source. diff --git a/amps/ags/.editorConfig b/amps/ags/.editorConfig deleted file mode 100644 index 1808f3da08..0000000000 --- a/amps/ags/.editorConfig +++ /dev/null @@ -1,15 +0,0 @@ -# EditorConfig file: http://editorconfig.org/ -# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties - -# This is the Top level for the RM project -root = true - -# All files should use spaces. -[*] -indent_style = space -end_of_line = crlf -trim_trailing_whitespace = true -indent_size = 3 - -[*.java] -indent_size = 4 diff --git a/amps/ags/.gitattributes b/amps/ags/.gitattributes deleted file mode 100644 index 2f5a361a05..0000000000 --- a/amps/ags/.gitattributes +++ /dev/null @@ -1,29 +0,0 @@ -# Automatically detect if no other rule applies. -* text=auto - -# Extensions known to be text files. -*.css text -*.editorConfig text -*.ftl text -*.gitattributes text -*.gitignore text -*.html text -*.importorder text -*.java text -*.js text -*.jshintrc text -*.json text -*.properties text -*.txt text -*.xml text - -# Alfresco content package. -*.acp binary - -# Image files. -*.gif binary -*.jpg binary -*.png binary - -# IntelliJ has a jar file as part of its config directory. -*.jar binary diff --git a/amps/ags/.gitignore b/amps/ags/.gitignore deleted file mode 100644 index 00f0a7cf70..0000000000 --- a/amps/ags/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -# General ignored files and directories -.ant-targets-build.xml -.classpath -.gradle -.idea -.project -.settings -.history -*.bak -*.eml -*.iml -*.log* -*.tmp -*.war -bin -build.local.properties -dist -explodedDeps -local.properties -rebel.xml -rebel-remote.xml -target -test-output - -# /rm-community/ -/rm-community/l10n -/rm-community/root - -# /rm-community/rm-server/ -/rm-community/rm-server/alfresco-solr.zip -/rm-community/rm-server/solr -/rm-community/rm-server/shared - -# /rm-community/rm-server/config/ -/rm-community/rm-server/config/alfresco-global.properties - -# /rm-community/rm-server/config/alfresco/ -/rm-community/rm-server/config/alfresco/extension - -# /rm-enterprise/rm-automation-enterprise/ -/rm-enterprise/rm-automation-enterprise/l10n -/rm-enterprise/rm-automation-enterprise/root - -rm-automation/src/test/resources/webdriver.properties - -/rm-community/rm-community-rest-api-explorer/overlays -/rm-enterprise/rm-enterprise-rest-api-explorer/overlays \ No newline at end of file diff --git a/amps/ags/.jshintrc b/amps/ags/.jshintrc deleted file mode 100644 index 67d44b1766..0000000000 --- a/amps/ags/.jshintrc +++ /dev/null @@ -1,44 +0,0 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "es3": true, - "forin": true, - "freeze": true, - "funcscope": true, - "immed": true, - "indent": 3, - "iterator": true, - "latedef": true, - "maxcomplexity": 10, - "maxdepth": 50, - "maxerr": 50, - "maxlen": 250, - "maxparams": 50, - "maxstatements": 30, - "newcap": true, - "noarg": true, - "nonbsp": true, - "nonew": true, - "notypeof": true, - "shadow": "outer", - "undef": true, - "unused": true, - - "globals": { - "module": false, - "model": true, - "Alfresco": true, - "YAHOO": false, - "appContext": false, - "PDFJS": false, - "AlfrescoUtil": true, - "msg": false - }, - - "expr": true, - "strict": false, - - "browser": true, - "dojo": true -} diff --git a/amps/ags/CODE_OF_CONDUCT.md b/amps/ags/CODE_OF_CONDUCT.md deleted file mode 100644 index bc34200905..0000000000 --- a/amps/ags/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,73 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at katalin.zanaty@alfresco.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org diff --git a/amps/ags/CONTRIBUTING.md b/amps/ags/CONTRIBUTING.md deleted file mode 100644 index 833f899f75..0000000000 --- a/amps/ags/CONTRIBUTING.md +++ /dev/null @@ -1,60 +0,0 @@ -# How to contribute -For the details on the Records Management project see [here](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management). - -## Getting started -What you need to get started: - -* A [GitHub](https://github.com/) account. - -Useful but not necessary: - -* An [Alfresco community](https://community.alfresco.com/) account - this is a good place to ask questions and find answers. - -* A [Jira](https://issues.alfresco.com/jira/projects/RM/issues/?filter=allopenissues) account - Good place to look at what the team is working on; - -## Making changes - -We use GitHub's issues to track community contributions and issues. If you are committing a fix for a raised issue please reference the issue number in the pull request. - -If you are adding in a new feature or bug fix please raise an issue in the issues tab. By raising an issue in this project you will be agreeing to the Alfresco Contribution Agreement which can be found [here](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement). - -When you are ready to make a change you just need to fork the [records-management](https://github.com/Alfresco/records-management) repository and then make your changes into your copy of the code. - -We have a set of standards we follow when writing code. These can be found [here](https://community.alfresco.com/docs/DOC-4658-coding-standards). - -When formatting your change please try not to change the format of any other code as this can make the changes difficult to spot and please make sure to use the correct line ending (we use LF). - -We ask that when adding/changing code you also add/change the appropriate unit tests and that these tests all run before creating the pull request (these will be run as part of the request, it just saves time if you know they will pass beforehand). - -If you are adding any user facing strings be advised these may be change after being reviewed by a member of our UA team. For UI consistency please write to these [guidelines](http://docs.alfresco.com/sites/docs.alfresco.com/files/public/docs_team/u2/Alfresco-Writing-Guide.pdf). - -## Submitting changes - -When you create a pull request we will run the unit tests using [Travis](https://travis-ci.org/Alfresco/records-management). If these pass a member of the team will look over the change and then assuming there are no issues will accept your change. If there are any issue we will discuss this with you using the pull request. - -It really helps speed up the review process if you include a description of the change in the pull request. - -After your change has been accepted you can add it to the page [here](https://community.alfresco.com/docs/DOC-5279-featured-contributions) to let other members of the community know. A community account is required to update this page. - -Occasionally we may have to revert a change after it has been accepted. This will usually be caused by failing integration or UI tests. If this happens to you then feel free to get in touch for more information. - -## Additional info and links - -[Alfresco coding standards](https://community.alfresco.com/docs/DOC-4658-coding-standards) - -[Alfresco community contributions page](https://community.alfresco.com/docs/DOC-5279-featured-contributions) - -[Alfresco community site](https://community.alfresco.com/) - -[Alfresco contribution agreement](https://community.alfresco.com/docs/DOC-7070-alfresco-contribution-agreement) - -[Alfresco writing guidelines](http://docs.alfresco.com/sites/docs.alfresco.com/files/public/docs_team/u2/Alfresco-Writing-Guide.pdf) - -[GitHub "Records Management" code repository](https://github.com/Alfresco/records-management) - -[IDE settings for Eclipse and Intellij](https://github.com/Alfresco/records-management/tree/master/ide-config) - -[Jira project used by GS team](https://issues.alfresco.com/jira/projects/RM/issues) - -[Records Management project details](https://community.alfresco.com/docs/DOC-6387-project-overview-records-management) - diff --git a/amps/ags/README.md b/amps/ags/README.md deleted file mode 100644 index 5a321152ab..0000000000 --- a/amps/ags/README.md +++ /dev/null @@ -1,241 +0,0 @@ -# Records Management: README - -## Contributing -Please refer to our [How to contribute](/CONTRIBUTING.md) guide and our [Contributor Covenant Code of Conduct](/CODE_OF_CONDUCT.md). - -## Configuring the ~/.m2/settings.xml file for local development -In order to be able to pull all the necessary project dependencies, the alfresco Nexus -repositories should be added in your local Maven configuration on your workstation. - -Update your `~/.m2/settings.xml` file with the _repositories_, _pluginRepositories_ and, optionally, -the _servers_ defined in the following snippet: -```xml - - - - alfresco-internal - - true - - - - - alfresco-internal - - true - - - true - - Alfresco Internal Repository - https://artifacts.alfresco.com/nexus/content/groups/internal - - - - - - alfresco-internal - Alfresco Internal Repository - https://artifacts.alfresco.com/nexus/content/groups/public - - - - - - - - alfresco-internal - ${env.MAVEN_USERNAME} - ${env.MAVEN_PASSWORD} - - - -``` - -The `alfresco-internal` server definition is required by the Alfresco _internal_ repository -group, and it should use your own Alfresco Nexus credentials. If only the _public_ repository -group is used (e.g., for the Community build) this server definition can be skipped. - -Optionally, you can also re-define the Maven Central repository, to increase the dependency download -speed (look up dependencies first in Maven Central, then in Alfresco Nexus). Define the -_Central Repository_ in both the `` and `` sections before -the _alfresco-internal_ repository: -```xml - - central - Central Repository - https://repo.maven.apache.org/maven2 - default - - false - - -``` - - -For additional instructions you can check the official Maven documentation: -* [setting up repositories](https://maven.apache.org/guides/mini/guide-multiple-repositories.html) -* [setting up servers](https://maven.apache.org/settings.html#servers) -* [password encryption](https://maven.apache.org/guides/mini/guide-encryption.html) - -## Configuring and starting Alfresco/Share -* Clone the project (e.g. `git clone git@github.com:Alfresco/governance-services.git`) -* Import the project as a maven project -* Start the Alfresco/Share instances with the following commands: - - ``` - mvn clean install -Pstart-repo - mvn clean install -Pstart-share - ``` - - (these commands work best if run from the specific directories, e.g. start Share from - rm-community/rm-community-share/ or rm-enterprise/rm-enterprise-share/ ) - -## Configuring a different DB other than H2 (e.g. MySQL or PostgreSQL) -* Create a file called _local.properties_ under src/main/resources in alfresco-rm-enterprise-repo -* Add the following properties in this new file - - ``` - my.db.name -> The name of the database schema - my.db.port -> The port number for your database (default port number for postgres is 5432 and for mysql it is 3306) - ``` -* Run the following commands to start your Alfresco instance: - - to start Alfresco (using Postgres): - ``` - mvn clean install -Pstart-repo,use-postgres - ``` - - to start Alfresco (using MySQL): - - ``` - mvn clean install -Pstart-repo,use-mysql - ``` - -## Technical documentation -Technical documentation is available at [rm-community/documentation/README.md](/rm-community/documentation/README.md) and [rm-enterprise/documentation/README.md](/rm-enterprise/documentation/README.md). This should be particularly useful for anyone wanting to integrate with or extend RM. - -## Running integration test -In order to execute the integration tests run the following command (unit tests will be executed every time before you start Alfresco/Share): - -``` -mvn clean install -Pstart-db -``` - -## Running UI Automation tests -To run the automated UI tests, change to the rm-automation directory and run: - -``` -mvn clean install -Dskip.automationtests=false -``` - -Note: due to Selenium Firefox driver changes, the highest supported Firefox version for UI tests is 43.0.4 (with Selenium 2.52.0). - -It is possible to have multiple versions of Firefox installed onto your workstation (e.g. one for running the UI tests and the other, kept -up to date, for everyday browsing) but beware Firefox auto-updates. In this scenario the best approach is to create a non-default profile -(default profiles will be shared between your Firefox installations!) for which auto-updates are disabled and forcing the use of this -profile in your tests (`-Dwebdriver.firefox.profile="ProfileName"`). If your Firefox 43 install isn't in your path, you can use the -`-Dwebdriver.firefox.profile` option set to the full path of its "firefox-bin" executable. - -MacOS X Sierra users: if you experience by order of magnitude slower performance when connected to a WiFi network (e.g. office WiFi) -add your workstation to your local /etc/hosts file as described on https://github.com/SeleniumHQ/selenium/issues/2824. - -To use Chrome instead of Firefox: -1. copy webdriver.properties from https://github.com/AlfrescoTestAutomation/selenium-grid/tree/master/src/main/resources -2. put it under src/test/resource in rm-automation-ui project -3. download the chrome driver from http://chromedriver.storage.googleapis.com and extract it -4. change the following properties in webdriver.properties: webdriver.browser (Chrome) and webdriver.chrome.server.path (path/to/chrome/driver) -5. run the tests as usual - -## Updating License Headers -In order to refesh out of date license source headers run the following command: - -``` -mvn clean install -Dlicense.update.dryrun=false -``` - -## Running tests against latest Aikau snapshot -The latest Aikau snapshot can be pulled by running the following command in rm-community: - -``` -mvn clean install -DskipTests -Dalfresco.aikau.version=LATEST -U -``` - -Thereafter start the Share instance and run automation tests as described above. - -## SNAPSHOT dependencies -If you're building Enterprise RM, the base project (Community) is pulled in via a snapshot dependency configured in maven. -This dependency will either be loaded from your local .m2 cache, or from Nexus if the version in your .m2 doesn't exist or is old -('old' in maven terms is anything over 24 hours old). If maven fetches community dependencies from Nexus, then it's unlikely to contain your changes. -You want to always use the version in your local cache - this means either doing a daily build at the root project level -that pushes a new copy of the correct version into your cache, or alternatively you could run mvn with the -`--no-snapshot-dependency` (or `-nsu`) option, which won't try to download a newer version. - -## Code Formatting -This project follows the usual Alfresco Coding Standards. If you use Eclipse or IntelliJ, there are settings inside the ide-config directory for you to import. - -## Surf build errors -If you get: -``` -[ERROR] Failed to execute goal on project alfresco-rm-community-share: Could not resolve dependencies for project org.alfresco:alfresco-rm-community-share:amp:2.6-SNAPSHOT: Failed to collect dependencies at org.alfresco.surf:spring-surf-api:jar:6.3 -> org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Failed to read artifact descriptor for org.alfresco.surf:spring-surf:jar:${dependency.surf.version}: Could not transfer artifact org.alfresco.surf:spring-surf:pom:${dependency.surf.version} from/to alfresco-internal (https://artifacts.alfresco.com/nexus/content/groups/private): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1] -``` - -then please re-run with `-Ddependency.surf.version=6.3` - -## Install lombok plugin for IDEs -To allow automation and benchmark projects to be built within an IDE the lombok 'plugin' needs to be installed. -Execute lombok.jar (doubleclick it, or run `java -jar lombok.jar`). Follow the instructions. - -## Use Solr 6 with Alfresco 5.2.x -In alfresco-global.properties (depending on the RM edition `/records-management/rm-community/rm-community-repo/src/test/properties/local` or `/records-management/rm-enterprise/rm-enterprise-repo/src/test/properties/local`) -change the value for "index.subsystem.name" from "solr4" to "solr6". -Add also the following property "solr.port=8983". - -Download the latest Alfresco Search Services from -[https://nexus.alfresco.com/nexus/#nexus-search;gav\~\~alfresco-search-services\~\~\~](https://nexus.alfresco.com/nexus/#nexus-search;gav~~alfresco-search-services~~~) -Currently it's 1.0.0 (alfresco-search-services-1.0.0.zip) - -Unzip it and change to the "solr" folder within it. Start the Solr server using the following command: -``` -solr start -a "-Dcreate.alfresco.defaults=alfresco,archive" -``` -Start your repository - -## Build Docker images for RM Repo and Share -A first step is checking that you have installed a working version of Docker that can be downloaded from here: -[https://docs.docker.com/install/] - -The second step, in case you already have Docker installed, the current running images must be checked in order to be sure that they are not occupying any of the ports that -ACS and Share use. - -To kill and clean all the images and containers the following command can be used: - -``` -docker system prune --volumes -``` - > Note that this will also remove all the stopped containers, containers, networks, volumes and build cache. - -Depending on which version of AGS you want to start, Community or Enterprise, **you must first build the docker images**. -From the root folder of the project you can create both the Repo and the Share images for Community and Enterprise. -To build all the images use the following command: -``` -mvn install -PbuildDockerImage -``` -If only the Community or Enterprise images need to be built than the same command as above must be run either in the rm-community or rm-enterprise modules. - -## Start the Docker images - -The Docker images of the Repo can be started independently from Share running the following command in the rm-repo-enterprise or rm-repo-community folder which contains the Docker-compose.yml file: -``` -docker-compose up -``` -> Be aware of the fact that the Share images can not be started independently from Repo - -e.g. In order to start an instance of rm-enterprise-repo and rm-enterprise-share, the above command must be run in rm-enterprise-share after the images have been built. - -## Start the Docker images with jRebel in remote server mode - -If you have a license for jRebel then this can be used from the rm-community-share or rm-enterprise-share directories with: -``` -docker-compose -f docker-compose.yml -f jrebel-docker-compose.yml --project-name agsdev up --build --force-recreate -``` diff --git a/amps/ags/ide-config/eclipse/alfresco-java-profile.xml b/amps/ags/ide-config/eclipse/alfresco-java-profile.xml deleted file mode 100644 index 4b56772b4a..0000000000 --- a/amps/ags/ide-config/eclipse/alfresco-java-profile.xml +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/ags/ide-config/eclipse/alfresco-javascript-profile.xml b/amps/ags/ide-config/eclipse/alfresco-javascript-profile.xml deleted file mode 100644 index eb0edaa553..0000000000 --- a/amps/ags/ide-config/eclipse/alfresco-javascript-profile.xml +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/ags/ide-config/eclipse/rm.eclipse.importorder b/amps/ags/ide-config/eclipse/rm.eclipse.importorder deleted file mode 100644 index c1558e39e3..0000000000 --- a/amps/ags/ide-config/eclipse/rm.eclipse.importorder +++ /dev/null @@ -1,10 +0,0 @@ -#Organize Import Order -#Thu Jan 28 11:20:46 GMT 2016 -6=com -5=javax -4=java -3=\#org -2=\#com -1=\#javax -0=\#java -7=org diff --git a/amps/ags/ide-config/intellij/RM-IntelliJ-settings.jar b/amps/ags/ide-config/intellij/RM-IntelliJ-settings.jar deleted file mode 100644 index 153947afb6..0000000000 Binary files a/amps/ags/ide-config/intellij/RM-IntelliJ-settings.jar and /dev/null differ diff --git a/amps/ags/l10n.properties b/amps/ags/l10n.properties deleted file mode 100644 index 4bde720182..0000000000 --- a/amps/ags/l10n.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Localisation config overrides for Records Management module -MESSAGE_SEARCH_PATH="rm-community/rm-community-repo/config rm-community/rm-community-share rm-community/rm-share/source rm-enterprise/rm-enterprise-repo/src/main rm-enterprise/rm-enterprise-share/src/main " -EXCLUDED_FILES="$EXCLUDED_FILES rm-method-security.properties springloaded.properties file-mapping.properties classified-content-notForTranslating.properties notForTranslating version.properties" -EXTENSION_PREFIX=-RM diff --git a/amps/ags/license/alfresco_community/header.txt b/amps/ags/license/alfresco_community/header.txt deleted file mode 100644 index d850cee1ea..0000000000 --- a/amps/ags/license/alfresco_community/header.txt +++ /dev/null @@ -1,18 +0,0 @@ -This file is part of the Alfresco software. -- -If the software was purchased under a paid Alfresco license, the terms of -the paid license agreement will prevail. Otherwise, the software is -provided under the following open source license terms: -- -Alfresco is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. -- -Alfresco is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. -- -You should have received a copy of the GNU Lesser General Public License -along with Alfresco. If not, see . \ No newline at end of file diff --git a/amps/ags/license/alfresco_community/license.txt b/amps/ags/license/alfresco_community/license.txt deleted file mode 100644 index cca7fc278f..0000000000 --- a/amps/ags/license/alfresco_community/license.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/amps/ags/license/description.ftl b/amps/ags/license/description.ftl deleted file mode 100644 index fc0de7cfef..0000000000 --- a/amps/ags/license/description.ftl +++ /dev/null @@ -1 +0,0 @@ -Alfresco Records Management Module \ No newline at end of file diff --git a/amps/ags/license/licenses.properties b/amps/ags/license/licenses.properties deleted file mode 100644 index a739cc67b9..0000000000 --- a/amps/ags/license/licenses.properties +++ /dev/null @@ -1 +0,0 @@ -alfresco_community=Alfresco Community \ No newline at end of file diff --git a/amps/ags/pom.xml b/amps/ags/pom.xml deleted file mode 100644 index 5df757b65b..0000000000 --- a/amps/ags/pom.xml +++ /dev/null @@ -1,590 +0,0 @@ - - 4.0.0 - alfresco-governance-services-community-parent - pom - Alfresco Governance Services Community Parent - - - org.alfresco - alfresco-community-repo-amps - 11.28-SNAPSHOT - - - - rm-community - rm-automation - - - - 1.9.1 - 3.8.0 - 3.0.0-M2 - 3.1.0 - - UTF-8 - UTF-8 - - true - false - - ${project.build.directory}/${project.build.finalName}-war - src/main/amp - ../${project.build.finalName} - true - ** - src/main/properties/local - ** - src/test/properties/local - - - - - - jakarta.jws - jakarta.jws-api - provided - - - - - ${project.artifactId}-${project.version} - - - maven-enforcer-plugin - - - enforce-java - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.codehaus.mojo - build-helper-maven-plugin - - - regex-properties - - regex-properties - - - - - ags.module.repo.version.min - ${amp.min.version} - (\d+)\.(\d+).* - $1.$2 - false - - - - - - add-test-source - - add-test-source - - - - src/unit-test/java - - - - - - - maven-surefire-plugin - - - **/*UnitTest.java - - - - - maven-javadoc-plugin - - none - - - - attach-javadocs - - none - - - jar - - - - - - maven-clean-plugin - 3.1.0 - - - default-clean - clean - - clean - - - - - - maven-install-plugin - - - default-install - install - - install - - - - - - maven-deploy-plugin - 2.7 - - - default-deploy - deploy - - deploy - - - - - - maven-site-plugin - 3.7.1 - - - default-site - site - - site - - - - default-deploy - site-deploy - - deploy - - - - - - - - org.apache.maven.archetype - archetype-packaging - 2.2 - - - org.apache.maven.wagon - wagon-webdav-jackrabbit - 2.2 - - - - - src/main/resources - ${app.filtering.enabled} - - - ${app.amp.folder} - ${app.amp.output.folder} - ${app.filtering.enabled} - - - - - src/test/resources - ${app.filtering.enabled} - - - - - - - maven-compiler-plugin - ${maven.compiler.version} - - ${maven.compiler.source} - ${maven.compiler.target} - - - - default-testCompile - process-test-sources - - testCompile - - - ${java.version} - ${java.version} - - - - - - maven-enforcer-plugin - ${maven.enforcer.plugin} - - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - - - maven-failsafe-plugin - 3.0.0-M5 - - - --illegal-access=permit - - - - - maven-antrun-plugin - 1.8 - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.buildhelper.version} - - - org.codehaus.mojo - sql-maven-plugin - 1.5 - - - - - maven-release-plugin - 2.5.3 - - V@{project.version} - - - - - - maven-javadoc-plugin - - none - ${java.version} - - - - - org.codehaus.mojo - license-maven-plugin - 1.16 - - - ${license.verbose} - false - false - - - Alfresco Software Limited - ${project.parent.parent.basedir}/license/description.ftl - true - true - - - file:${project.parent.parent.basedir}/license - - - ${license.update.dryrun} - true - true - - - - src - - - - - **/package-info.java - **/*.properties - **/*.css - **/*.xml - **/*.json - **/*.txt - **/*.html - - - - - - first - - update-file-header - - process-sources - - - - - maven-resources-plugin - ${maven.resources.version} - - - org.apache.maven.shared - maven-filtering - ${dependency.maven-filtering.version} - - - - UTF-8 - - ftl - acp - jpg - png - gif - svg - pdf - doc - docx - xls - xlsx - ppt - pptx - bin - lic - swf - zip - msg - jar - ttf - eot - woff - woff2 - css - ico - psd - - - - - maven-war-plugin - - - - org.apache.commons - commons-compress - ${dependency.apache-compress.version} - - - org.alfresco.maven.plugin - alfresco-maven-plugin - ${alfresco.maven-plugin.version} - - - - false - - - true - - - - - - maven-clean-plugin - 3.1.0 - - - maven-dependency-plugin - 3.1.1 - - - maven-archetype-plugin - 2.2 - - ${skipTests} - - - - com.google.code.maven-replacer-plugin - replacer - 1.5.3 - - - org.apache.tomcat.maven - tomcat7-maven-plugin - 2.2 - - true - - - - net.alchim31.maven - yuicompressor-maven-plugin - 1.5.1 - - - compress-js - process-resources - - compress - - - - **/webscripts/** - **/site-webscripts/** - **/*.lib.js - **/*.css - - src/main/resources/META-INF - false - - - - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - - - publicapi - - 1.6.1 - - - - - com.docflex - docflex-alfresco-license - 1.0 - license - - - - - - - maven-dependency-plugin - 3.1.1 - - - - default-cli - generate-sources - - unpack - - - - - com.docflex - docflex-javadoc - ${docflex.version} - zip - - - ${project.build.directory} - - - - - - - maven-javadoc-plugin - - com.docflex.javadoc.Doclet - ${project.build.directory}/docflex-javadoc-${docflex.version}/lib/docflex-javadoc.jar - none - - - -license ${settings.localRepository}/com/docflex/docflex-alfresco-license/1.0/docflex-alfresco-license-1.0.license - -template ${project.build.directory}/docflex-javadoc-${docflex.version}/templates/JavadocPro/FramedDoc.tpl - -nodialog - -launchviewer=false - -p:filter.byAnns.include.classes=org.alfresco.api.AlfrescoPublicApi - -p:docTitle "${project.name} ${project.version} Public API" - -p:windowTitle "${project.name} ${project.version} Public API" - - - - - - - - - - - enable-test-properties-filtering - - - - src/test/properties - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.buildhelper.version} - - - add-env-test-properties - generate-resources - - add-test-resource - - - - - ${app.properties.test.folder} - - ${app.properties.test.include} - - ${app.filtering.enabled} - - - - - - - - - - - diff --git a/amps/ags/rm-automation/pom.xml b/amps/ags/rm-automation/pom.xml deleted file mode 100644 index 440db8bc12..0000000000 --- a/amps/ags/rm-automation/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - 4.0.0 - alfresco-governance-services-automation-community-repo - pom - Alfresco Governance Services Automation Community - - - org.alfresco - alfresco-governance-services-community-parent - 11.28-SNAPSHOT - - - - rm-automation-community-rest-api - - - - testng.xml - true - - - - - LGPL 3 - - - - - - - maven-surefire-plugin - - false - - ${project.build.testOutputDirectory}/${suiteXmlFile} - - ${skip.automationtests} - - - - - diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/.gitignore b/amps/ags/rm-automation/rm-automation-community-rest-api/.gitignore deleted file mode 100644 index bb654bad1e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/target/ -/.settings/ -.classpath -.project -/src/test/resources/local.properties -/.idea/ -*.iml -/test-output/ -.factorypath \ No newline at end of file diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/README b/amps/ags/rm-automation/rm-automation-community-rest-api/README deleted file mode 100644 index 907f41ab0a..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/README +++ /dev/null @@ -1,3 +0,0 @@ -FIXME: Add more info to the README file - -In order to change the value of a property in "config.properties" create a file called "local.properties" under src/test/resources and redefine the property with the new value. \ No newline at end of file diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml deleted file mode 100644 index a1a9414143..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - 4.0.0 - alfresco-governance-services-automation-community-rest-api - Alfresco Governance Services Automation Community REST API - - - org.alfresco - alfresco-governance-services-automation-community-repo - 11.28-SNAPSHOT - - - - 2.7.9.1 - - - - - - org.codehaus.mojo - license-maven-plugin - - alfresco_community - file:${project.parent.parent.basedir}/license - ${project.parent.parent.basedir}/license/description.ftl - - - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - - - - - - - - org.slf4j - slf4j-log4j12 - 1.7.26 - test - - - org.alfresco.tas - restapi - - - com.fasterxml.jackson.core - jackson-databind - - - org.alfresco.tas - utility - - - - - org.alfresco.tas - utility - ${dependency.tas-utility.version} - - - org.projectlombok - lombok - provided - - - - org.jglue.fluent-json - fluent-json - 2.0.0 - - - org.alfresco.test - alfresco-testng - 1.1 - - - org.apache.commons - commons-collections4 - 4.4 - - - com.github.docker-java - docker-java - 3.0.14 - - - com.fasterxml.jackson.core - jackson-databind - - - diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java deleted file mode 100644 index a4578abcf4..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; - -import lombok.Getter; - -/** - * Extends {@link RestProperties} to be able to change/add properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Getter -@Configuration -@PropertySource(value = {"classpath:default.properties", "classpath:config.properties"}) -@PropertySource(value = "classpath:module.properties", ignoreResourceNotFound = true) -@PropertySource(value = "classpath:local.properties", ignoreResourceNotFound = true) -public class RMRestProperties extends RestProperties -{ - @Value ("${alfresco.scheme}") - private String scheme; - - @Value ("${alfresco.server}") - private String server; - - @Value ("${alfresco.port}") - private String port; - - @Value ("${rest.rmPath}") - private String restRmPath; - - @Value ("${docker.host}") - private String dockerHost; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java deleted file mode 100644 index 9c1acdde8b..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core; - -import io.restassured.builder.RequestSpecBuilder; - -import org.alfresco.rest.exception.EmptyJsonResponseException; -import org.alfresco.rest.model.RestErrorModel; -import org.alfresco.rest.model.RestHtmlResponse; -import org.alfresco.rest.model.RestSiteModel; -import org.alfresco.rest.model.RestSiteModelsCollection; -import org.alfresco.rest.requests.coreAPI.RestCoreAPI; -import org.alfresco.rest.requests.search.SearchAPI; -import org.alfresco.rest.rm.community.requests.gscore.GSCoreAPI; -import org.alfresco.utility.model.StatusModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Service; - -import lombok.Getter; - -/** - * Extends {@link RestWrapper} in order to call GS APIs with our own properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Service -@Scope(value = "prototype") -public class RMRestWrapper -{ - /** The class that wraps the ReST APIs from core. */ - @Autowired - private RestWrapper restWrapper; - - @Autowired - @Getter - private RMRestProperties rmRestProperties; - - public GSCoreAPI withGSCoreAPI() - { - return new GSCoreAPI(this, getRmRestProperties()); - } - - /** Get the core class that wraps the ReST APIs. */ - public RestWrapper getRestWrapper() - { - return restWrapper; - } - - /** Authenticate specific user to Alfresco REST API */ - public void authenticateUser(UserModel userModel) - { - restWrapper.authenticateUser(userModel); - } - - /** Get the last error thrown (if any). */ - public RestErrorModel assertLastError() - { - return restWrapper.assertLastError(); - } - - /** Process responses for a collection of models as {@link RestSiteModelsCollection}. */ - public T processModels(Class classz, RestRequest simpleRequest) - { - return restWrapper.processModels(classz, simpleRequest); - } - - /** Process responses for a single model as {@link RestSiteModel}. */ - public T processModel(Class classz, RestRequest restRequest) - { - return restWrapper.processModel(classz, restRequest); - } - - /** Process a response that has no body - basically will need only the status code from it. */ - public void processEmptyModel(RestRequest simpleRequest) - { - restWrapper.processEmptyModel(simpleRequest); - } - - /** Get the most recently returned status object. */ - public StatusModel getLastStatus() - { - return restWrapper.getLastStatus(); - } - - /** Get the most recently returned status code. */ - public String getStatusCode() - { - return restWrapper.getStatusCode(); - } - - /** Set the status code. This should only be needed when calling APIs without using the TAS framework. */ - public void setStatusCode(String statusCode) - { - restWrapper.setStatusCode(statusCode); - } - - /** Assert that a specific status code is returned. */ - public void assertStatusCodeIs(HttpStatus statusCode) - { - restWrapper.assertStatusCodeIs(statusCode); - } - - /** @return A parameters string that you could pass on the request ?param=value */ - public String getParameters() - { - return restWrapper.getParameters(); - } - - /** Create a {@link UserModel} for a new test user. */ - public UserModel getTestUser() - { - return restWrapper.getTestUser(); - } - - /** Get the Alfresco Core API. */ - public RestCoreAPI withCoreAPI() - { - return restWrapper.withCoreAPI(); - } - - /** Get the Alfresco Search API. */ - public SearchAPI withSearchAPI() - { - return restWrapper.withSearchAPI(); - } - - /** - * You can handle the request sent to server by calling this method. - * If for example you want to sent multipart form data you can use:
-     * restClient.configureRequestSpec()
-     *              .addMultiPart("filedata", Utility.getResourceTestDataFile("restapi-resource"))
-     *              .addFormParam("renditions", "doclib")
-     *              .addFormParam("autoRename", true);
-     *
-     * restClient.withCoreAPI().usingNode(ContentModel.my()).createNode();
-     * 
This will create the node using the multipart data defined. - */ - public RequestSpecBuilder configureRequestSpec() - { - return restWrapper.configureRequestSpec(); - } - - /** - * Process a response that returns a html - * - * @throws EmptyJsonResponseException If there is no response from the server. - */ - public RestHtmlResponse processHtmlResponse(RestRequest simpleRequest) - { - return restWrapper.processHtmlResponse(simpleRequest); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java deleted file mode 100644 index d26fd26d37..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core; - -import static lombok.AccessLevel.PROTECTED; - -import javax.annotation.Resource; - -import lombok.Getter; -import lombok.Setter; -import org.alfresco.rest.requests.Node; -import org.alfresco.rest.requests.coreAPI.RestCoreAPI; -import org.alfresco.rest.requests.search.SearchAPI; -import org.alfresco.rest.rm.community.requests.gscore.GSCoreAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.ActionsExecutionAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RMUserAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.TransferAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.TransferContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.utility.data.DataUserAIS; -import org.alfresco.utility.model.RepoTestModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Service; - -/** - * REST API Factory which provides access to the APIs - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Service -@Scope(value = "prototype") -public class RestAPIFactory -{ - @Autowired - @Getter (value = PROTECTED) - private DataUserAIS dataUser; - - @Resource(name = "RMRestWrapper") - @Getter - @Setter - private RMRestWrapper rmRestWrapper; - - private GSCoreAPI getGSCoreAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel != null ? userModel : getDataUser().getAdminUser()); - return getRmRestWrapper().withGSCoreAPI(); - } - - private RestCoreAPI getCoreAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel != null ? userModel : getDataUser().getAdminUser()); - return getRmRestWrapper().withCoreAPI(); - } - - public SearchAPI getSearchAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel != null ? userModel : getDataUser().getAdminUser()); - return getRmRestWrapper().withSearchAPI(); - } - - /** - * When no user is given the default is set to admin - */ - public SearchAPI getSearchAPI() - { - return getSearchAPI(null); - } - - public Node getNodeAPI(RepoTestModel model) throws RuntimeException - { - try - { - return getCoreAPI(null).usingNode(model); - } - catch (Exception e) - { - throw new RuntimeException("Failed to load nodeAPI.", e); - } - } - - public Node getNodeAPI(UserModel userModel, RepoTestModel model) throws RuntimeException - { - try - { - return getCoreAPI(userModel).usingNode(model); - } - catch (Exception e) - { - throw new RuntimeException("Failed to load nodeAPI.", e); - } - } - - public RMSiteAPI getRMSiteAPI() - { - return getGSCoreAPI(null).usingRMSite(); - } - - public RMSiteAPI getRMSiteAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingRMSite(); - } - - public FilePlanAPI getFilePlansAPI() - { - return getGSCoreAPI(null).usingFilePlans(); - } - - public FilePlanAPI getFilePlansAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingFilePlans(); - } - - public RecordCategoryAPI getRecordCategoryAPI() - { - return getGSCoreAPI(null).usingRecordCategory(); - } - - public RecordCategoryAPI getRecordCategoryAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingRecordCategory(); - } - - public RecordFolderAPI getRecordFolderAPI() - { - return getGSCoreAPI(null).usingRecordFolder(); - } - - public RecordFolderAPI getRecordFolderAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingRecordFolder(); - } - - public RecordsAPI getRecordsAPI() - { - return getGSCoreAPI(null).usingRecords(); - } - - public RecordsAPI getRecordsAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingRecords(); - } - - public FilesAPI getFilesAPI() - { - return getGSCoreAPI(null).usingFiles(); - } - - public FilesAPI getFilesAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingFiles(); - } - - public TransferContainerAPI getTransferContainerAPI() - { - return getGSCoreAPI(null).usingTransferContainer(); - } - - public TransferContainerAPI getTransferContainerAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingTransferContainer(); - } - - public TransferAPI getTransferAPI() - { - return getGSCoreAPI(null).usingTransfer(); - } - - public TransferAPI getTransferAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingTransfer(); - } - - public RMUserAPI getRMUserAPI() - { - return getGSCoreAPI(null).usingRMUser(); - } - - public RMUserAPI getRMUserAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingRMUser(); - } - - public UnfiledContainerAPI getUnfiledContainersAPI() - { - return getGSCoreAPI(null).usingUnfiledContainers(); - } - - public UnfiledContainerAPI getUnfiledContainersAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingUnfiledContainers(); - } - - public UnfiledRecordFolderAPI getUnfiledRecordFoldersAPI() - { - return getGSCoreAPI(null).usingUnfiledRecordFolder(); - } - - public UnfiledRecordFolderAPI getUnfiledRecordFoldersAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingUnfiledRecordFolder(); - } - - public ActionsExecutionAPI getActionsAPI(UserModel userModel) - { - return getGSCoreAPI(userModel).usingActionsExecutionsAPI(); - } - - public ActionsExecutionAPI getActionsAPI() - { - return getGSCoreAPI(null).usingActionsExecutionsAPI(); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/search/SearchRequestBuilder.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/search/SearchRequestBuilder.java deleted file mode 100644 index 313f6320f7..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/search/SearchRequestBuilder.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core.search; - -import java.util.List; - -import org.alfresco.rest.search.Pagination; -import org.alfresco.rest.search.RestRequestQueryModel; -import org.alfresco.rest.search.SearchRequest; - -/** - * Builder class for creating a search api request - */ -public class SearchRequestBuilder extends SearchRequest -{ - /** - * Constructor for Search API Request - */ - public SearchRequestBuilder() - { - new SearchRequest(); - } - /** - * Set the sql statement for the SearchRequest - * - * @param query sql statement - * @return search request - */ - public SearchRequestBuilder setQueryBuilder(RestRequestQueryModel query) - { - super.setQuery(query); - return this; - } - - /** - * Set the paging statement for the SearchRequest - * - * @param paging pagination requested - * @return search request - */ - public SearchRequestBuilder setPagingBuilder(Pagination paging) - { - super.setPaging(paging); - return this; - } - - /** - * Set the pagination properties - */ - public Pagination setPagination(Integer maxItems, Integer skipCount) - { - Pagination pagination = new Pagination(); - pagination.setMaxItems(maxItems); - pagination.setSkipCount(skipCount); - return pagination; - } - - /** - * Set the requested fields for the SearchRequest - * - * @param fields requested fields - * @return search request - */ - public SearchRequestBuilder setFieldsBuilder(List fields) - { - super.setFields(fields); - return this; - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/APIUtils.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/APIUtils.java deleted file mode 100644 index d0615b8c02..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/APIUtils.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core.v0; - -import javax.json.Json; -import javax.json.JsonReader; -import java.io.IOException; -import java.io.InputStream; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeFormatterBuilder; - -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.ParseException; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Helper methods for use with REST APIs. - * - * @author Tom Page - * @since 2.6 - */ -public class APIUtils -{ - /** Logger for this class. */ - private static final Logger LOGGER = LoggerFactory.getLogger(APIUtils.class); - /** The ISO instant formatter that formats or parses an instant in UTC, such as '2011-12-03T10:15:305Z' - * similar with {@link DateTimeFormatter#ISO_INSTANT}, but with only 3 nanoseconds*/ - public static final DateTimeFormatter ISO_INSTANT_FORMATTER = - new DateTimeFormatterBuilder().appendInstant(3).toFormatter(); - - /** Private constructor for helper class. */ - private APIUtils() - { - } - - /** - * Extract the body of a HTTP response as a JSON object. - * - * @param httpResponse The HTTP response. - * @return A JSON representation of the object. - */ - public static JSONObject convertHTTPResponseToJSON(HttpResponse httpResponse) - { - String source = null; - try - { - source = IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"); - } - catch (IOException e) - { - throw new IllegalArgumentException("Could not extract JSON from HTTP response.", e); - } - LOGGER.info("Response body:\n{}", source); - return new JSONObject(source); - } - - /** - * Util method to extract the message string from the HTTP response - * - * @param httpResponse http response - * @return error message from the http response - */ - public static String extractErrorMessageFromHttpResponse(HttpResponse httpResponse) - { - final HttpEntity entity = httpResponse.getEntity(); - JsonReader reader = null; - try - { - final InputStream responseStream = entity.getContent(); - reader = Json.createReader(responseStream); - return reader.readObject().getString("message"); - } - catch (JSONException error) - { - - LOGGER.error("Converting message body to JSON failed. Body: {}", httpResponse, error); - } - catch (ParseException | IOException error) - { - - LOGGER.error("Parsing message body failed.", error); - } - finally - { - if (reader != null) - { - reader.close(); - } - } - return null; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java deleted file mode 100644 index 95b05be349..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/BaseAPI.java +++ /dev/null @@ -1,815 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core.v0; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNull; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.dataprep.AlfrescoHttpClient; -import org.alfresco.dataprep.AlfrescoHttpClientFactory; -import org.alfresco.dataprep.ContentService; -import org.apache.chemistry.opencmis.client.api.CmisObject; -import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.NameValuePair; -import org.apache.http.ParseException; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.entity.StringEntity; -import org.apache.http.util.EntityUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * The base API class containing common methods for making v0 API requests - * - * @author Kristijan Conkas - * @since 2.5 - */ -public abstract class BaseAPI -{ - // logger - protected static final Logger LOGGER = LoggerFactory.getLogger(BaseAPI.class); - - /** exception key in JSON response body */ - private static final String EXCEPTION_KEY = "exception"; - private static final String MESSAGE_KEY = "message"; - public static final String NODE_PREFIX = "workspace/SpacesStore/"; - protected static final String UPDATE_METADATA_API = "{0}node/{1}/formprocessor"; - protected static final String ACTIONS_API = "{0}actionQueue"; - protected static final String RM_ACTIONS_API = "{0}rma/actions/ExecutionQueue"; - public static final String RM_SITE_ID = "rm"; - protected static final String SHARE_ACTION_API = "{0}internal/shared/share/workspace/SpacesStore/{1}"; - private static final String SLINGSHOT_PREFIX = "alfresco/s/slingshot/"; - - @Autowired - private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - - @Autowired - protected ContentService contentService; - - public static final String NODE_REF_WORKSPACE_SPACES_STORE = "workspace://SpacesStore/"; - private static final String FILE_PLAN_PATH = "/Sites/rm/documentLibrary"; - - /** - * Helper method to extract list of properties values from result. - * - * @param result the response - * @return list of specified property values in result - * @throws RuntimeException for malformed response - */ - protected List getPropertyValues(JSONObject result, String propertyName) - { - ArrayList results = new ArrayList<>(); - try - { - JSONArray items = result.getJSONArray("items"); - - for (int i = 0; i < items.length(); i++) - { - results.add(items.getJSONObject(i).getString(propertyName)); - } - } - catch (JSONException error) - { - throw new RuntimeException("Unable to parse result", error); - } - - return results; - } - - /** - * Helper method to extract the property value for the given nodeRef and property name - * - * @param result - * @param nodeRef - * @param propertyName - * @return - */ - protected String getPropertyValue(JSONObject result, String nodeRef, String propertyName) - { - String propertyValue = ""; - try - { - JSONArray items = result.getJSONArray("items"); - for (int i = 0; i < items.length(); i++) - { - JSONObject item = items.getJSONObject(i); - if(nodeRef.equals(item.getString("nodeRef"))) - { - propertyValue = item.getJSONObject("properties").getString(propertyName); - } - } - } - catch (JSONException error) - { - throw new RuntimeException("Unable to parse result", error); - } - - return propertyValue; - } - - /** - * Helper method to extract property values from request result and put them in map as a list that corresponds to a unique property value. - * - * @param requestResult the request response - * @return a map containing information about multiple properties values that correspond to a unique one - * @throws RuntimeException for malformed response - */ - protected Map> getPropertyValuesByUniquePropertyValue(JSONObject requestResult, String uniqueProperty, List otherProperties) - { - Map> valuesByUniqueProperty = new HashMap<>(); - try - { - JSONArray items = requestResult.getJSONArray("items"); - - for (int i = 0; i < items.length(); i++) - { - List otherPropertiesValues = new ArrayList<>(); - - for (int j = 0; j < otherProperties.size(); j++) - { - otherPropertiesValues.add(items.getJSONObject(i).get(otherProperties.get(j)).toString()); - } - valuesByUniqueProperty.put(items.getJSONObject(i).getString(uniqueProperty), otherPropertiesValues); - } - } - catch (JSONException error) - { - throw new RuntimeException("Unable to parse result", error); - } - - return valuesByUniqueProperty; - } - - /** - * Retrieves the nodeRef of an item (category, folder or record) with the given path - * - * @param username the username - * @param password the password - * @param path the path to the container eg. in case of a category it would be the category name, - * in case of a folder it would be /categoryName/folderName - * when trying to get File Plan, the path would be "" - * @return the container nodeRef - */ - public String getItemNodeRef(String username, String password, String path) - { - return contentService.getNodeRefByPath(username, password, FILE_PLAN_PATH + path); - } - - /** - * Retrieve a Cmis object by its path - * - * @param username the user's username - * @param password its password - * @param path the object path - * @return the object in case it exists, null if its does not exist - */ - protected CmisObject getObjectByPath(String username, String password, String path) - { - CmisObject object; - try - { - object = contentService.getCMISSession(username, password).getObjectByPath(path); - } catch (CmisObjectNotFoundException notFoundError) - { - return null; - } - return object; - } - - /** - * Generic faceted request. - * - * @param username the username - * @param password the password - * @param parameters if the request has parameters - * @return result object (see API reference for more details), null for any errors - */ - protected JSONObject facetedRequest(String username, String password, List parameters, String requestURI) - { - String requestURL; - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - - if (parameters == null || parameters.isEmpty()) - { - requestURL = MessageFormat.format( - requestURI, - client.getAlfrescoUrl()); - } - else - { - requestURL = MessageFormat.format( - requestURI, - client.getAlfrescoUrl(), - URLEncodedUtils.format(parameters, "UTF-8")); - } - LOGGER.info("On GET {}, received following response: ", requestURL); - client.close(); - return doGetRequest(username, password, requestURL); - } - - /** - * Helper method for GET requests - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected JSONObject doGetRequest(String adminUser, - String adminPassword, - String urlTemplate, - String ... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - String requestUrl = MessageFormat.format( - urlTemplate, - client.getApiUrl(), - urlTemplateParams); - client.close(); - - try - { - return doRequest(HttpGet.class, requestUrl, adminUser, adminPassword, null); - } - catch (InstantiationException | IllegalAccessException error) - { - throw new IllegalArgumentException("doGetRequest failed", error); - } - } - - /** - * Helper method for Delete requests - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected JSONObject doDeleteRequest(String adminUser, - String adminPassword, - String urlTemplate, - String ... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - String requestUrl = MessageFormat.format( - urlTemplate, - client.getApiUrl(), - urlTemplateParams); - client.close(); - - try - { - return doRequest(HttpDelete.class, requestUrl, adminUser, adminPassword, null); - } - catch (InstantiationException | IllegalAccessException error) - { - throw new IllegalArgumentException("doDeleteRequest failed", error); - } - } - - /** - * Helper method for PUT requests - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected JSONObject doPutRequest(String adminUser, - String adminPassword, - JSONObject requestParams, - String urlTemplate, - String ... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - String requestUrl = MessageFormat.format( - urlTemplate, - client.getApiUrl(), - urlTemplateParams); - client.close(); - - try - { - return doRequest(HttpPut.class, requestUrl, adminUser, adminPassword, requestParams); - } - catch (InstantiationException | IllegalAccessException error) - { - throw new IllegalArgumentException("doPutRequest failed", error); - } - } - - /** - * Helper method for PUT requests - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param expectedStatusCode The expected return status code. - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected HttpResponse doPutJsonRequest(String adminUser, - String adminPassword, - int expectedStatusCode, - JSONObject requestParams, - String urlTemplate, - String... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - return doPutJsonRequest(adminUser, adminPassword, expectedStatusCode, client.getApiUrl(), requestParams, urlTemplate, urlTemplateParams); - } - - /** - * Helper method for PUT requests - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param expectedStatusCode The expected return status code. - * @param urlStart the start of the URL (for example "alfresco/s/slingshot"). - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - * @throws AssertionError if the returned status code is not as expected. - */ - private HttpResponse doPutJsonRequest(String adminUser, - String adminPassword, - int expectedStatusCode, - String urlStart, - JSONObject requestParams, - String urlTemplate, - String... urlTemplateParams) - { - String requestUrl = formatRequestUrl(urlStart, urlTemplate, urlTemplateParams); - try - { - HttpResponse httpResponse = doRequestJson(HttpPut.class, requestUrl, adminUser, adminPassword, requestParams); - assertEquals("PUT request to " + requestUrl + " was not successful.", expectedStatusCode, httpResponse.getStatusLine().getStatusCode()); - return httpResponse; - } - catch (InstantiationException | IllegalAccessException error) - { - throw new IllegalArgumentException("doPutRequest failed", error); - } - } - - /** - * Fill in the parameters for a URL template. - * - * @param urlStart The start of the URL. - * @param urlTemplate The template. - * @param urlTemplateParams Any parameters that need to be filled into the URL template. - * @return The resultant URL. - */ - private String formatRequestUrl(String urlStart, String urlTemplate, String[] urlTemplateParams) - { - if (urlTemplateParams.length == 1) - { - // The format method needs some help to know not to use the whole array object. - return MessageFormat.format(urlTemplate, urlStart, urlTemplateParams[0]); - } - return MessageFormat.format(urlTemplate, urlStart, urlTemplateParams); - } - - /** - * Helper method for POST requests - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected JSONObject doPostRequest(String adminUser, - String adminPassword, - JSONObject requestParams, - String urlTemplate, - String ... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - String requestUrl = MessageFormat.format( - urlTemplate, - client.getApiUrl(), - urlTemplateParams); - client.close(); - - try - { - return doRequest(HttpPost.class, requestUrl, adminUser, adminPassword, requestParams); - } - catch (InstantiationException | IllegalAccessException error) - { - throw new IllegalArgumentException("doPostRequest failed", error); - } - } - - /** - * Helper method for POST requests - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param expectedStatusCode The expected return status code. - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected HttpResponse doPostJsonRequest(String adminUser, - String adminPassword, - int expectedStatusCode, - JSONObject requestParams, - String urlTemplate, - String... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - return doPostJsonRequest(adminUser, adminPassword, expectedStatusCode, client.getApiUrl(), requestParams, urlTemplate, urlTemplateParams); - } - - /** - * Helper method for POST requests to slingshot. - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param expectedStatusCode The expected return status code. - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - */ - protected HttpResponse doSlingshotPostJsonRequest(String adminUser, - String adminPassword, - int expectedStatusCode, - JSONObject requestParams, - String urlTemplate, - String... urlTemplateParams) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - return doPostJsonRequest(adminUser, adminPassword, expectedStatusCode, client.getAlfrescoUrl() + SLINGSHOT_PREFIX, requestParams, urlTemplate, urlTemplateParams); - } - - /** - * Helper method for POST requests - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param expectedStatusCode The expected return status code. - * @param urlStart the start of the URL (for example "alfresco/s/slingshot"). - * @param requestParams zero or more endpoint specific request parameters - * @param urlTemplate request URL template - * @param urlTemplateParams zero or more parameters used with urlTemplate - * @throws AssertionError if the returned status code is not as expected. - */ - private HttpResponse doPostJsonRequest(String adminUser, - String adminPassword, - int expectedStatusCode, - String urlStart, - JSONObject requestParams, - String urlTemplate, - String... urlTemplateParams) - { - String requestUrl; - requestUrl = formatRequestUrl(urlStart, urlTemplate, urlTemplateParams); - try - { - HttpResponse httpResponse = doRequestJson(HttpPost.class, requestUrl, adminUser, adminPassword, requestParams); - assertEquals("POST request to " + requestUrl + " was not successful.", expectedStatusCode, httpResponse.getStatusLine().getStatusCode()); - return httpResponse; - } - catch (InstantiationException | IllegalAccessException error) - { - throw new IllegalArgumentException("doPostRequest failed", error); - } - } - - /** - * Helper method for handling generic HTTP requests - * @param requestType request type (a subclass of {@link HttpRequestBase}) - * @param requestUrl URL the request is to be sent to - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param requestParams endpoint specific request parameters - * @return response body - * @throws IllegalAccessException for invalid requestType - * @throws InstantiationException for invalid requestType - */ - private JSONObject doRequest( - Class requestType, - String requestUrl, - String adminUser, - String adminPassword, - JSONObject requestParams) throws InstantiationException, IllegalAccessException - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - T request = requestType.newInstance(); - - JSONObject responseBody = null; - JSONObject returnValues = null; - - try - { - request.setURI(new URI(requestUrl)); - - if (requestParams != null && request instanceof HttpEntityEnclosingRequestBase) - { - ((HttpEntityEnclosingRequestBase) request).setEntity(new StringEntity(requestParams.toString())); - } - LOGGER.info("Sending {} request to {}", requestType.getSimpleName(), requestUrl); - LOGGER.info("Request body: {}", requestParams); - HttpResponse response = client.execute(adminUser, adminPassword, request); - LOGGER.info("Response: {}", response.getStatusLine()); - - try - { - responseBody = new JSONObject(EntityUtils.toString(response.getEntity())); - } - catch (JSONException error) - { - LOGGER.error("Converting message body to JSON failed. Body: {}", responseBody, error); - } - catch (ParseException | IOException error) - { - LOGGER.error("Parsing message body failed.", error); - } - - switch (response.getStatusLine().getStatusCode()) - { - case HttpStatus.SC_OK: - case HttpStatus.SC_CREATED: - // request successful - if (responseBody != null) - { - returnValues = responseBody; - } - break; - - case HttpStatus.SC_INTERNAL_SERVER_ERROR: - if (responseBody != null && responseBody.has(EXCEPTION_KEY)) - { - LOGGER.error("Request failed with error message: {}", responseBody.getString(MESSAGE_KEY)); - returnValues = responseBody; - } - break; - case HttpStatus.SC_BAD_REQUEST: - case HttpStatus.SC_UNPROCESSABLE_ENTITY: - if (responseBody != null && responseBody.has(EXCEPTION_KEY)) - { - LOGGER.error("Request failed: {}", responseBody.getString(EXCEPTION_KEY)); - returnValues = responseBody; - } - break; - - default: - LOGGER.error("Request returned unexpected HTTP status {}", response.getStatusLine().getStatusCode()); - break; - } - } - catch (JSONException error) - { - LOGGER.error("Unable to extract response parameter", error); - } - catch (UnsupportedEncodingException | URISyntaxException error1) - { - LOGGER.error("Unable to construct request", error1); - } - finally - { - if (request != null) - { - request.releaseConnection(); - } - client.close(); - } - - return returnValues; - } - - private HttpResponse doRequestJson( - Class requestType, - String requestUrl, - String adminUser, - String adminPassword, - JSONObject requestParams) throws InstantiationException, IllegalAccessException - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - T request = requestType.newInstance(); - - try - { - request.setURI(new URI(requestUrl)); - request.setHeader("Content-Type", "application/json"); - - if (requestParams != null && request instanceof HttpEntityEnclosingRequestBase) - { - ((HttpEntityEnclosingRequestBase) request).setEntity(new StringEntity(requestParams.toString())); - } - - LOGGER.info("Sending {} request to {}", requestType.getSimpleName(), requestUrl); - LOGGER.info("Request body: {}", requestParams); - HttpResponse httpResponse = client.execute(adminUser, adminPassword, request); - LOGGER.info("Response: {}", httpResponse.getStatusLine()); - return httpResponse; - } - catch (UnsupportedEncodingException | URISyntaxException error1) - { - LOGGER.error("Unable to construct request", error1); - } - finally - { - if (request != null) - { - request.releaseConnection(); - } - client.close(); - } - - return null; - } - - /** - * Used to set RM items properties - * including records, categories and folders - */ - public enum RMProperty - { - NAME, - TITLE, - CONTENT, - DESCRIPTION, - AUTHOR, - PHYSICAL_SIZE, - NUMBER_OF_COPIES, - STORAGE_LOCATION, - SHELF, - BOX, - FILE, - ORIGINATOR, - ORIGINATING_ORGANIZATION, - PUBLICATION_DATE - } - - public enum RETENTION_SCHEDULE - { - NAME, - DESCRIPTION, - RETENTION_AUTHORITY, - RETENTION_INSTRUCTIONS, - RETENTION_PERIOD, - RETENTION_LOCATION, - RETENTION_PERIOD_PROPERTY, - RETENTION_GHOST, - RETENTION_ELIGIBLE_FIRST_EVENT, - RETENTION_EVENTS, - COMBINE_DISPOSITION_STEP_CONDITIONS - } - - /** - * Used to execute rm actions on a node - */ - public enum RM_ACTIONS - { - EDIT_DISPOSITION_DATE("editDispositionActionAsOfDate"), - END_RETENTION("retain"), - CUT_OFF("cutoff"), - UNDO_CUT_OFF("undoCutoff"), - TRANSFER("transfer"), - COMPLETE_EVENT("completeEvent"), - UNDO_EVENT("undoEvent"), - DESTROY("destroy"); - String action; - - private RM_ACTIONS(String action) - { - this.action = action; - } - - public String getAction() - { - return action; - } - } - - public enum PermissionType - { - SET_READ, - REMOVE_READ, - SET_READ_AND_FILE, - REMOVE_READ_AND_FILE, - } - - /** - * Util to return the property value from a map - * - * @param properties the map containing properties - * @param property to get value for - * @return the property value - */ - public > String getPropertyValue(Map properties, Enum property) - { - String value = properties.get(property); - if (value == null) - { - return ""; - } - return value; - } - - /** - * Retrieves the property value and decides if that gets to be added to the request - * - * @param requestParams the request parameters - * @param propertyRequestValue the property name in the request, eg. "prop_cm_name" - * @param itemProperties map of item's properties values - * @param property the property in the property map to check value for - * @return the json object used in request with the property with its value added if that is not null or empty - */ - protected > JSONObject addPropertyToRequest(JSONObject requestParams, String propertyRequestValue, Map itemProperties, Enum property) throws JSONException - { - String propertyValue = getPropertyValue(itemProperties, property); - - if (!propertyValue.equals("")) - { - requestParams.put(propertyRequestValue, propertyValue); - } - return requestParams; - } - - /** - * Deletes the category, folder or record given as parameter - * - * @param username the username with whom the delete is performed - * @param password the user's password - * @param itemPath the path to the item eg. in case of a category it would be the "/" + category name, - * in case of a folder or subCategory it would be /categoryName/folderName or /categoryName/subCategoryName/ - * in case of a record /categoryName/folderName/recordName - * @throws AssertionError if the delete was not successful. - */ - protected void deleteItem(String username, String password, String itemPath) - { - CmisObject container = getObjectByPath(username, password, FILE_PLAN_PATH + itemPath); - if (container != null) - { - container.delete(); - } - assertNull("Could not delete " + itemPath, getObjectByPath(username, password, itemPath)); - } - - /** - * Retrieve the node ref spaces store value - * - * @return node ref spaces store - */ - public static String getNodeRefSpacesStore() - { - return NODE_REF_WORKSPACE_SPACES_STORE; - } - - /** - * Retrieve the File Plan path - * - * @return the File Plan path - */ - public static String getFilePlanPath() - { - return FILE_PLAN_PATH; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/RMEvents.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/RMEvents.java deleted file mode 100644 index 6234d18ae1..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/v0/RMEvents.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.core.v0; - -public enum RMEvents -{ - ABOLISHED("abolished"), - ALL_ALLOWANCES_GRANTED_ARE_TERMINATED("all_allowances_granted_are_terminated"), - CASE_CLOSED("case_closed"), - DECLASSIFICATION_REVIEW("declassification_review"), - OBSOLETE("obsolete"), - NO_LONGER_NEEDED("no_longer_needed"), - STUDY_COMPLETE("study_complete"); - private String eventName; - - RMEvents(String eventName) - { - this.eventName = eventName; - } - - public String getEventName() - { - return eventName; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEntry.java deleted file mode 100644 index f657b777f4..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEntry.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.audit; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.alfresco.utility.model.TestModel; - -/** - * POJO for audit entry - * - * @author Rodica Sutu - * @since 2.7 - */ -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class AuditEntry extends TestModel -{ - @JsonProperty (required = true) - private String nodeName; - - @JsonProperty (required = true) - private List changedValues; - - @JsonProperty (required = true) - private String identifier; - - @JsonProperty (required = true) - private String path; - - @JsonProperty (required = true) - private String nodeRef; - - @JsonProperty (required = true) - private String fullName; - - @JsonProperty - private String createPerson; - - @JsonProperty (required = true) - private String userName; - - @JsonProperty (required = true) - private String userRole; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String event; - - @JsonProperty (required = true) - private String timestamp; - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java deleted file mode 100644 index 7b9381040f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.audit; - -/** - * Enumerates the list of events audited - * - * @author Rodica Sutu - * @since 2.7 - * - */ -public enum AuditEvents -{ - CREATE_PERSON("Create Person", "Create User"), - DELETE_PERSON("Delete Person", "Delete User"), - CREATE_USER_GROUP("Create User Group", "Create User Group"), - DELETE_USER_GROUP("Delete User Group", "Delete User Group"), - ADD_TO_USER_GROUP("Add To User Group", "Add To User Group"), - REMOVE_FROM_USER_GROUP("Remove From User Group", "Remove From User Group"), - LOGIN_UNSUCCESSFUL("Login.Failure", "Login Unsuccessful"), - LOGIN_SUCCESSFUL("Login.Success", "Login Successful"), - CREATE_HOLD("Create Hold", "Create Hold"), - DELETE_HOLD("Delete Hold", "Delete Hold"), - ADD_TO_HOLD("Add To Hold", "Add To Hold"), - REMOVE_FROM_HOLD("Remove From Hold", "Remove From Hold"); - - /** event audited */ - public final String event; - - /** display name for the event audited */ - public final String eventDisplayName; - - AuditEvents(String event, String displayName) - { - this.event = event; - this.eventDisplayName = displayName; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/IdNamePair.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/IdNamePair.java deleted file mode 100644 index 7e2a69335c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/IdNamePair.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.common; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * POJO for id/name pair - * - * @author Kristijan Conkas - * @since 2.6 - */ -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class IdNamePair -{ - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String nodeType; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/Owner.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/Owner.java deleted file mode 100644 index 6f862f0a6a..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/Owner.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.common; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.alfresco.utility.model.TestModel; - -/** - * POJO for owner parameter - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -//@NoArgsConstructor -//@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class Owner extends TestModel -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/Path.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/Path.java deleted file mode 100644 index da1c6c459f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/Path.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.common; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for path parameter - * - * @author Kristijan Conkas - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class Path extends TestModel -{ - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private Boolean isComplete; - - @JsonProperty (required = true) - private List elements; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/ReviewPeriod.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/ReviewPeriod.java deleted file mode 100644 index aa986593c6..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/common/ReviewPeriod.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.common; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * POJO for the review period parameter - * - * @author Rodica Sutu - * @since 2.6 - */ -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ReviewPeriod -{ - @JsonProperty (required = true) - private String periodType; - - @JsonProperty (required = true) - private String expression; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/custom/CustomDefinitions.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/custom/CustomDefinitions.java deleted file mode 100644 index 78cbf10916..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/custom/CustomDefinitions.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.custom; - -/** - * List of existing records management custom references. - * - * @author Rodica Sutu - * @since 2.6 - */ -public enum CustomDefinitions -{ - ATTACHMENT("Attachment"), - MESSAGE("Message"), - NEXT_VERSION("Next Version"), - RENDITION("Rendition"); - /** - * The name of custom reference. - */ - private String definition; - - /** - * Private constructor. - */ - CustomDefinitions(String definition) - { - this.definition = definition; - } - - /** - * Get the name of the custom reference. - * - * @return The value of custom reference. - */ - public String getDefinition() - { - return definition; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplan/FilePlan.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplan/FilePlan.java deleted file mode 100644 index 266dad8d9f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplan/FilePlan.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplan; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for file plan - * - * @author Ramona Popa - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class FilePlan extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private FilePlanProperties properties; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplan/FilePlanProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplan/FilePlanProperties.java deleted file mode 100644 index 477105d694..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplan/FilePlanProperties.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplan; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_COMPONENT_ID; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_COUNT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for file plan properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class FilePlanProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_COMPONENT_ID) - private String componentd; - - @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty (PROPERTIES_COUNT) - private Integer count; - - @JsonProperty (PROPERTIES_TITLE) - private String title; - - @JsonProperty (PROPERTIES_DESCRIPTION) - private String description; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java deleted file mode 100644 index 2fbbd3efdd..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplancomponents; - -/** - * File plan component alias - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class FilePlanComponentAlias -{ - public static final String FILE_PLAN_ALIAS = "-filePlan-"; - public static final String TRANSFERS_ALIAS = "-transfers-"; - public static final String UNFILED_RECORDS_CONTAINER_ALIAS = "-unfiled-"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java deleted file mode 100644 index ba50b45a9e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplancomponents; - -/** - * File plan component aspect names constants - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class FilePlanComponentAspects -{ - /** Private constructor to prevent instantiation. */ - private FilePlanComponentAspects() - { - } - - // aspect present on completed records - public static final String ASPECTS_COMPLETED_RECORD = "rma:declaredRecord"; - - // aspect present on record folders/categories with vital records - public static final String ASPECTS_VITAL_RECORD_DEFINITION= "rma:vitalRecordDefinition"; - - // aspect present on vital records - public static final String ASPECTS_VITAL_RECORD = "rma:vitalRecord"; - - // Frozen aspect - public static final String FROZEN_ASPECT = "rma:frozen"; - - // recordSearch aspect - public static final String RECORD_SEARCH_ASPECT = "rma:recordSearch"; - - // retention schedule cut off aspect - public static final String CUT_OFF_ASPECT = "rma:cutOff"; - - // declare version as record aspect - public static final String VERSION_AS_RECORD = "rmv:versionRecord"; - - // WORM store selector aspect - public static final String ASPECT_STORE_SELECTOR = "cm:storeSelector"; - - // WORM Lock aspect - public static final String ASPECT_WORM_LOCK = "rme:wormLock"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java deleted file mode 100644 index 611d061a10..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplancomponents; - -/** - * File plan component field names constants - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class FilePlanComponentFields -{ - /** Common properties for file plans, record categories, record folders and records */ - public static final String PROPERTIES_ROOT_NODE_REF = "rma:rootNodeRef"; - public static final String PROPERTIES_IDENTIFIER = "rma:identifier"; - - /** Common properties for record categories, record folders and records */ - // Non-electronic record properties - public static final String PROPERTIES_TITLE = "cm:title"; - public static final String PROPERTIES_DESCRIPTION = "cm:description"; - - /** Common properties for record categories and record folders **/ - public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator"; - public static final String PROPERTIES_REVIEW_PERIOD = "rma:reviewPeriod"; - public static final String PROPERTIES_OWNER = "cm:owner"; - public static final String PROPERTIES_AUTHOR="cm:author"; - - /** Common properties for record folders and records */ - public static final String PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE = "rma:recordSearchHasDispositionSchedule"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION = "rma:recordSearchDispositionPeriodExpression"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY = "rma:recordSearchDispositionAuthority"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF = "rma:recordSearchDispositionActionAsOf"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD = "rma:recordSearchDispositionPeriod"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME = "rma:recordSearchDispositionActionName"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE = "rma:recordSearchDispositionEventsEligible"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS = "rma:recordSearchDispositionInstructions"; - public static final String PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS = "rma:recordSearchDispositionEvents"; - public static final String PROPERTIES_DECLASSIFICATION_REVIEW_COMPLETED_BY = "rma:declassificationReviewCompletedBy"; - public static final String PROPERTIES_DECLASSIFICATION_REVIEW_COMPLETED_AT = "rma:declassificationReviewCompletedAt"; - - - /** File plan properties */ - public static final String PROPERTIES_COMPONENT_ID = "st:componentId"; - public static final String PROPERTIES_COUNT = "rma:count"; - - /** Record category properties */ - // All fields are shared with record folders - - /** Record folder properties */ - public static final String PROPERTIES_IS_CLOSED = "rma:isClosed"; // not to be confused with IS_CLOSED! - public static final String PROPERTIES_HELD_CHILDREN_COUNT = "rma:heldChildrenCount"; - public static final String PROPERTIES_LOCATION = "rma:location"; - public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD = "rma:recordSearchVitalRecordReviewPeriod"; - public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = "rma:recordSearchVitalRecordReviewPeriodExpression"; - - /** - * Record properties - */ - public static final String PROPERTIES_CLASSIFICATION = "sc:classification"; - public static final String PROPERTIES_DATE_FILED = "rma:dateFiled"; - public static final String PROPERTIES_ORIGINAL_NAME = "rma:origionalName"; - public static final String PROPERTIES_REVIEW_AS_OF = "rma:reviewAsOf"; - - /** Electronic record properties */ - public static final String PROPERTIES_VERSION_TYPE = "cm:versionType"; - public static final String PROPERTIES_VERSION_LABEL = "cm:versionLabel"; - public static final String PROPERTIES_VERSIONED_NODEREF = "rmv:versionedNodeRef"; - public static final String PROPERTIES_RMV_VERSIONED = "rmv:versionLabel"; - public static final String PROPERTIES_DATE_TIME_ORIGINAL = "exif:dateTimeOriginal"; - public static final String PROPERTIES_EXPOSURE_TIME = "exif:exposureTime"; - public static final String PROPERTIES_FLASH = "exif:flash"; - public static final String PROPERTIES_F_NUMBER = "exif:fNumber"; - public static final String PROPERTIES_FOCAL_LENGTH = "exif:focalLength"; - public static final String PROPERTIES_ISO_SPEED_RATINGS = "exif:isoSpeedRatings"; - public static final String PROPERTIES_MANUFACTURER = "exif:manufacturer"; - public static final String PROPERTIES_MODEL = "exif:model"; - public static final String PROPERTIES_ORIENTATION = "exif:orientation"; - public static final String PROPERTIES_PIXEL_X_DIMENSION = "exif:pixelXDimension"; - public static final String PROPERTIES_PIXEL_Y_DIMENSION = "exif:pixelYDimension"; - public static final String PROPERTIES_RESOLUTION_UNIT = "exif:resolutionUnit"; - public static final String PROPERTIES_SOFTWARE = "exif:software"; - public static final String PROPERTIES_X_RESOLUTION = "exif:xResolution"; - public static final String PROPERTIES_Y_RESOLUTION = "exif:yResolution"; - public static final String PROPERTIES_RECORD_ORIGINATING_LOCATION = "rma:recordOriginatingLocation"; - public static final String PROPERTIES_RECORD_ORIGINATING_USER_ID = "rma:recordOriginatingUserId"; - public static final String PROPERTIES_RECORD_ORIGINATING_CREATION_DATE = "rma:recordOriginatingCreationDate"; - - /** Non-electronic record properties */ - public static final String PROPERTIES_SHELF = "rma:shelf"; - public static final String PROPERTIES_STORAGE_LOCATION = "rma:storageLocation"; - public static final String PROPERTIES_FILE = "rma:file"; - public static final String PROPERTIES_BOX = "rma:box"; - public static final String PROPERTIES_NUMBER_OF_COPIES = "rma:numberOfCopies"; - public static final String PROPERTIES_PHYSICAL_SIZE = "rma:physicalSize"; - - /** Transfer properties */ - public static final String PROPERTIES_PDF_INDICATOR = "rma:transferPDFIndicator"; - public static final String PROPERTIES_TRANSFER_LOCATION = "rma:transferLocation"; - public static final String PROPERTIES_ACCESSION_INDICATOR = "rma:transferAccessionIndicator"; - - /** Parameters */ - public static final String RELATIVE_PATH = "relativePath"; - public static final String INCLUDE = "include"; - - /** Include options */ - public static final String ALLOWABLE_OPERATIONS = "allowableOperations"; - public static final String IS_CLOSED = "isClosed"; - public static final String IS_COMPLETED = "isCompleted"; - public static final String CONTENT = "content"; - public static final String PATH = "path"; - /** CONTENT STORE property */ - public static final String PROPERTIES_STORE = "cm:storeName"; - /** WORM Unlock Date */ - public static final String PROPERTIES_WORM_UNLOCK_DATE = "rme:wormUnlockDate"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java deleted file mode 100644 index e57f0653e6..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplancomponents; - -/** - * File plan component type - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class FilePlanComponentType -{ - public static final String FILE_PLAN_TYPE = "rma:filePlan"; - public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory"; - public static final String RECORD_FOLDER_TYPE = "rma:recordFolder"; - public static final String RECORD_TYPE = "rma:record"; // generic record type - public static final String UNFILED_RECORD_FOLDER_TYPE = "rma:unfiledRecordFolder"; - public static final String TRANSFER_TYPE = "rma:transfer"; - public static final String TRANSFER_CONTAINER_TYPE = "rma:transferContainer"; - public static final String UNFILED_CONTAINER_TYPE = "rma:unfiledRecordContainer"; - public static final String FOLDER_TYPE = "cm:folder"; - public static final String CONTENT_TYPE = "cm:content"; - public static final String NON_ELECTRONIC_RECORD_TYPE = "rma:nonElectronicDocument"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/hold/HoldEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/hold/HoldEntry.java deleted file mode 100644 index 51c9623d16..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/hold/HoldEntry.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.hold; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.alfresco.utility.model.TestModel; - -/** - * POJO for hold entry - * - * @author Rodica Sutu - * @since 3.2 - */ -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class HoldEntry extends TestModel -{ - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String nodeRef; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java deleted file mode 100644 index 334637ba31..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.record; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.core.IRestModel; -import org.alfresco.rest.core.assertion.ModelAssertion; -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.model.RestNodeModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class Record extends TestModel implements IRestModel -{ - public final static String CONTENT_NODE_TYPE = "cm:content"; - - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private RecordContent content; - - @JsonProperty - private Boolean isCompleted; - - @JsonProperty - private RecordProperties properties; - - @JsonProperty - private List aspectNames; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; - - @Override - public ModelAssertion assertThat() - { - return new ModelAssertion<>(this); - } - - @Override - public ModelAssertion and() - { - return assertThat(); - } - - @JsonProperty (value = "entry") - RestNodeModel model; - - @Override - public RestNodeModel onModel() - { - return model; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordBodyFile.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordBodyFile.java deleted file mode 100644 index 4089ca6358..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordBodyFile.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.record; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for File records - * - * @author Rodica Sutu - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordBodyFile extends TestModel -{ - @JsonProperty - private String targetParentId; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordContent.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordContent.java deleted file mode 100644 index 19ec1b6e2f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordContent.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.record; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record content field - * - * @author Kristijan Conkas - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordContent extends TestModel -{ - @JsonProperty (required = true) - private String mimeType; - - @JsonProperty (required = true) - private String mimeTypeName; - - @JsonProperty (required = true) - private Integer sizeInBytes; - - @JsonProperty (required = true) - private String encoding; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java deleted file mode 100644 index 4616e7d474..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/RecordProperties.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.record; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_AUTHOR; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_CLASSIFICATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_FILED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_EXPOSURE_TIME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FLASH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FOCAL_LENGTH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_F_NUMBER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ISO_SPEED_RATINGS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MANUFACTURER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MODEL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIENTATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIGINAL_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_X_DIMENSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_Y_DIMENSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_CREATION_DATE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_ORIGINATING_USER_ID; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_AS_OF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RMV_VERSIONED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORAGE_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSIONED_NODEREF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_LABEL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_WORM_UNLOCK_DATE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION; - -import java.util.Date; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.utility.model.TestModel; - -/** - * POJO for record properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties(ignoreUnknown = true) -public class RecordProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (required = true, value = PROPERTIES_DATE_FILED) - private String dateField; - - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE) - private Boolean recordSearchHasDispositionSchedule; - - @JsonProperty (required = true, value = PROPERTIES_ORIGINAL_NAME) - private String originalName; - - @JsonProperty (PROPERTIES_CLASSIFICATION) - private List classification; - - /*********************************/ - /** Electronic record parameters */ - /*********************************/ - @JsonProperty (PROPERTIES_VERSION_TYPE) - private String versionType; - - @JsonProperty (PROPERTIES_VERSION_LABEL) - private String versionLabel; - - @JsonProperty(PROPERTIES_VERSIONED_NODEREF) - private String versionedNodeRef; - - @JsonProperty (PROPERTIES_RMV_VERSIONED) - private String recordVersionLabel; - - @JsonProperty (PROPERTIES_DATE_TIME_ORIGINAL) - private String dateTimeOriginal; - - @JsonProperty (PROPERTIES_EXPOSURE_TIME) - private Double exposureTime; - - @JsonProperty (PROPERTIES_FLASH) - private Boolean flash; - - @JsonProperty (PROPERTIES_F_NUMBER) - private Double fNumber; - - @JsonProperty (PROPERTIES_FOCAL_LENGTH) - private Double focalLength; - - @JsonProperty (PROPERTIES_ISO_SPEED_RATINGS) - private Integer isoSpeedRatings; - - @JsonProperty (PROPERTIES_MANUFACTURER) - private String manufacturer; - - @JsonProperty (PROPERTIES_MODEL) - private String model; - - @JsonProperty (PROPERTIES_ORIENTATION) - private Integer orientation; - - @JsonProperty (PROPERTIES_PIXEL_X_DIMENSION) - private Integer pixelXDimension; - - @JsonProperty (PROPERTIES_PIXEL_Y_DIMENSION) - private Integer pixelYDimension; - - @JsonProperty (PROPERTIES_RESOLUTION_UNIT) - private String resolutionUnit; - - @JsonProperty (PROPERTIES_SOFTWARE) - private String software; - - @JsonProperty (PROPERTIES_X_RESOLUTION) - private Double xResolution; - - @JsonProperty (PROPERTIES_Y_RESOLUTION) - private Double yResolution; - - @JsonProperty (PROPERTIES_RECORD_ORIGINATING_LOCATION) - private String originatingLocation; - - @JsonProperty (PROPERTIES_RECORD_ORIGINATING_USER_ID) - private String originatingUserId; - - @JsonProperty (PROPERTIES_RECORD_ORIGINATING_CREATION_DATE) - private String originatingCreationDate; - - /*************************************/ - /** Non-electronic record parameters */ - /*************************************/ - @JsonProperty (PROPERTIES_TITLE) - private String title; - - @JsonProperty (PROPERTIES_SHELF) - private String shelf; - - @JsonProperty (PROPERTIES_STORAGE_LOCATION) - private String storageLocation; - - @JsonProperty (PROPERTIES_FILE) - private String file; - - @JsonProperty (PROPERTIES_BOX) - private String box; - - @JsonProperty (PROPERTIES_DESCRIPTION) - private String description; - - @JsonProperty (PROPERTIES_NUMBER_OF_COPIES) - private Integer numberOfCopies; - - @JsonProperty (PROPERTIES_PHYSICAL_SIZE) - private Integer physicalSize; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; - - @JsonProperty(PROPERTIES_AUTHOR) - private String author; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION) - private String recordSearchDispositionPeriodExpression; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY) - private String recordSearchDispositionAuthority; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF) - private Date recordSearchDispositionActionAsOf; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD) - private String recordSearchDispositionPeriod; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME) - private String recordSearchDispositionActionName; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE) - private Boolean recordSearchDispositionEventsEligible; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS) - private String recordSearchDispositionInstructions; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD) - private String recordSearchVitalRecordReviewPeriod; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION) - private String recordSearchVitalRecordReviewPeriodExpression; - - @JsonProperty(PROPERTIES_REVIEW_AS_OF) - private Date reviewAsOf; - - @JsonProperty (PROPERTIES_STORE) - private String store; - - @JsonProperty(PROPERTIES_WORM_UNLOCK_DATE) - private Date wormUnlockDate; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java deleted file mode 100644 index d929a3460e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record category - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordCategory extends TestModel -{ - public static final String DEFAULT_FILE_PLAN_ALIAS = "-filePlan-"; - - /*************************/ - /** Mandatory parameters */ - /*************************/ - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private RecordCategoryProperties properties; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private Boolean hasRetentionSchedule; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java deleted file mode 100644 index 1b00e8fe94..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record category child - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordCategoryChild extends TestModel -{ - public static final String RECORD_FOLDER_NODE_TYPE = "rma:recordFolder"; - - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private Boolean isRecordCategory; - - @JsonProperty - private Boolean isRecordFolder; - - @JsonProperty - private RecordCategoryChildProperties properties; - - @JsonProperty - private List aspectNames; - - @JsonProperty - private Boolean hasRetentionSchedule; - - @JsonProperty - private Boolean isClosed; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; - - @JsonProperty - private String relativePath; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildCollection.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildCollection.java deleted file mode 100644 index 06438747b8..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildCollection.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import org.alfresco.rest.core.RestModels; - -/** - * Handle collection of {@link RecordCategoryChildEntry} - * - * @author Kristijan Conkas - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordCategoryChildCollection extends RestModels -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildEntry.java deleted file mode 100644 index d204b4c6c8..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildEntry.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.core.RestModels; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * POJO for record category child entry - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class RecordCategoryChildEntry extends RestModels -{ - @JsonProperty - private RecordCategoryChild entry; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java deleted file mode 100644 index 9494bf37c9..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChildProperties.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HELD_CHILDREN_COUNT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record category child properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordCategoryChildProperties extends TestModel -{ - /**************************************************************************/ - /** Mandatory parameters - Shared by record categories and record folders */ - /**************************************************************************/ - @JsonProperty (required = true, value = PROPERTIES_TITLE) - private String title; - - @JsonProperty (required = true, value = PROPERTIES_VITAL_RECORD_INDICATOR) - private Boolean vitalRecordIndicator; - - @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_REVIEW_PERIOD) - @JsonSerialize (using = ReviewPeriodSerializer.class) - private ReviewPeriod reviewPeriod; - - @JsonProperty (required = true, value = PROPERTIES_DESCRIPTION) - private String description; - - /*********************************************************/ - /** Optional parameters - Applies only to record folders */ - /*********************************************************/ - @JsonProperty (PROPERTIES_HELD_CHILDREN_COUNT) - private Integer heldChildrenCount; - - @JsonProperty (PROPERTIES_LOCATION) - private String location; - - @JsonProperty (PROPERTIES_IS_CLOSED) - private Boolean isClosed; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE) - private Boolean recordSearchHasDispositionSchedule; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION) - private String recordSearchDispositionPeriodExpression; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY) - private String recordSearchDispositionAuthority; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_AS_OF) - private Date recordSearchDispositionActionAsOf; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD) - private String recordSearchDispositionPeriod; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_ACTION_NAME) - private String recordSearchDispositionActionName; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS_ELIGIBLE) - private Boolean recordSearchDispositionEventsEligible; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS) - private String recordSearchDispositionInstructions; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_EVENTS) - private Boolean recordSearchDispositionEvents; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryCollection.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryCollection.java deleted file mode 100644 index da39eb7643..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryCollection.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import org.alfresco.rest.core.RestModels; - -/** - * Handle collection of {@link RecordCategoryEntry} - * - * @author Ramona Popa - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordCategoryCollection extends RestModels -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryEntry.java deleted file mode 100644 index 19a88927f8..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryEntry.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.core.RestModels; -import org.alfresco.rest.rm.community.model.fileplan.FilePlan; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * POJO for file plan entry - * - * @author Ramona Popa - * @author Tuna Aksoy - * @since 2.6 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class RecordCategoryEntry extends RestModels -{ - @JsonProperty - private RecordCategory entry; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryProperties.java deleted file mode 100644 index b9b14eaa85..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryProperties.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordcategory; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_CLASSIFICATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; - - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record category properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class RecordCategoryProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_REVIEW_PERIOD) - @JsonSerialize (using = ReviewPeriodSerializer.class) - private ReviewPeriod reviewPeriod; - - @JsonProperty (required = true, value = PROPERTIES_VITAL_RECORD_INDICATOR) - private Boolean vitalRecordIndicator; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty (PROPERTIES_TITLE) - private String title; - - @JsonProperty (PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (PROPERTIES_DESCRIPTION) - private String description; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; - - @JsonProperty (PROPERTIES_CLASSIFICATION) - private List classification; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolder.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolder.java deleted file mode 100644 index b2c159f7b3..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolder.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordfolder; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record folder - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordFolder extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private RecordFolderProperties properties; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private Boolean isClosed; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderCollection.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderCollection.java deleted file mode 100644 index 80cde184c3..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderCollection.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordfolder; - -import org.alfresco.rest.core.RestModels; - -/** - * Handle collection of {@link RecordFolderEntry} - * - * @author Kristijan Conkas - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordFolderCollection extends RestModels -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderEntry.java deleted file mode 100644 index f3ab55d5c1..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderEntry.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordfolder; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.core.RestModels; -import org.alfresco.rest.rm.community.model.record.Record; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record folder entry - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RecordFolderEntry extends RestModels -{ - @JsonProperty - private Record entry; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderProperties.java deleted file mode 100644 index eaf0b4ab24..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordfolder/RecordFolderProperties.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.recordfolder; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_CLASSIFICATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HELD_CHILDREN_COUNT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields - .PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields - .PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record folder properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class RecordFolderProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_IS_CLOSED) - private Boolean isClosed; - - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_HELD_CHILDREN_COUNT) - private Integer heldChildrenCount; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty (PROPERTIES_TITLE) - private String title; - - @JsonProperty (PROPERTIES_VITAL_RECORD_INDICATOR) - private Boolean vitalRecordIndicator; - - @JsonProperty (PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (PROPERTIES_LOCATION) - private String location; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE) - private Boolean recordSearchHasDispositionSchedule; - - @JsonProperty (PROPERTIES_REVIEW_PERIOD) - @JsonSerialize (using = ReviewPeriodSerializer.class) - private ReviewPeriod reviewPeriod; - - @JsonProperty (PROPERTIES_CLASSIFICATION) - private List classification; - - @JsonProperty (PROPERTIES_DESCRIPTION) - private String description; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD) - private String recordSearchVitalRecordReviewPeriod; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION) - private String recordSearchVitalRecordReviewPeriodExpression; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY) - private String recordSearchDispositionAuthority; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS) - private String recordSearchDispositionInstructions; - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java deleted file mode 100644 index 5720629c0c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.rules; - -/** - * Action values. - */ -public enum ActionsOnRule -{ - COMPLETE_RECORD("declareRecord"), - REOPEN_RECORD("undeclareRecord"), - OPEN_RECORD_FOLDER("openRecordFolder"), - CLOSE_RECORD_FOLDER("closeRecordFolder"), - FILE_TO("fileTo"), - COPY_TO("copyTo"), - MOVE_TO("moveTo"), - LINK_TO("linkTo"), - REJECT("reject"), - REQUEST_INFORMATION("requestInfo"), - COMPLETE_EVENT("completeEvent"), - ADD_RECORD_TYPES("addRecordTypes"), - EXECUTE_SCRIPT("executeScript"), - SEND_EMAIL("sendEmail"), - SET_PROPERTY_VALUE_COLL_SITE("set-property-value"), - SET_PROPERTY_VALUE_RM("setPropertyValue"), - HIDE_RECORD("hide-record"), - DECLARE_VERSION_AS_RECORD("declare-as-version-record"), - DECLARE_AS_RECORD("create-record"), - WORM_LOCK("wormLock"); - - private String actionValue; - - ActionsOnRule(String value) - { - this.actionValue = value; - } - - public String getActionValue() - { - return actionValue; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ConditionsOnRule.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ConditionsOnRule.java deleted file mode 100644 index 4a259f2fd4..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ConditionsOnRule.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.rules; - -/** - * enum used to find the when condition names options by their value - */ -public enum ConditionsOnRule -{ - UPDATE("update"), - ADDED("inbound"), - REMOVED("outbound"); - private String whenConditionValue; - - ConditionsOnRule(String value) - { - this.whenConditionValue = value; - } - - public String getWhenConditionValue() - { - return whenConditionValue; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/RuleDefinition.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/RuleDefinition.java deleted file mode 100644 index 6b9bdfdee1..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/RuleDefinition.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.rules; - -import java.util.List; - -/** - * A class describing the rule - */ -public class RuleDefinition -{ - private String id = ""; - private String title; - private String description = ""; - private boolean disabled = false; - private boolean applyToChildren = false; - private boolean runInBackground = false; - private String ruleType = ConditionsOnRule.ADDED.getWhenConditionValue(); - private String path; - private Boolean createRecordPath; - private String contentTitle; - private String contentDescription; - private String rejectReason; - private List actions; - - /** - * Creates a new object of type Rule Definition - * - * @return the object - */ - public static RuleDefinition createNewRule() - { - return new RuleDefinition(); - } - - public String getId() - { - return id; - } - - public RuleDefinition id(String id) - { - this.id = id; - return this; - } - - public String getTitle() - { - return title; - } - - public RuleDefinition title(String title) - { - this.title = title; - return this; - } - - public String getDescription() - { - return description; - } - - public RuleDefinition description(String description) - { - this.description = description; - return this; - } - - public boolean isDisabled() - { - return disabled; - } - - public RuleDefinition disabled(boolean disabled) - { - this.disabled = disabled; - return this; - } - - public boolean isApplyToChildren() - { - return applyToChildren; - } - - public RuleDefinition applyToChildren(boolean applyToChildren) - { - this.applyToChildren = applyToChildren; - return this; - } - - public boolean getRunInBackground() - { - return runInBackground; - } - - public RuleDefinition runInBackground(boolean runInBackground) - { - this.runInBackground = runInBackground; - return this; - } - - public String getRuleType() - { - return ruleType; - } - - public RuleDefinition ruleType(String ruleType) - { - this.ruleType = ruleType; - return this; - } - - public String getPath() - { - return path; - } - - public RuleDefinition path(String path) - { - this.path = path; - return this; - } - - public Boolean getCreateRecordPath() - { - return createRecordPath; - } - - public RuleDefinition createRecordPath(boolean createRecordPath) - { - this.createRecordPath = createRecordPath; - return this; - } - - public String getContentTitle() - { - return contentTitle; - } - - public RuleDefinition contentTitle(String contentTitle) - { - this.contentTitle = contentTitle; - return this; - } - - public String getContentDescription() - { - return contentDescription; - } - - public RuleDefinition contentDescription(String contentDescription) - { - this.contentDescription = contentDescription; - return this; - } - - public String getRejectReason() - { - return rejectReason; - } - - public RuleDefinition rejectReason(String rejectReason) - { - this.rejectReason = rejectReason; - return this; - } - - public List getActions() - { - return actions; - } - - public RuleDefinition actions(List actions) - { - this.actions = actions; - return this; - } -} - diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java deleted file mode 100644 index 45b696ef4e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.site; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestSiteModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for RM Site component - * - * @author Rodica Sutu - * @since 2.6 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class RMSite extends RestSiteModel -{ - @JsonProperty (required = true) - private RMSiteCompliance compliance; - - /** Private constructor allowing Lombok to include superclass fields in the builder. */ - @Builder - private RMSite(String title, String description, RMSiteCompliance compliance) - { - this.setTitle(title); - this.setDescription(description); - this.compliance = compliance; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteCompliance.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteCompliance.java deleted file mode 100644 index 9aa8680c4d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteCompliance.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.site; - -/** - * RM Site compliance - * - * @author Tuna Aksoy - * @since 2.6 - */ -public enum RMSiteCompliance -{ - STANDARD, - DOD5015 -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteFields.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteFields.java deleted file mode 100644 index 288f4fe39b..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteFields.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.site; - -/** - *RM Site properties from the RM Model Schema - *"entry": { - * "id": "string", - * "guid": "string", - * "title": "string", - * "description": "string", - * "visibility": "{@link org.springframework.social.alfresco.api.entities.Site.Visibility}", - * "compliance": "{@link RMSiteCompliance}", - * "role": "{@link org.alfresco.utility.constants.UserRole}" - *} - * @author Tuna Aksoy - * @author Rodica Sutu - * @since 2.6 - */ -public class RMSiteFields -{ - public static final String ID = "id"; - public static final String COMPLIANCE = "compliance"; - public static final String TITLE = "title"; - public static final String DESCRIPTION = "description"; - public static final String VISIBILITY ="visibility"; - public static final String ROLE = "role"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java deleted file mode 100644 index c6c228efbc..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/Transfer.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for Transfer - * - * @author Silviu Dinuta - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class Transfer extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private TransferProperties properties; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private List allowableOperations; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChild.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChild.java deleted file mode 100644 index b9a7eb7846..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChild.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for transfer child - * - * @author Silviu Dinuta - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferChild extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private TransferChildProperties properties; - - @JsonProperty - private Boolean isRecord; - - @JsonProperty - private Boolean isRecordFolder; - - @JsonProperty - private List aspectNames; - - @JsonProperty - private Boolean isCompleted; - - @JsonProperty - private Boolean isClosed; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildCollection.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildCollection.java deleted file mode 100644 index 421f42e292..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildCollection.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import org.alfresco.rest.core.RestModels; - -/** - * Handle collection of {@link TransferChildEntry} - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferChildCollection extends RestModels -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildEntry.java deleted file mode 100644 index 58a21fdf5b..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildEntry.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import org.alfresco.rest.core.RestModels; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for transfer child entry - * - * @author Silviu Dinuta - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferChildEntry extends RestModels -{ - @JsonProperty - private TransferChild entry; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildProperties.java deleted file mode 100644 index a0be6e5c0b..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferChildProperties.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_FILED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_EXPOSURE_TIME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FLASH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FOCAL_LENGTH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_F_NUMBER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HELD_CHILDREN_COUNT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ISO_SPEED_RATINGS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MANUFACTURER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MODEL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIENTATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIGINAL_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_X_DIMENSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_Y_DIMENSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORAGE_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_LABEL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer; -import org.alfresco.utility.model.TestModel; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for transfer child properties - * - * @author Silviu Dinuta - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferChildProperties extends TestModel -{ - /**************************************************************************/ - /** Mandatory parameters - Shared by record folders and records*/ - /**************************************************************************/ - @JsonProperty (PROPERTIES_TITLE) - private String title; - - @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (PROPERTIES_DESCRIPTION) - private String description; - - /*********************************************************/ - /** Optional parameters - Applies only to record folders */ - /*********************************************************/ - @JsonProperty (PROPERTIES_VITAL_RECORD_INDICATOR) - private Boolean vitalRecordIndicator; - - @JsonProperty (PROPERTIES_REVIEW_PERIOD) - @JsonSerialize (using = ReviewPeriodSerializer.class) - private ReviewPeriod reviewPeriod; - - @JsonProperty (PROPERTIES_HELD_CHILDREN_COUNT) - private Integer heldChildrenCount; - - @JsonProperty (PROPERTIES_LOCATION) - private String location; - - @JsonProperty (PROPERTIES_IS_CLOSED) - private Boolean isClosed; - - /*********************************************************/ - /** Optional parameters - Applies only to records */ - /*********************************************************/ - @JsonProperty (PROPERTIES_DATE_FILED) - private String dateField; - - @JsonProperty (PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE) - private Boolean recordSearchHasDispositionSchedule; - - @JsonProperty (PROPERTIES_ORIGINAL_NAME) - private String originalName; - - - /*********************************/ - /** Electronic record parameters */ - /*********************************/ - @JsonProperty (PROPERTIES_VERSION_TYPE) - private String versionType; - - @JsonProperty (PROPERTIES_VERSION_LABEL) - private String versionLabel; - - @JsonProperty (PROPERTIES_DATE_TIME_ORIGINAL) - private String dateTimeOriginal; - - @JsonProperty (PROPERTIES_EXPOSURE_TIME) - private Double exposureTime; - - @JsonProperty (PROPERTIES_FLASH) - private Boolean flash; - - @JsonProperty (PROPERTIES_F_NUMBER) - private Double fNumber; - - @JsonProperty (PROPERTIES_FOCAL_LENGTH) - private Double focalLength; - - @JsonProperty (PROPERTIES_ISO_SPEED_RATINGS) - private Integer isoSpeedRatings; - - @JsonProperty (PROPERTIES_MANUFACTURER) - private String manufacturer; - - @JsonProperty (PROPERTIES_MODEL) - private String model; - - @JsonProperty (PROPERTIES_ORIENTATION) - private Integer orientation; - - @JsonProperty (PROPERTIES_PIXEL_X_DIMENSION) - private Integer pixelXDimension; - - @JsonProperty (PROPERTIES_PIXEL_Y_DIMENSION) - private Integer pixelYDimension; - - @JsonProperty (PROPERTIES_RESOLUTION_UNIT) - private String resolutionUnit; - - @JsonProperty (PROPERTIES_SOFTWARE) - private String software; - - @JsonProperty (PROPERTIES_X_RESOLUTION) - private Double xResolution; - - @JsonProperty (PROPERTIES_Y_RESOLUTION) - private Double yResolution; - - /*************************************/ - /** Non-electronic record parameters */ - /*************************************/ - - @JsonProperty (PROPERTIES_SHELF) - private String shelf; - - @JsonProperty (PROPERTIES_STORAGE_LOCATION) - private String storageLocation; - - @JsonProperty (PROPERTIES_FILE) - private String file; - - @JsonProperty (PROPERTIES_BOX) - private String box; - - @JsonProperty (PROPERTIES_NUMBER_OF_COPIES) - private Integer numberOfCopies; - - @JsonProperty (PROPERTIES_PHYSICAL_SIZE) - private Integer physicalSize; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferCollection.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferCollection.java deleted file mode 100644 index afd6824ed1..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferCollection.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import org.alfresco.rest.core.RestModels; - -/** - * Handle collection of {@link TransferEntry} - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferCollection extends RestModels -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferEntry.java deleted file mode 100644 index 2570cef8e9..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferEntry.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import org.alfresco.rest.core.RestModels; -import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for transfer entry - * - * @author Silviu Dinuta - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferEntry extends RestModels -{ - @JsonProperty - private Transfer entry; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferProperties.java deleted file mode 100644 index e191db7df0..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfer/TransferProperties.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfer; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PDF_INDICATOR; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TRANSFER_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ACCESSION_INDICATOR; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.utility.model.TestModel; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for Transfer properties - * - * @author Dinuta Silviu - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty (PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; - - @JsonProperty (PROPERTIES_PDF_INDICATOR) - private Boolean pdfIndicator; - - @JsonProperty (PROPERTIES_TRANSFER_LOCATION) - private String transferLocation; - - @JsonProperty (PROPERTIES_ACCESSION_INDICATOR) - private Boolean accessionIndicator; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java deleted file mode 100644 index 32ef258c59..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainer.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfercontainer; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for Transfer Container - * - * @author Silviu Dinuta - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferContainer extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private TransferContainerProperties properties; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private List allowableOperations; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainerProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainerProperties.java deleted file mode 100644 index 459f5c5380..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/transfercontainer/TransferContainerProperties.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.transfercontainer; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_COUNT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; - -import org.alfresco.utility.model.TestModel; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for Transfer Container properties - * - * @author Dinuta Silviu - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class TransferContainerProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty (PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (PROPERTIES_COUNT) - private Integer count; - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainer.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainer.java deleted file mode 100644 index 3d07dc4b9b..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainer.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import java.util.List; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.utility.model.TestModel; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for unfiled container - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class UnfiledContainer extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private UnfiledContainerProperties properties; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChild.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChild.java deleted file mode 100644 index 3368be324f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChild.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import java.util.List; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.rest.rm.community.model.record.RecordContent; -import org.alfresco.utility.model.TestModel; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record category child - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class UnfiledContainerChild extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private Boolean isUnfiledRecordFolder; - - @JsonProperty (required = true) - private Boolean isRecord; - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private UnfiledContainerChildProperties properties; - - @JsonProperty - private List aspectNames; - - @JsonProperty - private Boolean isClosed; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; - - @JsonProperty - private String relativePath; - - @JsonProperty - private RecordContent content; - - @JsonProperty - private Boolean isCompleted; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildCollection.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildCollection.java deleted file mode 100644 index 8cc78989d2..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildCollection.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import org.alfresco.rest.core.RestModels; - -/** - * Handle collection of {@link UnfiledContainerChildEntry} - * - * @author Kristijan Conkas - * @author Tuna Aksoy - * @since 2.6 - */ -public class UnfiledContainerChildCollection extends RestModels -{ - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildEntry.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildEntry.java deleted file mode 100644 index 63b5be89a8..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildEntry.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.core.RestModels; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * POJO for record category child entry - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class UnfiledContainerChildEntry extends RestModels -{ - @JsonProperty - private UnfiledContainerChild entry; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java deleted file mode 100644 index 7f6fb0124e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerChildProperties.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_BOX; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DATE_TIME_ORIGINAL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_EXPOSURE_TIME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FILE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FLASH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_FOCAL_LENGTH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_F_NUMBER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ISO_SPEED_RATINGS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MANUFACTURER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_MODEL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_NUMBER_OF_COPIES; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIENTATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ORIGINAL_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PHYSICAL_SIZE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_X_DIMENSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_PIXEL_Y_DIMENSION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RMV_VERSIONED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_STORAGE_LOCATION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSIONED_NODEREF; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_LABEL; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VERSION_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_X_RESOLUTION; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_Y_RESOLUTION; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.rm.community.model.common.Owner; -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for record category child properties - * - * @author Tuna Aksoy - * @author Ana Bozianu - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class UnfiledContainerChildProperties extends TestModel -{ - /**************************************************************************/ - /** Mandatory parameters - Shared by unfiled record folder and records */ - /**************************************************************************/ - @JsonProperty (required = true, value = PROPERTIES_TITLE) - private String title; - - @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; - - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_DESCRIPTION) - private String description; - - @JsonProperty (value = PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE) - private Boolean recordSearchHasDispositionSchedule; - - /*********************************/ - /** Electronic record parameters */ - /*********************************/ - @JsonProperty (PROPERTIES_VERSION_TYPE) - private String versionType; - - @JsonProperty (PROPERTIES_VERSION_LABEL) - private String versionLabel; - - @JsonProperty(PROPERTIES_VERSIONED_NODEREF) - private String versionedNodeRef; - - @JsonProperty (PROPERTIES_RMV_VERSIONED) - private String recordVersionLabel; - - @JsonProperty (PROPERTIES_DATE_TIME_ORIGINAL) - private String dateTimeOriginal; - - @JsonProperty (PROPERTIES_EXPOSURE_TIME) - private Double exposureTime; - - @JsonProperty (PROPERTIES_FLASH) - private Boolean flash; - - @JsonProperty (PROPERTIES_F_NUMBER) - private Double fNumber; - - @JsonProperty (PROPERTIES_FOCAL_LENGTH) - private Double focalLength; - - @JsonProperty (PROPERTIES_ISO_SPEED_RATINGS) - private Integer isoSpeedRatings; - - @JsonProperty (PROPERTIES_MANUFACTURER) - private String manufacturer; - - @JsonProperty (PROPERTIES_MODEL) - private String model; - - @JsonProperty (PROPERTIES_ORIENTATION) - private Integer orientation; - - @JsonProperty (PROPERTIES_PIXEL_X_DIMENSION) - private Integer pixelXDimension; - - @JsonProperty (PROPERTIES_PIXEL_Y_DIMENSION) - private Integer pixelYDimension; - - @JsonProperty (PROPERTIES_RESOLUTION_UNIT) - private String resolutionUnit; - - @JsonProperty (PROPERTIES_SOFTWARE) - private String software; - - @JsonProperty (PROPERTIES_X_RESOLUTION) - private Double xResolution; - - @JsonProperty (PROPERTIES_Y_RESOLUTION) - private Double yResolution; - - @JsonProperty (PROPERTIES_ORIGINAL_NAME) - private String originalName; - - /*************************************/ - /** Non-electronic record parameters */ - /*************************************/ - - @JsonProperty (PROPERTIES_SHELF) - private String shelf; - - @JsonProperty (PROPERTIES_STORAGE_LOCATION) - private String storageLocation; - - @JsonProperty (PROPERTIES_FILE) - private String file; - - @JsonProperty (PROPERTIES_BOX) - private String box; - - @JsonProperty (PROPERTIES_NUMBER_OF_COPIES) - private Integer numberOfCopies; - - @JsonProperty (PROPERTIES_PHYSICAL_SIZE) - private Integer physicalSize; - - @JsonProperty (PROPERTIES_OWNER) - private Owner owner; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java deleted file mode 100644 index ca836b8365..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledContainerProperties.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IDENTIFIER; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.utility.model.TestModel; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for file plan properties - * - * @author Tuna Aksoy - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties (ignoreUnknown = true) -public class UnfiledContainerProperties extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true, value = PROPERTIES_IDENTIFIER) - private String identifier; - - @JsonProperty (required = true, value = PROPERTIES_ROOT_NODE_REF) - private String rootNodeRef; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledRecordFolder.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledRecordFolder.java deleted file mode 100644 index e6157bf4dd..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/unfiledcontainer/UnfiledRecordFolder.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.unfiledcontainer; - -import java.util.List; - -import org.alfresco.rest.model.RestByUserModel; -import org.alfresco.rest.rm.community.model.common.Path; -import org.alfresco.rest.rm.community.model.record.RecordContent; -import org.alfresco.utility.model.TestModel; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -/** - * POJO for unfiled container - * - * @author Ramona Popa - * @since 2.6 - */ -@Builder -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -public class UnfiledRecordFolder extends TestModel -{ - /*************************/ - /** Mandatory parameters */ - /*************************/ - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private RestByUserModel createdByUser; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private RestByUserModel modifiedByUser; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private String parentId; - - /************************/ - /** Optional parameters */ - /************************/ - @JsonProperty - private UnfiledContainerChildProperties properties; - - @JsonProperty - private List aspectNames; - - @JsonProperty - private Boolean hasRetentionSchedule; - - @JsonProperty - private Boolean isClosed; - - @JsonProperty - private List allowableOperations; - - @JsonProperty - private Path path; - - @JsonProperty - private String relativePath; - - @JsonProperty - private RecordContent content; - - @JsonProperty - private Boolean isCompleted; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserCapabilities.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserCapabilities.java deleted file mode 100644 index e3adedfb9c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserCapabilities.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.user; - -/** - * Constants for RM user capabilities - * - * @author Rodica Sutu - * @since 2.7 - */ -public class UserCapabilities -{ - - /** The id of the view records capability. */ - public static final String VIEW_RECORDS_CAP = "ViewRecords"; - /** The id of the declare records capability. */ - public static final String DECLARE_RECORDS_CAP = "DeclareRecords"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java deleted file mode 100644 index 02515a1b94..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserPermissions.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.user; - -/** - * Constants for RM user capabilities - * - * @author Kristijan Conkas - * @since 2.6 - */ -public enum UserPermissions -{ - PERMISSION_FILING("Filing"), - PERMISSION_READ_RECORDS("ReadRecords"), - PERMISSION_FILE_RECORDS("FileRecords"); - - public final String permissionId; - - UserPermissions(String permissionId) - { - this.permissionId = permissionId; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserRoles.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserRoles.java deleted file mode 100644 index c729db204c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/user/UserRoles.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.model.user; - -/** - * Constants for RM user roles - * - * @author Kristijan Conkas - * @since 2.6 - */ -public enum UserRoles -{ - IN_PLACE_WRITERS("ExtendedWriters", "In-Place Writers"), - ROLE_RM_ADMIN("Administrator", "Records Management Administrator"), - ROLE_RM_MANAGER("RecordsManager", "Records Management Manager"), - ROLE_RM_POWER_USER("PowerUser", "Records Management Power User"), - ROLE_RM_SECURITY_OFFICER("SecurityOfficer", "Records Management Security Officer"), - ROLE_RM_USER("User", "Records Management User"); - - public final String roleId; - public final String displayName; - - UserRoles(String roleId, String displayName) - { - this.roleId = roleId; - this.displayName = displayName; - } - - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java deleted file mode 100644 index 3caded7fa4..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests; - -import static lombok.AccessLevel.PRIVATE; -import static lombok.AccessLevel.PROTECTED; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.requests.ModelRequest; - -import lombok.Getter; -import lombok.Setter; - -/** - * Extends {@link ModelRequest} to set {@link RMRestWrapper} - * - * @author Tuna Aksoy - * @since 2.6 - */ -public abstract class RMModelRequest extends ModelRequest -{ - @Getter (value = PROTECTED) - @Setter (value = PRIVATE) - private RMRestWrapper rmRestWrapper; - - /** - * @param rmRestWrapper - */ - public RMModelRequest(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper.getRestWrapper()); - setRmRestWrapper(rmRestWrapper); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java deleted file mode 100644 index e7f91fe725..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/GSCoreAPI.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore; - -import static java.lang.Integer.parseInt; -import static java.lang.String.format; - -import io.restassured.RestAssured; - -import org.alfresco.rest.core.RMRestProperties; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.requests.gscore.api.ActionsExecutionAPI; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RMUserAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.TransferAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.TransferContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; - -/** - * Defines the entire GS Core API - * {@link http://host:port/gs-api-explorer} select "GS Core API" - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class GSCoreAPI extends RMModelRequest -{ - /** - * Constructor - * - * @param rmRestWrapper RM REST Wrapper - * @param rmRestProperties RM REST Properties - */ - public GSCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties) - { - super(rmRestWrapper); - RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer()); - RestAssured.port = parseInt(rmRestProperties.getPort()); - RestAssured.basePath = rmRestProperties.getRestRmPath(); - restWrapper.configureRequestSpec().setBasePath(RestAssured.basePath); - } - - /** - * Provides DSL on all REST calls under ig-sites/rm/... API path - * - * @return {@link RMSiteAPI} - */ - public RMSiteAPI usingRMSite() - { - return new RMSiteAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under file-plans/... API path - * - * @return {@link FilePlanAPI} - */ - public FilePlanAPI usingFilePlans() - { - return new FilePlanAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under record-categories/... API path - * - * @return {@link RecordCategoryAPI} - */ - public RecordCategoryAPI usingRecordCategory() - { - return new RecordCategoryAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under record-folders/... API path - * - * @return {@link RecordFolderAPI} - */ - public RecordFolderAPI usingRecordFolder() - { - return new RecordFolderAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under records/... API path - * - * @return {@link RecordsAPI} - */ - public RecordsAPI usingRecords() - { - return new RecordsAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under files/... API path - * - * @return {@link FilesAPI} - */ - public FilesAPI usingFiles() - { - return new FilesAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under transfer-containers/... API path - * - * @return {@link TransferContainerAPI} - */ - public TransferContainerAPI usingTransferContainer() - { - return new TransferContainerAPI(getRmRestWrapper()); - } - - /** - * Provides DSL on all REST calls under transfers/... API path - * - * @return {@link TransferAPI} - */ - public TransferAPI usingTransfer() - { - return new TransferAPI(getRmRestWrapper()); - } - - /** - * Provides DSL for RM unfiled container API - * - * @return {@link UnfiledContainerAPI} - */ - public UnfiledContainerAPI usingUnfiledContainers() - { - return new UnfiledContainerAPI(getRmRestWrapper()); - } - - /** - * Provides DSL for RM unfiled record folders API - * - * @return {@link UnfiledRecordFolderAPI} - */ - public UnfiledRecordFolderAPI usingUnfiledRecordFolder() - { - return new UnfiledRecordFolderAPI(getRmRestWrapper()); - } - - /** - * Provides DSL for RM user management API - * - * @return {@link RMUserAPI} - */ - public RMUserAPI usingRMUser() - { - return new RMUserAPI(getRmRestWrapper()); - } - - /** - * Provides DSL for ActionExecution API - * - * @return {@link ActionsExecutionAPI} - */ - public ActionsExecutionAPI usingActionsExecutionsAPI() - { - return new ActionsExecutionAPI(getRmRestWrapper()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java deleted file mode 100644 index 1f8513de27..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import com.google.common.collect.ImmutableMap; - -import lombok.SneakyThrows; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.rules.ActionsOnRule; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.utility.model.RepoTestModel; -import org.json.JSONObject; - -/** - * Produces processed results from Core Actions API calls - * - * @author Claudia Agache - * @since 3.1 - */ -public class ActionsExecutionAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public ActionsExecutionAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Declares and files a document as record to a record folder using v1 actions api - * - * @param targetNode the node on which the action is executed - * @param destinationPath the path to the record folder - * @throws Exception - */ - public JSONObject declareAndFile(RepoTestModel targetNode, String destinationPath) throws Exception - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode, - ImmutableMap.of("path", destinationPath)); - } - - /** - * Declares a document as record using v1 actions api - * - * @param targetNode the node on which the action is executed - * @throws Exception - */ - public JSONObject declareAsRecord(RepoTestModel targetNode) throws Exception - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode); - } - - - /** - * Declares and file a document version as record to a record folder using v1 actions api - * - * @param targetNode the node on which the action is executed - * @param destinationPath the path to the record folder - * @throws Exception - */ - public JSONObject declareAndFileVersionAsRecord(RepoTestModel targetNode, String destinationPath) throws Exception - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.DECLARE_VERSION_AS_RECORD.getActionValue(), targetNode, - ImmutableMap.of("path", destinationPath)); - } - - /** - * Declares a document version as record using v1 actions api - * - * @param targetNode the node on which the action is executed - * @throws Exception - */ - public JSONObject declareVersionAsRecord(RepoTestModel targetNode) throws Exception - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.DECLARE_VERSION_AS_RECORD.getActionValue(), targetNode); - } - - /** - * Add WORM lock to a node using v1 actions api - * - * @param targetNode the node on which the action is executed - * @throws Exception - */ - @SneakyThrows - public JSONObject addWORMLock(RepoTestModel targetNode) - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.WORM_LOCK.getActionValue(), targetNode); - } - - /** - * WORM lock a node for a period of days - * - * @param targetNode the node on which the action is executed - * @param retentionPeriod the retention period in days for the WORM lock - * @throws Exception - */ - @SneakyThrows - public JSONObject addWORMLock(RepoTestModel targetNode, int retentionPeriod) - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.WORM_LOCK.getActionValue(), targetNode, - ImmutableMap.of("retentionPeriod", String.valueOf(retentionPeriod))); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java deleted file mode 100644 index ce882ff99a..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilePlanAPI.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.fileplan.FilePlan; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -/** - * File plan REST API Wrapper - * - * @author Ramona Popa - * @author Tuna Aksoy - * @since 2.6 - */ -public class FilePlanAPI extends RMModelRequest -{ - /** - * Constructor. - * - * @param rmRestWrapper RM REST Wrapper - */ - public FilePlanAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * see {@link #getFilePlan(String, String)} - */ - public FilePlan getFilePlan(String filePlanId) - { - mandatoryString("filePlanId", filePlanId); - - return getFilePlan(filePlanId, EMPTY); - } - - /** - * Gets a file plan. - * - * @param filePlanId The identifier of a file plan - * @param parameters The URL parameters to add - * @return The {@link FilePlan} for the given {@code filePlanId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code filePlanId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code filePlanId}
  • - *
  • {@code filePlanId} does not exist
  • - *
- */ - public FilePlan getFilePlan(String filePlanId, String parameters) - { - mandatoryString("filePlanId", filePlanId); - - return getRmRestWrapper().processModel(FilePlan.class, simpleRequest( - GET, - "/file-plans/{filePlanId}?{parameters}", - filePlanId, - parameters - )); - } - - /** - * see {@link #getRootRecordCategories(String, String)} - */ - public RecordCategoryCollection getRootRecordCategories(String filePlanId) - { - mandatoryString("filePlanId", filePlanId); - - return getRootRecordCategories(filePlanId, EMPTY); - } - - /** - * Gets the children (root categories) of a file plan. - * - * @param filePlanId The identifier of a file plan - * @param parameters The URL parameters to add - * @return The {@link RecordCategoryCollection} for the given {@code filePlanId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code filePlanId}
  • - *
  • {@code filePlanId} does not exist
  • - *
- */ - public RecordCategoryCollection getRootRecordCategories(String filePlanId, String parameters) - { - mandatoryString("filePlanId", filePlanId); - - return getRmRestWrapper().processModels(RecordCategoryCollection.class, simpleRequest( - GET, - "file-plans/{filePlanId}/categories?{parameters}", - filePlanId, - parameters - )); - } - - /** - * see {@link #createRootRecordCategory(RecordCategory, String, String)} - */ - public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId) - { - mandatoryObject("recordCategoryModel", recordCategoryModel); - mandatoryString("filePlanId", filePlanId); - - return createRootRecordCategory(recordCategoryModel, filePlanId, EMPTY); - } - - /** - * Creates a root record category. - * - * @param recordCategoryModel The record category model which holds the information - * @param filePlanId The identifier of a file plan - * @param parameters The URL parameters to add - * @return The created {@link RecordCategory} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code filePlanId} is not a valid format or {@code filePlanId} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to add children to {@code filePlanId}
  • - *
  • {@code filePlanIds} does not exist
  • - *
  • new name clashes with an existing node in the current parent container
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public RecordCategory createRootRecordCategory(RecordCategory recordCategoryModel, String filePlanId, String parameters) - { - mandatoryObject("recordCategoryModel", recordCategoryModel); - mandatoryString("filePlanId", filePlanId); - - return getRmRestWrapper().processModel(RecordCategory.class, requestWithBody( - POST, - toJson(recordCategoryModel), - "file-plans/{filePlanId}/categories?{parameters}", - filePlanId, - parameters - )); - } - - /** - * see {@link #updateFilePlan(FilePlan, String, String) - */ - public FilePlan updateFilePlan(FilePlan filePlanModel, String filePlanId) - { - mandatoryObject("filePlanModel", filePlanModel); - mandatoryString("filePlanId", filePlanId); - - return updateFilePlan(filePlanModel, filePlanId, EMPTY); - } - - /** - * Updates a file plan. - * - * @param filePlanModel The file plan model which holds the information - * @param filePlanId The identifier of the file plan - * @param parameters The URL parameters to add - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code filePlanId} is not a valid format or {@code filePlanModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code filePlanId}
  • - *
  • {@code filePlanId} does not exist
  • - *
  • model integrity exception, including file name with invalid characters
  • - *
- */ - public FilePlan updateFilePlan(FilePlan filePlanModel, String filePlanId, String parameters) - { - mandatoryObject("filePlanModel", filePlanModel); - mandatoryString("filePlanId", filePlanId); - - return getRmRestWrapper().processModel(FilePlan.class, requestWithBody( - PUT, - toJson(filePlanModel), - "file-plans/{filePlanId}?{parameters}", - filePlanId, - parameters)); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java deleted file mode 100644 index 816d507295..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.springframework.http.HttpMethod.POST; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -/** - * Files REST API Wrapper - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class FilesAPI extends RMModelRequest -{ - public static final String PARENT_ID_PARAM = "parentId"; - - /** - * @param rmRestWrapper RM REST Wrapper - */ - public FilesAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Declare file as record - * - * @param fileId The Id of a file to declare as record - * @return The {@link Record} for created record - * @throws RuntimeException for malformed JSON responses - */ - public Record declareAsRecord(String fileId) - { - mandatoryString("fileId", fileId); - - return getRmRestWrapper().processModel(Record.class, simpleRequest( - POST, - "/files/{fileId}/declare?{parameters}", - fileId, - getRmRestWrapper().getParameters() - )); - } -} - diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMSiteAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMSiteAPI.java deleted file mode 100644 index 383a93cfde..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMSiteAPI.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.springframework.http.HttpMethod.DELETE; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; -import static org.springframework.http.HttpStatus.OK; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.site.RMSite; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -/** - * RM Site REST API Wrapper - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class RMSiteAPI extends RMModelRequest -{ - /** - * Constructor - * - * @param rmRestWrapper RM REST Wrapper - */ - public RMSiteAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Get the RM site - * - * @return The {@link RMSite} for the given file plan component id - * @throws RuntimeException for the following cases: - *
    - *
  • Api Response code 400 Invalid parameter: GET request is supported only for the RM site
  • - *
  • Api Response code 401 If authentication failed
  • - *
  • Api Response code 409 If RM Site does not exist
  • - *
  • Api Response code default Unexpected error
  • - *
- */ - public RMSite getSite() - { - return getRmRestWrapper().processModel(RMSite.class, simpleRequest( - GET, - "gs-sites/rm" - )); - } - - /** - * Create the RM site - * - * @param rmSiteModel The properties of the rm site to be created - * @return The {@link RMSite} with the given properties - * @throws RuntimeException for the following cases: - *
    - *
  • Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid
  • - *
  • Api Response code 401 If authentication failedApi Response code 409 RM Site already exists
  • - *
  • Api Response code default Unexpected error
  • - *
- */ - public RMSite createRMSite(RMSite rmSiteModel) - { - mandatoryObject("rmSiteModel", rmSiteModel); - - return getRmRestWrapper().processModel(RMSite.class, requestWithBody( - POST, - toJson(rmSiteModel), - "gs-sites" - )); - } - - /** - * Delete RM site - * @throws RuntimeException for the following cases: - *
    - *
  • Api Response code 400 Invalid parameter: DELETE request is supported only for the RM site
  • - *
  • Api Response code 401 If authentication failedApi Response code 403 Current user does not have permission to delete the site that is visible to them.
  • - *
  • Api Response code 404 RM site does not exist
  • - *
  • Api Response code default Unexpected error
  • - *
- */ - public void deleteRMSite() - { - getRmRestWrapper().processEmptyModel(simpleRequest( - DELETE, - "gs-sites/rm" - )); - } - - /** - * Update RM site - * - * @param rmSiteModel The properties to be updated - * @return The updated {@link RMSite} - * @throws RuntimeException for the following cases: - *
    - *
  • Api Response code 400 the update request is invalid {@code rmSiteModel} is invalid
  • - *
  • Api Response code 401 If authentication fails
  • - *
  • Api Response code 403 does not have permission to update {@code RMSite}
  • - *
  • Api Response code 404 {@code RMSiteModel} does not exist
  • - *
  • Api Response code default Unexpected error,model integrity exception
  • - *
- */ - public RMSite updateRMSite(RMSite rmSiteModel) - { - mandatoryObject("rmSiteProperties", rmSiteModel); - - return getRmRestWrapper().processModel(RMSite.class, requestWithBody( - PUT, - toJson(rmSiteModel), - "gs-sites/rm" - )); - } - - /** - * Checks if the RM site exists or not - * - * @return true if the RM site exists, false otherwise - * @throws RuntimeException for the following cases: - *
    - *
  • Api Response code 400 Invalid parameter: GET request is supported only for the RM site
  • - *
  • Api Response code 401 If authentication failed
  • - *
  • Api Response code 409 If RM Site does not exist
  • - *
  • Api Response code default Unexpected error
  • - *
- */ - public boolean existsRMSite() - { - getSite(); - return getRmRestWrapper().getStatusCode().equals(String.valueOf(OK.value())); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java deleted file mode 100644 index d1c3500f10..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RMUserAPI.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.jglue.fluentjson.JsonBuilderFactory.buildObject; -import static org.springframework.http.HttpStatus.OK; - -import com.google.gson.JsonObject; - -import io.restassured.builder.RequestSpecBuilder; -import io.restassured.http.ContentType; -import io.restassured.response.Response; -import io.restassured.specification.RequestSpecification; -import static io.restassured.RestAssured.basic; -import static io.restassured.RestAssured.given; - -import org.alfresco.dataprep.AlfrescoHttpClient; -import org.alfresco.dataprep.AlfrescoHttpClientFactory; -import org.alfresco.rest.core.RMRestProperties; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.utility.model.UserModel; - -/** - * RM user management API - * - * @author Kristijan Conkas - * @since 2.6 - */ -// FIXME: As of December 2016 there is no v1-style API for managing RM users and users' -// roles/permissions. Until such APIs have become available, methods in this class are just proxies to -// "old-style" API calls. -public class RMUserAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public RMUserAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Helper method to obtain {@link AlfrescoHttpClient} - * @return Initialized {@link AlfrescoHttpClient} instance - */ - private AlfrescoHttpClient getAlfrescoHttpClient() - { - RMRestProperties properties = getRmRestWrapper().getRmRestProperties(); - - AlfrescoHttpClientFactory factory = new AlfrescoHttpClientFactory(); - factory.setHost(properties.getServer()); - factory.setPort(Integer.parseInt(properties.getPort())); - factory.setScheme(properties.getScheme()); - - return factory.getObject(); - } - - /** - * Assign RM role to user - * - * @param userName User's username - * @param userRole User's RM role, one of {@link UserRoles} roles - * @throws RuntimeException for failed requests - */ - public void assignRoleToUser(String userName, String userRole) - { - UserModel adminUser = getRmRestWrapper().getTestUser(); - - // get an "old-style" REST API client - AlfrescoHttpClient client = getAlfrescoHttpClient(); - - // override v1 baseURI and basePath - RequestSpecification spec = new RequestSpecBuilder() - .setBaseUri(client.getApiUrl()) - .setBasePath("/") - .build(); - - Response response = given() - .spec(spec) - .log().all() - .pathParam("role", userRole) - .pathParam("authority", userName) - .param("alf_ticket", client.getAlfTicket(adminUser.getUsername(), - adminUser.getPassword())) - .when() - .post("/rm/roles/{role}/authorities/{authority}") - .prettyPeek() - .andReturn(); - getRmRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); - } - - /** - * Helper method to add permission on a component to user - * @param filePlanComponentId The id of the file plan component on which permission should be given - * @param user {@link UserModel} for a user to be granted permission - * @param permission {@link UserPermissions} to be granted - */ - public void addUserPermission(String filePlanComponentId, UserModel user, UserPermissions permission) - { - UserModel adminUser = getRmRestWrapper().getTestUser(); - - // get an "old-style" REST API client - AlfrescoHttpClient client = getAlfrescoHttpClient(); - - JsonObject bodyJson = buildObject() - .addArray("permissions") - .addObject() - .add("authority", user.getUsername()) - .add("role", permission.permissionId) - .end() - .getJson(); - - // override v1 baseURI and basePath - RequestSpecification spec = new RequestSpecBuilder() - .setBaseUri(client.getApiUrl()) - .setBasePath("/") - .build(); - - // execute an "old-style" API call - Response response = given() - .spec(spec) - .auth().basic(adminUser.getUsername(), adminUser.getPassword()) - .contentType(ContentType.JSON) - .body(bodyJson.toString()) - .pathParam("nodeId", filePlanComponentId) - .log().all() - .when() - .post("/node/workspace/SpacesStore/{nodeId}/rmpermissions") - .prettyPeek() - .andReturn(); - getRmRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); - } - - /** - * Helper method to set permission inheritance on a file plan component - * - * @param filePlanComponentId The id of the file plan component on which inherited permission should be set - * @param isInherited true if the permission is inherited - * false if the permission inheritance is disabled - */ - public void setUserPermissionInheritance(String filePlanComponentId, Boolean isInherited) - { - final UserModel adminUser = getRmRestWrapper().getTestUser(); - - // get an "old-style" REST API client - final AlfrescoHttpClient client = getAlfrescoHttpClient(); - - final JsonObject bodyJson = buildObject() - .addArray("permissions") - .end() - .add("isInherited", isInherited) - .getJson(); - - // override v1 baseURI and basePath - RequestSpecification spec = new RequestSpecBuilder() - .setBaseUri(client.getApiUrl()) - .setBasePath("/") - .build(); - - // execute an "old-style" API call - final Response response = given() - .spec(spec) - .auth().basic(adminUser.getUsername(), adminUser.getPassword()) - .contentType(ContentType.JSON) - .body(bodyJson.toString()) - .pathParam("nodeId", filePlanComponentId) - .log().all() - .when() - .post("/node/workspace/SpacesStore/{nodeId}/rmpermissions") - .prettyPeek() - .andReturn(); - getRmRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); - } - - - /** - * Creates a user with the given name using the old APIs - * - * @param userName The user name - * @param userPassword The user's password - * @param userEmail The user's e-mail address - * @return true if the user was created successfully, false otherwise. - */ - public boolean createUser(String userName, String userPassword, String userEmail) - { - UserModel adminUser = getRmRestWrapper().getTestUser(); - final AlfrescoHttpClient client = getAlfrescoHttpClient(); - - JsonObject body = buildObject() - .add("userName", userName) - .add("firstName", userName) - .add("lastName", userName) - .add("password", userPassword) - .add("email", userEmail) - .getJson(); - - final RequestSpecification spec = new RequestSpecBuilder() - .setBaseUri(client.getApiUrl()) - .setBasePath("/") - .setAuth(basic(adminUser.getUsername(), adminUser.getPassword())) - .setContentType(ContentType.JSON) - .setBody(body.toString()) - .build(); - - // create POST request to "people" endpoint - Response response = given() - .spec(spec) - .log().all() - .when() - .post("people") - .prettyPeek() - .andReturn(); - - return (response.getStatusCode() == OK.value()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java deleted file mode 100644 index bb776ea799..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordCategoryAPI.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.DELETE; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildCollection; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -/** - * Record category REST API Wrapper - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordCategoryAPI extends RMModelRequest -{ - /** - * Constructor. - * - * @param rmRestWrapper RM REST Wrapper - */ - public RecordCategoryAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Deletes a record category. - * - * @param recordCategoryId The identifier of a record category - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordCategoryId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to delete {@code recordCategoryId}
  • - *
  • {@code recordCategoryId} does not exist
  • - *
  • {@code recordCategoryId} is locked and cannot be deleted
  • - *
- */ - public void deleteRecordCategory(String recordCategoryId) - { - mandatoryString("recordCategoryId", recordCategoryId); - - getRmRestWrapper().processEmptyModel(simpleRequest( - DELETE, - "record-categories/{recordCategoryId}", - recordCategoryId - )); - } - - /** - * see {@link #getRecordCategory(String, String)} - */ - public RecordCategory getRecordCategory(String recordCategoryId) - { - mandatoryString("recordCategoryId", recordCategoryId); - - return getRecordCategory(recordCategoryId, EMPTY); - } - - /** - * Gets a record category. - * - * @param recordCategoryId The identifier of a record category - * @param parameters The URL parameters to add - * @return The {@link RecordCategory} for the given {@code recordCategoryId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordCategoryId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code recordCategoryId}
  • - *
  • {@code recordCategoryId} does not exist
  • - *
- */ - public RecordCategory getRecordCategory(String recordCategoryId, String parameters) - { - mandatoryString("recordCategoryId", recordCategoryId); - - return getRmRestWrapper().processModel(RecordCategory.class, simpleRequest( - GET, - "record-categories/{recordCategoryId}?{parameters}", - recordCategoryId, - parameters - )); - } - - /** - * see {@link #updateRecordCategory(RecordCategory, String, String) - */ - public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId) - { - mandatoryObject("recordCategoryModel", recordCategoryModel); - mandatoryString("recordCategoryId", recordCategoryId); - - return updateRecordCategory(recordCategoryModel, recordCategoryId, EMPTY); - } - - /** - * Updates a record category. - * - * @param recordCategoryModel The record category model which holds the information - * @param recordCategoryId The identifier of a record category - * @param parameters The URL parameters to add - * @param returns The updated {@link RecordCategory} - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code recordCategoryId} is not a valid format or {@code recordCategoryModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code recordCategoryId}
  • - *
  • {@code recordCategoryId} does not exist
  • - *
  • the updated name clashes with an existing record category in the current parent category
  • - *
  • model integrity exception, including file name with invalid characters
  • - *
- */ - public RecordCategory updateRecordCategory(RecordCategory recordCategoryModel, String recordCategoryId, String parameters) - { - mandatoryObject("recordCategoryModel", recordCategoryModel); - mandatoryString("recordCategoryId", recordCategoryId); - - return getRmRestWrapper().processModel(RecordCategory.class, requestWithBody( - PUT, - toJson(recordCategoryModel), - "record-categories/{recordCategoryId}?{parameters}", - recordCategoryId, - parameters - )); - } - - /** - * see {@link #getRecordCategoryChildren(String, String)} - */ - public RecordCategoryChildCollection getRecordCategoryChildren(String recordCategoryId) - { - mandatoryString("recordCategoryId", recordCategoryId); - - return getRecordCategoryChildren(recordCategoryId, EMPTY); - } - - /** - * Gets the children of a record category. - * - * @param recordCategoryId The identifier of a record category - * @param parameters The URL parameters to add - * @return The {@link RecordCategoryChildCollection} for the given {@code recordCategoryId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code recordCategoryId}
  • - *
  • {@code recordCategoryId} does not exist
  • - *
- */ - public RecordCategoryChildCollection getRecordCategoryChildren(String recordCategoryId, String parameters) - { - mandatoryString("recordCategoryId", recordCategoryId); - - return getRmRestWrapper().processModels(RecordCategoryChildCollection.class, simpleRequest( - GET, - "record-categories/{recordCategoryId}/children?{parameters}", - recordCategoryId, - parameters - )); - } - - /** - * see {@link #createRecordCategoryChild(RecordCategoryChild, String, String)} - */ - public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId) - { - mandatoryObject("recordCategoryChildModel", recordCategoryChildModel); - mandatoryString("recordCategoryId", recordCategoryId); - - return createRecordCategoryChild(recordCategoryChildModel, recordCategoryId, EMPTY); - } - - /** - * Creates a record category child. Can be a record category or a record folder. - * - * @param recordCategoryChildModel The record category child model which holds the information - * @param recordCategoryId The identifier of a record category - * @param parameters The URL parameters to add - * @return The created {@link RecordCategoryChild} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordCategoryId} is not a valid format or {@code recordCategoryChildModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to add children to {@code recordCategoryId}
  • - *
  • {@code recordCategoryId} does not exist
  • - *
  • new name clashes with an existing node in the current parent container
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public RecordCategoryChild createRecordCategoryChild(RecordCategoryChild recordCategoryChildModel, String recordCategoryId, String parameters) - { - mandatoryObject("filePlanComponentProperties", recordCategoryChildModel); - mandatoryString("recordCategoryId", recordCategoryId); - - return getRmRestWrapper().processModel(RecordCategoryChild.class, requestWithBody( - POST, - toJson(recordCategoryChildModel), - "record-categories/{recordCategoryId}/children?{parameters}", - recordCategoryId, - parameters - )); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java deleted file mode 100644 index df2148c710..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordFolderAPI.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.DELETE; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; -import static org.testng.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import io.restassured.builder.RequestSpecBuilder; -import io.restassured.http.ContentType; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderCollection; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.util.FilePlanComponentMixIn; - -/** - * Record folder REST API Wrapper - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordFolderAPI extends RMModelRequest -{ - /** - * Constructor. - * - * @param rmRestWrapper RM REST Wrapper - */ - public RecordFolderAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Deletes a record folder. - * - * @param recordFolderId The identifier of a record folder - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordFolderId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to delete {@code recordFolderId}
  • - *
  • {@code recordFolderId} does not exist
  • - *
  • {@code recordFolderId} is locked and cannot be deleted
  • - *
- */ - public void deleteRecordFolder(String recordFolderId) - { - mandatoryString("recordFolderId", recordFolderId); - - getRmRestWrapper().processEmptyModel(simpleRequest( - DELETE, - "record-folders/{recordFolderId}", - recordFolderId - )); - } - - /** - * see {@link #getRecordFolder(String, String)} - */ - public RecordFolder getRecordFolder(String recordFolderId) - { - mandatoryString("recordFolderId", recordFolderId); - - return getRecordFolder(recordFolderId, EMPTY); - } - - /** - * Gets a record folder. - * - * @param recordFolderId The identifier of a record folder - * @param parameters The URL parameters to add - * @return The {@link RecordFolder} for the given {@code recordFolderId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordFolderId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code recordFolderId}
  • - *
  • {@code recordFolderId} does not exist
  • - *
- */ - public RecordFolder getRecordFolder(String recordFolderId, String parameters) - { - mandatoryString("recordFolderId", recordFolderId); - - return getRmRestWrapper().processModel(RecordFolder.class, simpleRequest( - GET, - "record-folders/{recordFolderId}?{parameters}", - recordFolderId, - parameters - )); - } - - /** - * see {@link #updateRecordFolder(RecordFolder, String, String) - */ - public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId) - { - mandatoryObject("recordFolderModel", recordFolderModel); - mandatoryString("recordFolderId", recordFolderId); - - return updateRecordFolder(recordFolderModel, recordFolderId, EMPTY); - } - - /** - * Updates a record folder. - * - * @param recordFolderModel The record folder model which holds the information - * @param recordFolderId The identifier of a record folder - * @param parameters The URL parameters to add - * @param returns The updated {@link RecordFolder} - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code recordFolderId} is not a valid format or {@code recordFolderModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code recordFolderId}
  • - *
  • {@code recordFolderId} does not exist
  • - *
  • the updated name clashes with an existing record folder in the current parent category
  • - *
  • model integrity exception, including file name with invalid characters
  • - *
- */ - public RecordFolder updateRecordFolder(RecordFolder recordFolderModel, String recordFolderId, String parameters) - { - mandatoryObject("recordFolderModel", recordFolderModel); - mandatoryString("recordFolderId", recordFolderId); - - return getRmRestWrapper().processModel(RecordFolder.class, requestWithBody( - PUT, - toJson(recordFolderModel), - "record-folders/{recordFolderId}?{parameters}", - recordFolderId, - parameters - )); - } - - /** - * see {@link #getRecordFolderChildren(String, String)} - */ - public RecordFolderCollection getRecordFolderChildren(String recordFolderId) - { - mandatoryString("recordFolderId", recordFolderId); - - return getRecordFolderChildren(recordFolderId, EMPTY); - } - - /** - * Gets the children of a record folder. - * - * @param recordFolderId The identifier of a record folder - * @param parameters The URL parameters to add - * @return The {@link RecordFolderCollection} for the given {@code recordFolderId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code recordFolderId}
  • - *
  • {@code recordFolderId} does not exist
  • - *
- */ - public RecordFolderCollection getRecordFolderChildren(String recordFolderId, String parameters) - { - mandatoryString("recordFolderId", recordFolderId); - - return getRmRestWrapper().processModels(RecordFolderCollection.class, simpleRequest( - GET, - "record-folders/{recordFolderId}/records?{parameters}", - recordFolderId, - parameters - )); - } - - /** - * see {@link #createRecord(Record, String, String)} - */ - public Record createRecord(Record recordModel, String recordFolderId) - { - mandatoryObject("recordModel", recordModel); - mandatoryString("recordFolderId", recordFolderId); - - return createRecord(recordModel, recordFolderId, EMPTY); - } - - /** - * Create a record from file resource - * - * @param recordModel {@link Record} for electronic record to be created - * @param recordContent {@link File} pointing to the content of the electronic record to be created - * @param recordFolderId The identifier of a record folder - * @return newly created {@link Record} - * @throws RuntimeException for invalid recordModel JSON strings - */ - public Record createRecord(Record recordModel, String recordFolderId, File recordContent) throws RuntimeException - { - mandatoryString("recordFolderId", recordFolderId); - mandatoryObject("recordContent", recordContent); - mandatoryObject("recordModel", recordModel); - - if (!recordModel.getNodeType().equals(CONTENT_TYPE)) - { - fail("Only electronic records are supported"); - } - - /* - * For file uploads nodeBodyCreate is ignored hence can't be used. Append all Record fields - * to the request. - */ - RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec(); - JsonNode root; - try - { - root = new ObjectMapper().readTree(toJson(recordModel, Record.class, FilePlanComponentMixIn.class)); - } - catch (IOException e) - { - throw new RuntimeException("Failed to convert model to JSON.", e); - } - // add request fields - Iterator fieldNames = root.fieldNames(); - while (fieldNames.hasNext()) - { - String fieldName = fieldNames.next(); - builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name()); - } - builder.addMultiPart("filedata", recordContent, ContentType.BINARY.name()); - - // create node with given content - return createRecord(recordModel, recordFolderId); - } - - /** - * Creates a record in a record folder child, i.e. a record. - * - * @param recordModel The record model which holds the information - * @param recordFolderId The identifier of a record folder - * @param parameters The URL parameters to add - * @return The created {@link Record} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordFolderId is not a valid format or {@code recordModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to add children to {@code recordFolderId}
  • - *
  • {@code recordFolderId} does not exist
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public Record createRecord(Record recordModel, String recordFolderId, String parameters) - { - mandatoryObject("recordModel", recordModel); - mandatoryString("recordFolderId", recordFolderId); - - return getRmRestWrapper().processModel(Record.class, requestWithBody( - POST, - toJson(recordModel), - "record-folders/{recordFolderId}/records?{parameters}", - recordFolderId, - parameters - )); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java deleted file mode 100644 index 2cb2982941..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/RecordsAPI.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.DELETE; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; - - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordBodyFile; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -import io.restassured.response.ResponseBody; - -/** - * Records REST API Wrapper - * - * @author Rodica Sutu - * @since 2.6 - */ -public class RecordsAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public RecordsAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * Get the content for the electronic record - * - * @param recordId The id of the electronic record - * @return {@link ResponseBody} representing content for the given record id - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordId} has no content
  • - *
  • {@code recordId} is not a valid format, or is not a record
  • - *
  • authentication fails
  • - *
  • {@code recordId} does not exist
  • - *
- */ - public ResponseBody getRecordContent(String recordId) - { - mandatoryString("recordId", recordId); - - return getRmRestWrapper() - .processHtmlResponse(simpleRequest(GET,"records/{recordId}/content", recordId)) - .getBody(); - - } - - /** - * File the record recordId into file plan structure based on the location sent via the request body - * - * @param recordBodyFile The properties where to file the record - * @param recordId The id of the record to file - * @return The {@link Record} with the given properties - * @throws RuntimeException for the following cases: - *
    - *
  • Invalid parameter: {@code recordBodyFile} is not a valid format,{@code recordId} is not a record
  • - *
  • authentication fails
  • - *
  • current user does not have permission to file to {@code fileplanComponentId}
  • - *
  • {@code recordId} does not exist
  • - *
  • targetParentId from recordBodyFile does not exist
  • - *
  • model integrity exception: the action breaks system's integrity restrictions
  • - *
- * - */ - public Record fileRecord(RecordBodyFile recordBodyFile, String recordId) - { - mandatoryObject("recordBodyFile", recordBodyFile); - mandatoryString("recordId", recordId); - - return fileRecord(recordBodyFile, recordId, EMPTY); - } - - /** - * File the record recordId into file plan structure based on the location sent via the request body - * - * @param recordBodyFile The properties where to file the record - * @param recordId The id of the record to file - * @return The {@link Record} with the given properties - * @throws RuntimeException for the following cases: - *
    - *
  • Invalid parameter: {@code recordBodyFile} is not a valid format,{@code recordId} is not a record
  • - *
  • authentication fails
  • - *
  • current user does not have permission to file to {@code fileplanComponentId}
  • - *
  • {@code recordId} does not exist
  • - *
  • targetParentId from recordBodyFile does not exist
  • - *
  • model integrity exception: the action breaks system's integrity restrictions
  • - *
- * - */ - public Record fileRecord(RecordBodyFile recordBodyFile, String recordId, String parameters) - { - mandatoryObject("requestBodyFile", recordBodyFile); - mandatoryString("recordId", recordId); - - return getRmRestWrapper().processModel(Record.class, requestWithBody( - POST, - toJson(recordBodyFile), - "/records/{recordId}/file?{parameters}", - recordId, - parameters - )); - } - - /** - * see {@link #completeRecord(String, String) - */ - public Record completeRecord(String recordId) - { - mandatoryString("recordId", recordId); - - return completeRecord(recordId, EMPTY); - } - - /** - * Complete the record recordId - * - * @param recordId The id of the record to complete - * @return The completed {@link Record} with the given properties - * @throws RuntimeException for the following cases: - *
    - *
  • Invalid parameter: {@code recordId} is not a record
  • - *
  • authentication fails
  • - *
  • current user does not have permission to complete {@code recordId}
  • - *
  • {@code recordId} does not exist or is frozen
  • - *
  • model integrity exception: the record is already completed
  • - *
  • model integrity exception: the record has missing meta-data
  • - *
- */ - public Record completeRecord(String recordId, String parameters) - { - mandatoryString("recordId", recordId); - - return getRmRestWrapper().processModel(Record.class, simpleRequest( - POST, - "/records/{recordId}/complete?{parameters}", - recordId, - parameters - )); - } - /** - * Deletes a record. - * - * @param recordId The identifier of a record - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to delete {@code recordId}
  • - *
  • {@code recordId} does not exist
  • - *
  • {@code recordId} is locked and cannot be deleted
  • - *
- */ - public void deleteRecord(String recordId) - { - mandatoryString("recordId", recordId); - - getRmRestWrapper().processEmptyModel(simpleRequest( - DELETE, - "records/{recordId}", - recordId - )); - } - - /** - * see {@link #getRecord(String, String)} - */ - public Record getRecord(String recordId) - { - mandatoryString("recordId", recordId); - - return getRecord(recordId, EMPTY); - } - - /** - * Gets a record. - * - * @param recordId The identifier of a record - * @param parameters The URL parameters to add - * @return The {@link Record} for the given {@code recordId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code recordId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code recordId}
  • - *
  • {@code recordId} does not exist
  • - *
- */ - public Record getRecord(String recordId, String parameters) - { - mandatoryString("recordId", recordId); - - return getRmRestWrapper().processModel(Record.class, simpleRequest( - GET, - "records/{recordId}?{parameters}", - recordId, - parameters - )); - } - - /** - * see {@link #updateRecord(Record, String, String) - */ - public Record updateRecord(Record recordModel, String recordId) - { - mandatoryObject("recordModel", recordModel); - mandatoryString("recordId", recordId); - - return updateRecord(recordModel, recordId, EMPTY); - } - - /** - * Updates a record. - * - * @param recordModel The record model which holds the information - * @param recordId The identifier of a record - * @param parameters The URL parameters to add - * @return The updated {@link Record} - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code recordId} is not a valid format or {@code recordModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code recordId}
  • - *
  • {@code recordId} does not exist
  • - *
  • the updated name clashes with an existing record in the current parent folder
  • - *
  • model integrity exception, including file name with invalid characters
  • - *
- */ - public Record updateRecord(Record recordModel, String recordId, String parameters) - { - mandatoryObject("recordModel", recordModel); - mandatoryString("recordId", recordId); - - return getRmRestWrapper().processModel(Record.class, requestWithBody( - PUT, - toJson(recordModel), - "records/{recordId}?{parameters}", - recordId, - parameters - )); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java deleted file mode 100644 index 01cc0ba40d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferAPI.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.GET; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.transfer.Transfer; -import org.alfresco.rest.rm.community.model.transfer.TransferChildCollection; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -/** - * Transfer REST API Wrapper - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public TransferAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * see {@link #getTransfer(String, String)} - */ - public Transfer getTransfer(String transferId) - { - mandatoryString("transferId", transferId); - - return getTransfer(transferId, EMPTY); - } - - /** - * Gets a transfer. - * - * @param transferId The identifier of a transfer - * @param parameters The URL parameters to add - * @return The {@link Transfer} for the given {@code transferId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code transferId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code transferId}
  • - *
  • {@code transferId} does not exist
  • - *
- */ - public Transfer getTransfer(String transferId, String parameters) - { - mandatoryString("transferId", transferId); - - return getRmRestWrapper().processModel(Transfer.class, simpleRequest( - GET, - "/transfers/{transferId}?{parameters}", - transferId, - parameters - )); - } - /** - * see {@link #getTransfersChildren(String, String)} - */ - public TransferChildCollection getTransfersChildren(String transferId) - { - mandatoryString("transferId", transferId); - - return getTransfersChildren(transferId, EMPTY); - } - - /** - * Gets the children (record folder or record) of a transfer. - * - * @param transferId The identifier of a transfer - * @param parameters The URL parameters to add - * @return The {@link TransferChildCollection} for the given {@code transferId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code transferId}
  • - *
  • {@code filePlanId} does not exist
  • - *
- */ - public TransferChildCollection getTransfersChildren(String transferId, String parameters) - { - mandatoryString("transferId", transferId); - - return getRmRestWrapper().processModels(TransferChildCollection.class, simpleRequest( - GET, - "transfers/{filePlanId}/children?{parameters}", - transferId, - parameters - )); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java deleted file mode 100644 index 049e4124dc..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/TransferContainerAPI.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.PUT; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.transfer.TransferCollection; -import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer; -import org.alfresco.rest.rm.community.requests.RMModelRequest; - -/** - * Transfer Container REST API Wrapper - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferContainerAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public TransferContainerAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * see {@link #getTransferContainer(String, String)} - */ - public TransferContainer getTransferContainer(String transferContainerId) - { - mandatoryString("transferContainerId", transferContainerId); - - return getTransferContainer(transferContainerId, EMPTY); - } - - /** - * Gets a transfer container. - * - * @param transferContainerId The identifier of a transfer container - * @param parameters The URL parameters to add - * @return The {@link TransferContainer} for the given {@code transferContainerId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code transferContainerId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code transferContainerId}
  • - *
  • {@code transferContainerId} does not exist
  • - *
- */ - public TransferContainer getTransferContainer(String transferContainerId, String parameters) - { - mandatoryString("transferContainerId", transferContainerId); - - return getRmRestWrapper().processModel(TransferContainer.class, simpleRequest( - GET, - "/transfer-containers/{transferContainerId}?{parameters}", - transferContainerId, - parameters - )); - } - - /** - * see {@link #updateTransferContainer(TransferContainer, String, String) - */ - public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId) - { - mandatoryObject("transferContainerModel", transferContainerModel); - mandatoryString("transferContainerId", transferContainerId); - - return updateTransferContainer(transferContainerModel, transferContainerId, EMPTY); - } - - /** - * Updates a transfer container. - * - * @param transferContainerModel The transfer container model which holds the information - * @param transferContainerId The identifier of a transfer container - * @param parameters The URL parameters to add - * @param returns The updated {@link TransferContainer} - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code transferContainerId} is not a valid format or {@code transferContainerModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code transferContainerId}
  • - *
  • {@code transferContainerId} does not exist
  • - *
  • the updated name clashes with an existing transfer container in the current file plan
  • - *
  • model integrity exception, including transfer container name with invalid characters
  • - *
- */ - public TransferContainer updateTransferContainer(TransferContainer transferContainerModel, String transferContainerId, String parameters) - { - mandatoryObject("transferContainerModel", transferContainerModel); - mandatoryString("transferContainerId", transferContainerId); - - return getRmRestWrapper().processModel(TransferContainer.class, requestWithBody( - PUT, - toJson(transferContainerModel), - "transfer-containers/{transferContainerId}?{parameters}", - transferContainerId, - parameters - )); - } - - /** - * see {@link #getTransfers(String, String)} - */ - public TransferCollection getTransfers(String transferContainerId) - { - mandatoryString("transferContainerId", transferContainerId); - - return getTransfers(transferContainerId, EMPTY); - } - - /** - * Gets the children (transfers) of a transfer container. - * - * @param transferContainerId The identifier of a transfer container - * @param parameters The URL parameters to add - * @return The {@link TransferCollection} for the given {@code transferContainerId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code transferContainerId}
  • - *
  • {@code filePlanId} does not exist
  • - *
- */ - public TransferCollection getTransfers(String transferContainerId, String parameters) - { - mandatoryString("transferContainerId", transferContainerId); - - return getRmRestWrapper().processModels(TransferCollection.class, simpleRequest( - GET, - "transfer-containers/{filePlanId}/transfers?{parameters}", - transferContainerId, - parameters - )); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java deleted file mode 100644 index d9dbe0b2eb..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledContainerAPI.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; -import static org.testng.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import io.restassured.builder.RequestSpecBuilder; -import io.restassured.http.ContentType; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.util.UnfiledContainerChildMixin; - -/** - * Unfiled Container REST API Wrapper - * - * @author Tuna Aksoy - * @author Ana Bozianu - * @since 2.6 - */ -public class UnfiledContainerAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public UnfiledContainerAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * see {@link #getUnfiledContainer(String, String)} - */ - public UnfiledContainer getUnfiledContainer(String unfiledContainerId) - { - mandatoryString("unfiledContainerId", unfiledContainerId); - - return getUnfiledContainer(unfiledContainerId, EMPTY); - } - - /** - * Gets an unfiled record container. - * - * @param unfiledContainerId The identifier of a unfiled record container - * @param parameters The URL parameters to add - * @return The {@link UnfiledContainer} for the given {@code unfiledContainerId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code unfiledContainerId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code unfiledContainerId}
  • - *
  • {@code unfiledContainerId} does not exist
  • - *
- */ - public UnfiledContainer getUnfiledContainer(String unfiledContainerId, String parameters) - { - mandatoryString("unfiledContainerId", unfiledContainerId); - - return getRmRestWrapper().processModel(UnfiledContainer.class, simpleRequest( - GET, - "unfiled-containers/{unfiledContainerId}?{parameters}", - unfiledContainerId, - parameters - )); - } - - /** - * see {@link #getUnfiledContainerChildren(String)} (String, String)} - */ - public UnfiledContainerChildCollection getUnfiledContainerChildren(String unfiledContainerId) - { - mandatoryString("unfiledContainerId", unfiledContainerId); - - return getUnfiledContainerChildren(unfiledContainerId, EMPTY); - } - - /** - * Gets the children of an unfiled records container - * - * @param unfiledContainerId The identifier of an unfiled records container - * @param parameters The URL parameters to add - * @return The {@link UnfiledContainerChildCollection} for the given {@code unfiledContainerId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code unfiledContainerId}
  • - *
  • {@code unfiledContainerId} does not exist
  • - *
- */ - public UnfiledContainerChildCollection getUnfiledContainerChildren(String unfiledContainerId, String parameters) - { - mandatoryString("unfiledContainerId", unfiledContainerId); - - return getRmRestWrapper().processModels(UnfiledContainerChildCollection.class, simpleRequest( - GET, - "unfiled-containers/{unfiledContainerId}/children?{parameters}", - unfiledContainerId, - parameters - )); - } - - /** - * see {@link #createUnfiledContainerChild(UnfiledContainerChild, String, String)} - */ - public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId) - { - mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel); - mandatoryString("unfiledContainerId", unfiledContainerId); - - return createUnfiledContainerChild(unfiledContainerChildModel, unfiledContainerId, EMPTY); - } - - /** - * Creates an unfiled container child. Can be a record or an unfiled record folder. - * - * @param unfiledContainerChildModel The unfiled container child model which holds the information - * @param unfiledContainerId The identifier of an unfiled container - * @param parameters The URL parameters to add - * @return The created {@link UnfiledContainerChild} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code unfiledContainerId} is not a valid format or {@code unfiledContainerChildModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to add children to {@code unfiledContainerId}
  • - *
  • {@code unfiledContainerId} does not exist
  • - *
  • new name clashes with an existing node in the current parent container
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public UnfiledContainerChild createUnfiledContainerChild(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, String parameters) - { - mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel); - mandatoryString("unfiledContainerId", unfiledContainerId); - - return getRmRestWrapper().processModel(UnfiledContainerChild.class, requestWithBody( - POST, - toJson(unfiledContainerChildModel), - "unfiled-containers/{unfiledContainerId}/children?{parameters}", - unfiledContainerId, - parameters - )); - } - - /** - * Create a record from file resource - * - * @param unfiledContainerChildModel {@link UnfiledContainerChild} for electronic record to be created - * @param unfiledContainerChildContent {@link File} pointing to the content of the electronic record to be created - * @param unfiledContainerId The identifier of a unfiled container - * @return newly created {@link UnfiledContainerChild} - * @throws RuntimeException for invalid recordModel JSON strings - */ - public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledContainerChildModel, String unfiledContainerId, File unfiledContainerChildContent) - { - mandatoryObject("unfiledContainerChildModel", unfiledContainerChildModel); - mandatoryObject("unfiledContainerChildContent", unfiledContainerChildContent); - mandatoryString("unfiledContainerId", unfiledContainerId); - - if (!unfiledContainerChildModel.getNodeType().equals(CONTENT_TYPE)) - { - fail("Only electronic records are supported"); - } - - /* - * For file uploads nodeBodyCreate is ignored hence can't be used. Append all Record fields - * to the request. - */ - RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec(); - JsonNode root; - try - { - root = new ObjectMapper().readTree(toJson(unfiledContainerChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class)); - } - catch (IOException e) - { - throw new RuntimeException("Failed to convert model to JSON.", e); - } - // add request fields - Iterator fieldNames = root.fieldNames(); - while (fieldNames.hasNext()) - { - String fieldName = fieldNames.next(); - builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name()); - } - builder.addMultiPart("filedata", unfiledContainerChildContent, ContentType.BINARY.name()); - - // create node with given content - return createUnfiledContainerChild(unfiledContainerChildModel, unfiledContainerId); - } - - /** - * see {@link #updateUnfiledContainer(UnfiledContainer, String, String) - */ - public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId) - { - mandatoryObject("unfiledContainerModel", unfiledContainerModel); - mandatoryString("unfiledContainerId", unfiledContainerId); - - return updateUnfiledContainer(unfiledContainerModel, unfiledContainerId, EMPTY); - } - - /** - * Updates an unfiled record container - * - * @param unfiledContainerModel The unfiled record container model which holds the information - * @param unfiledContainerId The identifier of an unfiled record container - * @param parameters The URL parameters to add - * @param returns The updated {@link UnfiledContainer} - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code unfiledContainerId} is not a valid format or {@code unfiledContainerModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code unfiledContainerId}
  • - *
  • {@code unfiledContainerId} does not exist
  • - *
  • the updated name clashes with an existing root category of special container in the current fileplan
  • - *
  • model integrity exception, including file name with invalid characters
  • - *
- */ - public UnfiledContainer updateUnfiledContainer(UnfiledContainer unfiledContainerModel, String unfiledContainerId, String parameters) - { - mandatoryObject("unfiledContainerModel", unfiledContainerModel); - mandatoryString("unfiledContainerId", unfiledContainerId); - - return getRmRestWrapper().processModel(UnfiledContainer.class, requestWithBody( - PUT, - toJson(unfiledContainerModel), - "unfiled-containers/{unfiledContainerId}?{parameters}", - unfiledContainerId, - parameters - )); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java deleted file mode 100644 index 7a38e2a23d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/UnfiledRecordFolderAPI.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests.gscore.api; - -import static org.alfresco.rest.core.RestRequest.requestWithBody; -import static org.alfresco.rest.core.RestRequest.simpleRequest; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.apache.commons.lang3.StringUtils.EMPTY; -import static org.springframework.http.HttpMethod.DELETE; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; -import static org.testng.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import io.restassured.builder.RequestSpecBuilder; -import io.restassured.http.ContentType; - -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder; -import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.util.UnfiledContainerChildMixin; - -/** - * Unfiled Record Folders REST API Wrapper - * - * @author Ramona Popa - * @since 2.6 - */ -public class UnfiledRecordFolderAPI extends RMModelRequest -{ - /** - * @param rmRestWrapper RM REST Wrapper - */ - public UnfiledRecordFolderAPI(RMRestWrapper rmRestWrapper) - { - super(rmRestWrapper); - } - - /** - * see {@link #getUnfiledRecordFolder(String, String)} - */ - public UnfiledRecordFolder getUnfiledRecordFolder(String unfiledRecordFolderId) - { - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return getUnfiledRecordFolder(unfiledRecordFolderId, EMPTY); - } - - /** - * Gets an unfiled record folder. - * - * @param unfiledRecordFolderId The identifier of a unfiled record folder - * @param parameters The URL parameters to add - * @return The {@link UnfiledRecordFolder} for the given {@code unfiledRecordFolderId} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code unfiledRecordFolderId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code unfiledRecordFolderId}
  • - *
  • {@code unfiledRecordFolderId} does not exist
  • - *
- */ - public UnfiledRecordFolder getUnfiledRecordFolder(String unfiledRecordFolderId, String parameters) - { - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return getRmRestWrapper().processModel(UnfiledRecordFolder.class, simpleRequest( - GET, - "unfiled-record-folders/{unfiledRecordFolderId}?{parameters}", - unfiledRecordFolderId, - parameters - )); - } - - /** - * see {@link #getUnfiledRecordFolderChildren(String, String)} - */ - public UnfiledContainerChildCollection getUnfiledRecordFolderChildren(String unfiledRecordFolderId) - { - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return getUnfiledRecordFolderChildren(unfiledRecordFolderId, EMPTY); - } - - /** - * Gets the children of an unfiled record folder - * - * @param unfiledRecordFolderId The identifier of an unfiled records folder - * @param parameters The URL parameters to add - * @return The {@link UnfiledRecordFolderChildCollection} for the given {@code unfiledRecordFolderId} - * @throws RuntimeException for the following cases: - *
    - *
  • authentication fails
  • - *
  • current user does not have permission to read {@code unfiledRecordFolderId}
  • - *
  • {@code unfiledRecordFolderId} does not exist
  • - *
- */ - public UnfiledContainerChildCollection getUnfiledRecordFolderChildren(String unfiledRecordFolderId, String parameters) - { - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return getRmRestWrapper().processModels(UnfiledContainerChildCollection.class, simpleRequest( - GET, - "unfiled-record-folders/{unfiledRecordFolderId}/children?{parameters}", - unfiledRecordFolderId, - parameters - )); - } - - /** - * see {@link #createUnfiledRecordFolderChild(UnfiledContainerChild, String, String)} - */ - public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId) - { - mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel); - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return createUnfiledRecordFolderChild(unfiledRecordFolderChildModel, unfiledRecordFolderId, EMPTY); - } - - /** - * Creates an unfiled record folder child. Can be a record or an unfiled record folder. - * - * @param unfiledRecordFolderChildModel The unfiled folder child model which holds the information - * @param unfiledRecordFolderId The identifier of an unfiled folder - * @param parameters The URL parameters to add - * @return The created {@link UnfiledRecordFolderChild} - * @throws RuntimeException for the following cases: - *
    - *
  • {@code unfiledRecordFolderId} is not a valid format or {@code unfiledRecordFolderChildModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to add children to {@code unfiledRecordFolderId}
  • - *
  • {@code unfiledRecordFolderId} does not exist
  • - *
  • new name clashes with an existing node in the current parent container
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public UnfiledContainerChild createUnfiledRecordFolderChild(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, String parameters) - { - mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel); - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return getRmRestWrapper().processModel(UnfiledContainerChild.class, requestWithBody( - POST, - toJson(unfiledRecordFolderChildModel), - "unfiled-record-folders/{unfiledRecordFolderId}/children?{parameters}", - unfiledRecordFolderId, - parameters - )); - } - - /** - * Create a record from file resource - * - * @param unfiledRecordFolderChildModel {@link UnfiledContainerChild} for electronic record to be created - * @param unfiledRecordFolderChildContent {@link File} pointing to the content of the electronic record to be created - * @param unfiledRecordFolderId The identifier of a unfiled record folder - * @return newly created {@link UnfiledContainerChild} - * @throws RuntimeException for invalid recordModel JSON strings - */ - public UnfiledContainerChild uploadRecord(UnfiledContainerChild unfiledRecordFolderChildModel, String unfiledRecordFolderId, File unfiledRecordFolderChildContent) - { - mandatoryObject("unfiledRecordFolderChildModel", unfiledRecordFolderChildModel); - mandatoryObject("unfiledRecordFolderChildContent", unfiledRecordFolderChildContent); - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - if (!unfiledRecordFolderChildModel.getNodeType().equals(CONTENT_TYPE)) - { - fail("Only electronic records are supported"); - } - - /* - * For file uploads nodeBodyCreate is ignored hence can't be used. Append all Record fields - * to the request. - */ - RequestSpecBuilder builder = getRmRestWrapper().configureRequestSpec(); - JsonNode root; - try - { - root = new ObjectMapper().readTree(toJson(unfiledRecordFolderChildModel, UnfiledContainerChild.class, UnfiledContainerChildMixin.class)); - } - catch (IOException e) - { - throw new RuntimeException("Failed to convert model to JSON.", e); - } - // add request fields - Iterator fieldNames = root.fieldNames(); - while (fieldNames.hasNext()) - { - String fieldName = fieldNames.next(); - builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name()); - } - builder.addMultiPart("filedata", unfiledRecordFolderChildContent, ContentType.BINARY.name()); - - // create node with given content - return createUnfiledRecordFolderChild(unfiledRecordFolderChildModel, unfiledRecordFolderId); - } - - /** - * see {@link #updateUnfiledRecordFolder(UnfiledRecordFolder, String, String) - */ - public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId) - { - mandatoryObject("unfiledRecordFolderModel", unfiledRecordFolderModel); - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return updateUnfiledRecordFolder(unfiledRecordFolderModel, unfiledRecordFolderId, EMPTY); - } - - /** - * Updates an unfiled record folder - * - * @param unfiledRecordFolderModel The unfiled record folder model which holds the information - * @param unfiledRecordFolderId The identifier of an unfiled record folder - * @param parameters The URL parameters to add - * @param returns The updated {@link UnfiledRecordFolder} - * @throws RuntimeException for the following cases: - *
    - *
  • the update request is invalid or {@code unfiledRecordFolderId} is not a valid format or {@code unfiledRecordFolderModel} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code unfiledRecordFolderId}
  • - *
  • {@code unfiledRecordFolderId} does not exist
  • - *
  • the updated name clashes with an existing root category of special container in the current fileplan
  • - *
  • model integrity exception, including file name with invalid characters
  • - *
- */ - public UnfiledRecordFolder updateUnfiledRecordFolder(UnfiledRecordFolder unfiledRecordFolderModel, String unfiledRecordFolderId, String parameters) - { - mandatoryObject("unfiledRecordFolderModel", unfiledRecordFolderModel); - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - return getRmRestWrapper().processModel(UnfiledRecordFolder.class, requestWithBody( - PUT, - toJson(unfiledRecordFolderModel), - "unfiled-record-folders/{unfiledRecordFolderId}?{parameters}", - unfiledRecordFolderId, - parameters - )); - } - - /** - * Deletes an unfiled record folder. - * - * @param unfiledRecordFolderId The identifier of a unfiled record folder - * @throws RuntimeException for the following cases: - *
    - *
  • {@code unfiledRecordFolderId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to delete {@code unfiledRecordFolderId}
  • - *
  • {@code unfiledRecordFolderId} does not exist
  • - *
  • {@code unfiledRecordFolderId} is locked and cannot be deleted
  • - *
- */ - public void deleteUnfiledRecordFolder(String unfiledRecordFolderId) - { - mandatoryString("unfiledRecordFolderId", unfiledRecordFolderId); - - getRmRestWrapper().processEmptyModel(simpleRequest( - DELETE, - "unfiled-record-folders/{recordFolderId}", - unfiledRecordFolderId - )); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java deleted file mode 100644 index dbe6a0862d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/CommonTestUtils.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.util; - -import java.util.UUID; - -/** - * A utility class to provide test methods that can be used by the REST and UI tests. - * - * @author Tom Page - * @since 2.6 - */ -public class CommonTestUtils -{ - /** - * The default pattern used for the user full name when users are created with tas utility - */ - public static final String USER_FULLNAME_PATTERN = "FN-%1$s LN-%1$s"; - - /** Private constructor to prevent instantiation. */ - private CommonTestUtils() - { - } - - /** - * Generate a prefix to namespace the objects in a test class. Note that four random hex digits should be good enough to avoid - * collisions when running locally and should also be short enough to maintain readability. - */ - public static String generateTestPrefix(Class clazz) - { - return clazz.getSimpleName().substring(0, 7) + UUID.randomUUID().toString().substring(0, 4).toUpperCase(); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java deleted file mode 100644 index 1709197434..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.util; - -import static org.testng.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import com.github.dockerjava.api.DockerClient; -import com.github.dockerjava.api.command.LogContainerCmd; -import com.github.dockerjava.api.model.Container; -import com.github.dockerjava.api.model.Frame; -import com.github.dockerjava.core.DockerClientBuilder; -import com.github.dockerjava.core.command.LogContainerResultCallback; -import com.github.dockerjava.netty.NettyDockerCmdExecFactory; - -import lombok.Getter; -import lombok.Setter; -import org.alfresco.utility.Utility; -import org.apache.commons.lang.SystemUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -/** - * Helper class for interaction with docker containers - * - * @author Claudia Agache - * @since 3.1 - */ -@Service -public class DockerHelper -{ - private static final Logger LOGGER = LoggerFactory.getLogger(DockerHelper.class); - private static final String REPO_IMAGE_NAME = "repository"; - @Getter - @Setter - private DockerClient dockerClient; - - @Autowired - public DockerHelper(@Value ("${docker.host}") String dockerHost) - { - if (SystemUtils.IS_OS_WINDOWS) - { - this.dockerClient = DockerClientBuilder - .getInstance(dockerHost) - .withDockerCmdExecFactory(new NettyDockerCmdExecFactory()) - .build(); - } - else - { - this.dockerClient = DockerClientBuilder - .getInstance() - .withDockerCmdExecFactory(new NettyDockerCmdExecFactory()) - .build(); - } - } - - /** - * Method for returning logs of docker container - * - * @param containerId - ID of the container - * @param timeStamp - get the logs since a specific timestamp - * @return list of strings, where every string is log line - */ - private List getDockerLogs(String containerId, int timeStamp) - { - final List logs = new ArrayList<>(); - - final LogContainerCmd logContainerCmd = getDockerClient().logContainerCmd(containerId); - logContainerCmd.withStdOut(true) - .withStdErr(true) - .withSince(timeStamp) // UNIX timestamp to filter logs. Output log-entries since that timestamp. - .withTimestamps(true); //print timestamps for every log line - - try - { - logContainerCmd.exec(new LogContainerResultCallback() - { - @Override - public void onNext(Frame item) - { - logs.add(item.toString()); - } - }).awaitCompletion(); - } - catch (InterruptedException e) - { - Thread.currentThread().interrupt(); // set interrupt flag - LOGGER.error("Failed to retrieve logs of container " + containerId, e); - } - - return logs; - } - - /** - * Get the alfresco container logs - * - * @return list of strings, where every string is log line - */ - public List getAlfrescoLogs() - { - final List alfrescoContainers = findContainersByImageName(REPO_IMAGE_NAME); - if (alfrescoContainers.isEmpty()) - { - return Collections.emptyList(); - } - else - { - List alfrescoLogs = new ArrayList<>(); - // get the logs since current time - 10 seconds - final int timeStamp = (int) (System.currentTimeMillis() / 1000) - 10; - alfrescoContainers.forEach(alfrescoContainer -> alfrescoLogs.addAll(getDockerLogs(alfrescoContainer.getId(), timeStamp))); - return alfrescoLogs; - } - } - - /** - * Helper method to check if the specified exception is thrown in alfresco logs - * - * @param expectedException the expected exception to be thrown - * @throws Exception - */ - public void checkExceptionIsInAlfrescoLogs(String expectedException) throws Exception - { - //Retry the operation because sometimes it takes few seconds to throw the exception - Utility.sleep(6000, 30000, () -> - { - List alfrescoLogs = getAlfrescoLogs(); - assertTrue(alfrescoLogs.stream().anyMatch(logLine -> logLine.contains(expectedException))); - }); - } - - /** - * Method for finding docker containers after the image name - * - * @param imageName - the name of the image used by container - * @return the containers - */ - private List findContainersByImageName(String imageName) - { - final List containers = getDockerClient().listContainersCmd().withShowAll(true).exec(); - - return containers.stream() - .filter(container -> container.getImage().contains(imageName)) - .collect(Collectors.toList()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/FilePlanComponentMixIn.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/FilePlanComponentMixIn.java deleted file mode 100644 index b59219cde5..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/FilePlanComponentMixIn.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.util; - -import com.fasterxml.jackson.annotation.JsonUnwrapped; - -import org.alfresco.rest.rm.community.model.record.RecordProperties; - -/** - * Mix class for Record POJO class - * Mix-in annotations are: a way to associate annotations with classes - * without modifying (target) classes themselves. - * - * @author Rodica Sutu - * @since 2.6 - */ -public abstract class FilePlanComponentMixIn -{ - /** - * Annotation used to indicate that a property should be serialized "unwrapped" - * Its properties are instead included as properties of its containing Object - */ - @JsonUnwrapped - abstract RecordProperties getProperties(); -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ParameterCheck.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ParameterCheck.java deleted file mode 100644 index 7acd4abb97..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ParameterCheck.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.util; - -import static org.apache.commons.lang3.StringUtils.isBlank; - -/** - * Utility class for checking parameters - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class ParameterCheck -{ - private ParameterCheck() - { - // Intentionally blank - } - - /** - * Checks if a given {@link String} is blank or not, i.e. not null, "" or " ". - * - * @param paramName The name of the parameter to check - * @param paramValue The value of the parameter to check - * @throws IllegalArgumentException Throws an exception if the given value is blank - */ - public static void mandatoryString(final String paramName, final String paramValue) throws IllegalArgumentException - { - if (isBlank(paramValue)) - { - throw new IllegalArgumentException("'" + paramName + "' is a mandatory parameter."); - } - } - - /** - * Checks if a given {@link Object} is null or not - * - * @param paramName The name of the parameter to check - * @param object The value of the parameter to check - * @throws IllegalArgumentException Throws an exception if the given value is null - */ - public static void mandatoryObject(final String paramName, final Object object) throws IllegalArgumentException - { - if (object == null) - { - throw new IllegalArgumentException("'" + paramName + "' is a mandatory parameter."); - } - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java deleted file mode 100644 index f7ce46c21c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.util; - -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; - -import java.io.IOException; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.CollectionType; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Utility class for creating the json object - * - * @author Rodica Sutu - * @since 2.6 - */ -public class PojoUtility -{ - /** - * Logger for the class. - */ - private static final Logger LOGGER = LoggerFactory.getLogger(PojoUtility.class); - - /** Private constructor to prevent instantiation. */ - private PojoUtility() - {} - - /** - * see {@link #toJson(Object, Class, Class)} - */ - public static String toJson(Object model) - { - mandatoryObject("model", model); - - return toJson(model, null, null); - } - - /** - * Converting object to JSON string - * - * @param model The java object model to convert - * @param target Class (or interface) whose annotations to effectively override - * @param mixinSource Class (or interface) whose annotations are to be "added" to target's annotations, overriding as necessary - * @return The converted java object as JSON string - * @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model - */ - public static String toJson(Object model, Class target, Class mixinSource) - { - mandatoryObject("model", model); - - ObjectMapper mapper = new ObjectMapper(); - - if (target != null && mixinSource != null) - { - //inject the "mix-in" annotations from FilePlanComponentMix to - // FilePlanComponent POJO class when converting to json - mapper.addMixIn(target, mixinSource); - } - - //include only values that differ from default settings to be included - mapper.setSerializationInclusion(Include.NON_DEFAULT); - - //return the json object - try - { - return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model); - } - catch (JsonProcessingException error) - { - return error.toString(); - } - } - - /** - * Converting json to java object - * - * @param json The json object to convert - * @param classz Class for the java object - * @return The converted java object - * @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model - */ - public static T jsonToObject(JSONObject json, Class classz) - { - mandatoryObject("model", classz); - mandatoryObject("jsonObject", json); - - ObjectMapper mapper = new ObjectMapper(); - - T obj = null; - try - { - obj = mapper.readValue(json.toString(), classz); - } - catch (IOException e) - { - LOGGER.error("Unable to convert the json into a java object.", e); - } - - return obj; - } - - /** - * Converting json array into a list of java objects - * - * @param json The json array to convert - * @param classz Class for the java object - * @return The list of converted java objects - * @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model - */ - public static List jsonToObject(JSONArray json, Class classz) - { - - mandatoryObject("model", classz); - mandatoryObject("jsonObject", json); - - ObjectMapper mapper = new ObjectMapper(); - - CollectionType collectionType = mapper.getTypeFactory().constructCollectionType(List.class, classz); - List asList = null; - try - { - asList = mapper.readValue(json.toString(), collectionType); - } - catch (IOException e) - { - LOGGER.error("Unable to convert the json array into a java collection.", e); - } - - - return asList; - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java deleted file mode 100644 index c69fe9e0a8..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.util; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; - -/** - * Utility class for serializing @{FilePlanComponentReviewPeriod} - * - * @author Rodica Sutu - * @since 2.6 - */ -public class ReviewPeriodSerializer extends JsonSerializer -{ - /** - * @param value The Review Period value that is being serialized. - * @param gen Jackson utility is responsible for writing JSON - * @param serializers Provider for getting access to other serializers and configurations registered with the ObjectMapper. - * @throws IOException - * @throws JsonProcessingException - */ - @Override - public void serialize(ReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException - { - //create the custom string value for the Review Period type - gen.writeString(new StringBuilder().append(value.getPeriodType()).append("|").append(value.getExpression()).toString()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/UnfiledContainerChildMixin.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/UnfiledContainerChildMixin.java deleted file mode 100644 index 9c0b9c8686..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/UnfiledContainerChildMixin.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.util; - -import com.fasterxml.jackson.annotation.JsonUnwrapped; - -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; - -/** - * Mix class for Record POJO class - * Mix-in annotations are: a way to associate annotations with classes - * without modifying (target) classes themselves. - * - * @author Tuna Aksoy - * @since 2.6 - */ -public abstract class UnfiledContainerChildMixin -{ - /** - * Annotation used to indicate that a property should be serialized "unwrapped" - * Its properties are instead included as properties of its containing Object - */ - @JsonUnwrapped - abstract UnfiledContainerChildProperties getProperties(); -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CopyToAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CopyToAPI.java deleted file mode 100644 index ff4334e2ef..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CopyToAPI.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import java.text.MessageFormat; -import java.util.List; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.apache.http.HttpResponse; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * The v0 REST API for copy-to (which supports multi-item copy). - * - * @author Tom Page - * @since 2.6 - */ -@Component -public class CopyToAPI extends BaseAPI -{ - /** Logger for the class. */ - private static final Logger LOGGER = LoggerFactory.getLogger(CopyToAPI.class); - /** The URI for the copy-to API. */ - private static final String COPY_TO_API = "{0}doclib/action/copy-to/node/{1}"; - - /** - * Copy a list of nodes to the target container. - * - * @param user The username of the user to use. - * @param password The password of the user. - * @param targetContainerPath The destination to copy the nodes to. This should be in the format - * "{site}/{container}/{path}", "{site}/{container}", "{store_type}/{store_id}/{id}/{path}", - * "{store_type}/{store_id}/{id}" or "{store_type}/{store_id}". - * @param nodeRefs The list of nodes to copy. - * @return The HTTP Response. - * @throws AssertionError If the API call didn't return a 200 response. - */ - public HttpResponse copyTo(String user, String password, String targetContainerPath, List nodeRefs) - { - return copyTo(user, password, 200, targetContainerPath, nodeRefs); - } - - /** - * Copy a list of nodes to the target container. - * - * @param user The username of the user to use. - * @param password The password of the user. - * @param expectedStatusCode The expected return status code. - * @param targetContainerPath The destination to copy the nodes to. This should be in the format - * "{site}/{container}/{path}", "{site}/{container}", "{store_type}/{store_id}/{id}/{path}", - * "{store_type}/{store_id}/{id}" or "{store_type}/{store_id}". - * @param nodeRefs The list of nodes to copy. - * @return The HTTP Response. - * @throws AssertionError If the API didn't return the expected status code. - */ - public HttpResponse copyTo(String user, String password, int expectedStatusCode, String targetContainerPath, List nodeRefs) - { - JSONObject requestParams = new JSONObject(); - requestParams.put("nodeRefs", new JSONArray(nodeRefs)); - - return doSlingshotPostJsonRequest(user, password, expectedStatusCode, requestParams, - MessageFormat.format(COPY_TO_API, "{0}", targetContainerPath)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java deleted file mode 100644 index 4612d4cd11..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.testng.AssertJUnit.assertTrue; - -import java.text.MessageFormat; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.rest.rm.community.model.custom.CustomDefinitions; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * Methods to make API requests using v0 API on Records Management Custom Model Reference Definitions - * - * @author Rodica Sutu - * @since 2.6 - */ -@Component -public class CustomDefinitionsAPI extends BaseAPI -{ - /** - * custom references endpoint - */ - private static final String CUSTOM_REFERENCE_API_ENDPOINT = "{0}rma/admin/customreferencedefinitions"; - - /** - * create reference endpoint - */ - private static final String CREATE_RELATIONSHIP_API_ENDPOINT = "{0}node/{1}/customreferences"; - - /** - * logger - */ - private static final Logger LOGGER = LoggerFactory.getLogger(CustomDefinitionsAPI.class); - - /** - * Helper method to get the reference id for a custom reference - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param customDefinition custom reference definition name - * @return reference id if the customDefinition is found - * null otherwise - * - */ - public String getCustomReferenceId(String adminUser, String adminPassword, String customDefinition) - { - - JSONObject getResponse = doGetRequest(adminUser, adminPassword, CUSTOM_REFERENCE_API_ENDPOINT); - if (getResponse != null) - { - try - { - JSONArray customDefinitions = getResponse.getJSONObject("data").getJSONArray("customReferences"); - for (int i = 0; i < customDefinitions.length(); i++) - { - JSONObject item = customDefinitions.getJSONObject(i); - boolean hasSource = customDefinition.equalsIgnoreCase( - item.has("source") ? item.getString("source") : null - ); - - boolean hasTarget = customDefinition.equalsIgnoreCase( - item.has("target") ? item.getString("target") : null - ); - - boolean hasLabel = customDefinition.equalsIgnoreCase( - item.has("label") ? item.getString("label") : null - ); - if ( hasSource || hasTarget || hasLabel) - { - return item.getString("refId"); - } - } - - } - catch (JSONException error) - { - LOGGER.error("Unable to get the refId for the custom reference definition {}", customDefinition); - } - } - return null; - } - - /** - * Helper method to add custom reference instance to the specified record node - * - * @param adminUser user with administrative privileges - * @param adminPassword password for adminUser - * @param recordNodeIdFrom node ref to set a custom reference - * @param recordNodeIdTo node ref of the to record - * @param relationshipType relation type to be created - * @throws AssertionError if the creation fails. - */ - public void createRelationship( - String adminUser, - String adminPassword, - String recordNodeIdFrom, - String recordNodeIdTo, - CustomDefinitions relationshipType) - { - //create the request body - JSONObject requestParams = new JSONObject(); - requestParams.put("toNode", NODE_REF_WORKSPACE_SPACES_STORE + recordNodeIdTo); - requestParams.put("refId", getCustomReferenceId(adminUser, adminPassword, relationshipType - .getDefinition())); - //send the API request to create the relationship - JSONObject setRelationshipStatus = doPostRequest(adminUser, adminPassword, requestParams, - MessageFormat.format(CREATE_RELATIONSHIP_API_ENDPOINT, "{0}", NODE_PREFIX + recordNodeIdFrom)); - //check the response - boolean success = (setRelationshipStatus != null) && setRelationshipStatus.getBoolean("success"); - assertTrue("Creating relationship from " + recordNodeIdFrom + " to " + recordNodeIdTo + " failed.", success); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/HoldsAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/HoldsAPI.java deleted file mode 100644 index 934c0c0c32..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/HoldsAPI.java +++ /dev/null @@ -1,360 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.alfresco.rest.core.v0.APIUtils.convertHTTPResponseToJSON; -import static org.apache.http.HttpStatus.SC_OK; - -import java.text.MessageFormat; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import org.alfresco.rest.core.v0.APIUtils; -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.rest.rm.community.model.hold.HoldEntry; -import org.alfresco.rest.rm.community.util.PojoUtility; -import org.alfresco.utility.model.UserModel; -import org.apache.http.HttpResponse; -import org.apache.http.ParseException; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.stereotype.Component; - -/** - * Methods to make API requests using v0 API for generalized holds - * - * @author Rodica Sutu - * @since 3.2 - */ -@Component -public class HoldsAPI extends BaseAPI -{ - public static final String HOLDS_CONTAINER = "Holds"; - /** - * The URI to create a hold - */ - private static final String CREATE_HOLDS_API = "{0}type/rma:hold/formprocessor"; - - /** - * The URI to add items to hold or to remove items from hold - */ - private static final String RM_HOLDS_API = "{0}rma/holds"; - - /** - * The URI to get holds. - */ - private static final String GET_RM_HOLDS = RM_HOLDS_API + "?{1}"; - - /** - * Util method to create a hold - * - * @param user the user creating the hold - * @param password the user's password - * @param holdName the hold name - * @param reason hold reason - * @param description hold description - * @return The HTTP response. - */ - public HttpResponse createHold(String user, String password, String holdName, String reason, String description) - { - return createHold(user, password, holdName, reason, description, SC_OK); - } - - /** - * Util method to create a hold - * - * @param user the user creating the hold - * @param password the user's password - * @param holdName the hold name - * @param reason hold reason - * @param description hold description - * @param expectedStatusCode The expected return status code. - * @return The HTTP response or throws AssertionError if the returned status code is not as expected. - */ - public HttpResponse createHold(String user, String password, String holdName, String reason, String description, - int expectedStatusCode) - { - // retrieve the Holds container nodeRef - final String parentNodeRef = getItemNodeRef(user, password, "/" + HOLDS_CONTAINER); - - final JSONObject requestParams = new JSONObject(); - requestParams.put("alf_destination", getNodeRefSpacesStore() + parentNodeRef); - requestParams.put("prop_cm_name", holdName); - requestParams.put("prop_cm_description", description); - requestParams.put("prop_rma_holdReason", reason); - - return doPostJsonRequest(user, password, expectedStatusCode, requestParams, CREATE_HOLDS_API); - } - - /** - * Create a hold and get the node ref of the hold from the response body - * - * @param user the user creating the hold - * @param password the user's password - * @param holdName the hold name to be created - * @param reason reason of the hold to be created - * @param description hold description - * @return node ref of the hold created - */ - public String createHoldAndGetNodeRef(String user, String password, - String holdName, String reason, String description) - { - final HttpResponse httpResponse = createHold(user, password, holdName, reason, description); - - try - { - return convertHTTPResponseToJSON(httpResponse).getString("persistedObject") - .replace(NODE_REF_WORKSPACE_SPACES_STORE, ""); - } - catch(JSONException error) - { - LOGGER.error("Converting message body to JSON failed. Body: {}", httpResponse, error); - } - catch(ParseException error) - { - LOGGER.error("Parsing message body failed.", error); - } - - return null; - } - - /** - * Deletes hold using RM Actions API and expect action to be successful - * - * @param user the user who does the request - * @param holdNodeRef the hold node ref - * @return The HTTP Response or throws AssertionError if the request is not successful. - */ - public HttpResponse deleteHold(UserModel user, String holdNodeRef) - { - return deleteHold(user.getUsername(), user.getPassword(), holdNodeRef, SC_OK); - } - - /** - * Deletes hold using RM Actions API and expect a specific status code - * - * @param username user's username - * @param password its password - * @param holdNodeRef the hold node ref - * @return The HTTP Response or throws AssertionError if the returned status code is not as expected. - */ - public HttpResponse deleteHold(String username, String password, String holdNodeRef, int expectedStatusCode) - { - JSONObject requestParams = new JSONObject(); - requestParams.put("name", "deleteHold"); - requestParams.put("nodeRef", getNodeRefSpacesStore() + holdNodeRef); - - return doPostJsonRequest(username, password, expectedStatusCode, requestParams, RM_ACTIONS_API); - } - - /** - * Deletes hold using cmis - * - * @param username user's username - * @param password its password - * @param holdName the hold name - * @throws AssertionError if the deletion was unsuccessful. - */ - public void deleteHold( String username, String password, String holdName) - { - deleteItem(username, password, String.format("/%s/%s", HOLDS_CONTAINER, holdName)); - } - - /** - * Adds item(content/record/record folder) to the hold - * - * @param user the user who adds the item to the hold - * @param password the user's password - * @param itemNodeRef the nodeRef of the item to be added to hold - * @param holdName the hold name - * @return The HTTP response - */ - public HttpResponse addItemToHold(String user, String password, String itemNodeRef, String holdName) - { - return addItemsToHolds(user, password, Collections.singletonList(itemNodeRef), Collections.singletonList(holdName)); - } - - /** - * Adds a list of items (content/record/record folder) to a list of holds - * - * @param user the user who adds the items to the holds - * @param password the user's password - * @param itemNodeRefs the list of items nodeRefs to be added to holds - * @param holdNames the list of holds - * @return The HTTP response - */ - public HttpResponse addItemsToHolds(String user, String password, List itemNodeRefs, List holdNames) - { - final List holdNodeRefs = holdNames.stream() - .map(hold -> getItemNodeRef(user, password, String.format("/%s/%s", HOLDS_CONTAINER, hold))) - .collect(Collectors.toList()); - return addItemsToHolds(user, password, SC_OK, itemNodeRefs, holdNodeRefs); - } - - /** - * Adds a list of items (content/record/record folder) to a list of holds - * - * @param user the user who adds the items to the holds - * @param password the user's password - * @param itemNodeRefs the list of items nodeRefs to be added to holds - * @param holdNodeRefs the list of holds - * @return The HTTP response - */ - public HttpResponse addItemsToHolds(String user, String password, int expectedStatus, List itemNodeRefs, - List holdNodeRefs) - { - final JSONObject requestParams = addOrRemoveToFromHoldJsonObject(itemNodeRefs, holdNodeRefs); - return doPostJsonRequest(user, password, expectedStatus, requestParams, RM_HOLDS_API); - } - - /** - * Util method to add item(content/record/record folder) to the hold and get the error message - * - * @param user the user who adds the item to the hold - * @param password the user's password - * @param itemNodeRef the nodeRef of the item to be added to hold - * @param holdNodeRef the hold node ref - * @return The error message - */ - public String addToHoldAndGetMessage(String user, String password, int expectedStatus, String itemNodeRef, String - holdNodeRef) - { - final HttpResponse httpResponse = addItemsToHolds(user, password, expectedStatus, Collections.singletonList(itemNodeRef), - Collections.singletonList(holdNodeRef)); - return APIUtils.extractErrorMessageFromHttpResponse(httpResponse); - } - - /** - * Util method to create the request body used when adding items to holds or when removing items from holds - * - * @param items list of items node refs to be added to holds - * @param holdNodeRefs list of hold node refs for add/remove items - * @return JSONObject fo - */ - private JSONObject addOrRemoveToFromHoldJsonObject(List items, List holdNodeRefs) - { - final JSONArray nodeRefs = new JSONArray(); - items.forEach(itemNodeRef -> nodeRefs.put(getNodeRefSpacesStore() + itemNodeRef)); - final JSONArray holds = new JSONArray(); - holdNodeRefs.forEach(holdNodeRef -> holds.put(getNodeRefSpacesStore() + holdNodeRef)); - final JSONObject requestParams = new JSONObject(); - requestParams.put("nodeRefs", nodeRefs); - requestParams.put("holds", holds); - return requestParams; - } - - /** - * Remove item(content/record/record folder) from hold - * - * @param user the user who removes the item from the hold - * @param password the user's password - * @param itemNodeRef the nodeRef of the item to be removed from hold - * @param holdName the hold name - * @return The HTTP response - */ - public HttpResponse removeItemFromHold(String user, String password, String itemNodeRef, String holdName) - { - return removeItemsFromHolds(user, password, Collections.singletonList(itemNodeRef), Collections.singletonList(holdName)); - } - - /** - * Remove a list of items (content/record/record folder) from a list of holds - * - * @param user the user who removes the item from the hold - * @param password the user's password - * @param itemNodeRefs the list of items nodeRefs to be removed from hold - * @param holdNames the list of hold names - * @return The HTTP response - */ - public HttpResponse removeItemsFromHolds(String user, String password, List itemNodeRefs, List holdNames) - { - final List holdNodeRefs = holdNames.stream() - .map(hold -> getItemNodeRef(user, password, String.format("/%s/%s", HOLDS_CONTAINER, hold))) - .collect(Collectors.toList()); - return removeItemsFromHolds(user, password, SC_OK, itemNodeRefs, holdNodeRefs); - } - - /** - * Remove a list of items (content/record/record folder) from a list of holds - * - * @param user the user who removes the item from the hold - * @param password the user's password - * @param expectedStatus https status code expected - * @param itemNodeRefs the list of items nodeRefs to be removed from hold - * @param holdNodeRefs the list of hold node refs - * @return The HTTP response - */ - public HttpResponse removeItemsFromHolds(String user, String password, int expectedStatus, List itemNodeRefs, - List holdNodeRefs) - { - final JSONObject requestParams = addOrRemoveToFromHoldJsonObject(itemNodeRefs, holdNodeRefs); - return doPutJsonRequest(user, password, expectedStatus, requestParams, RM_HOLDS_API); - } - - /** - * Util method to remove item(content/record/record folder) from hold and get the error message - * - * @param user the user who removes the item from hold - * @param password the user's password - * @param itemNodeRef the nodeRef of the item to be removed from hold - * @param holdNodeRef the hold node ref - * @return The error message - */ - public String removeFromHoldAndGetMessage(String user, String password, int expectedStatus, String itemNodeRef, String - holdNodeRef) - { - final HttpResponse httpResponse = removeItemsFromHolds(user, password, expectedStatus, Collections.singletonList(itemNodeRef), - Collections.singletonList(holdNodeRef)); - return APIUtils.extractErrorMessageFromHttpResponse(httpResponse); - } - - /** - * Get the list of the available holds which have the item node reference if includedInHold parameter is true, - * otherwise a list of hold node references will be retrieved which do not include the given node reference. - * - * @param user The username of the user to use. - * @param password The password of the user. - * @param itemNodeRef The item node reference - * @param includedInHold True to retrieve the holds which have the item node reference - * @param fileOnly True if only files should be return - * @return return a list of hold entries - */ - public List getHolds(String user, String password, final String itemNodeRef, - final Boolean includedInHold, final Boolean fileOnly) - { - final String parameters = (itemNodeRef != null ? "itemNodeRef=" + NODE_REF_WORKSPACE_SPACES_STORE + itemNodeRef : "") - + (includedInHold != null ? "&includedInHold=" + includedInHold : "") - + (fileOnly != null ? "&fileOnly=" + fileOnly : ""); - - final JSONArray holdEntries = doGetRequest(user, password, - MessageFormat.format(GET_RM_HOLDS, "{0}", parameters)).getJSONObject("data").getJSONArray("holds"); - - return PojoUtility.jsonToObject(holdEntries, HoldEntry.class); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodeAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodeAPI.java deleted file mode 100644 index c12c074c18..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodeAPI.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; -import java.text.MessageFormat; - -import org.alfresco.dataprep.AlfrescoHttpClient; -import org.alfresco.dataprep.AlfrescoHttpClientFactory; -import org.alfresco.rest.core.v0.BaseAPI; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * The v0 REST API for nodes - * - * @author jcule - * @since 2.7EA1 - */ -@Component -public class NodeAPI extends BaseAPI -{ - /** Logger for the class. */ - private static final Logger LOGGER = LoggerFactory.getLogger(NodeAPI.class); - - /** The URI for the get node API. */ - private static final String GET_NODE_API = "{0}alfresco/s/slingshot/doclib2/node/{1}"; - - @Autowired - private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - - /** - * Get the node metadata using the using the node data webscript: Document List v2 Component - * - * @param username - * @param password - * @param nodeId - * @return - */ - public JSONObject getNode(String username, String password, String nodeId) - { - String requestURL; - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - requestURL = MessageFormat.format(GET_NODE_API, client.getAlfrescoUrl(), NODE_PREFIX + nodeId); - client.close(); - return doGetRequest(username, password, requestURL); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodePropertiesAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodePropertiesAPI.java deleted file mode 100644 index f23470ab44..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodePropertiesAPI.java +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.v0; - -import java.io.IOException; -import java.text.MessageFormat; - -import org.alfresco.dataprep.AlfrescoHttpClient; -import org.alfresco.dataprep.AlfrescoHttpClientFactory; -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.utility.model.UserModel; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.util.EntityUtils; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.JSONValue; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * The v0 API to get the node properties - * - * @since AGS 3.4 - */ -@Component -public class NodePropertiesAPI extends BaseAPI -{ - /** - * The URI for the get node API. - */ - private static final String GET_NODE_API = "{0}alfresco/s/slingshot/node/{1}"; - - @Autowired - private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - - /** - * Get the node properties - * - * @param username - * @param password - * @param nodeId - * @return JSONArray object - */ - protected JSONArray getNodeProperties(String username, String password, String nodeId) - { - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - String requestURL = MessageFormat.format(GET_NODE_API, client.getAlfrescoUrl(), NODE_PREFIX + nodeId); - - // doRequest from BaseAPI cannot be used as parsing the response body to org.json.JSONObject is throwing an - // JSONException - // construct a get request - HttpGet get = new HttpGet(requestURL); - HttpResponse response = client.execute(username, password, get); - HttpEntity entity = response.getEntity(); - String responseString; - try - { - responseString = EntityUtils.toString(entity, "UTF-8"); - } - catch (IOException e) - { - throw new IllegalArgumentException("Failed to read the response", e); - } - client.close(); - Object obj = JSONValue.parse(responseString); - JSONObject jsonObject = (JSONObject) obj; - return (JSONArray) jsonObject.get("properties"); - } - - /** - * Get the content url (bin name) for a node - * - * @param userModel - * @param nodeId - * @return Return the content url string - */ - public String getContentUrl(UserModel userModel, String nodeId) - { - String contentProperty = getContentProperty(userModel, nodeId); - if (contentProperty != null) - { - // get the first element before the first | - // e.g. "contentUrl=s3://-system-/fc077fe8-1742-4c45-a153-8309c857996b - // .bin|mimetype=text/plain|size=19|encoding=ISO-8859-2|locale=en_US_|id=508" - contentProperty = contentProperty.split("\\|")[0]; - return contentProperty.replaceAll("contentUrl=", ""); - } - return null; - } - - /** - * Get the content property for a node - * - * @param userModel - * @param nodeId - * @return Return the content property string - */ - public String getContentProperty(UserModel userModel, String nodeId) - { - JSONArray properties = getNodeProperties(userModel.getUsername(), userModel.getPassword(), nodeId); - - for (int i = 0; i < properties.size(); i++) - { - JSONObject object = (JSONObject) properties.get(i); - JSONArray valuesArray = (JSONArray) object.get("values"); - if (valuesArray.toString().contains("contentUrl")) - { - return ((JSONObject) valuesArray.get(0)).get("value").toString(); - } - } - return null; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java deleted file mode 100644 index 2137594e51..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.testng.Assert.assertTrue; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.text.MessageFormat; -import java.util.List; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.rest.rm.community.model.audit.AuditEntry; -import org.alfresco.rest.rm.community.util.PojoUtility; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * The v0 REST API for rm audit logs - * - * @author Rodica Sutu - * @since 2.7 - */ -@Component -public class RMAuditAPI extends BaseAPI -{ - /** Logger for the class. */ - private static final Logger LOGGER = LoggerFactory.getLogger(RMAuditAPI.class); - - /** The URI for the audit API. */ - private static final String RM_AUDIT_API = "{0}rma/admin/rmauditlog"; - private static final String RM_AUDIT_LOG_API = RM_AUDIT_API + "?{1}"; - - /** - * Returns a list of rm audit entries . - * - * @param user The username of the user to use. - * @param password The password of the user. - * @param size Maximum number of log entries to return - * @param event The name of audit event to be retrieved - * @return return Only return log entries matching this event - */ - public List getRMAuditLog(String user, String password, final int size, final String event) - { - String parameters = null; - try - { - parameters = "size=" + size + (event != null ? "&event=" + URLEncoder.encode(event, "UTF-8"):""); - } - catch (UnsupportedEncodingException e) - { - LOGGER.error("Unable to encode the event name {}", e.getMessage()); - } - JSONArray auditEntries = doGetRequest(user, password, - MessageFormat.format(RM_AUDIT_LOG_API,"{0}", parameters)).getJSONObject("data").getJSONArray("entries"); - - return PojoUtility.jsonToObject(auditEntries, AuditEntry.class); - } - - /** - * Clear the list of audit entries. - * - * @param username The username of the user to use. - * @param password The password of the user. - * @throws AssertionError If the API call didn't clear the audit log. - */ - public void clearAuditLog(String username, String password) - { - JSONObject deleteStatus = doDeleteRequest(username, password, RM_AUDIT_API); - - assertTrue(deleteStatus != null - //audit clear and login events are returned - && getRMAuditLog(username, password, 100, null).size() == 2); - } - - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java deleted file mode 100644 index 7f524b0121..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMRolesAndActionsAPI.java +++ /dev/null @@ -1,486 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.alfresco.dataprep.AlfrescoHttpClient.MIME_TYPE_JSON; -import static org.alfresco.rest.core.v0.APIUtils.ISO_INSTANT_FORMATTER; -import static org.apache.http.HttpStatus.SC_OK; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.fail; - -import java.io.IOException; -import java.text.MessageFormat; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.util.Arrays; -import java.util.Map; -import java.util.Set; - -import org.alfresco.dataprep.AlfrescoHttpClient; -import org.alfresco.dataprep.AlfrescoHttpClientFactory; -import org.alfresco.dataprep.UserService; -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.rest.core.v0.RMEvents; -import org.alfresco.utility.data.DataUserAIS; -import org.apache.chemistry.opencmis.client.api.CmisObject; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHeader; -import org.apache.http.protocol.HTTP; -import org.apache.http.util.EntityUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Methods to make API requests using v0 API on RM items (move, update and other actions) including adding users to RM roles - * - * @author Oana Nechiforescu - * @since 2.5 - */ -@Component -public class RMRolesAndActionsAPI extends BaseAPI -{ - /** The URI to view the configured roles and capabilities. */ - private static final String RM_ROLES = "{0}rma/admin/rmroles"; - /** The URI for REST requests about a particular configured role. */ - private static final String RM_ROLES_ROLE = RM_ROLES + "/{1}"; - private static final String RM_ROLES_AUTHORITIES = "{0}rm/roles/{1}/authorities/{2}?alf_ticket={3}"; - - // logger - private static final Logger LOGGER = LoggerFactory.getLogger(RMRolesAndActionsAPI.class); - private static final String MOVE_ACTIONS_API = "action/rm-move-to/site/rm/documentLibrary/{0}"; - - /** http client factory */ - @Autowired - private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - - /** user service */ - @Autowired - private UserService userService; - - @Autowired - private DataUserAIS dataUser; - /** - * Get all the configured RM roles. - * - * @param adminUser The RM admin user. - * @param adminPassword The password of the user. - * @return The RM roles in the system (Note that this will be the internal names, not the display labels). - */ - public Set getConfiguredRoles(String adminUser, String adminPassword) - { - // Using "is=true" includes the in-place readers and writers. - final JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject( - "data"); - return jsonObject.toMap().keySet(); - } - - /** - * Get the capabilities for a given role. - * - * @param adminUser The RM admin user. - * @param adminPassword The password of the user. - * @param role The role to get capabilities for. - * @return The set of system names for the capabilities. - */ - public Set getCapabilitiesForRole(String adminUser, String adminPassword, String role) - { - final JSONObject jsonObject = doGetRequest(adminUser, adminPassword, RM_ROLES + "?is=true").getJSONObject( - "data"); - assertTrue("Could not find role '" + role + "' in " + jsonObject.keySet(), jsonObject.has(role)); - return jsonObject.getJSONObject(role).getJSONObject("capabilities").keySet(); - } - - /** - * Creates the body for PUT/POST Roles API requests - * - * @param roleName the role name - * @param roleDisplayLabel a human-readable label for the role - * @param capabilities a list of capabilities for the role - * @return - */ - private JSONObject roleRequestBody(String roleName, String roleDisplayLabel, Set capabilities) - { - final JSONObject requestBody = new JSONObject(); - requestBody.put("name", roleName); - requestBody.put("displayLabel", roleDisplayLabel); - final JSONArray capabilitiesArray = new JSONArray(); - capabilities.forEach(capabilitiesArray::put); - requestBody.put("capabilities", capabilitiesArray); - return requestBody; - } - - /** - * Create a new RM role. - * - * @param adminUser The username of the admin user. - * @param adminPassword The password for the admin user. - * @param roleName The name of the new role. - * @param roleDisplayLabel A human-readable label for the role. - * @param capabilities A list of capabilities for the role. - */ - public void createRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set capabilities) - { - doPostJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, roleRequestBody(roleName, roleDisplayLabel, capabilities), - RM_ROLES); - } - - /** - * Update an existing RM role. - * - * @param adminUser The username of the admin user. - * @param adminPassword The password for the admin user. - * @param roleName The name of the new role. - * @param roleDisplayLabel A human-readable label for the role. - * @param capabilities A list of capabilities for the role. - */ - public void updateRole(String adminUser, String adminPassword, String roleName, String roleDisplayLabel, Set capabilities) - { - doPutJsonRequest(adminUser, adminPassword, HttpStatus.SC_OK, roleRequestBody(roleName, roleDisplayLabel, capabilities), - RM_ROLES_ROLE, roleName); - } - - /** - * Delete a created RM role. - * - * @param adminUser The username of the admin user. - * @param adminPassword The password for the admin user. - * @param roleName The name of the role to be deleted. - */ - public void deleteRole(String adminUser, String adminPassword, String roleName) - { - doDeleteRequest(adminUser, adminPassword, MessageFormat.format(RM_ROLES_ROLE, "{0}", roleName)); - assertFalse("Failed to delete role " + roleName + " with " + adminUser, - getConfiguredRoles(adminUser, adminPassword).contains(roleName)); - } - - /** - * create user and assign to records management role - */ - public void createUserAndAssignToRole( - String adminUser, - String adminPassword, - String userName, - String password, - String role) - { - if (!userService.userExists(adminUser, adminPassword, userName)) - { - dataUser.createUser(userName, password); - - } - assignRoleToUser(adminUser, adminPassword, userName, role); - } - - /** - * Assign a records management role to a user. - * - * @throws AssertionError if the assignation is unsuccessful. - */ - public void assignRoleToUser(String adminUser, String adminPassword, String userName, String role) - { - final AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - final String reqURL = MessageFormat.format( - RM_ROLES_AUTHORITIES, - client.getApiUrl(), - role, - userName, - client.getAlfTicket(adminUser, adminPassword)); - - HttpPost request = null; - HttpResponse response; - try - { - request = new HttpPost(reqURL); - response = client.execute(adminUser, adminPassword, request); - } - finally - { - if (request != null) - { - request.releaseConnection(); - } - client.close(); - } - assertEquals("Assigning role " + role + " to user " + userName + " failed.", SC_OK, - response.getStatusLine().getStatusCode()); - } - - /** - * Move action - * - * @param user the user to move the contentPath - * @param password the user's password - * @param contentPath path to the content to be moved - * @param destinationPath destination path - * @throws AssertionError if the move was unsuccessful. - */ - public void moveTo(String user, String password, String contentPath, String destinationPath) - { - String contentNodeRef = getNodeRefSpacesStore() + getItemNodeRef(user, password, contentPath); - AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - String url = MessageFormat.format(client.getAlfrescoUrl() + "alfresco/s/slingshot/doclib/" + MOVE_ACTIONS_API, destinationPath); - HttpPost request = new HttpPost(url); - - boolean success = false; - try - { - JSONObject body = new JSONObject(); - body.put("nodeRefs", new JSONArray(Arrays.asList(contentNodeRef))); - StringEntity se = new StringEntity(body.toString(), AlfrescoHttpClient.UTF_8_ENCODING); - se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, MIME_TYPE_JSON)); - request.setEntity(se); - - HttpResponse response = client.execute(user, password, request); - switch (response.getStatusLine().getStatusCode()) - { - case HttpStatus.SC_OK: - JSONObject json = new JSONObject(EntityUtils.toString(response.getEntity())); - success = (Boolean) json.get("overallSuccess"); - break; - case HttpStatus.SC_NOT_FOUND: - LOGGER.info("The provided paths couldn't be found " + response.toString()); - break; - default: - LOGGER.error("Unable to move: " + response.toString()); - break; - } - } - catch (JSONException | IOException e) - { - LOGGER.error(e.toString()); - } - finally - { - if (request != null) - { - request.releaseConnection(); - } - client.close(); - } - - assertTrue("Moving " + contentPath + " to " + destinationPath + " failed.", success); - } - - /** - * Move action - * - * @param user the user to move the contentPath - * @param password the user's password - * @param contentPath path to the content to be moved - * @param destinationPath destination path - * @throws AssertionError if the move was unexpectedly successful. - */ - public void moveToAndExpectFailure(String user, String password, String contentPath, String destinationPath) - { - try - { - moveTo(user, password, contentPath, destinationPath); - } - catch(AssertionError e) - { - // We are expecting the move to fail. - return; - } - fail("Moving " + contentPath + " to " + destinationPath + " succeeded unexpectedly."); - } - - /** - * Perform an action on the given content - * - * @param user the user executing the action - * @param password the user's password - * @param contentName the content name - * @return The HTTP response. - */ - public HttpResponse executeAction(String user, String password, String contentName, RM_ACTIONS action) - { - return executeAction(user, password, contentName, action, null, SC_OK); - } - /** - * Perform an action on the given content - * - * @param user the user executing the action - * @param password the user's password - * @param contentName the content name - * @return The HTTP response. - */ - public HttpResponse executeActionAndExpectResponseCode(String user, String password, String contentName, RM_ACTIONS action, - int status) - { - return executeAction(user, password, contentName, action, null, status); - } - - /** - * Perform an action on the given content - * - * @param user the user executing the action - * @param password the user's password - * @param contentName the content name - * @return The HTTP response. - */ - public HttpResponse executeAction(String user, String password, String contentName, RM_ACTIONS action, - ZonedDateTime date) - { - return executeAction(user, password, contentName, action, date, SC_OK); - } - - /** - * Creates the body for Actions API requests - * - * @param user the user executing the action - * @param password the user's password - * @param contentName the content on which the action is executed - * @param action the action executed - * @param actionsParams the request parameters - * @return the JSONObject created - */ - private JSONObject actionsRequestBody(String user, String password, String contentName, RM_ACTIONS action, - JSONObject actionsParams) - { - final String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, contentName); - final JSONObject requestParams = new JSONObject(); - requestParams.put("name", action.getAction()); - requestParams.put("nodeRef", recNodeRef); - if (actionsParams != null) - { - requestParams.put("params", actionsParams); - } - return requestParams; - } - - /** - * Perform an action on the record folder - * - * @param user the user executing the action - * @param password the user's password - * @param contentName the content name - * @param date the date to be updated - * @return The HTTP response. - */ - public HttpResponse executeAction(String user, String password, String contentName, RM_ACTIONS action, - ZonedDateTime date, int status) - { - final JSONObject actionParams = new JSONObject(); - if (date != null) - { - actionParams.put("asOfDate", new JSONObject().put("iso8601", ISO_INSTANT_FORMATTER.format(date))); - } - final JSONObject requestParams = actionsRequestBody(user, password, contentName, action, actionParams); - return doPostJsonRequest(user, password, status, requestParams, RM_ACTIONS_API); - } - - /** - * Complete an event on the record/record folder - * - * @param user the user executing the action - * @param password the user's password - * @param nodeName the node name - * @param event the event to be completed - * @param date the date to be updated - * @return The HTTP response. - */ - public HttpResponse completeEvent(String user, String password, String nodeName, RMEvents event, Instant date) - { - date = (date != null) ? date : Instant.now(); - final JSONObject actionParams = new JSONObject().put("eventName", event.getEventName()) - .put("eventCompletedBy", user) - .put("eventCompletedAt", new JSONObject() - .put("iso8601", ISO_INSTANT_FORMATTER.format(date)) - ); - final JSONObject requestParams = actionsRequestBody(user, password, nodeName, RM_ACTIONS.COMPLETE_EVENT, - actionParams); - return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); - } - - /** - * Undo an event on the record/record folder - * - * @param user the user executing the action - * @param password the user's password - * @param contentName the content name - * @param event the event to be undone - * @return The HTTP response. - */ - public HttpResponse undoEvent(String user, String password, String contentName, RMEvents event) - { - final JSONObject requestParams = actionsRequestBody(user, password, contentName, RM_ACTIONS.UNDO_EVENT, - new JSONObject().put("eventName", event.getEventName())); - return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); - } - - /** - * Deletes every item in the given container - * - * @param username the user's username - * @param password its password - * @param siteId the site id in which the container is located - * @param containerName the container to look for items into - * @throws AssertionError if not all items could be deleted. - */ - public void deleteAllItemsInContainer(String username, String password, String siteId, String containerName) - { - for (CmisObject item : contentService.getFolderObject(contentService.getCMISSession(username, password), siteId, containerName).getChildren()) - { - item.delete(); - } - assertFalse("Not all items were deleted from " + containerName, - contentService.getFolderObject(contentService.getCMISSession(username, password), siteId, containerName).getChildren().getHasMoreItems()); - } - - /** - * Updates metadata, can be used on records, folders and categories - * - * @param username the user updating the item - * @param password the user's password - * @param itemNodeRef the item noderef - * @return The HTTP response. - */ - public HttpResponse updateMetadata(String username, String password, String itemNodeRef, Map properties) - { - JSONObject requestParams = new JSONObject(); - addPropertyToRequest(requestParams, "prop_cm_name", properties, RMProperty.NAME); - addPropertyToRequest(requestParams, "prop_cm_title", properties, RMProperty.TITLE); - addPropertyToRequest(requestParams, "prop_cm_description", properties, RMProperty.DESCRIPTION); - addPropertyToRequest(requestParams, "prop_cm_author", properties, RMProperty.AUTHOR); - addPropertyToRequest(requestParams, "prop_dod_originator", properties, RMProperty.ORIGINATOR); - addPropertyToRequest(requestParams, "prop_dod_originatingOrganization", properties, RMProperty - .ORIGINATING_ORGANIZATION); - addPropertyToRequest(requestParams, "prop_dod_publicationDate", properties, RMProperty.PUBLICATION_DATE); - - return doPostJsonRequest(username, password, SC_OK, requestParams, MessageFormat.format(UPDATE_METADATA_API, "{0}", itemNodeRef)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordCategoriesAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordCategoriesAPI.java deleted file mode 100644 index efb9783e8c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordCategoriesAPI.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.apache.http.HttpStatus.SC_OK; - -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.apache.http.HttpResponse; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * Methods to make API requests using v0 API on record categories - * - * @author Oana Nechiforescu - * @since 2.5 - */ -@Component -public class RecordCategoriesAPI extends BaseAPI -{ - private static final Logger LOGGER = LoggerFactory.getLogger(RecordCategoriesAPI.class); - private static final String RM_ACTIONS_API = "{0}rma/actions/ExecutionQueue"; - private static final String DISPOSITION_ACTIONS_API = "{0}node/{1}/dispositionschedule/dispositionactiondefinitions"; - private static final String DISPOSITION_SCHEDULE_API = "{0}node/{1}/dispositionschedule"; - - - /** - * Creates a retention schedule for the category given as parameter - * - * @param user the user creating the disposition schedule - * @param password the user's password - * @param categoryName the category name to create the retention schedule for - * @return The HTTP Response. - */ - public HttpResponse createRetentionSchedule(String user, String password, String categoryName) - { - String catNodeRef = getNodeRefSpacesStore() + getItemNodeRef(user, password, "/" + categoryName); - - JSONObject requestParams = new JSONObject(); - requestParams.put("name", "createDispositionSchedule"); - requestParams.put("nodeRef", catNodeRef); - - return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); - } - - /** - * Get the disposition schedule nodeRef - * - * @param user - * @param password - * @param categoryName - * @return the disposition schedule nodeRef - */ - public String getDispositionScheduleNodeRef(String user, String password, String categoryName) - { - String catNodeRef = NODE_PREFIX + getItemNodeRef(user, password, "/" + categoryName); - JSONObject dispositionSchedule = doGetRequest(user, password, MessageFormat.format(DISPOSITION_SCHEDULE_API, "{0}", catNodeRef)); - return dispositionSchedule.getJSONObject("data").getString("nodeRef").replace(getNodeRefSpacesStore(), ""); - } - - /** - * Sets retention schedule authority and instructions, also if it is applied to records or folders - * - * @param user the user creating the disposition schedule - * @param password the user's password - * @param retentionNodeRef the retention nodeRef - * @return The HTTP Response. - */ - public HttpResponse setRetentionScheduleGeneralFields(String user, String password, String retentionNodeRef, Map retentionProperties, Boolean appliedToRecords) - { - String dispRetentionNodeRef = NODE_PREFIX + retentionNodeRef; - - JSONObject requestParams = new JSONObject(); - requestParams.put("prop_rma_dispositionAuthority", getPropertyValue(retentionProperties, RETENTION_SCHEDULE.RETENTION_AUTHORITY)); - requestParams.put("prop_rma_dispositionInstructions", getPropertyValue(retentionProperties, RETENTION_SCHEDULE.RETENTION_INSTRUCTIONS)); - requestParams.put("prop_rma_recordLevelDisposition", appliedToRecords.toString()); - return doPostJsonRequest(user, password, SC_OK, requestParams, MessageFormat.format(UPDATE_METADATA_API, "{0}", dispRetentionNodeRef)); - } - - /** - * Creates a retention schedule steps for the category given as parameter - * - * @param user the user creating the disposition schedule - * @param password the user's password - * @param categoryName the category name to create the retention schedule for - * @return The HTTP Response. - */ - public HttpResponse addDispositionScheduleSteps(String user, String password, String categoryName, Map properties) - { - String catNodeRef = NODE_PREFIX + getItemNodeRef(user, password, "/" + categoryName); - - JSONObject requestParams = new JSONObject(); - addPropertyToRequest(requestParams, "name", properties, RETENTION_SCHEDULE.NAME); - addPropertyToRequest(requestParams, "description", properties, RETENTION_SCHEDULE.DESCRIPTION); - addPropertyToRequest(requestParams, "period", properties, RETENTION_SCHEDULE.RETENTION_PERIOD); - addPropertyToRequest(requestParams, "ghostOnDestroy", properties, RETENTION_SCHEDULE.RETENTION_GHOST); - addPropertyToRequest(requestParams, "periodProperty", properties, RETENTION_SCHEDULE.RETENTION_PERIOD_PROPERTY); - String events = getPropertyValue(properties, RETENTION_SCHEDULE.RETENTION_EVENTS); - if(!events.equals("")) - { - requestParams.append("events", events); - } - addPropertyToRequest(requestParams, "combineDispositionStepConditions", properties, RETENTION_SCHEDULE.COMBINE_DISPOSITION_STEP_CONDITIONS); - addPropertyToRequest(requestParams, "eligibleOnFirstCompleteEvent", properties, RETENTION_SCHEDULE.RETENTION_ELIGIBLE_FIRST_EVENT); - - return doPostJsonRequest(user, password, SC_OK, requestParams, MessageFormat.format(DISPOSITION_ACTIONS_API, "{0}", catNodeRef)); - } - - /** - * Delete a category - * - * @param username user's username - * @param password its password - * @param categoryName the name of the category - * @throws AssertionError if the delete was unsuccessful. - */ - public void deleteCategory(String username, String password, String categoryName) - { - deleteItem(username, password, "/" + categoryName); - } - - /** - * Delete a sub-category - * - * @param username user's username - * @param password its password - * @param categoryName the name of the sub-category - * @throws AssertionError if the deletion was unsuccessful. - */ - public void deleteSubCategory(String username, String password, String categoryName, String subCategoryName) - { - deleteItem(username, password, "/" + categoryName + "/" + subCategoryName); - } - - /** - * Delete a folder inside a container in RM site - * - * @param username user's username - * @param password its password - * @param folderName folder name - * @param containerName the name of the category or container sin which the folder is - * @throws AssertionError if the deletion was unsuccessful. - */ - public void deleteFolderInContainer(String username, String password, String folderName, String containerName) - { - deleteItem(username, password, "/" + containerName + "/" + folderName); - } - - /** - * Returns a map of retention properties - * - * @param authority retention authority - * @param instructions retention authority - * @return the map - */ - public Map getRetentionProperties(String authority, String instructions) - { - Map retentionProperties = new HashMap<>(); - retentionProperties.put(RETENTION_SCHEDULE.RETENTION_AUTHORITY, authority); - retentionProperties.put(RETENTION_SCHEDULE.RETENTION_INSTRUCTIONS, instructions); - return retentionProperties; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java deleted file mode 100644 index 7cb196d290..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordFoldersAPI.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.apache.http.HttpStatus.SC_OK; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.apache.http.HttpResponse; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * Methods to make API requests using v0 API on records folders - * - * @author Oana Nechiforescu - * @since 2.5 - */ -@Component -public class RecordFoldersAPI extends BaseAPI -{ - private static final Logger LOGGER = LoggerFactory.getLogger(RecordFoldersAPI.class); - - /** - * Close the record folder - * - * @param user the user closing the folder - * @param password the user's password - * @param recordFolder the record folder name - * @return The HTTP Response (or null if the response could not be understood). - */ - public HttpResponse closeRecordFolder(String user, String password, String recordFolder) - { - String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, recordFolder); - - try - { - JSONObject requestParams = new JSONObject(); - requestParams.put("name", "closeRecordFolder"); - requestParams.put("nodeRef", recNodeRef); - - return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); - } - catch (JSONException error) - { - LOGGER.error("Unable to extract response parameter", error); - } - return null; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java deleted file mode 100644 index 785b9cf3fc..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RecordsAPI.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.apache.http.HttpStatus.SC_OK; -import static org.testng.AssertJUnit.assertTrue; - -import java.text.MessageFormat; -import java.util.Map; - -import org.alfresco.dataprep.CMISUtil.DocumentType; -import org.alfresco.rest.core.v0.BaseAPI; -import org.apache.chemistry.opencmis.client.api.CmisObject; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.http.HttpResponse; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * Methods to make API requests using v0 API on records - * - * @author Oana Nechiforescu - * @since 2.5 - */ -@Component -public class RecordsAPI extends BaseAPI -{ - // logger - private static final Logger LOGGER = LoggerFactory.getLogger(RecordsAPI.class); - - private static final String CREATE_NON_ELECTRONIC_RECORD_API = "{0}type/rma:nonElectronicDocument/formprocessor"; - - /** - * Declare documents as records - * - * @param user the user declaring the document as record - * @param password the user's password - * @param siteID the site id in which the document exists - * @param documentName the document name - * @return The HTTP Response. - */ - public HttpResponse declareDocumentAsRecord(String user, String password, String siteID, String documentName) - { - String docNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, siteID, documentName); - - JSONObject requestParams = new JSONObject(); - requestParams.put("actionedUponNode", docNodeRef); - requestParams.put("actionDefinitionName", "create-record"); - - return doPostJsonRequest(user, password, SC_OK, requestParams, ACTIONS_API); - } - - /** - * Completes the record given as parameter - * - * @param user the user declaring the document as record - * @param password the user's password - * @param recordName the record name - * @return The HTTP Response. - */ - public HttpResponse completeRecord(String user, String password, String recordName) - { - String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, recordName); - - JSONObject requestParams = new JSONObject(); - requestParams.put("name", "declareRecord"); - requestParams.put("nodeRef", recNodeRef); - - return doPostJsonRequest(user, password, SC_OK, requestParams, RM_ACTIONS_API); - } - - /** - * Reject the record given as parameter - * - * @param user the user declaring the document as record - * @param password the user's password - * @param recordName the record name - * @param reason reject reason - * @return The HTTP Response. - * @throws AssertionError If the POST call is not successful. - */ - public HttpResponse rejectRecord(String user, String password, String recordName, String reason) - { - return rejectRecord(user, password, SC_OK, recordName, reason); - } - - /** - * Reject the record given as parameter - * - * @param user the user declaring the document as record - * @param password the user's password - * @param expectedStatusCode The expected return status code. - * @param recordName the record name - * @param reason reject reason - * @return The HTTP Response. - * @throws AssertionError If the expectedStatusCode was not returned. - */ - public HttpResponse rejectRecord(String user, String password, int expectedStatusCode, String recordName, String reason) - { - String recNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, RM_SITE_ID, recordName); - - JSONObject requestParams = new JSONObject(); - requestParams.put("name", "reject"); - requestParams.put("nodeRef", recNodeRef); - requestParams.put("params",new JSONObject() - .put("reason",reason)); - - return doPostJsonRequest(user, password, expectedStatusCode, requestParams, RM_ACTIONS_API); - } - - /** - * Declare document version as record - * - * @param user the user declaring the document version as record - * @param password the user's password - * @param siteID the site id in which the document exists - * @param documentName the document name - * @return The HTTP Response. - */ - public HttpResponse declareDocumentVersionAsRecord(String user, String password, String siteID, String documentName) - { - String docNodeRef = getNodeRefSpacesStore() + contentService.getNodeRef(user, password, siteID, documentName); - - JSONObject requestParams = new JSONObject(); - requestParams.put("actionedUponNode", docNodeRef); - requestParams.put("actionDefinitionName", "declare-as-version-record"); - - return doPostJsonRequest(user, password, SC_OK, requestParams, ACTIONS_API); - } - - /** - * Creates a non-electronic record - *
    - *
  • eg. of usage for Unfiled records with folder : createNonElectronicRecord(getAdminName(), getAdminPassword(), properties, UNFILED_RECORDS_BREADCRUMB, "unfiled records folder"); - *
  • eg. of usage for creating record directly in Unfiled Records : createNonElectronicRecord(getAdminName(), getAdminPassword(), properties, UNFILED_RECORDS_BREADCRUMB, ""); - *
- * - * @param username the username - * @param password the password - * @param properties a map of record properties and their values - * @param categoryName the category that contains the record, in the case in which the container would be Unfiled records use UNFILED_RECORDS_BREADCRUMB as value - * @param folderName the folder inside which the record exists, in the case in which the folder name is "", the record will be created directly in the specified container - * this case is useful when trying to create a record directly in Unfiled Records - * @return The HTTP Response (or null if the request was not needed). - */ - public > HttpResponse createNonElectronicRecord(String username, String password, Map properties, String categoryName, String folderName) - { - String recordName = properties.get(RMProperty.NAME); - if (getRecord(username, password, folderName, recordName) != null) - { - return null; - } - String recordPath = "/" + categoryName; - if (!folderName.equals("")) - { - recordPath = recordPath + "/" + folderName; - } - // if the record already exists don't try to create it again - CmisObject record = getObjectByPath(username, password, getFilePlanPath() + recordPath + "/" + recordName); - - if (record != null) - { - return null; - } - // non-electronic properties - String recordTitle = getPropertyValue(properties, RMProperty.TITLE); - String description = getPropertyValue(properties, RMProperty.DESCRIPTION); - String physicalSize = getPropertyValue(properties, RMProperty.PHYSICAL_SIZE); - String numberOfCopies = getPropertyValue(properties, RMProperty.NUMBER_OF_COPIES); - String shelf = getPropertyValue(properties, RMProperty.SHELF); - String storage = getPropertyValue(properties, RMProperty.STORAGE_LOCATION); - String box = getPropertyValue(properties, RMProperty.BOX); - String file = getPropertyValue(properties, RMProperty.FILE); - - // retrieve the container nodeRef - String parentNodeRef = getItemNodeRef(username, password, recordPath); - - JSONObject requestParams = new JSONObject(); - requestParams.put("alf_destination", getNodeRefSpacesStore() + parentNodeRef); - requestParams.put("prop_cm_name", recordName); - requestParams.put("prop_cm_title", recordTitle); - requestParams.put("prop_cm_description", description); - requestParams.put("prop_rma_physicalSize", physicalSize); - requestParams.put("prop_rma_numberOfCopies", numberOfCopies); - requestParams.put("prop_rma_storageLocation", storage); - requestParams.put("prop_rma_shelf", shelf); - requestParams.put("prop_rma_box", box); - requestParams.put("prop_rma_file", file); - - return doPostJsonRequest(username, password, SC_OK, requestParams, CREATE_NON_ELECTRONIC_RECORD_API); - } - - /** - * Uploads an electronic record - *

- * eg. of usage for creating record directly in Unfiled Records : uploadElectronicRecord(getAdminName(), getAdminPassword(), recordPropertiesStringMap, UNFILED_RECORDS_BREADCRUMB, DocumentType.HTML) - * @param username the username - * @param password the password - * @param properties a map of record properties and their values - * @param folderName the folder inside which the record will be created, it needs to have a unique name, as this method doesn't check other containers than the folder name - * @throws AssertionError if the upload was unsuccessful. - */ - public void uploadElectronicRecord(String username, String password, Map properties, String folderName, DocumentType documentType) - { - String recordName = getPropertyValue(properties, RMProperty.NAME); - String recordContent = getPropertyValue(properties, RMProperty.CONTENT); - boolean success = (getRecord(username, password, folderName, recordName) != null) || (contentService.createDocumentInFolder(username, password, RM_SITE_ID, folderName, documentType, recordName, recordContent) != null); - assertTrue("Failed to upload electronic record to " + folderName, success); - } - - /** - * Delete a record from the given path - *

    - *
  • eg. of usage in the case in which the record is inside a folder in Unfiled Records : deleteRecord(getAdminName(), getAdminPassword(), "f1 (2016-1472716888713)", UNFILED_RECORDS_BREADCRUMB, "unfiled records folder"); - *
  • eg. of usage in the case in which the record is created directly in Unfiled Records : deleteRecord(getAdminName(), getAdminPassword(), "f1 (2016-1472716888713)", UNFILED_RECORDS_BREADCRUMB, ""); - *
- * @param username user's username - * @param password its password - * @param recordName the record name - * @param categoryName the name of the category in which the folder is, in case of unfiled record, this will have UNFILED_RECORDS_BREADCRUMB as container - * @param folderName folder name, in case in which trying to delete a record in Unfiled records directly, this will be "" - * @throws AssertionError If the record could not be deleted. - */ - public void deleteRecord(String username, String password, String recordName, String categoryName, String folderName) - { - String recordPath = "/" + categoryName; - if (!folderName.equals("")) - { - recordPath = recordPath + "/" + folderName; - } - deleteItem(username, password, recordPath + "/" + recordName); - } - - /** - * Retrieves the record object in case it exists - * - * @param username the user's username - * @param password its password - * @param folderName the folder in which the record is supposed to exist - * @param recordName the String with which the record name starts - * @return the record object in case it exists, null otherwise - */ - private CmisObject getRecord(String username, String password, String folderName, String recordName) - { - for (CmisObject record : contentService.getFolderObject(contentService.getCMISSession(username, password), RM_SITE_ID, folderName).getChildren()) - { - if (record.getName().startsWith(recordName)) - { - return record; - } - } - return null; - } - - /** - * Retrieves record full name for given partial name - * - * @param username the user's username - * @param password its password - * @param folderName the folder in which the record is supposed to exist - * @param recordPartialName the String with which the record name starts - * @return the record name in case it exists, empty String otherwise - */ - public String getRecordFullName(String username, String password, String folderName, String recordPartialName) - { - CmisObject record = getRecord(username, password, folderName, recordPartialName); - if (record != null) - { - return record.getName(); - } - return ""; - } - - - /** - * Share a document - * - * @param user the user sharing the file - * @param password the user's password - * @param nodeId the node id of the file - * @return {@link Pair}. on success will be true and the shareId. - * on failure will be false and the response status code. - */ - public Pair shareDocument(String user, String password, String nodeId) throws JSONException - { - JSONObject response = doPostRequest(user, password, null, - MessageFormat.format(SHARE_ACTION_API, "{0}", nodeId)); - try - { - if (response.has("sharedId")) - { - return Pair.of(true, response.getString("sharedId")); - } - } catch (JSONException e) - { - LOGGER.info("Unable to extract response parameter", e); - } - return Pair.of(false, String.valueOf(response.getJSONObject("status").getInt("code"))); - } - - /** - * Hide in place record - * - * @param user the user - * @param password the user's password - * @param nodeId the in place record node id - * @return The HTTP Response. - */ - public HttpResponse hideRecord(String user, String password, String nodeId) - { - String docNodeRef = getNodeRefSpacesStore() + nodeId; - - JSONObject requestParams = new JSONObject(); - requestParams.put("actionedUponNode", docNodeRef); - requestParams.put("actionDefinitionName", "hide-record"); - - return doPostJsonRequest(user, password, SC_OK, requestParams, ACTIONS_API); - } - - /** - * Retrieves the record's nodeRef - * - * @param username the user's username - * @param password its password - * @param recordName the record full name - * @param recordPath the String with which the record name starts - * @return the record nodeRef in case it exists, empty string otherwise - */ - public String getRecordNodeRef(String username, String password, String recordName, String recordPath) - { - return getNodeRefSpacesStore() + getItemNodeRef(username, password, recordPath + "/" + recordName); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RulesAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RulesAPI.java deleted file mode 100644 index 3474c9febc..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RulesAPI.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.v0; - -import static java.util.Arrays.asList; - -import static org.apache.http.HttpStatus.SC_OK; -import static org.testng.AssertJUnit.assertTrue; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.rest.rm.community.model.rules.RuleDefinition; -import org.apache.http.HttpResponse; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * Covers CRUD API operations on rules - */ -@Component -public class RulesAPI extends BaseAPI -{ - - public static final String RULES_API = "{0}node/{1}/ruleset/rules"; - public static final String RULE_API = "{0}node/{1}/ruleset/rules/{2}"; - public static final String INHERIT_RULES_API = "{0}node/{1}/ruleset/inheritrules/toggle"; - public static final String INHERIT_RULES_STATE_API = "{0}node/{1}/ruleset/inheritrules/state"; - // logger - public static final Logger LOGGER = LoggerFactory.getLogger(RulesAPI.class); - - /** - * Creates a rule for the specified container with given rule properties - * - * @param containerNodeRef the container to have the rule created on - * @param ruleProperties the rule properties - * @return The HTTP Response (or null if the response could not be understood). - */ - public HttpResponse createRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties) - { - try - { - return doPostJsonRequest(username, password, SC_OK, getRuleRequest(ruleProperties), MessageFormat.format(RULES_API, "{0}", containerNodeRef)); - } - catch (JSONException error) - { - LOGGER.error("Unable to extract response parameter.", error); - } - return null; - } - - /** - * Updates a rule for the specified container with given rule properties - * - * @param containerNodeRef the container to have the rule created on - * @param ruleProperties the rule properties - * @return true if the rule has been updated successfully, false otherwise - */ - public JSONObject updateRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties) - { - String ruleId = ruleProperties.getId(); - if (ruleId == null || ruleId.isEmpty()) - { - throw new RuntimeException("Can not update a rule without id."); - } - try - { - return doPutRequest(username, password, getRuleRequest(ruleProperties), MessageFormat.format(RULE_API, "{0}", containerNodeRef, ruleId)); - } - catch (JSONException error) - { - LOGGER.error("Unable to extract response parameter.", error); - } - return null; - } - - /** - * Deletes a rule on a container and checks it doesn't exist anymore - * - * @param username the user performing the request - * @param password the password - * @param containerNodeRef the container on which the rule has been created - * @param ruleId the rule id - * @throws AssertionError if the rule could not be deleted. - */ - public void deleteRule(String username, String password, String containerNodeRef, String ruleId) - { - doDeleteRequest(username, password, MessageFormat.format(RULE_API, "{0}", containerNodeRef, ruleId)); - boolean success = !getRulesIdsSetOnContainer(username, password, containerNodeRef).contains(ruleId); - assertTrue("Rule " + ruleId + " was not deleted successfully from " + containerNodeRef, success); - } - - /** - * Deletes all the rules on a container and checks they don't exist anymore - * - * @param username the user performing the request - * @param password the password - * @param containerNodeRef the container on which the rules have been created - * @throws AssertionError if at least one of the rules could not be deleted. - */ - public void deleteAllRulesOnContainer(String username, String password, String containerNodeRef) - { - List ruleIds = getRulesIdsSetOnContainer(username, password, containerNodeRef); - for (String ruleId : ruleIds) - { - deleteRule(username, password, containerNodeRef, ruleId); - } - } - - /** - * Gets all the rules for the specified container with given rule properties - * - * @param username the user performing the request - * @param password the password - * @param containerNodeRef the container to get the rules from - * - * @return list of rules on container - */ - - public List getRulesSetOnContainer(String username, String password, String containerNodeRef) - { - List rulesDefinitions = new ArrayList<>(); - - // get the rules set on the container - JSONObject rulesJson = doGetRequest(username, password, MessageFormat.format(RULES_API, "{0}", containerNodeRef)); - if (rulesJson != null) - { - try - { - JSONArray rules = rulesJson.getJSONArray("data"); - for (int i = 0; i < rules.length(); i++) - { - RuleDefinition ruleDefinition = new RuleDefinition(); - JSONObject rule = rules.getJSONObject(i); - ruleDefinition.id(rule.getString("id")); - ruleDefinition.title(rule.getString("title")); - ruleDefinition.description(rule.getString("description")); - ruleDefinition.ruleType(rule.getJSONArray("ruleType").get(0).toString()); - ruleDefinition.disabled(rule.getBoolean("disabled")); - rulesDefinitions.add(ruleDefinition); - } - } - catch (JSONException error) - { - LOGGER.error("Unable to parse rules.", error); - } - } - return rulesDefinitions; - } - - /** - * Retrieves all the ids of the rules set on the container - * - * @param username the user performing the request - * @param password the password - * @param containerNodeRef the container's noderef to get set rules for - * @return the list of rules ids that the container has - */ - public List getRulesIdsSetOnContainer(String username, String password, String containerNodeRef) - { - return getRulesSetOnContainer(username, password, containerNodeRef).stream().map(RuleDefinition::getId).collect(Collectors.toList()); - } - - /** - * Prepares a request object for rules with given properties - * - * @param ruleProperties the rule properties - * @return a object containing the rule properties for the request - * - * @throws JSONException - */ - private JSONObject getRuleRequest(RuleDefinition ruleProperties) throws JSONException - { - JSONObject requestParams = new JSONObject(); - - // the id has to be sent as empty string no matter the request - requestParams.put("id", ""); - requestParams.put("action", addRulesActions(ruleProperties)); - requestParams.put("title", ruleProperties.getTitle()); - requestParams.put("description", ruleProperties.getDescription()); - requestParams.put("disabled", ruleProperties.isDisabled()); - requestParams.put("applyToChildren", ruleProperties.isApplyToChildren()); - requestParams.put("executeAsynchronously", ruleProperties.getRunInBackground()); - requestParams.put("ruleType", asList(ruleProperties.getRuleType())); - - return requestParams; - } - - /** - * Adds rules actions to the request - * - * @param ruleProperties the rules properties to extract actions from - * - * @return the object with actions set - * - * @throws JSONException - */ - private JSONObject addRulesActions(RuleDefinition ruleProperties) throws JSONException - { - JSONObject action = new JSONObject(); - action.put("actionDefinitionName", "composite-action"); - JSONObject conditions = new JSONObject(); - conditions.put("conditionDefinitionName", "no-condition"); - conditions.put("parameterValues", new JSONObject()); - action.put("conditions", asList(conditions)); - action.put("actions", getRuleActionsList(ruleProperties)); - return action; - } - - /** - * Creates the actions list for request - * - * @param ruleProperties given rule properties - * - * @return the list of rule actions objects - */ - private List getRuleActionsList(RuleDefinition ruleProperties) throws JSONException - { - List ruleActionsList = new ArrayList<>(); - - for (String ruleAction : ruleProperties.getActions()) - { - JSONObject ruleActionObj = new JSONObject(); - ruleActionObj.put("actionDefinitionName", ruleAction); - JSONObject parameters = new JSONObject(); - if (ruleProperties.getPath() != null) - { - if(ruleProperties.getCreateRecordPath() != null) - { - parameters.put("createRecordPath", ruleProperties.getCreateRecordPath()); - } - parameters.put("path", ruleProperties.getPath()); - } - if (ruleProperties.getContentTitle() != null) - { - parameters.put("property", "cm:title"); - parameters.put("value", ruleProperties.getContentTitle()); - parameters.put("prop_type", "d:mltext"); - } - if (ruleProperties.getContentDescription() != null) - { - parameters.put("property", "cm:description"); - parameters.put("value", ruleProperties.getContentDescription()); - parameters.put("prop_type", "d:mltext"); - } - if (ruleProperties.getRejectReason() != null) - { - parameters.put("reason", ruleProperties.getRejectReason()); - } - ruleActionObj.put("parameterValues", parameters); - ruleActionsList.add(ruleActionObj); - } - return ruleActionsList; - } - - /** - * Returns the rule id for the give rule title set on a container - * - * @param username the user performing the request - * @param password the password - * @param containerNodeRef container nodeRef - * - * @return the rule id - */ - public String getRuleIdWithTitle(String username, String password, String containerNodeRef, String title) - { - return getRulesSetOnContainer(username, password, containerNodeRef).stream().filter( - rule -> rule.getTitle().equals(title)).findAny().get().getId(); - } - - /** - * Disable inheritance on specific container - * - * @param username the username - * @param password the password - * @param containerNodeRef the container nodeRef - * - * @return The HTTP Response (or null if the current state is disabled). - */ - public HttpResponse disableRulesInheritance(String username, String password, String containerNodeRef) - { - if(containerInheritsRulesFromParent(username, password, containerNodeRef)) - { - return doPostJsonRequest(username, password, SC_OK, new JSONObject(), MessageFormat.format(INHERIT_RULES_API, "{0}", containerNodeRef)); - } - return null; - } - - /** - * Enable inheritance on specific container - * - * @param username the username - * @param password the password - * @param containerNodeRef the container nodeRef - * @return The HTTP Response (or null if the current state is disabled). - */ - public HttpResponse enableRulesInheritance(String username, String password, String containerNodeRef) - { - if (!containerInheritsRulesFromParent(username, password, containerNodeRef)) - { - return doPostJsonRequest(username, password, SC_OK, new JSONObject(), MessageFormat.format(INHERIT_RULES_API, "{0}", containerNodeRef)); - } - return null; - } - - /** - * Returns the rules inheritance state of the container - * - * @param username the username - * @param password the password - * @param containerNodeRef the container nodeRef - * - * @return a boolean specifying if the container inherits rules from parent - * @throws JSONException - */ - public boolean containerInheritsRulesFromParent(String username, String password, String containerNodeRef) throws JSONException - { - JSONObject rulesInheritanceInfo = doGetRequest(username, password, MessageFormat.format(INHERIT_RULES_STATE_API, "{0}", containerNodeRef)); - return rulesInheritanceInfo.getJSONObject("data").getBoolean("inheritRules"); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java deleted file mode 100644 index 01844820f5..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.dataprep.AlfrescoHttpClientFactory; -import org.alfresco.rest.core.v0.BaseAPI; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.message.BasicNameValuePair; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Helper methods for performing search using various Alfresco search APIs. - * - * @author Kristijan Conkas - * @since 2.5 - */ -@Component -public class SearchAPI extends BaseAPI -{ - /** http client factory */ - @Autowired - private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - - /** faceted search API endpoint */ - private static final String FACETED_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/faceted/rmsearch?{1}"; - - /** share live search API endpoint */ - private static final String SHARE_LIVE_SEARCH_DOCS_ENDPOINT = "{0}alfresco/s/slingshot/live-search-docs?{1}"; - - /** RM search URL template */ - private static final String RM_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/{1}?{2}"; - - /** RM all nodes search filters */ - private static final String RM_DEFAULT_NODES_FILTERS = - "records/true,undeclared/true,vital/false,folders/{0},categories/{1},frozen/false,cutoff/false"; - - /** - * Perform search request on search endpoint as a user. - *

- * This method is applicable only to endpoints that support HTTP GET requests and return JSON body as response. - * @param searchEndpoint - * @param searchUser - * @param searchPassword - * @return search results as a {@link JSONObject}, please refer to API documentation for details - */ - private JSONObject doSearch( - String searchEndpoint, - String searchUser, - String searchPassword) - { - return facetedRequest(searchUser, searchPassword, null, searchEndpoint); - } - - /** - * Generic rm search. - * @param username - * @param password - * @param site - * @param query - * @param filters - * @param sortby - * @return search results (see API reference for more details), null for any errors - */ - public JSONObject rmSearch( - String username, - String password, - String site, - String query, - String filters, - String sortby) - { - List searchParameters = new ArrayList<>(); - searchParameters.add(new BasicNameValuePair("query", query)); - searchParameters.add(new BasicNameValuePair("filters", filters)); - if (sortby != null) - { - searchParameters.add(new BasicNameValuePair("sortby", sortby)); - } - - String requestURL = MessageFormat.format( - RM_SEARCH_ENDPOINT, - alfrescoHttpClientFactory.getObject().getAlfrescoUrl(), - (site != null) ? site : RM_SITE_ID, - URLEncodedUtils.format(searchParameters, "UTF-8")); - - return doSearch(requestURL, username, password); - } - - /** - * Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted - * by sortby - *
- * - * @param username - * @param password - * @param query - * @param sortby - * @return list of node names - */ - - public List searchForNodeNamesAsUser(String username, String password, String query, String sortby, - boolean includeCategories, boolean includeFolders) - { - String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_NODES_FILTERS, Boolean.toString(includeFolders), - Boolean.toString(includeCategories)); - - return getItemNames(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby)); - } - - /** - * Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted - * by sortby and returns the property value for the given nodeRef and property name - * - * @param username - * @param password - * @param query - * @param sortby - * @param includeCategories - * @param includeFolders - * @return list of node properties - */ - public String searchForNodePropertyAsUser(String username, String password, String nodeRef, String propertyName, String query, String sortby, - boolean includeCategories, boolean includeFolders) - { - String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_NODES_FILTERS, Boolean.toString(includeFolders), - Boolean.toString(includeCategories)); - return getItemProperty(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby), nodeRef, propertyName); - } - - /** - * Generic faceted search. - * @param username - * @param password - * @param parameters - * @return search results (see API reference for more details), null for any errors - */ - public JSONObject facetedSearch(String username, String password, List parameters) - { - return facetedRequest(username, password, parameters, FACETED_SEARCH_ENDPOINT); - } - - /** - * Execute share live search for documents. - * - * @param searchUser - * @param searchPassword - * @param searchTerm - * @return search results (see API reference for more details) - */ - public JSONObject liveSearchForDocuments(String searchUser, String searchPassword, String searchTerm) - { - return facetedRequest(searchUser, searchPassword, Arrays.asList(new BasicNameValuePair("t", searchTerm)), - SHARE_LIVE_SEARCH_DOCS_ENDPOINT); - } - - /** - * Execute faceted search for term. - * @param searchUser - * @param searchPassword - * @param searchTerm - * @return search results (see API reference for more details) - */ - public JSONObject facetedSearchForTerm(String searchUser, String searchPassword, String searchTerm) - { - return facetedSearch( - searchUser, - searchPassword, - Arrays.asList(new BasicNameValuePair("term", searchTerm))); - } - - /** - * Helper method to search for documents as a user using faceted search. - * @param username to search as - * @param password for username - * @param term search term - * @return list of document names found - */ - public List searchForDocumentsAsUser(String username, String password, String term) - { - return getItemNames(facetedSearchForTerm(username, password, term)); - } - - /** - * Helper method to search for documents as a user using share live search. - * @param username to search as - * @param password for username - * @param term search term - * @return list of document names found - */ - public List liveSearchForDocumentsAsUser(String username, String password, String term) throws JSONException - { - JSONObject searchResult = liveSearchForDocuments(username, password, term); - LOGGER.info(searchResult.toString(3)); - return getItemNames(searchResult); - } - - /** - * Helper method to extract list of names from search result. - * - * @param searchResult - * @return list of document or record names in search result - * @throws FileNotFoundException - * @throws JsonSyntaxException - * @throws JsonIOException - * @throws RuntimeException for malformed search response - */ - /** - * Helper method to extract list of names from search result. - * - * @param searchResult - * @return - */ - private List getItemNames(JSONObject searchResult) - { - return getPropertyValues(searchResult, "name"); - } - - /** - * Helper method to extract list of property values from search result for the given nodeRef. - * - * @param searchResult - * @param nodeRef - * @param propertyName - * @return - */ - private String getItemProperty(JSONObject searchResult, String nodeRef, String propertyName) - { - return getPropertyValue(searchResult, nodeRef, propertyName); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java deleted file mode 100644 index 5bb286e98f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0; - -import static org.testng.AssertJUnit.assertNotNull; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.springframework.stereotype.Component; - -/** - * Helper methods for performing actions on user trashcan - * - * @author Oana Nechiforescu - * @since 2.6 - */ -@Component -public class UserTrashcanAPI extends BaseAPI -{ - private static final String EMPTY_TRASHCAN = "{0}archive/workspace/SpacesStore"; - - /** - * Clears the trashcan for the current user - * - * @param username the username - * @param password the password - * @throws AssertionError if emptying the trashcan fails. - */ - public void emptyTrashcan(String username, String password) - { - assertNotNull("Emptying trashcan failed for user " + username, - doDeleteRequest(username, password, EMPTY_TRASHCAN)); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java deleted file mode 100644 index 9fa6db0860..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0.service; - - -import java.util.HashMap; - -import org.alfresco.rest.core.v0.BaseAPI; -import org.alfresco.rest.v0.RecordCategoriesAPI; -import org.alfresco.utility.data.DataUserAIS; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Service for different disposition schedule actions - * - * @author jcule, cagache - * @since 2.6.2 - */ -@Service -public class DispositionScheduleService extends BaseAPI -{ - @Autowired - private RecordCategoriesAPI recordCategoriesAPI; - - @Autowired - private DataUserAIS dataUser; - - /** - * Helper method for adding a retain after period step - * - * @param categoryName the category in whose schedule the step will be added - * @param period - */ - public void addRetainAfterPeriodStep(String categoryName, String period) - { - HashMap retainStep = new HashMap<>(); - retainStep.put(RETENTION_SCHEDULE.NAME, "retain"); - retainStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period); - retainStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Retain after a period step"); - recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), categoryName, retainStep); - } - - /** - * Helper method for adding a cut off after period step - * - * @param categoryName the category in whose schedule the step will be added - * @param period - */ - public void addCutOffAfterPeriodStep(String categoryName, String period) - { - HashMap cutOffStep = new HashMap<>(); - cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff"); - cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period); - cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after a period step"); - recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), categoryName, cutOffStep); - } - - /** - * Helper method for adding a destroy with ghosting after period - * - * @param categoryName the category in whose schedule the step will be added - * @param period - */ - public void addDestroyWithGhostingAfterPeriodStep(String categoryName, String period) - { - HashMap destroyStep = new HashMap<>(); - destroyStep.put(RETENTION_SCHEDULE.NAME, "destroy"); - destroyStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period); - destroyStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Destroy after a period step"); - destroyStep.put(RETENTION_SCHEDULE.RETENTION_GHOST, "on"); - recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), categoryName, destroyStep); - } - - /** - * Helper method for adding a cut off after an event occurs step - * - * @param categoryName the category in whose schedule the step will be added - * @param events - */ - public void addCutOffAfterEventStep(String categoryName, String events) - { - HashMap cutOffStep = new HashMap<>(); - cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff"); - cutOffStep.put(RETENTION_SCHEDULE.RETENTION_EVENTS, events); - cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after event step"); - - recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), categoryName, cutOffStep); - } - - /** - * Helper method for adding an accession step - * - * @param timeOrEvent - * @param events - * @param period - * @param periodProperty - * @param combineConditions - * @return - */ - public void addAccessionStep(String categoryName, Boolean timeOrEvent, String events, String period, String - periodProperty, Boolean combineConditions) - { - HashMap accessionStep = new HashMap<>(); - accessionStep.put(RETENTION_SCHEDULE.NAME, "accession"); - accessionStep.put(RETENTION_SCHEDULE.COMBINE_DISPOSITION_STEP_CONDITIONS, Boolean.toString(combineConditions)); - accessionStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period); - accessionStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD_PROPERTY, periodProperty); - if (!timeOrEvent) - { - accessionStep.put(RETENTION_SCHEDULE.RETENTION_ELIGIBLE_FIRST_EVENT, Boolean.toString(timeOrEvent)); - } - accessionStep.put(RETENTION_SCHEDULE.RETENTION_EVENTS, events); - accessionStep.put(RETENTION_SCHEDULE.DESCRIPTION, - "Accession step with time and event conditions."); - recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), categoryName, accessionStep); - } - - /** - * Helper method to create retention schedule with general fields for the given category as admin - * and apply it to the records - * - * @param categoryName - * @param appliedToRecords - */ - public void createCategoryRetentionSchedule(String categoryName, Boolean appliedToRecords) - { - recordCategoriesAPI.createRetentionSchedule(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), categoryName); - String retentionScheduleNodeRef = recordCategoriesAPI.getDispositionScheduleNodeRef( - dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), categoryName); - - HashMap retentionScheduleGeneralFields = new HashMap<>(); - retentionScheduleGeneralFields.put(RETENTION_SCHEDULE.RETENTION_AUTHORITY, "Authority"); - retentionScheduleGeneralFields.put(RETENTION_SCHEDULE.RETENTION_INSTRUCTIONS, "Instructions"); - recordCategoriesAPI.setRetentionScheduleGeneralFields(dataUser.getAdminUser().getUsername(), - dataUser.getAdminUser().getPassword(), retentionScheduleNodeRef, retentionScheduleGeneralFields, - appliedToRecords); - - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java deleted file mode 100644 index 32b5b2072f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0.service; - -import static java.time.temporal.ChronoUnit.MINUTES; - -import static org.alfresco.utility.report.log.Step.STEP; -import static org.testng.AssertJUnit.assertTrue; - -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.List; - -import org.alfresco.rest.rm.community.model.audit.AuditEntry; -import org.alfresco.rest.rm.community.model.audit.AuditEvents; -import org.alfresco.rest.v0.RMAuditAPI; -import org.alfresco.utility.data.DataUserAIS; -import org.alfresco.utility.model.UserModel; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Produces processed results from RM Audit REST API calls - * - * @author Claudia Agache - * @since 3.3 - */ -@Service -public class RMAuditService -{ - @Autowired - private RMAuditAPI rmAuditAPI; - - @Autowired - private DataUserAIS dataUser; - - /** - * Clear the list of audit entries as admin user. - */ - public void clearAuditLog() - { - STEP("Clean audit logs."); - rmAuditAPI.clearAuditLog(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword()); - } - - /** - * Returns a list of rm audit entries filtered by given event - * - * @param user the user who requests the list of rm audit entries - * @param auditEvent the event - * @return the list of audit entries matching the event - */ - public List getAuditEntriesFilteredByEvent(UserModel user, AuditEvents auditEvent) - { - STEP("Get the list of audit entries for the " + auditEvent.eventDisplayName + " event."); - return rmAuditAPI.getRMAuditLog(user.getUsername(), user.getPassword(), 100, auditEvent.event); - } - - /** - * Checks the rm audit log contains the entry for the given event. - * - * @param user the user who checks the audit log - * @param auditEvent the audited event - * @param auditUser the user who did the audited event - * @param nodeName the audited node name if exists or empty string - * @param changedValues the values changed by event if exist or empty list - */ - public void checkAuditLogForEvent(UserModel user, AuditEvents auditEvent, UserModel auditUser, - String nodeName, List changedValues) - { - - List auditEntries = getAuditEntriesFilteredByEvent(user, auditEvent); - assertTrue("The list of events is not filtered by " + auditEvent.event, - auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(auditEvent.eventDisplayName))); - final LocalDateTime eventTimestamp = - LocalDateTime.ofInstant(Instant.now(), ZoneId.systemDefault()).truncatedTo(MINUTES); - assertTrue("The event details are not audited", - auditEntries.stream().anyMatch(auditEntry -> auditEntry.getNodeName().equals(nodeName) && - auditEntry.getUserName().equals(auditUser.getUsername()) && - CollectionUtils.isEqualCollection(auditEntry.getChangedValues(), changedValues) && - !auditEntry.getTimestamp().isEmpty() && - (LocalDateTime.ofInstant(Instant.parse(auditEntry.getTimestamp()), ZoneId.systemDefault()).truncatedTo(MINUTES) - .compareTo(eventTimestamp) <= 0)) - ); - } - - /** - * Checks the rm audit log contains the entry for the given event. - * - * @param user the user who checks the audit log - * @param auditEvent the audited event - * @param auditUser the user who did the audited event - * @param nodeName the audited node name if exists or empty string - * @param nodePath the path of the audited node if exists or empty string - * @param changedValues the values changed by event if exist or empty list - */ - public void checkAuditLogForEvent(UserModel user, AuditEvents auditEvent, UserModel auditUser, - String nodeName, String nodePath, List changedValues) - { - List auditEntries = getAuditEntriesFilteredByEvent(user, auditEvent); - assertTrue("The list of events is not filtered by " + auditEvent.event, - auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(auditEvent.eventDisplayName))); - final LocalDateTime eventTimestamp = - LocalDateTime.ofInstant(Instant.now(), ZoneId.systemDefault()).truncatedTo(MINUTES); - assertTrue("The event details are not audited", - auditEntries.stream().anyMatch(auditEntry -> auditEntry.getNodeName().equals(nodeName) && - auditEntry.getUserName().equals(auditUser.getUsername()) && - auditEntry.getPath().equals(nodePath) && - CollectionUtils.isEqualCollection(auditEntry.getChangedValues(), changedValues) && - !auditEntry.getTimestamp().isEmpty() && - (LocalDateTime.ofInstant(Instant.parse(auditEntry.getTimestamp()), ZoneId.systemDefault()).truncatedTo(MINUTES) - .compareTo(eventTimestamp) <= 0)) - ); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java deleted file mode 100644 index afecd9c92b..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.v0.service; - -import static lombok.AccessLevel.PROTECTED; -import static org.springframework.http.HttpStatus.OK; - -import java.util.HashSet; -import java.util.Set; - -import lombok.Getter; -import org.alfresco.rest.core.RestAPIFactory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.v0.RMRolesAndActionsAPI; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.data.DataUser; -import org.alfresco.utility.data.DataUserAIS; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Produces processed results from roles API calls - * - * @author Rodica Sutu - * @since 2.6 - */ -@Service -public class RoleService -{ - @Autowired - @Getter (value = PROTECTED) - private RMRolesAndActionsAPI rmRolesAndActionsAPI; - - @Autowired - @Getter (value = PROTECTED) - private DataUserAIS dataUser; - - @Autowired - @Getter (value = PROTECTED) - private RestAPIFactory restAPIFactory; - - /** - * Get the capabilities for a role - * - * @param roleName the role name - * @return the list of capabilities - */ - public Set getRoleCapabilities(String roleName) - { - return getRmRolesAndActionsAPI().getCapabilitiesForRole(getDataUser().getAdminUser().getUsername(), - getDataUser().getAdminUser().getPassword(), roleName); - } - - /** - * Add capabilities to a role - * - * @param role role to be updated - * @param capabilities list of capabilities to be added - */ - public void addCapabilitiesToRole(UserRoles role, Set capabilities) - { - final Set roleCapabilities = new HashSet<>(getRoleCapabilities(role.roleId)); - roleCapabilities.addAll(capabilities); - - getRmRolesAndActionsAPI().updateRole(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(), - role.roleId, role.displayName, roleCapabilities); - } - - /** - * Remove capabilities from a role - * - * @param role role to be updated - * @param capabilities list of capabilities to be removed - */ - public void removeCapabilitiesFromRole(UserRoles role, Set capabilities) - { - final Set roleCapabilities = getRoleCapabilities(role.roleId); - roleCapabilities.removeAll(capabilities); - getRmRolesAndActionsAPI().updateRole(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(), - role.roleId, role.displayName, roleCapabilities); - } - - /** - * Assign permission on a record category and give the user RM role - * - * @param user the user to assign rm role and permissions - * @param categoryId the id of the category to assign permissions for - * @param userPermission the permissions to be assigned to the user - * @param userRole the rm role to be assigned to the user - */ - public void assignUserPermissionsOnCategoryAndRMRole(UserModel user, String categoryId, UserPermissions userPermission, - String userRole) - { - getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission); - getRmRolesAndActionsAPI().assignRoleToUser(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(), - user.getUsername(), userRole); - } - - /** - * Helper method to create a test user with rm role - * - * @param userRole the rm role - * @return the created user model - */ - public UserModel createUserWithRMRole(String userRole) - { - final UserModel rmUser = getDataUser().createRandomTestUser(); - getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), userRole); - getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK); - return rmUser; - } - - /** - * Helper method to create a test user with rm role and permissions over the record category - * - * @param userRole the rm role - * @param userPermission the permissions over the record category - * @param recordCategory the category on which user has permissions - * @return the created user model - */ - public UserModel createUserWithRMRoleAndCategoryPermission(String userRole, RecordCategory recordCategory, - UserPermissions userPermission) - { - return createUserWithRMRoleAndRMNodePermission(userRole, recordCategory.getId(), userPermission); - } - - /** - * Helper method to create a user with rm role and permissions on the node ref - * - * @param userRole the rm role - * @param userPermission the permissions over the rm node - * @param componentId the node id to grant rm permission - * @return the created user model - */ - public UserModel createUserWithRMRoleAndRMNodePermission(String userRole, String componentId, - UserPermissions userPermission) - { - final UserModel rmUser = createUserWithRMRole(userRole); - getRestAPIFactory().getRMUserAPI().addUserPermission(componentId, rmUser, userPermission); - getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK); - return rmUser; - } - - /** - * Helper method to create a user with rm role and permissions over the recordCategory and collaborator role - * in collaboration site - * - * @param siteModel collaboration site - * @param recordCategory the category on which permission should be given - * @param userRole the rm role - * @param userPermission the permissions over the recordCategory - * @return the created user model - */ - public UserModel createCollaboratorWithRMRoleAndPermission(SiteModel siteModel, RecordCategory recordCategory, - UserRoles userRole, UserPermissions userPermission) - { - return createUserWithSiteRoleRMRoleAndPermission(siteModel, UserRole.SiteCollaborator, recordCategory.getId(), - userRole, userPermission); - } - - /** - * Helper method to create a test user with a rm role and permissions over a rm component and a role - * in collaboration site - * - * @param siteModel collaboration site - * @param userSiteRole user role in the collaboration site - * @param rmNodeId rm node id to grant rm permission - * @param userRole the rm role - * @param userPermission the permissions over the rmNodeId - * @return the created user model - */ - public UserModel createUserWithSiteRoleRMRoleAndPermission(SiteModel siteModel, UserRole userSiteRole, - String rmNodeId, UserRoles userRole, - UserPermissions userPermission) - { - final UserModel rmUser = createUserWithRMRoleAndRMNodePermission(userRole.roleId, rmNodeId, - userPermission); - getDataUser().addUserToSite(rmUser, siteModel, userSiteRole); - return rmUser; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder deleted file mode 100644 index 48b9fa5717..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder +++ /dev/null @@ -1 +0,0 @@ -org.glassfish.jersey.client.JerseyClientBuilder \ No newline at end of file diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties deleted file mode 100644 index 5d54d6c02d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties +++ /dev/null @@ -1,6 +0,0 @@ -alfresco.server=localhost -alfresco.port=8080 -rest.rmPath=alfresco/api/-default-/public/gs/versions/1 - -# Docker properties values -docker.host=tcp://127.0.0.1:2375 \ No newline at end of file diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java deleted file mode 100644 index ae7fd03b9e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_HOLD; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.FILE_PLAN_PATH; -import static org.alfresco.utility.Utility.buildPath; -import static org.alfresco.utility.Utility.removeLastSlash; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.audit.AuditEntry; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the add to hold event is audited - * - * @author Claudia Agache - * @since 3.3 - */ -@AlfrescoTest (jira = "RM-6859") -public class AuditAddToHoldTests extends BaseRMRestTest -{ - private final String PREFIX = generateTestPrefix(AuditAddToHoldTests.class); - private final String HOLD1 = PREFIX + "hold1"; - private final String HOLD2 = PREFIX + "hold2"; - - @Autowired - private RMAuditService rmAuditService; - @Autowired - private HoldsAPI holdsAPI; - @Autowired - private RoleService roleService; - - private UserModel rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode; - private SiteModel privateSite; - private RecordCategory recordCategory; - private RecordCategoryChild recordFolder; - private List auditEntries; - private final List holdsList = asList(HOLD1, HOLD2); - private List holdsListRef = new ArrayList<>(); - private String hold1NodeRef; - - @BeforeClass (alwaysRun = true) - public void preconditionForAuditAddToHoldTests() - { - STEP("Create 2 holds."); - hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), - getAdminUser().getPassword(), HOLD1, HOLD_REASON, HOLD_DESCRIPTION); - String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION); - holdsListRef = asList(hold1NodeRef, hold2NodeRef); - - STEP("Create a new record category with a record folder."); - recordCategory = createRootCategory(getRandomName("recordCategory")); - recordFolder = createRecordFolder(recordCategory.getId(), PREFIX + "recFolder"); - - STEP("Create an user with full rights to add content to a hold."); - rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId); - - STEP("Create a collaboration site."); - privateSite = dataSite.usingUser(rmAdmin).createPrivateRandomSite(); - - STEP("Create users without rights to add content to a hold."); - rmManagerNoReadOnHold = roleService.createUserWithSiteRoleRMRoleAndPermission(privateSite, - UserRole.SiteManager, recordCategory.getId(), UserRoles.ROLE_RM_MANAGER, UserPermissions.PERMISSION_FILING); - rmManagerNoReadOnNode = roleService.createUserWithRMRoleAndRMNodePermission(UserRoles.ROLE_RM_MANAGER.roleId, - hold1NodeRef, UserPermissions.PERMISSION_FILING); - } - - /** - * Data provider with valid nodes that can be added to a hold - * - * @return the node id, the node name and the node path - */ - @DataProvider (name = "validNodesForAddToHold") - public Object[][] getValidNodesForAddToHold() - { - FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - RecordCategoryChild recordFolderToBeAdded = createRecordFolder(recordCategory.getId(), PREFIX + "recFolderToBeAdded"); - Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record"); - String recordFolderPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), - recordFolderToBeAdded.getName())); - String recordPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), - recordFolder.getName(), recordToBeAdded.getName())); - String contentPath = "/Company Home" + contentToBeAdded.getCmisLocation(); - - return new String[][] - { - // a record folder - { recordFolderToBeAdded.getId(), recordFolderToBeAdded.getName(), recordFolderPath }, - // a record - { recordToBeAdded.getId(), recordToBeAdded.getName(), recordPath }, - //an active content, - { contentToBeAdded.getNodeRefWithoutVersion(), contentToBeAdded.getName(), contentPath } - }; - } - - /** - * Given a document/record/record folder is added to a hold - * When I view the audit log - * Then an entry has been created in the audit log that contains the following: - * name of the hold - * name of the document/record/record folder added - * user who added the content - * date the content was added - * path of the node - */ - @Test (dataProvider = "validNodesForAddToHold") - public void addToHoldEventIsAudited(String nodeId, String nodeName, String nodePath) - { - rmAuditService.clearAuditLog(); - - STEP("Add node to hold."); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD1); - - STEP("Check the audit log contains the entry for the add to hold event."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), ADD_TO_HOLD, rmAdmin, nodeName, nodePath, - asList(ImmutableMap.of("new", nodeName, "previous", "", "name", "Name"), - ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name"))); - } - - /** - * Given an unsuccessful add to hold action - * When I view the audit log - * Then the add to hold event isn't audited - */ - @Test - public void unsuccessfulAddToHoldIsNotAudited() - { - STEP("Create a new record"); - Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record"); - - rmAuditService.clearAuditLog(); - - STEP("Try to add the record to a hold by an user with no rights."); - holdsAPI.addItemsToHolds(rmManagerNoReadOnHold.getUsername(), rmManagerNoReadOnHold.getPassword(), - SC_INTERNAL_SERVER_ERROR, Collections.singletonList(recordToBeAdded.getId()), - Collections.singletonList(hold1NodeRef)); - - STEP("Check the audit log doesn't contain the entry for the unsuccessful add to hold."); - assertTrue("The list of events should not contain Add to Hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD).isEmpty()); - } - - /** - * Given a not empty record folder is added to a hold - * When I view the audit log - * Then only an entry has been created in the audit log for the record folder added - */ - @Test - public void addToHoldIsNotAuditedForRecordFolderChildren() - { - STEP("Create a new record folder with a record inside"); - RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder"); - Record record = createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record"); - - rmAuditService.clearAuditLog(); - - STEP("Add record folder to hold."); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1); - - auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD); - - STEP("Check the audit log contains only an entry for add to hold."); - assertEquals("The list of events should contain only an entry", 1, auditEntries.size()); - assertTrue("The list of events should not contain Add to Hold entry for the record", - auditEntries.stream().noneMatch(entry -> entry.getNodeName().equals(record.getName()))); - } - - /** - * Given a record is added to multiple holds - * When I view the audit log - * Then multiple entries have been created in the audit log for each add to hold event - */ - @Test - public void addToHoldIsAuditedInBulkAddition() - { - STEP("Create a new record"); - Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record"); - - rmAuditService.clearAuditLog(); - - STEP("Add record to multiple holds."); - holdsAPI.addItemsToHolds(rmAdmin.getUsername(), rmAdmin.getPassword(), - Collections.singletonList(recordToBeAdded.getId()), holdsList); - - auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD); - - STEP("Check the audit log contains entries for both additions."); - assertEquals("The list of events should contain Add to Hold entries for both holds", 2, auditEntries.size()); - assertTrue("The hold name value for the first add to hold is not audited.", - auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains( - ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name")))); - assertTrue("The hold name value for the second add to hold is not audited.", - auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains( - ImmutableMap.of("new", HOLD2, "previous", "", "name", "Hold Name")))); - } - - /** - * Given a document is added to a hold - * When I view the audit log as an user with no Read permissions over the document - * Then the add to hold entry isn't visible - */ - @Test - public void addToHoldAuditEntryNotVisible() - { - STEP("Create a new file"); - FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - rmAuditService.clearAuditLog(); - - STEP("Add file to hold."); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), contentToBeAdded.getNodeRefWithoutVersion(), HOLD1); - - STEP("Check that an user with no Read permissions can't see the entry for the add to hold event."); - assertTrue("The list of events should not contain Add to Hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnNode, ADD_TO_HOLD).isEmpty()); - } - - /** - * Given a document is added to a hold - * When I view the audit log as an user with no Read permissions over the hold - * Then the the hold name is replaced in the add to hold entry - */ - @Test - public void addToHoldAuditEntryHoldNameNotVisible() - { - STEP("Create a new file"); - FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - rmAuditService.clearAuditLog(); - - STEP("Add file to hold."); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), contentToBeAdded.getNodeRefWithoutVersion(), HOLD1); - - auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnHold, ADD_TO_HOLD); - - STEP("Check that an user with no Read permissions can't see the hold name in the add to hold event."); - String replacementHoldName = "You don't have permission to view this hold."; - assertEquals("The list of events should contain the Add to Hold entry", 1, auditEntries.size()); - assertTrue("The hold name should not be visible in the Add to Hold entry ", - auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains( - ImmutableMap.of("new", replacementHoldName, "previous", "", "name", "Hold Name")))); - } - - @AfterClass (alwaysRun = true) - public void cleanUpAuditAddToHoldTests() - { - holdsListRef.forEach(holdRef -> holdsAPI.deleteHold(getAdminUser(), holdRef)); - dataSite.usingAdmin().deleteSite(privateSite); - asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user)); - deleteRecordCategory(recordCategory.getId()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditCreateHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditCreateHoldTests.java deleted file mode 100644 index ea5df99e55..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditCreateHoldTests.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_HOLD; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.audit.AuditEntry; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the create hold event is audited - * - * @author Claudia Agache - * @since 3.3 - */ -@AlfrescoTest (jira = "RM-6859") -public class AuditCreateHoldTests extends BaseRMRestTest -{ - private final String PREFIX = generateTestPrefix(AuditCreateHoldTests.class); - private final String HOLD1 = PREFIX + "createHold"; - private final String HOLD2 = PREFIX + "createHold2"; - private final String HOLD3 = PREFIX + "createHold3"; - private final List holdsListRef = new ArrayList<>(); - - @Autowired - private RMAuditService rmAuditService; - @Autowired - private HoldsAPI holdsAPI; - @Autowired - private RoleService roleService; - - private UserModel rmAdmin, rmManager; - - @BeforeClass (alwaysRun = true) - public void preconditionForAuditCreateHoldTests() - { - STEP("Create test users."); - rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId); - rmManager = roleService.createUserWithRMRole(UserRoles.ROLE_RM_MANAGER.roleId); - } - - /** - * Given a new hold is created - * When I view the audit log - * Then an entry has been created in the audit log which contains the following: - * name of the hold - * reason for hold - * user who created the hold - * date the creation occurred - */ - @Test - public void createHoldEventIsAuditedForNewHold() - { - rmAuditService.clearAuditLog(); - - STEP("Create a new hold."); - String hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD1, - HOLD_REASON, HOLD_DESCRIPTION); - holdsListRef.add(hold1NodeRef); - STEP("Check the audit log contains the entry for the created hold with the hold details."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_HOLD, rmAdmin, HOLD1, - asList(ImmutableMap.of("new", HOLD_REASON, "previous", "", "name", "Hold Reason"), - ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name"))); - } - - /** - * Given an unsuccessful create hold action - * When I view the audit log - * Then the create hold event isn't audited - */ - @Test - public void createHoldEventIsNotAuditedForExistingHold() - { - STEP("Create a new hold."); - String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION); - holdsListRef.add(hold2NodeRef); - rmAuditService.clearAuditLog(); - - STEP("Try to create again the same hold and expect action to fail."); - holdsAPI.createHold(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION, - SC_INTERNAL_SERVER_ERROR); - - STEP("Check the audit log doesn't contain the entry for the second create hold event."); - assertTrue("The list of events should not contain Create Hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), CREATE_HOLD).isEmpty()); - } - - /** - * Given a new hold is created and then deleted - * When I view the audit log - * Then the create hold entry still contains the initial details - */ - @Test - public void createHoldAuditEntryIsNotLost() - { - final String holdName = PREFIX + "holdToBeDeleted"; - rmAuditService.clearAuditLog(); - - STEP("Create a new hold."); - holdsAPI.createHold(rmAdmin.getUsername(), rmAdmin.getPassword(), holdName, HOLD_REASON, HOLD_DESCRIPTION); - - STEP("Get the list of audit entries for the create hold event."); - List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), CREATE_HOLD); - - STEP("Delete the created hold."); - holdsAPI.deleteHold(rmAdmin.getUsername(), rmAdmin.getPassword(), holdName); - - STEP("Get again the list of audit entries for the create hold event."); - List auditEntriesAfterDelete = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), CREATE_HOLD); - - STEP("Check that the audit entry for the created hold didn't change after hold deletion."); - assertEquals("The audit entry for Create Hold has been changed", auditEntries, auditEntriesAfterDelete); - } - - /** - * Given a new hold is created - * When I view the audit log as an user with no Read permissions over the created hold - * Then the create hold entry isn't visible - */ - @Test - public void createHoldAuditEntryNotVisible() - { - rmAuditService.clearAuditLog(); - - STEP("Create a new hold."); - String hold3NodeRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD3, - HOLD_REASON, HOLD_DESCRIPTION); - holdsListRef.add(hold3NodeRef); - - STEP("Check that an user with no Read permissions over the hold can't see the entry for the create hold event"); - assertTrue("The list of events should not contain Create Hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(rmManager, CREATE_HOLD).isEmpty()); - } - - @AfterClass (alwaysRun = true) - public void cleanUpAuditCreateHoldTests() - { - holdsListRef.forEach(holdRef -> holdsAPI.deleteHold(getAdminUser(), holdRef)); - asList(rmAdmin, rmManager).forEach(user -> getDataUser().usingAdmin().deleteUser(user)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditDeleteHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditDeleteHoldTests.java deleted file mode 100644 index c5723bcd6e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditDeleteHoldTests.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.DELETE_HOLD; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.Collections; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the delete hold event is audited - * - * @author Claudia Agache - * @since 3.3 - */ -@AlfrescoTest (jira = "RM-6859") -public class AuditDeleteHoldTests extends BaseRMRestTest -{ - private final String PREFIX = generateTestPrefix(AuditDeleteHoldTests.class); - private final String HOLD = PREFIX + "holdToBeDeleted"; - private final String HOLD2 = PREFIX + "deleteHold"; - - @Autowired - private RMAuditService rmAuditService; - @Autowired - private HoldsAPI holdsAPI; - @Autowired - private RoleService roleService; - - private UserModel rmAdmin, rmManager; - private String holdNodeRef; - - @BeforeClass (alwaysRun = true) - public void preconditionForAuditDeleteHoldTests() - { - STEP("Create a new hold."); - holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD, - HOLD_REASON, HOLD_DESCRIPTION); - - STEP("Create 2 users with different permissions for the created hold."); - rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId); - rmManager = roleService.createUserWithRMRole(UserRoles.ROLE_RM_MANAGER.roleId); - } - - /** - * Given a hold is deleted - * When I view the audit log - * Then an entry has been created in the audit log which contains the following: - * name of the hold - * user who deleted the hold - * date the delete occurred - */ - @Test - public void deleteHoldEventIsAudited() - { - STEP("Create a new hold."); - String holdRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2, - HOLD_REASON, HOLD_DESCRIPTION); - - rmAuditService.clearAuditLog(); - - STEP("Delete the created hold."); - holdsAPI.deleteHold(rmAdmin, holdRef); - - STEP("Check the audit log contains the entry for the deleted hold with the hold details."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), DELETE_HOLD, rmAdmin, HOLD2, - Collections.singletonList(ImmutableMap.of("new", "", "previous", HOLD2, "name", "Hold Name"))); - } - - /** - * Given an unsuccessful delete hold action - * When I view the audit log - * Then the delete hold event isn't audited - */ - @Test - public void unsuccessfulDeleteHoldIsNotAudited() - { - rmAuditService.clearAuditLog(); - - STEP("Try to delete a hold by an user with no Read permissions over the hold."); - holdsAPI.deleteHold(rmManager.getUsername(), rmManager.getPassword(), holdNodeRef, SC_INTERNAL_SERVER_ERROR); - - STEP("Check the audit log doesn't contain the entry for the unsuccessful delete hold."); - assertTrue("The list of events should not contain Delete Hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), DELETE_HOLD).isEmpty()); - } - - @AfterClass (alwaysRun = true) - public void cleanUpAuditDeleteHoldTests() - { - holdsAPI.deleteHold(getAdminUser(), holdNodeRef); - asList(rmAdmin, rmManager).forEach(user -> getDataUser().usingAdmin().deleteUser(user)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditGroupEventsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditGroupEventsTests.java deleted file mode 100644 index d7344360e6..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditGroupEventsTests.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_USER_GROUP; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_USER_GROUP; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.DELETE_USER_GROUP; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_USER_GROUP; -import static org.alfresco.utility.report.log.Step.STEP; - -import java.util.Collections; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.GroupModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the group events are audited - * - * @author Claudia Agache - * @since 2.7 - */ -@AlfrescoTest (jira = "RM-5236") -public class AuditGroupEventsTests extends BaseRMRestTest -{ - @Autowired - private RMAuditService rmAuditService; - private GroupModel testGroup; - private UserModel testUser; - - @BeforeClass (alwaysRun = true) - public void cleanAuditLogs() - { - rmAuditService.clearAuditLog(); - } - - /** - * Given I have created a new group - * When I view the RM audit - * Then there is an entry showing that I created a group - */ - @Test - public void createGroupEventIsAudited() - { - testGroup = dataGroup.createRandomGroup(); - - STEP("Check the audit log contains the entry for the created group."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(), - Collections.singletonList(ImmutableMap.of("new", testGroup.getGroupIdentifier(), "previous", "", - "name", "authorityDisplayName"))); - } - - /** - * Given I have added a user to a group - * When I view the RM audit - * Then there is an entry showing that I have added a user to a group - */ - @Test - public void addUserToGroupEventIsAudited() - { - testGroup = dataGroup.createRandomGroup(); - testUser = getDataUser().createRandomTestUser(); - dataGroup.usingUser(testUser).addUserToGroup(testGroup); - - STEP("Check the audit log contains the entry for the add user to group event."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), ADD_TO_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(), - asList(ImmutableMap.of("new", testUser.getUsername(), "previous", "", "name", "User Name"), - ImmutableMap.of("new", testGroup.getGroupIdentifier(), "previous", "", "name", "Parent Group"))); - } - - /** - * Given I have removed a user from a group - * When I view the RM audit - * Then there is an entry showing that I have removed a user from a group - */ - @Test - public void removeUserFromGroupEventIsAudited() - { - testGroup = dataGroup.createRandomGroup(); - testUser = getDataUser().createRandomTestUser(); - dataGroup.usingUser(testUser).addUserToGroup(testGroup); - dataGroup.removeUserFromGroup(testGroup, testUser); - - STEP("Check the audit log contains the entry for the remove user from group event."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(), - asList(ImmutableMap.of("new", "", "previous", testUser.getUsername(), "name", "User Name"), - ImmutableMap.of("new", "","previous", testGroup.getGroupIdentifier(), "name", "Parent Group"))); - } - - /** - * Given I have deleted a group - * When I view the RM audit - * Then there is an entry showing that I have deleted a group - */ - @Test - public void deleteGroupEventIsAudited() - { - testGroup = dataGroup.createRandomGroup(); - dataGroup.deleteGroup(testGroup); - - STEP("Check the audit log contains the entry for the delete group event."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), DELETE_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(), - Collections.singletonList(ImmutableMap.of("new", "", "previous", testGroup.getGroupIdentifier(), - "name", "authorityDisplayName"))); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java deleted file mode 100644 index 02f40b5c2e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_SUCCESSFUL; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_UNSUCCESSFUL; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.List; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.audit.AuditEntry; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the login events are audited - * - * @author Claudia Agache - * @since 2.7 - */ -@AlfrescoTest (jira = "RM-5234") -public class AuditLoginEventsTests extends BaseRMRestTest -{ - @Autowired - private RMAuditService rmAuditService; - - /** - * Given I have tried to login using invalid credentials - * When I view the RM audit filtered by Login unsuccessful event - * Then the audit log contains only the entries for the Login unsuccessful event - */ - @Test - public void filterByLoginUnsuccessful() throws Exception - { - rmAuditService.clearAuditLog(); - restClient.authenticateUser(new UserModel(getAdminUser().getUsername(), "InvalidPassword")); - restClient.withCoreAPI().getSites(); - - STEP("Get the list of audit entries for the login unsuccessful event."); - List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), - LOGIN_UNSUCCESSFUL); - - STEP("Check the audit log contains only the entries for the login unsuccessful event."); - assertTrue("The list of events is not filtered by " + LOGIN_UNSUCCESSFUL.event, - auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_UNSUCCESSFUL.eventDisplayName))); - } - - /** - * Given I have tried to login using valid credentials - * When I view the RM audit filtered by Login successful event - * Then the audit log contains only the entries for the Login successful event - */ - @Test - public void filterByLoginSuccessful() throws Exception - { - restClient.authenticateUser(getAdminUser()); - restClient.withCoreAPI().getSites(); - - STEP("Get the list of audit entries for the login successful event."); - List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), - LOGIN_SUCCESSFUL); - - STEP("Check the audit log contains only the entries for the login successful event."); - assertTrue("The list of events is not filtered by " + LOGIN_SUCCESSFUL.event, - auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_SUCCESSFUL.eventDisplayName))); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java deleted file mode 100644 index 374818e816..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_HOLD; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.FILE_PLAN_PATH; -import static org.alfresco.utility.Utility.buildPath; -import static org.alfresco.utility.Utility.removeLastSlash; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.audit.AuditEntry; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the remove from hold event is audited - * - * @author Claudia Agache - * @since 3.3 - */ -@AlfrescoTest (jira = "RM-6859") -public class AuditRemoveFromHoldTests extends BaseRMRestTest -{ - private final String PREFIX = generateTestPrefix(AuditRemoveFromHoldTests.class); - private final String HOLD1 = PREFIX + "hold1"; - private final String HOLD2 = PREFIX + "hold2"; - private final String HOLD3 = PREFIX + "hold3"; - - @Autowired - private RMAuditService rmAuditService; - @Autowired - private HoldsAPI holdsAPI; - @Autowired - private RoleService roleService; - - private UserModel rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode; - private SiteModel privateSite; - private RecordCategory recordCategory; - private RecordCategoryChild recordFolder, heldRecordFolder; - private Record heldRecord; - private List auditEntries; - private final List holdsList = asList(HOLD1, HOLD2, HOLD3); - private List holdsListRef = new ArrayList<>(); - private FileModel heldContent; - private String hold1NodeRef; - - @BeforeClass (alwaysRun = true) - public void preconditionForAuditRemoveFromHoldTests() - { - STEP("Create an user with full rights to remove content from a hold."); - rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId); - - STEP("Create a collaboration site."); - privateSite = dataSite.usingUser(rmAdmin).createPrivateRandomSite(); - - STEP("Create new holds."); - hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), - HOLD1, HOLD_REASON, HOLD_DESCRIPTION); - String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION); - String hold3NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD3, HOLD_REASON, HOLD_DESCRIPTION); - holdsListRef = asList(hold1NodeRef, hold2NodeRef, hold3NodeRef); - - STEP("Create a new record category with a record folder."); - recordCategory = createRootCategory(getRandomName("recordCategory")); - recordFolder = createRecordFolder(recordCategory.getId(), getRandomName("recFolder")); - - STEP("Create some held items"); - heldContent = dataContent.usingAdmin().usingSite(privateSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - heldRecordFolder = createRecordFolder(recordCategory.getId(), PREFIX + "heldRecFolder"); - heldRecord = createElectronicRecord(recordFolder.getId(), PREFIX + "record"); - - holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - asList(heldContent.getNodeRefWithoutVersion(), heldRecordFolder.getId(), heldRecord.getId()), - holdsList); - - STEP("Create users without rights to remove content from a hold."); - rmManagerNoReadOnHold = roleService.createUserWithSiteRoleRMRoleAndPermission(privateSite, - UserRole.SiteManager, recordCategory.getId(), UserRoles.ROLE_RM_MANAGER, UserPermissions.PERMISSION_FILING); - rmManagerNoReadOnNode = roleService.createUserWithRMRoleAndRMNodePermission(UserRoles.ROLE_RM_MANAGER.roleId, - hold1NodeRef, UserPermissions.PERMISSION_FILING); - } - - /** - * Data provider with valid nodes that can be removed from a hold - * - * @return the node id, the node name and the node path - */ - @DataProvider (name = "validNodesForRemoveFromHold") - public Object[][] getValidNodesForRemoveFromHold() - { - String recordFolderPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), - heldRecordFolder.getName())); - String recordPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(), - recordFolder.getName(), heldRecord.getName())); - String contentPath = "/Company Home" + heldContent.getCmisLocation(); - - return new String[][] - { - // a record folder - { heldRecordFolder.getId(), heldRecordFolder.getName(), recordFolderPath }, - // a record - { heldRecord.getId(), heldRecord.getName(), recordPath }, - //an active content, - { heldContent.getNodeRefWithoutVersion(), heldContent.getName(), contentPath } - }; - } - - /** - * Given a document/record/record folder is removed from a hold - * When I view the audit log - * Then an entry has been created in the audit log that contains the following: - * name of the hold - * name of the document/record/record folder removed - * user who removed the content - * date the content was removed - * path of the node - */ - @Test (dataProvider = "validNodesForRemoveFromHold") - public void removeFromHoldEventIsAudited(String nodeId, String nodeName, String nodePath) - { - rmAuditService.clearAuditLog(); - - STEP("Remove node from hold."); - holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD3); - - STEP("Check the audit log contains the entry for the remove from hold event."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_HOLD, rmAdmin, nodeName, nodePath, - asList(ImmutableMap.of("new", "", "previous", nodeName, "name", "Name"), - ImmutableMap.of("new", "", "previous", HOLD3, "name", "Hold Name"))); - } - - /** - * Given an unsuccessful remove from hold action - * When I view the audit log - * Then the remove from hold event isn't audited - */ - @Test - public void unsuccessfulRemoveFromHoldIsNotAudited() - { - rmAuditService.clearAuditLog(); - - STEP("Try to remove the record from a hold by an user with no rights."); - holdsAPI.removeItemsFromHolds(rmManagerNoReadOnHold.getUsername(), rmManagerNoReadOnHold.getPassword(), - SC_INTERNAL_SERVER_ERROR, Collections.singletonList(heldRecord.getId()), - Collections.singletonList(hold1NodeRef)); - - STEP("Check the audit log doesn't contain the entry for the unsuccessful remove from hold."); - assertTrue("The list of events should not contain remove from hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD).isEmpty()); - } - - /** - * Given a not empty record folder is removed from a hold - * When I view the audit log - * Then only an entry has been created in the audit log for the record folder removed - */ - @Test - public void removeFromHoldNotAuditedForRecordFolderChildren() - { - STEP("Create a new record folder with a record inside"); - RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder"); - Record record = createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record"); - - STEP("Add the record folder to a hold."); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1); - - rmAuditService.clearAuditLog(); - - STEP("Remove record folder from hold."); - holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1); - - STEP("Get the list of audit entries for the remove from hold event."); - auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD); - - STEP("Check the audit log contains only an entry for remove from hold."); - assertEquals("The list of events should contain only an entry", 1, auditEntries.size()); - assertTrue("The list of events should not contain Remove from Hold entry for the record", - auditEntries.stream().noneMatch(entry -> entry.getNodeName().equals(record.getName()))); - } - - /** - * Given a record folder is removed from multiple holds - * When I view the audit log - * Then multiple entries have been created in the audit log for each remove from hold event - */ - @Test - public void removeFromHoldIsAuditedInBulkRemoval() - { - rmAuditService.clearAuditLog(); - - STEP("Remove record folder from multiple holds."); - holdsAPI.removeItemsFromHolds(rmAdmin.getUsername(), rmAdmin.getPassword(), - Collections.singletonList(heldRecordFolder.getId()), asList(HOLD1, HOLD2)); - - STEP("Get the list of audit entries for the remove from hold event."); - auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD); - - STEP("Check the audit log contains entries for both removal."); - assertEquals("The list of events should contain remove from Hold entries for both holds", 2, - auditEntries.size()); - assertTrue("The hold name value for the first remove from hold is not audited.", - auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains( - ImmutableMap.of("new", "", "previous", HOLD1, "name", "Hold Name")))); - assertTrue("The hold name value for the second remove from hold is not audited.", - auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains( - ImmutableMap.of("new", "", "previous", HOLD2, "name", "Hold Name")))); - } - - /** - * Given a document/record/record folder is removed from a hold - * When I view the audit log as an user with no Read permissions over the node - * Then the remove from hold entry isn't visible - */ - @Test - public void removeFromHoldAuditEntryNotVisible() - { - STEP("Add content to a hold."); - FileModel heldFile = dataContent.usingAdmin().usingSite(privateSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1); - - rmAuditService.clearAuditLog(); - - STEP("Remove held content from the hold."); - holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1); - - STEP("Check that an user with no Read permissions can't see the entry for the remove from hold event."); - assertTrue("The list of events should not contain Remove from Hold entry ", - rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnNode, REMOVE_FROM_HOLD).isEmpty()); - } - - /** - * Given a document/record/record folder is removed from a hold - * When I view the audit log as an user with no Read permissions over the hold - * Then the the hold name is replaced in the remove from hold entry - */ - @Test - public void removeFromHoldAuditEntryHoldNameNotVisible() - { - STEP("Add content to a hold."); - FileModel heldFile = dataContent.usingAdmin().usingSite(privateSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1); - - rmAuditService.clearAuditLog(); - - STEP("Remove held content from the hold."); - holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1); - - auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnHold, REMOVE_FROM_HOLD); - - STEP("Check that an user with no Read permissions can't see the hold name in the remove from hold event."); - String replacementHoldName = "You don't have permission to view this hold."; - assertEquals("The list of events should contain the Remove from Hold entry", 1, auditEntries.size()); - assertTrue("The hold name should not be visible in the Remove from Hold entry ", - auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains( - ImmutableMap.of("new", "", "previous", replacementHoldName, "name", "Hold Name")))); - } - - @AfterClass (alwaysRun = true) - public void cleanUpAuditRemoveFromHoldTests() - { - holdsListRef.forEach(holdRef -> holdsAPI.deleteHold(getAdminUser(), holdRef)); - dataSite.usingAdmin().deleteSite(privateSite); - asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user)); - deleteRecordCategory(recordCategory.getId()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditUserEventsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditUserEventsTests.java deleted file mode 100644 index ed7d5a1005..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditUserEventsTests.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.audit; - -import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_PERSON; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.utility.report.log.Step.STEP; - -import java.util.Collections; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.v0.service.RMAuditService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -/** - * This class contains the tests that check the user events are audited - * - * @author Rodica Sutu - * @since 2.7 - */ -public class AuditUserEventsTests extends BaseRMRestTest -{ - private final String PREFIX = generateTestPrefix(AuditUserEventsTests.class); - private UserModel createUser; - @Autowired - private RMAuditService rmAuditService; - - /** - * Given I have created a new user - * When I view the RM audit - * Then there is an entry showing that I created a user - */ - @Test - @AlfrescoTest(jira = "RM-6223") - public void createUserEventIsAudited() - { - rmAuditService.clearAuditLog(); - STEP("Create a new user."); - String userName = "auditCreateUser" + PREFIX; - createUser = getDataUser().createUser(userName); - - STEP("Check the audit log contains the entry for the created user event."); - rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_PERSON, getAdminUser(), userName, - Collections.singletonList(ImmutableMap.of("new", userName, "previous", "", "name", "User Name"))); - } - - @AfterClass (alwaysRun = true) - public void cleanUp() - { - //delete the created user - getDataUser().deleteUser(createUser); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java deleted file mode 100644 index 1d8806732d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.base; - -/** - * List of allowable operations - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class AllowableOperations -{ - public static final String CREATE = "create"; - public static final String UPDATE = "update"; - public static final String DELETE = "delete"; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java deleted file mode 100644 index 31ffe7a5ee..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ /dev/null @@ -1,944 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.base; - -import static lombok.AccessLevel.PROTECTED; -import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME; -import static org.alfresco.rest.rm.community.base.TestData.RECORD_CATEGORY_TITLE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_COMPLETED_RECORD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.VERSION_AS_RECORD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.CoreUtil.toFileModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryChildModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -import lombok.Getter; -import org.alfresco.dataprep.ContentService; -import org.alfresco.rest.RestTest; -import org.alfresco.rest.core.RestAPIFactory; -import org.alfresco.rest.model.RestNodeModel; -import org.alfresco.rest.rm.community.model.fileplan.FilePlan; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderEntry; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties; -import org.alfresco.rest.rm.community.model.site.RMSite; -import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry; -import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.search.RestRequestQueryModel; -import org.alfresco.rest.search.SearchNodeModel; -import org.alfresco.rest.search.SearchRequest; -import org.alfresco.rest.v0.SearchAPI; -import org.alfresco.utility.Utility; -import org.alfresco.utility.data.DataUserAIS; -import org.alfresco.utility.model.ContentModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; - -/** - * Base class for all GS REST API Tests - * - * @author Kristijan Conkas - * @author Tuna Aksoy - * @since 2.6 - */ -public class BaseRMRestTest extends RestTest -{ - @Autowired - @Getter (value = PROTECTED) - private RestAPIFactory restAPIFactory; - - @Autowired - @Getter (value = PROTECTED) - protected DataUserAIS dataUser; - - @Autowired - @Getter(value = PROTECTED) - private ContentService contentService; - - @Autowired - @Getter(value = PROTECTED) - private SearchAPI searchApi; - - /** - * Asserts the given status code - * - * @param statusCode The status code to assert - */ - protected void assertStatusCode(HttpStatus statusCode) - { - getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(statusCode); - } - - /** - * Gets the admin user - * - * @return The admin user - */ - protected UserModel getAdminUser() - { - return getDataUser().getAdminUser(); - } - - /** Valid root containers where electronic and non-electronic records can be created */ - @DataProvider(name = "validRootContainers") - public Object[][] getValidRootContainers() - { - return new String[][] - { - // an arbitrary record folder - { createCategoryFolderInFilePlan().getId(), RECORD_FOLDER_TYPE}, - // unfiled records root - { UNFILED_RECORDS_CONTAINER_ALIAS, UNFILED_CONTAINER_TYPE}, - // an arbitrary unfiled records folder - { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId(), UNFILED_RECORD_FOLDER_TYPE } - }; - } - - /** - * @see org.alfresco.rest.RestTest#checkServerHealth() - */ - @Override - @BeforeClass (alwaysRun = true) - public void checkServerHealth() throws Exception - { - // Create RM Site if not exist - createRMSiteIfNotExists(); - } - - /** - * Helper method to create the RM Site via the POST request - * if the site doesn't exist - */ - public void createRMSiteIfNotExists() - { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); - - // Check RM site doesn't exist - if (!rmSiteAPI.existsRMSite()) - { - // Create the RM site - rmSiteAPI.createRMSite(createStandardRMSiteModel()); - - // Verify the status code - assertStatusCode(CREATED); - } - } - - /** - * Helper method to delete the RM site if exists and to create a new one - */ - public void createRMSite(RMSite rmSiteModel) - { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); - if (rmSiteAPI.existsRMSite()) - { - rmSiteAPI.deleteRMSite(); - assertStatusCode(NO_CONTENT); - } - - rmSiteAPI.createRMSite(rmSiteModel); - assertStatusCode(CREATED); - } - - /** - * Helper method to create root category as the admin user - * - * @param categoryName The name of the category - * @return The created category - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategory createRootCategory(String categoryName) - { - return createRootCategory(getAdminUser(), categoryName, RECORD_CATEGORY_TITLE); - } - - /** - * Helper method to create root category - * - * @param userModel The user under whose privileges this structure is going to be created - * @param categoryName The name of the category - * @return The created category - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategory createRootCategory(UserModel userModel, String categoryName) - { - return createRootCategory(userModel, categoryName, RECORD_CATEGORY_TITLE); - } - - /** - * Helper method to create root category as the admin user - * - * @param categoryName The name of the category - * @param categoryTitle The title of the category - * @return The created category - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategory createRootCategory(String categoryName, String categoryTitle) - { - return createRootCategory(getAdminUser(), categoryName, categoryTitle); - } - - /** - * Helper method to create root category - * - * @param userModel The user under whose privileges this structure is going to be created - * @param categoryName The name of the category - * @param categoryTitle The title of the category - * @return The created category - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategory createRootCategory(UserModel userModel, String categoryName, String categoryTitle) - { - RecordCategory recordCategoryModel = createRecordCategoryModel(categoryName, categoryTitle); - return getRestAPIFactory().getFilePlansAPI(userModel).createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS); - } - - /** - * Helper method to create a record category child - * - * @param user The user under whose privileges the node is going to be created - * @param recordCategoryId The id of the record category - * @param name The name of the record category child - * @param type The type of the record category child - * @return The created {@link RecordCategoryChild} - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategoryChild createRecordCategoryChild(UserModel user, String recordCategoryId, String name, String type) - { - RecordCategoryChild recordCategoryChildModel = createRecordCategoryChildModel(name, type); - return getRestAPIFactory().getRecordCategoryAPI(user).createRecordCategoryChild(recordCategoryChildModel, recordCategoryId); - } - - /** - * Helper method to create a record category child as the admin user - * - * @param recordCategoryId The id of the record category - * @param name The name of the record category child - * @param type The type of the record category child - * @return The created {@link RecordCategoryChild} - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategoryChild createRecordCategoryChild(String recordCategoryId, String name, String type) - { - return createRecordCategoryChild(getAdminUser(), recordCategoryId, name, type); - } - - /** - * Helper method to create a record category as the admin user - * - * @param recordCategoryId The id of the record category - * @param name The name of the record category child - * @return The created {@link RecordCategoryChild} - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategoryChild createRecordCategory(String recordCategoryId, String name) - { - return createRecordCategoryChild(getAdminUser(), recordCategoryId, name, RECORD_CATEGORY_TYPE); - } - - /** - * Helper method to create a record folder as the admin user - * - * @param recordCategoryId The id of the record category - * @param name The name of the record category child - * @return The created {@link RecordCategoryChild} - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategoryChild createRecordFolder(String recordCategoryId, String name) - { - return createRecordCategoryChild(getAdminUser(), recordCategoryId, name, RECORD_FOLDER_TYPE); - } - - /** - * Helper method to create record folder - * - * @param user The user under whose privileges this structure is going to be created - * @param recordCategoryId The id of the record category - * @param name The name of the folder - * @return The created folder - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategoryChild createFolder(UserModel user, String recordCategoryId, String name) - { - RecordCategoryChild recordFolderModel = createRecordCategoryChildModel(name, RECORD_FOLDER_TYPE); - return getRestAPIFactory().getRecordCategoryAPI(user).createRecordCategoryChild(recordFolderModel, recordCategoryId); - } - - /** - * Helper method to create record folder as the admin user - * - * @param recordCategoryId The id of the record category - * @param name The name of the folder - * @return The created folder - * @throws RuntimeException on unsuccessful component creation - */ - public RecordCategoryChild createFolder(String recordCategoryId, String name) - { - return createFolder(getAdminUser(), recordCategoryId, name); - } - - /** - * Helper method to create child unfiled record folder - * - *@param user The user under whose privileges this structure is going to be created - * @param parentId The id of the parent folder - * @param nodeType The child type - * @return The created folder - * @throws RuntimeException on unsuccessful component creation - */ - public UnfiledContainerChild createUnfiledRecordsFolderChild(UserModel user, String parentId, String childName, String nodeType) - { - UnfiledContainerChild childModel = createUnfiledContainerChildModel(childName, nodeType); - UnfiledContainerChild child = getRestAPIFactory().getUnfiledRecordFoldersAPI(user).createUnfiledRecordFolderChild(childModel, parentId); - assertStatusCode(CREATED); - - return child; - } - - /** - * Helper method to create child unfiled record folder as the admin user - * - * @param parentId The id of the parent folder - * @param nodeType The child type - * @return The created folder - * @throws RuntimeException on unsuccessful component creation - */ - public UnfiledContainerChild createUnfiledRecordsFolderChild(String parentId, String childName, String nodeType) - { - return createUnfiledRecordsFolderChild(getAdminUser(), parentId, childName, nodeType); - } - - /** - * Helper method to create a child to an unfiled record container - * - * @param user The user under whose privileges this structure is going to be created - * @param parentId The id of the parent container - * @param childName The name of the child - * @param nodeType the child type - * @return The created chid - * @throws RuntimeException on unsuccessful child creation - */ - public UnfiledContainerChild createUnfiledContainerChild(UserModel user, String parentId, String childName, String nodeType) - { - UnfiledContainerChild child = null; - UnfiledContainerChild childModel = createUnfiledContainerChildModel(childName, nodeType); - - if (FilePlanComponentType.CONTENT_TYPE.equals(nodeType)) - { - child = getRestAPIFactory().getUnfiledContainersAPI(user).uploadRecord(childModel, parentId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)); - } - else - { - child = getRestAPIFactory().getUnfiledContainersAPI(user).createUnfiledContainerChild(childModel, parentId); - } - assertStatusCode(CREATED); - - return child; - } - - /** - * Helper method to create a child to an unfiled record container as the admin user - * - * @param parentId The id of the parent container - * @param childName The name of the child - * @param nodeType the child type - * @return The created chid - * @throws RuntimeException on unsuccessful child creation - */ - public UnfiledContainerChild createUnfiledContainerChild(String parentId, String childName, String nodeType) - { - return createUnfiledContainerChild(getAdminUser(), parentId, childName, nodeType); - } - - /** - * Helper method to close folder - * - * @param folderId The id of the folder - * @return The closed folder - */ - protected RecordFolder closeFolder(String folderId) - { - RecordFolder recordFolderModel = RecordFolder.builder() - .properties(RecordFolderProperties.builder() - .isClosed(true) - .build()) - .build(); - RecordFolder updateRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(recordFolderModel, folderId); - assertStatusCode(OK); - - return updateRecordFolder; - } - - /** - * Helper method to complete record - * - * @param recordId The id of the record to complete - * @return The completed record - */ - public Record completeRecord(String recordId) - { - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - List aspects = recordsAPI.getRecord(recordId).getAspectNames(); - - // this operation is only valid for records - assertTrue(aspects.contains(RECORD_TYPE)); - // a record mustn't be completed - assertFalse(aspects.contains(ASPECTS_COMPLETED_RECORD)); - // add completed record aspect - aspects.add(ASPECTS_COMPLETED_RECORD); - - Record updateRecord = recordsAPI.updateRecord(Record.builder().aspectNames(aspects).build(), recordId); - assertStatusCode(OK); - - return updateRecord; - } - - /** - * Helper method to create a randomly-named [category]/[folder] structure in file plan - * - * @param user The user under whose privileges this structure is going to be created - * @return {@link RecordCategoryChild} which represents the record folder - * @throws RuntimeException on failed creation - */ - public RecordCategoryChild createCategoryFolderInFilePlan(UserModel user) - { - // create root category - RecordCategory recordCategory = createRootCategory(user, "Category " + getRandomAlphanumeric()); - - // and return a folder underneath - return createFolder(user, recordCategory.getId(), "Folder " + getRandomAlphanumeric()); - } - - /** - * Helper method to create a randomly-named [category]/[folder] structure in file plan as the admin user - * - * @return {@link RecordCategoryChild} which represents the record folder - * @throws RuntimeException on failed creation - */ - public RecordCategoryChild createCategoryFolderInFilePlan() - { - return createCategoryFolderInFilePlan(getAdminUser()); - } - - public UnfiledContainer getUnfiledContainerAsUser(UserModel user, String componentId) - { - return getRestAPIFactory().getUnfiledContainersAPI(user).getUnfiledContainer(componentId); - } - - public UnfiledContainer getUnfiledContainer(String componentId) - { - return getUnfiledContainerAsUser(getAdminUser(), componentId); - } - - public TransferContainer getTransferContainerAsUser(UserModel user, String componentId) - { - return getRestAPIFactory().getTransferContainerAPI(user).getTransferContainer(componentId); - } - - public TransferContainer getTransferContainer(String componentId) - { - return getTransferContainerAsUser(getAdminUser(), componentId); - } - - public FilePlan getFilePlanAsUser(UserModel user, String componentId) - { - return getRestAPIFactory().getFilePlansAPI(user).getFilePlan(componentId); - } - - public FilePlan getFilePlan(String componentId) - { - return getFilePlanAsUser(getAdminUser(), componentId); - } - - /** - * Recursively delete a folder - * - * @param siteModel - * @param folder - */ - public void deleteFolder(SiteModel siteModel, FolderModel folder) - { - contentService.deleteTree(getAdminUser().getUsername(), getAdminUser().getPassword(), siteModel.getId(), - folder.getName()); - } - - /** - * Create an electronic record - * - * @param parentId the id of the parent - * @param name the name of the record - * @return the created record - */ - public Record createElectronicRecord(String parentId, String name) - { - return createElectronicRecord(parentId, name ,null); - } - - - /** - * Create an electronic record - * - * @param parentId the id of the parent - * @param name the name of the record - * @return the created record - */ - public Record createElectronicRecord(String parentId, String name, UserModel user) - { - RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI(user); - Record recordModel = Record.builder().name(name).nodeType(CONTENT_TYPE).build(); - return recordFolderAPI.createRecord(recordModel, parentId); - } - - /** - * Create a non-electronic record - * - * @param parentId the id of the parent - * @param name the name of the record - * @return the created record - */ - public Record createNonElectronicRecord(String parentId, String name) - { - return createNonElectronicRecord(parentId, name, null); - } - - /** - * Create a non-electronic record - * - * @param parentId the id of the parent - * @param name the name of the record - * @param user the user who creates the non-electronic record - * @return the created record - */ - public Record createNonElectronicRecord(String parentId, String name, UserModel user) - { - RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI(user); - Record recordModel = Record.builder().name(name).nodeType(NON_ELECTRONIC_RECORD_TYPE).build(); - return recordFolderAPI.createRecord(recordModel, parentId); - } - - /** - * Delete a record folder - * - * @param recordFolderId the id of the record folder to delete - */ - public void deleteRecordFolder(String recordFolderId) - { - RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI(); - recordFolderAPI.deleteRecordFolder(recordFolderId); - } - - /** - * Delete a record - * - * @param recordId the id of the record to delete - */ - public void deleteRecord(String recordId) - { - RecordsAPI recordsAPI = restAPIFactory.getRecordsAPI(); - recordsAPI.deleteRecord(recordId); - } - - /** - * Delete a record category - * - * @param recordCategoryId the id of the record category to delete - */ - public void deleteRecordCategory(String recordCategoryId) - { - RecordCategoryAPI recordCategoryAPI = restAPIFactory.getRecordCategoryAPI(); - recordCategoryAPI.deleteRecordCategory(recordCategoryId); - } - - /** - * Returns search results for the given search term - * - * @param user - * @param term - * @return - */ - public List searchForContentAsUser(UserModel user, String term) - { - getRestAPIFactory().getRmRestWrapper().authenticateUser(user); - RestRequestQueryModel queryReq = new RestRequestQueryModel(); - SearchRequest query = new SearchRequest(queryReq); - queryReq.setQuery("cm:name:*" + term + "*"); - - List names = new ArrayList<>(); - // wait for solr indexing - int counter = 0; - int waitInMilliSeconds = 7000; - while (counter < 4) - { - synchronized (this) - { - try - { - this.wait(waitInMilliSeconds); - } - catch (InterruptedException e) - { - // Restore interrupted state... - Thread.currentThread().interrupt(); - } - } - - List searchResults = getRestAPIFactory().getRmRestWrapper().withSearchAPI().search(query) - .getEntries(); - if (searchResults != null && !searchResults.isEmpty()) - { - searchResults.forEach(childNode -> names.add(childNode.onModel().getName())); - break; - } - else - { - counter++; - } - // double wait time to not overdo solr search - waitInMilliSeconds = waitInMilliSeconds * 2; - } - return names; - } - - /** - * Returns the list of node names returned by search results for the given search term - * - * @param user - * @param term - * @param sortby - * @param includeFolders - * @param includeCategories - * @param expectedResults - * @return List - */ - public List searchForRMContentAsUser(UserModel user, String term, String sortby, boolean includeFolders, - boolean includeCategories, List expectedResults) - { - List results = new ArrayList<>(); - // wait for solr indexing - int counter = 0; - int waitInMilliSeconds = 7000; - while (counter < 4) - { - synchronized (this) - { - try - { - this.wait(waitInMilliSeconds); - } - catch (InterruptedException e) - { - // Restore interrupted state... - Thread.currentThread().interrupt(); - } - } - - results = searchApi.searchForNodeNamesAsUser(user.getUsername(), user.getPassword(), term, sortby, - includeFolders, includeCategories); - if (!results.isEmpty() && results.containsAll(expectedResults)) - { - break; - } - else - { - counter++; - } - // double wait time to not overdo solr search - waitInMilliSeconds = waitInMilliSeconds * 2; - } - return results; - } - - /** - * Returns the property value for the given property name and nodeRef of the search results - * - * @param user - * @param term - * @param nodeRef - * @param propertyName - * @param sortby - * @param includeFolders - * @param includeCategories - * @param expectedResults - * @return String - */ - public String searchForRMContentAsUser(UserModel user, String term, String nodeRef, String propertyName, - String sortby, boolean includeFolders, boolean includeCategories, String expectedResults) - { - String result = ""; - // wait for solr indexing - int counter = 0; - int waitInMilliSeconds = 5000; - while (counter < 4) - { - synchronized (this) - { - try - { - this.wait(waitInMilliSeconds); - } - catch (InterruptedException e) - { - // Restore interrupted state... - Thread.currentThread().interrupt(); - } - } - result = searchApi.searchForNodePropertyAsUser(user.getUsername(), user.getPassword(), nodeRef, - propertyName, term, sortby, includeFolders, includeCategories); - if (!result.isEmpty() && result.contains(expectedResults)) - { - break; - } - else - { - counter++; - } - // double wait time to not overdo solr search - waitInMilliSeconds = (waitInMilliSeconds * 2); - } - return result; - } - - /** - * Helper method to return site document library content model - * - * @return ContentModel - * @throws Exception - */ - public ContentModel getDocumentLibrary(UserModel usermodel, SiteModel testSite) throws Exception - { - ContentModel siteModel = new ContentModel(); - siteModel.setNodeRef(testSite.getGuid()); - - restClient.authenticateUser(usermodel); - - List nodes = restClient.withCoreAPI().usingNode(siteModel) - .listChildren().getEntries().stream().collect(Collectors.toList()); - ContentModel documentLibrary = new ContentModel(); - documentLibrary.setName(nodes.get(0).onModel().getName()); - documentLibrary.setNodeRef(nodes.get(0).onModel().getId()); - return documentLibrary; - } - /** - * Checks if the given file has record aspect - * - * @param testFile the file to be checked - * @return true if the file has the aspect, false otherwise - */ - protected boolean hasRecordAspect(FileModel testFile) throws Exception - { - return hasAspect(testFile, RECORD_TYPE); - } - - /** - * Checks if the given file has the given aspect - * - * @param testFile the file to be checked - * @param aspectName the matching aspect - * @return true if the file has the aspect, false otherwise - */ - private boolean hasAspect(FileModel testFile, String aspectName) throws Exception - { - return getRestAPIFactory().getNodeAPI(testFile).getNode() - .getAspectNames().contains(aspectName); - } - - /** - * Checks if the given node has the given aspect - * - * @param nodeId the node to be checked - * @param aspectName the matching aspect - * @return true if the file has the aspect, false otherwise - */ - protected boolean hasAspect(String nodeId, String aspectName) throws Exception - { - return hasAspect(toFileModel(nodeId), aspectName); - } - - /** - * Helper method to verify if the declared record is in Unfiled Records location - * - * @param testFile the file declared as record - * @return true if the matching record is found in Unfiled Records, false otherwise - */ - protected boolean isMatchingRecordInUnfiledRecords(FileModel testFile) - { - try - { - Utility.sleep(1000, 10000, - () -> { - Optional matchingRecord = getRestAPIFactory().getUnfiledContainersAPI() - .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS) - .getEntries() - .stream() - .filter(e -> e.getEntry().getId() - .equals(testFile.getNodeRefWithoutVersion())) - .findAny(); - assertTrue(matchingRecord.isPresent()); - }); - return true; - } - catch (AssertionError | Exception e) - { - return false; - } - } - - /** - * Helper method to verify if the declared record is filed to the record folder location - * - * @param testFile the file declared as record - * @param recFolder the record folder where the declared record has been filed - * @return true if matching record is found in record folder, null otherwise - */ - protected boolean isMatchingRecordInRecordFolder(FileModel testFile, RecordCategoryChild recFolder) - { - try - { - Utility.sleep(1000, 10000, - () -> { - Optional matchingRecord = getRestAPIFactory().getRecordFolderAPI() - .getRecordFolderChildren(recFolder.getId()) - .getEntries() - .stream() - .filter(e -> e.getEntry().getId() - .equals(testFile.getNodeRefWithoutVersion())) - .findAny(); - assertTrue(matchingRecord.isPresent()); - }); - return true; - } - catch (AssertionError | Exception e) - { - return false; - } - } - /** - * Helper method to verify if the document version is declared as record version in unfiled container - * - * @param testFile the file declared as record version - * @param version the document version - * @return true if matching record version is found in unfiled record container, false otherwise - */ - protected boolean isRecordVersionInUnfiledRecords(FileModel testFile, String version) - { - try - { - Utility.sleep(1000, 10000, - () -> { - UnfiledContainerChildEntry matchingRecord = getRestAPIFactory().getUnfiledContainersAPI() - .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS, "include=properties,aspectNames") - .getEntries() - .stream() - .filter(e -> e.getEntry().getName().contains(testFile.getName().replace(".txt", "")) - && e.getEntry().getProperties().getVersionedNodeRef().equals(testFile.getNodeRefWithoutVersion()) - && e.getEntry().getProperties().getRecordVersionLabel().equalsIgnoreCase(version) - ) - .findFirst().get(); - - assertTrue(hasAspect(matchingRecord.getEntry().getId(), VERSION_AS_RECORD)); - }); - return true; - } - catch (AssertionError | Exception e) - { - return false; - } - } - /** - * Helper method to verify if the document version is declared as record version in a specific record folder - * - * @param testFile the file declared as record version - * @param recordFolder the record folder where the versioned record is filled - * @param version the document version - * @return true if matching record version is found in record folder, false otherwise - */ - protected boolean isRecordVersionInRecordFolder(FileModel testFile, RecordCategoryChild recordFolder, - String version) - { - try - { - Utility.sleep(1000, 10000, - () -> { - RecordFolderEntry matchingRecord = getRestAPIFactory().getRecordFolderAPI() - .getRecordFolderChildren(recordFolder.getId(),"include=properties,aspectNames") - .getEntries() - .stream() - .filter(e -> e.getEntry().getName().contains(testFile.getName().replace(".txt", "")) - && e.getEntry().getProperties().getVersionedNodeRef().equals(testFile.getNodeRefWithoutVersion()) - && e.getEntry().getProperties().getRecordVersionLabel().equalsIgnoreCase(version) - ) - .findFirst().get(); - - assertTrue(hasAspect(matchingRecord.getEntry().getId(), VERSION_AS_RECORD)); - }); - return true; - } - catch (AssertionError | Exception e) - { - return false; - } - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java deleted file mode 100644 index 28cd24ee04..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.base; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; - -import org.testng.annotations.DataProvider; - -/** - * Data Provider class used in tests - * - * @author Rodica Sutu - * @since 2.6 - */ -public class DataProviderClass -{ - /** - * Data Provider with the special file plan components alias - * @return file plan component alias - */ - @DataProvider - public static Object[][] getContainers() - { - return new String[][] { - { FILE_PLAN_ALIAS }, - { TRANSFERS_ALIAS }, - { UNFILED_RECORDS_CONTAINER_ALIAS }, - }; - } - - /** - * Data Provider with: - * with the object types not allowed as children for a record category - * - * @return file plan component alias - */ - @DataProvider - public static Object[][] childrenNotAllowedForCategory() - { - return new String[][] { - { FILE_PLAN_TYPE }, - { TRANSFER_CONTAINER_TYPE }, - { UNFILED_CONTAINER_TYPE }, - { UNFILED_RECORD_FOLDER_TYPE }, - { TRANSFER_TYPE }, - { CONTENT_TYPE } - }; - } - - /** - * Data Provider with: - * with the object types for creating a Record Folder - * - * @return file plan component alias - */ - @DataProvider - public static Object[][] folderTypes() - { - return new String[][] { - { RECORD_FOLDER_TYPE }, - { FOLDER_TYPE } - }; - } - - /** - * Data Provider with: - * with the object types for creating a Record Category - * - * @return file plan component alias - */ - @DataProvider - public static Object[][] categoryTypes() - { - return new String[][] { - { FOLDER_TYPE }, - { RECORD_CATEGORY_TYPE } - }; - } - - /** - * Data Provider with: - * with the object types for creating a Record Category Child - * - * @return record category child type - */ - @DataProvider - public static Object[][] categoryChild() - { - return new String[][] { - { RECORD_FOLDER_TYPE }, - { FOLDER_TYPE }, - { RECORD_CATEGORY_TYPE } - }; - } - - /** - * Invalid root level types, at unfiled record folder/unfiled containers container level that shouldn't be possible to create - */ - @DataProvider (name = "invalidRootTypes") - public static Object[][] getInvalidRootTypes() - { - return new String[][] - { - { FILE_PLAN_TYPE }, - { RECORD_CATEGORY_TYPE }, - { RECORD_FOLDER_TYPE }, - { TRANSFER_CONTAINER_TYPE }, - { TRANSFER_TYPE }, - { UNFILED_CONTAINER_TYPE }, - - }; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java deleted file mode 100644 index ead1ee816e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.base; - -import static com.google.common.collect.Sets.newHashSet; - -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_ADMIN; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_SECURITY_OFFICER; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; - -import java.util.Set; - -/** - * Test data used in tests - * - * @author Rodica Sutu - * @since 2.6 - */ -public interface TestData -{ - /** - * A user with ALFRESCO_ADMINISTRATORS role. - *

"GROUP_ANOTHER_ADMIN_EXISTS" The ANOTHER_ADMIN user has been created. - */ - public static final String ANOTHER_ADMIN = "another_admin"; - - /** - * The default password used when creating test users. - */ - public static final String DEFAULT_PASSWORD = "password"; - - /** - * The default email address used when creating test users. - */ - public static final String DEFAULT_EMAIL = "default@alfresco.com"; - - /** - * The default record category name used when creating categories - */ - public static String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric(); - - /** - * The default record category title used when creating categories - */ - public static String RECORD_CATEGORY_TITLE = "CATEGORY TITLE" + getRandomAlphanumeric(); - - /** - * The default record folder name used when creating folders - */ - public static String RECORD_FOLDER_NAME = "FOLDER NAME" + getRandomAlphanumeric(); - - /** - * The default record folder title used when creating folders - */ - public static String RECORD_FOLDER_TITLE = "FOLDER TITLE" + getRandomAlphanumeric(); - - /** - * The default electronic record name used when creating electronic records - */ - public static String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric(); - - /** - * The default non-electronic record name used when creating non-electronic records - */ - public static String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); - - public static final String ALFRESCO_ADMINISTRATORS = "ALFRESCO_ADMINISTRATORS"; - /** - * The ids of the default RM roles. - */ - public static final Set RM_ROLES = newHashSet(ROLE_RM_ADMIN.roleId, ROLE_RM_MANAGER.roleId, - ROLE_RM_POWER_USER.roleId, ROLE_RM_SECURITY_OFFICER.roleId, ROLE_RM_USER.roleId); - - /** - * The default hold description - */ - String HOLD_DESCRIPTION = "Generalized hold case for tests"; - - /** - * The default hold reason - */ - String HOLD_REASON = "Active content to be reviewed for the CASE McDermott, FINRA "; -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java deleted file mode 100644 index b24c59d86f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java +++ /dev/null @@ -1,518 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.fileplans; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.AllowableOperations.CREATE; -import static org.alfresco.rest.rm.community.base.AllowableOperations.DELETE; -import static org.alfresco.rest.rm.community.base.AllowableOperations.UPDATE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.springframework.http.HttpStatus.CONFLICT; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.OK; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; -import static org.testng.AssertJUnit.assertEquals; - -import java.util.ArrayList; -import java.util.NoSuchElementException; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.base.DataProviderClass; -import org.alfresco.rest.rm.community.model.fileplan.FilePlan; -import org.alfresco.rest.rm.community.model.fileplan.FilePlanProperties; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryProperties; -import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; -import org.alfresco.utility.constants.ContainerName; -import org.alfresco.utility.model.UserModel; -import org.alfresco.utility.report.Bug; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests for the File Plan CRUD API - * - * @author Rodica Sutu - * @since 2.6 - */ -public class FilePlanTests extends BaseRMRestTest -{ - //** Number of children (for children creation test) */ - private static final int NUMBER_OF_CHILDREN = 10; - - /** - * Data Provider with: - * with the object types not allowed as children for a record category - * - * @return file plan component alias - */ - @DataProvider - public static Object[][] childrenNotAllowedForFilePlan() - { - return new String[][] { - { FILE_PLAN_TYPE }, - { TRANSFER_CONTAINER_TYPE }, - { UNFILED_CONTAINER_TYPE }, - { UNFILED_RECORD_FOLDER_TYPE }, - { TRANSFER_TYPE }, - { CONTENT_TYPE }, - { NON_ELECTRONIC_RECORD_TYPE}, - { RECORD_FOLDER_TYPE} - }; - } - - /** - *

-     * Given that the RM site doesn't exist
-     * When I use the API to get the File Plan
-     * Then I get the 404 response code
-     * 
- */ - @Test (priority = 1) - // Set priority to 1 in order for this test to run last one in this class. The rm site is created only once at the - // beginning of the class and because this test deletes the rm site, the other tests might be affected - public void getFilePlanWhenRMIsNotCreated() - { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); - - // Check RM Site Exist - if (rmSiteAPI.existsRMSite()) - { - // Delete RM Site - rmSiteAPI.deleteRMSite(); - } - //get file plan - getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS); - - // Check the response code is NOT_FOUND - assertStatusCode(NOT_FOUND); - } - - /** - *
-     * Given that a file plan exists
-     * When I ask the API for the details of the file plan
-     * Then I am given the details of the file plan
-     * 
- */ - @Test - public void getFilePlanWhenRMIsCreated() - { - // Create RM Site if doesn't exist - createRMSiteIfNotExists(); - - FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS); - - // Check the response code - assertStatusCode(OK); - //check file plan details - assertEquals(FILE_PLAN_TYPE, filePlan.getNodeType()); - assertEquals(ContainerName.documentLibrary.toString(), filePlan.getName()); - } - - /** - *
-     * Given that a file plan exists
-     * When I ask the API for the details of the file plan to include the allowableOperations property
-     * Then I am given the allowableOperations property with the update and create operations.
-     * 
- */ - @Test - public void includeAllowableOperations() - { - // Check the list of allowableOperations returned - FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS, "include=" + ALLOWABLE_OPERATIONS); - - assertTrue(filePlan.getAllowableOperations().containsAll(asList(UPDATE, CREATE)), - "Wrong list of the allowable operations is return" + filePlan.getAllowableOperations().toString()); - - // Check the list of allowableOperations doesn't contain DELETE operation - assertFalse(filePlan.getAllowableOperations().contains(DELETE), - "The list of allowable operations contains delete option" + filePlan.getAllowableOperations().toString()); - } - - /** - *
-     * Given that RM site exists
-     * When a non-RM user asks the API for the details of the file plan
-     * Then the status code 403 (Permission denied) is return
-     * 
- */ - @Test - public void getFilePlanWithNonRMuser() - { - // Create a random user - UserModel nonRMuser = getDataUser().createRandomTestUser("testUser"); - - // Get the special file plan components - getRestAPIFactory().getFilePlansAPI(nonRMuser).getFilePlan(FILE_PLAN_ALIAS); - - // Check the response status code is FORBIDDEN - assertStatusCode(FORBIDDEN); - } - - /** - * Given that a file plan exists - * When I ask the API to modify the details of the file plan - * Then the details of the file are modified - * Note: the details of the file plan are limited to title and description. - */ - @Test - @Bug (id = "RM-4295") - public void updateFilePlan() - { - String FILE_PLAN_DESCRIPTION = "Description updated " + getRandomAlphanumeric(); - String FILE_PLAN_TITLE = "Title updated " + getRandomAlphanumeric(); - - // Build object for updating the filePlan - FilePlan filePlanComponent = FilePlan.builder() - .properties(FilePlanProperties.builder() - .title(FILE_PLAN_TITLE) - .description(FILE_PLAN_DESCRIPTION) - .build()) - .build(); - // Create a random user - UserModel nonRMuser = getDataUser().createRandomTestUser("testUser"); - - // Update the file plan - getRestAPIFactory().getFilePlansAPI(nonRMuser).updateFilePlan(filePlanComponent, FILE_PLAN_ALIAS); - - //Check the response status code is FORBIDDEN - assertStatusCode(FORBIDDEN); - - // Update the file plan - FilePlan renamedFilePlan = getRestAPIFactory().getFilePlansAPI().updateFilePlan(filePlanComponent, FILE_PLAN_ALIAS); - - // Verify the response status code - assertStatusCode(OK); - - // Verify the returned description field for the file plan component - assertEquals(FILE_PLAN_DESCRIPTION, renamedFilePlan.getProperties().getDescription()); - - // Verify the returned title field for the file plan component - assertEquals(FILE_PLAN_TITLE, renamedFilePlan.getProperties().getTitle()); - } - - /** - * Given that a file plan exists - * When I ask the API to modify the name of the file plan - * Then a error is returned (422 response code) - */ - @Test - @Bug (id = "RM-4295") - public void updateFilePlanName() - { - // Build object for updating the filePlan - FilePlan filePlanComponent = FilePlan.builder() - .name(getRandomName("File Plan name updated ")) - .build(); - - // Update the file plan - getRestAPIFactory().getFilePlansAPI().updateFilePlan(filePlanComponent, FILE_PLAN_ALIAS); - - // Verify the response status code - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - *
-     * Given that a file plan exists
-     * When I ask the API to create a root record category
-     * Then it is created as a root record category
-     * 
- *
-     * Given that a file plan exists
-     * When I use the API to create a folder (cm:folder type) into the fileplan
-     * Then the folder is converted to rma:recordCategory
-     * (see RM-4572 comments)
-     * 
- */ - @Test - ( - description = "Create root category", - dataProviderClass = DataProviderClass.class, - dataProvider = "categoryTypes" - ) - public void createFilePlanChildren(String nodeType) - { - String categoryName = "Category name " + getRandomAlphanumeric(); - String categoryTitle = "Category title " + getRandomAlphanumeric(); - - // Create the root record category - RecordCategory recordCategory = RecordCategory.builder() - .name(categoryName) - .properties(RecordCategoryProperties.builder() - .title(categoryTitle) - .build()) - .nodeType(nodeType) - .build(); - RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI() - .createRootRecordCategory(recordCategory,FILE_PLAN_ALIAS); - - // Verify the status code - assertStatusCode(CREATED); - - assertEquals(rootRecordCategory.getName(), categoryName); - assertEquals(rootRecordCategory.getNodeType(), RECORD_CATEGORY_TYPE); - - assertEquals(rootRecordCategory.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Verify the returned root record category properties - RecordCategoryProperties rootRecordCategoryProperties = rootRecordCategory.getProperties(); - assertEquals(rootRecordCategoryProperties.getTitle(), categoryTitle); - assertNotNull(rootRecordCategoryProperties.getIdentifier()); - } - - /** - *
-     * Given a root category
-     * When I ask the API to create a root category having the same name
-     * Then  the response code received is 409 - name clashes with an existing node
-     *
- *
-     * Given a root category
-     * When I ask the API to create a root category having the same name  with autoRename parameter on true
-     * Then the record category is created the record category has a unique name by adding an integer suffix
-     * 
- */ - @Test - @Bug(id = "RM-5116") - public void createDuplicateCategories() - { - String categoryName = "Category name " + getRandomAlphanumeric(); - String categoryTitle = "Category title " + getRandomAlphanumeric(); - - - // Create the root record category - RecordCategory recordCategory = RecordCategory.builder() - .name(categoryName) - .properties(RecordCategoryProperties.builder() - .title(categoryTitle) - .build()) - .build(); - // Create the root record category - RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategory,FILE_PLAN_ALIAS); - - // Verify the status code - assertStatusCode(CREATED); - assertEquals(rootRecordCategory.getName(), categoryName); - - // Create the same root record category - getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategory, FILE_PLAN_ALIAS); - - // Verify the status code - assertStatusCode(CONFLICT); - - //create the same category with autoRename parameter on true - RecordCategory rootRecordCategoryAutoRename = getRestAPIFactory().getFilePlansAPI() - .createRootRecordCategory(recordCategory, FILE_PLAN_ALIAS,"autoRename=true"); - - // Verify the status code - assertStatusCode(CREATED); - assertNotEquals(rootRecordCategoryAutoRename.getName(), categoryName); - assertTrue(rootRecordCategoryAutoRename.getName().startsWith(categoryName)); - } - - @Test - public void listFilePlanChildren() - { - //delete all the root categories - getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getEntries().forEach(recordCategoryEntry -> - deleteRecordCategory(recordCategoryEntry.getEntry().getId())); - // Add child folders - ArrayList children = new ArrayList<>(); - for (int i = 0; i < NUMBER_OF_CHILDREN; i++) - { - String categoryName = "Category name " + getRandomAlphanumeric(); - String categoryTitle = "Category title " + getRandomAlphanumeric(); - // Create a record folder - RecordCategory recordCategory = createRootCategory(categoryName, categoryTitle); - assertNotNull(recordCategory.getId()); - children.add(recordCategory); - } - - // Get record category children from API - RecordCategoryCollection recordCategoryChildren = getRestAPIFactory().getFilePlansAPI() - .getRootRecordCategories(FILE_PLAN_ALIAS, "include=aspects,properties"); - - // Check status code - assertStatusCode(OK); - - // Check children against created list - recordCategoryChildren.getEntries().forEach(c -> - { - RecordCategory recordCategoryChild = c.getEntry(); - String recordCategoryChildId = recordCategoryChild.getId(); - assertNotNull(recordCategoryChildId); - logger.info("Checking child " + recordCategoryChildId); - - try - { - // Find this child in created children list - RecordCategory createdComponent = children.stream() - .filter(child -> child.getId().equals(recordCategoryChildId)) - .findFirst() - .orElseThrow(); - - // Created by - assertEquals(recordCategoryChild.getCreatedByUser().getId(), getAdminUser().getUsername()); - - assertEquals(createdComponent.getName(), recordCategoryChild.getName()); - assertEquals(createdComponent.getNodeType(), recordCategoryChild.getNodeType()); - - } - catch (NoSuchElementException e) - { - fail("No child element for " + recordCategoryChildId); - } - } - ); - } - - /** - *
-     * Given that RM site is created
-     * When I use the API to create invalid types inside a file plan
-     * Then the node type provided is converted to a record category
-     * 
- */ - @Test - ( - description = "Create a record folder/unfiled container/unfiled folder/record/file plan container", - dataProvider = "childrenNotAllowedForFilePlan" - ) - public void createChildrenNotAllowedInFilePlan(String nodeType) - { - String componentName = "Component" + getRandomAlphanumeric(); - - // Create the root record category - RecordCategory component = RecordCategory.builder() - .name(componentName) - .nodeType(nodeType) - .build(); - // Create the invalid node type - RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI() - .createRootRecordCategory(component, FILE_PLAN_ALIAS); - //check the response status code - assertStatusCode(CREATED); - assertEquals(rootRecordCategory.getName(), componentName); - assertEquals(rootRecordCategory.getNodeType(), RECORD_CATEGORY_TYPE); - - assertEquals(rootRecordCategory.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Verify the returned root record category properties - assertNotNull(rootRecordCategory.getProperties().getIdentifier()); - } - - @Test - public void listChildrenUserPermission() - { - // Create a random user - UserModel managerUser = getDataUser().createRandomTestUser("managerUser"); - - // Add child folders - ArrayList children = new ArrayList<>(); - for (int i = 0; i < NUMBER_OF_CHILDREN/2; i++) - { - String categoryName = "Category name " + getRandomAlphanumeric(); - String categoryTitle = "Category title " + getRandomAlphanumeric(); - // Create a record folder - RecordCategory recordCategory = createRootCategory(categoryName, categoryTitle); - assertNotNull(recordCategory.getId()); - children.add(recordCategory); - } - - getRestAPIFactory().getRMUserAPI().assignRoleToUser(managerUser.getUsername(), ROLE_RM_MANAGER.roleId); - // Get record category children from API - getRestAPIFactory().getFilePlansAPI(managerUser).getRootRecordCategories(FILE_PLAN_ALIAS) - .assertThat().entriesListIsEmpty().assertThat().paginationExist(); - - ArrayList childrenManager = new ArrayList<>(); - for (int i = 0; i < NUMBER_OF_CHILDREN / 2; i++) - { - String categoryName = "Category for manager " + getRandomAlphanumeric(); - String categoryTitle = "Category for manager " + getRandomAlphanumeric(); - // Create a record folder - RecordCategory recordCategory = createRootCategory(categoryName, categoryTitle); - assertNotNull(recordCategory.getId()); - getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategory.getId(), managerUser, PERMISSION_FILING); - childrenManager.add(recordCategory); - } - // Get record category children from API - RecordCategoryCollection recordCategoryChildren = getRestAPIFactory().getFilePlansAPI(managerUser).getRootRecordCategories(FILE_PLAN_ALIAS); - - //Check children against created list - recordCategoryChildren.getEntries().forEach(c -> - { - RecordCategory recordCategoryChild = c.getEntry(); - String recordCategoryChildId = recordCategoryChild.getId(); - assertNotNull(recordCategoryChildId); - logger.info("Checking child " + recordCategoryChildId); - - try - { - // Find this child in created children list - assertTrue(childrenManager.stream() - .anyMatch(child -> child.getId().equals(recordCategoryChildId)) - ); - assertFalse(children.stream() - .anyMatch(child -> child.getId().equals(recordCategoryChildId)) - - ); - } catch (NoSuchElementException e) - { - fail("No child element for " + recordCategoryChildId); - } - } - ); - } - - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java deleted file mode 100644 index 383dff7c68..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ /dev/null @@ -1,472 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.files; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER; -import static org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI.PARENT_ID_PARAM; -import static org.alfresco.rest.v0.HoldsAPI.HOLDS_CONTAINER; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.springframework.http.HttpStatus.ACCEPTED; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.util.DockerHelper; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.RMRolesAndActionsAPI; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.Utility; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * API tests for declaring document as record and filing it immediately to a record folder location within the file plan - * - * @author Claudia Agache - * @since 3.1 - */ -@AlfrescoTest (jira = "RM-6779") -public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest -{ - private final static String DESTINATION_PATH_NOT_FOUND_EXC = "Unable to execute create-record action, because the destination path could not be found."; - private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute create-record action, because the destination path is invalid."; - private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder."; - private final static String CLOSED_RECORD_FOLDER_EXC = "You can't add new items to a closed record folder."; - private final static String HOLD_NAME = getRandomName("holdName"); - private final static String RECORD_FOLDER_NAME_WITH_SPACE = "Folder With Spaces In Name"; - - private UserModel userFillingPermission, userReadOnlyPermission; - private SiteModel publicSite; - private FolderModel testFolder; - private FileModel testFile; - private RecordCategory recordCategory; - private RecordCategoryChild recordFolder, subcategoryRecordFolder, closedRecordFolder, recordFolderWithSpacesInName; - private UnfiledContainerChild unfiledContainerFolder; - private String holdNodeRef; - - @Autowired - private DockerHelper dockerHelper; - - @Autowired - private RoleService roleService; - - @Autowired - private RMRolesAndActionsAPI rmRolesAndActionsAPI; - - @Autowired - private HoldsAPI holdsAPI; - - /** - * Invalid destination paths where in-place records can't be filed - */ - @DataProvider (name = "invalidDestinationPaths") - public Object[][] getInvalidDestinationPaths() - { - return new String[][] - { - { "/", DESTINATION_PATH_NOT_FOUND_EXC }, - { "Unfiled Records", INVALID_DESTINATION_PATH_EXC }, - { "Transfers", INVALID_DESTINATION_PATH_EXC }, - { "Holds", INVALID_DESTINATION_PATH_EXC }, - { "rm/documentlibrary", DESTINATION_PATH_NOT_FOUND_EXC }, - { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC }, - // a closed record folder - { Utility.buildPath(recordCategory.getName(), closedRecordFolder.getName()), CLOSED_RECORD_FOLDER_EXC}, - // an arbitrary unfiled records folder - { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC }, - // a collaboration site folder - { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_FOUND_EXC } - }; - } - - /** - * Invalid destination ids where in-place records can't be filed - */ - @DataProvider (name = "invalidDestinationIds") - public Object[][] getInvalidDestinationIds() - { - return new String[][] - { - { getFilePlan(FILE_PLAN_ALIAS).getId() }, - { getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, - { getTransferContainer(TRANSFERS_ALIAS).getId() }, - { rmRolesAndActionsAPI.getItemNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), - "/" + HOLDS_CONTAINER) }, - { recordCategory.getId() }, - { unfiledContainerFolder.getId() }, - { testFolder.getNodeRef() } - }; - } - - @BeforeClass (alwaysRun = true) - public void declareAndFileDocumentAsRecordSetup() - { - STEP("Create test collaboration site to store documents in."); - publicSite = dataSite.usingAdmin().createPublicRandomSite(); - - STEP("Create a test folder within the collaboration site"); - testFolder = dataContent.usingAdmin().usingSite(publicSite).createFolder(); - - STEP("Create record categories and record folders"); - recordCategory = createRootCategory(getRandomName("recordCategory")); - RecordCategoryChild subCategory = createRecordCategory(recordCategory.getId(), getRandomName("subCategory")); - recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder")); - subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder")); - unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); - closedRecordFolder = createFolder(recordCategory.getId(), getRandomName("closedRecordFolder")); - closeFolder(closedRecordFolder.getId()); - recordFolderWithSpacesInName = createFolder(recordCategory.getId(), RECORD_FOLDER_NAME_WITH_SPACE); - - STEP("Create rm users with different permissions on the record category"); - userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING); - userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, - ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS); - } - - @BeforeMethod(alwaysRun = true) - public void createDocument() - { - STEP("Create a document in the collaboration site"); - testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - } - - /** - * Given I am calling the "declare as record" action - * And I am not providing a location parameter value - * When I execute the action - * Then the document is declared as a record - * And is placed in the Unfiled Records location - */ - @Test - public void declareAndFileNoLocationUsingActionsAPI() throws Exception - { - STEP("Declare document as record without providing a location parameter value using v1 actions api"); - getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareAsRecord(testFile); - - STEP("Verify the declared record is placed in the Unfiled Records folder"); - assertTrue(isMatchingRecordInUnfiledRecords(testFile), "Record should be filed to Unfiled Records folder"); - - STEP("Verify the document in collaboration site is now a record"); - assertTrue(hasRecordAspect(testFile), "File should have record aspect"); - } - - /** - * Given I am calling the "declare as record" action - * And I provide a valid record folder in the location parameter - * When I execute the action - * Then the document is declared as a record - * And is filed to the record folder specified - */ - @Test - public void declareAndFileToValidLocationUsingActionsAPI() throws Exception - { - STEP("Declare document as record with a location parameter value"); - getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile, - Utility.buildPath(recordCategory.getName(), recordFolder.getName())); - - STEP("Verify the declared record is placed in the record folder"); - assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record should be filed to record folder"); - - STEP("Verify the document in collaboration site is now a record"); - assertTrue(hasRecordAspect(testFile), "File should have record aspect"); - } - - /** - * Given I am calling the "declare as record" action - * And I provide a valid record folder name in the location parameter - * When I execute the action - * Then the document is declared as a record - * And is filed to the record folder specified - */ - @Test - public void declareAndFileToValidLocationWithSpacesUsingActionsAPI() throws Exception - { - STEP("Declare document as record with an encoded location parameter value"); - getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile, - Utility.buildPath(recordCategory.getName(), RECORD_FOLDER_NAME_WITH_SPACE)); - - STEP("Verify the declared record is placed in the record folder"); - assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolderWithSpacesInName), "Record should be filed to record folder"); - - STEP("Verify the document in collaboration site is now a record"); - assertTrue(hasRecordAspect(testFile), "File should have record aspect"); - } - - /** - * Given I am calling the "declare as record" action - * And I provide an invalid record folder in the location parameter - * When I execute the action - * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder - * And the document is not declared as a record - */ - @Test (dataProvider = "invalidDestinationPaths") - public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception - { - STEP("Declare document as record with an invalid location parameter value"); - getRestAPIFactory().getActionsAPI().declareAndFile(testFile, containerPath); - assertStatusCode(ACCEPTED); - - STEP("Check the exception thrown in alfresco logs"); - dockerHelper.checkExceptionIsInAlfrescoLogs(expectedException); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I declare a record using the v1 API - * When I provide a location parameter - * Then the record is declared in the correct location - */ - @Test - public void declareAndFileToValidLocationUsingFilesAPI() throws Exception - { - STEP("Declare document as record with a location parameter value"); - Record record = getRestAPIFactory().getFilesAPI(userFillingPermission) - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Verify the declared record is placed in the record folder"); - assertEquals(record.getParentId(), recordFolder.getId(), "Record should be filed to record folder"); - - STEP("Verify the document in collaboration site is now a record"); - assertTrue(hasRecordAspect(testFile), "File should have record aspect"); - } - - /** - * Given I declare a record using the v1 API - * When I provide an invalid record folder in the location parameter - * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder - * And the document is not declared as a record - */ - @Test (dataProvider = "invalidDestinationIds") - public void declareAndFileToInvalidLocationUsingFilesAPI(String containerID) throws Exception - { - STEP("Declare document as record with an invalid location parameter value"); - getRestAPIFactory().getFilesAPI() - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, containerID)) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(BAD_REQUEST); - getRestAPIFactory().getRmRestWrapper() - .assertLastError() - .containsSummary("is not valid for this endpoint. Expected nodeType is:{http://www.alfresco.org/model/recordsmanagement/1.0}recordFolder"); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I am an user with read only permissions on a record folder - * When I declare and file a record to the record folder - * Then I receive an error indicating that the access is denied - * And the document is not declared as a record - */ - @Test - public void declareAndFileByUserWithReadOnlyPermission() throws Exception - { - STEP("Declare document as record with a record folder as location parameter"); - getRestAPIFactory().getFilesAPI(userReadOnlyPermission) - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(FORBIDDEN); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I am a non RM user - * When I declare and file a record to the record folder - * Then I receive an error indicating that the access is denied - * And the document is not declared as a record - */ - @Test - public void declareAndFileByNonRMUser() throws Exception - { - STEP("Create an user with no rm rights"); - UserModel nonRMUser = getDataUser().createRandomTestUser(); - getDataUser().addUserToSite(nonRMUser, publicSite, UserRole.SiteCollaborator); - - STEP("Declare document as record with a record folder as location parameter"); - getRestAPIFactory().getFilesAPI(nonRMUser) - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(FORBIDDEN); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I declare a record using the v1 API - * When I provide a nonexistent record folder in the location parameter - * Then I receive an error indicating that the record folder does not exist - * And the document is not declared as a record - */ - @Test - public void declareAndFileToNonexistentRecordFolderUsingFilesAPI() throws Exception - { - STEP("Declare document as record with a nonexistent location parameter value"); - getRestAPIFactory().getFilesAPI() - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, "nonexistent")) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(NOT_FOUND); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I declare a record using the v1 API - * When I provide a closed record folder in the location parameter - * Then I receive an error indicating that the record folder is closed - * And the document is not declared as a record - */ - @Test - public void declareAndFileToClosedRecordFolderUsingFilesAPI() throws Exception - { - STEP("Declare document as record with a closed location parameter value"); - getRestAPIFactory().getFilesAPI() - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, closedRecordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(UNPROCESSABLE_ENTITY); - getRestAPIFactory().getRmRestWrapper() - .assertLastError() - .containsSummary(CLOSED_RECORD_FOLDER_EXC); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I declare a record using the v1 API - * When I provide a held record folder in the location parameter - * Then I receive an error indicating that the record folder is held - * And the document is not declared as a record - */ - @Test - public void declareAndFileToHeldRecordFolderUsingFilesAPI() throws Exception - { - RecordCategoryChild heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder")); - holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(), - HOLD_NAME); - - STEP("Declare document as record with a frozen location parameter value"); - getRestAPIFactory().getFilesAPI() - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, heldRecordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(UNPROCESSABLE_ENTITY); - - STEP("Check that the file is not a record"); - assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); - } - - /** - * Given I declare a record using the v1 API - * When I provide a location parameter - * Then the record is declared in the correct location - * And when I declare it again using a different location - * Then I get an invalid operation exception - */ - @Test - public void declareAndFileTwiceDifferentLocations() - { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite).usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Declare document as record with a record folder as location parameter"); - getRestAPIFactory().getFilesAPI(userFillingPermission) - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, subcategoryRecordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Declare it again using a different record folder as location parameter"); - getRestAPIFactory().getFilesAPI(userFillingPermission) - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(UNPROCESSABLE_ENTITY); - - STEP("Verify the declared record is placed in the first record folder"); - assertTrue(isMatchingRecordInRecordFolder(testFile, subcategoryRecordFolder), - "Record should be filed to recordFolder"); - assertFalse(isMatchingRecordInRecordFolder(testFile, recordFolder), - "Record should not be filed to subcategoryRecordFolder"); - } - - @AfterClass(alwaysRun = true) - public void declareAndFileDocumentAsRecordCleanup() - { - //delete rm items - holdsAPI.deleteHold(getAdminUser(), holdNodeRef); - deleteRecordCategory(recordCategory.getId()); - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledContainerFolder.getId()); - - //delete created collaboration site - dataSite.deleteSite(publicSite); - - //delete users - getDataUser().deleteUser(userFillingPermission); - getDataUser().deleteUser(userReadOnlyPermission); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java deleted file mode 100644 index 6f812729e2..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.files; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; - -import java.io.InputStream; -import java.util.List; -import java.util.stream.Collectors; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.model.RestNodeModel; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordProperties; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.v0.RecordsAPI; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.apache.chemistry.opencmis.client.api.Document; -import org.apache.chemistry.opencmis.client.api.SecondaryType; -import org.apache.commons.codec.digest.DigestUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * Tests for Declare Documents as Records Action API - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class DeclareDocumentAsRecordTests extends BaseRMRestTest -{ - private UserModel testUser, testUserReadOnly; - private SiteModel testSite; - private FolderModel testFolder; - - @Autowired - RecordsAPI recordsAPI; - - @BeforeClass(alwaysRun=true) - public void declareDocumentAsRecordSetup() - { - // create test user and test collaboration site to store documents in - testUser = getDataUser().createRandomTestUser(); - testUserReadOnly = getDataUser().createRandomTestUser(); - - testSite = dataSite.usingAdmin().createPublicRandomSite(); - - getDataUser().addUserToSite(testUser, testSite, UserRole.SiteContributor); - getDataUser().addUserToSite(testUserReadOnly, testSite, UserRole.SiteConsumer); - - testFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder(); - } - - /** - *
-     * Given a document that is not a record
-     * And I have write permissions on the document
-     * When I declare the document as a record
-     * Then it is successfully moved into the unfiled record container
-     * And it is renamed to reflect the record identifier
-     * And it is now a record
-     * And it remains a secondary child of the starting location where I can still view it
-     * 
-     *
-     * RM-6779
-     * Given I declare a record using the v1 API
-     * When I do not provide a location parameter
-     * Then the record is declared in the unfiled folder
-     *
-     * @throws Exception for malformed JSON API response
-     */
-    @Test(description = "User with correct permissions can declare document as a record")
-    @AlfrescoTest(jira = "RM-4429, RM-6779")
-    public void userWithPrivilegesCanDeclareDocumentAsRecord() throws Exception
-    {
-        // create document in a folder in a collaboration site
-        FileModel document = dataContent.usingSite(testSite)
-            .usingUser(testUser)
-            .usingResource(testFolder)
-            .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
-        // declare document as record
-        Record record = getRestAPIFactory().getFilesAPI(testUser).declareAsRecord(document.getNodeRefWithoutVersion());
-        assertStatusCode(CREATED);
-
-        // verify the declared record is in Unfiled Records folder
-        UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
-        List matchingRecords = unfiledContainersAPI.getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
-            .getEntries()
-            .stream()
-            .filter(e -> e.getEntry().getId().equals(document.getNodeRefWithoutVersion()))
-            .collect(Collectors.toList());
-        // there should be only one matching record corresponding this document
-        assertEquals(matchingRecords.size(), 1, "More than one record matching document name");
-
-        // verify the original file in collaboration site has been renamed to reflect the record identifier
-        List filesAfterRename = getRestAPIFactory().getNodeAPI(testFolder)
-                .listChildren()
-                .getEntries()
-                .stream()
-                .filter(f -> f.onModel().getId().equals(document.getNodeRefWithoutVersion()))
-                .collect(Collectors.toList());
-        assertEquals(filesAfterRename.size(), 1, "There should be only one file in folder " + testFolder.getName());
-
-        // verify the new name has the form of " ()."
-        String recordName = filesAfterRename.get(0).onModel().getName();
-        assertEquals(recordName, document.getName().replace(".", String.format(" (%s).", record.getProperties().getIdentifier())));
-
-        // verify the document in collaboration site is now a record, note the file is now renamed hence folder + doc. name concatenation
-        // this also verifies the document is still in the initial folder
-        Document documentPostFiling = dataContent.usingSite(testSite)
-            .usingUser(testUser)
-            .getCMISDocument(testFolder.getCmisLocation() + "/" + recordName);
-
-        // a document is a record if "Record" is one of its secondary types
-        List documentSecondary = documentPostFiling.getSecondaryTypes()
-            .stream()
-            .filter(t -> t.getDisplayName().equals("Record"))
-            .collect(Collectors.toList());
-        assertFalse(documentSecondary.isEmpty(), "Document is not a record");
-
-        // verify the document is readable and has same content as corresponding record
-        try
-        (
-            InputStream recordInputStream = getRestAPIFactory().getRecordsAPI().getRecordContent(record.getId()).asInputStream();
-            InputStream documentInputStream = documentPostFiling.getContentStream().getStream()
-        )
-        {
-            assertEquals(DigestUtils.sha1(recordInputStream), DigestUtils.sha1(documentInputStream));
-        }
-    }
-
-    /**
-     * 
-     * Given a document that is not a record
-     * And I have read permissions on the document
-     * When I declare the document as a record
-     * Then I get a permission denied exception
-     * 
- * @throws Exception for malformed JSON API response - */ - @Test(description = "User with read-only permissions can't declare document a record") - @AlfrescoTest(jira = "RM-4429") - public void userWithReadPermissionsCantDeclare() throws Exception - { - // create document in a folder in a collaboration site - FileModel document = dataContent.usingSite(testSite) - .usingUser(testUser) - .usingResource(testFolder) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - // declare document as record as testUserReadOnly - getRestAPIFactory().getFilesAPI(testUserReadOnly).declareAsRecord(document.getNodeRefWithoutVersion()); - assertStatusCode(FORBIDDEN); - - // verify the document is still in the original folder - List filesAfterRename = getRestAPIFactory().getNodeAPI(testFolder) - .listChildren() - .getEntries() - .stream() - .filter(f -> f.onModel().getId().equals(document.getNodeRefWithoutVersion())) - .collect(Collectors.toList()); - assertEquals(filesAfterRename.size(), 1, "Declare as record failed but original document is missing"); - } - - /** - *
-     * Given a record
-     * When I declare the record as a record
-     * Then I get a invalid operation exception
-     * 
- */ - @Test(description = "Record can't be declared a record") - @AlfrescoTest(jira = "RM-4429") - public void recordCantBeDeclaredARecord() - { - // create a non-electronic record in a random folder - Record nonelectronicRecord = Record.builder() - .properties(RecordProperties.builder() - .description("Description") - .title("Title") - .build()) - .name("Non-Electronic Record") - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - Record record = getRestAPIFactory().getRecordFolderAPI() - .createRecord(nonelectronicRecord, createCategoryFolderInFilePlan().getId()); - assertStatusCode(CREATED); - - // try to declare it as a record - getRestAPIFactory().getFilesAPI().declareAsRecord(record.getId()); - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - *
-     * Given a node that is NOT a document
-     * When I declare the node as a record
-     * Then I get a invalid operation exception
-     * 
- */ - @Test(description = "Node that is not a document can't be declared a record") - @AlfrescoTest(jira = "RM-4429") - public void nonDocumentCantBeDeclaredARecord() - { - FolderModel otherTestFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder(); - - // try to declare otherTestFolder as a record - getRestAPIFactory().getFilesAPI().declareAsRecord(otherTestFolder.getNodeRefWithoutVersion()); - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - * Given a file that has version declared as record - * When the file is declared as record - * Then the action is successful - */ - @Test (description = "Declaring as record a file that already has its version declared as record is successful") - @AlfrescoTest (jira = "RM-6786") - public void declareAsRecordAFileWithARecordVersion() - { - STEP("Create a file."); - FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Declare file version as record and check that record is successfully created."); - recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(), - testFile.getName()); - - STEP("Declare file as record and check that record is successfully created."); - getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - } - -// @Test(description = "Create 500 documents and declare them ass records concurently.") -// public void declare500DocumentsAsRecordsConcurrently() throws Exception -// { -// FolderModel testFolder1 = dataContent.usingSite(testSite).usingUser(testUser).createFolder(); -// // create 500 documents in a folder in a collaboration site -// List listOfDocuments = new ArrayList(); -// for(int i = 0; i < 500; i++) -// { -// FileModel document = dataContent.usingSite(testSite) -// .usingUser(testUser) -// .usingResource(testFolder1) -// .createContent(CMISUtil.DocumentType.TEXT_PLAIN); -// listOfDocuments.add(document); -// } -// -// UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); -// String unfiledContainerId = unfiledContainersAPI.getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId(); -// Counter.initSuccessCount(0); -// Counter.initFailCount(0); -// ExecutorService pool = Executors.newFixedThreadPool(16); -// for (FileModel document : listOfDocuments) -// { -// pool.submit(new Task(document, unfiledContainerId)); -// } -// pool.shutdown(); -// pool.awaitTermination(120L, TimeUnit.SECONDS); -// -// assertEquals(Counter.getSuccessCount(), 500 - Counter.getFailCount()); -// } -// -// class Task implements Runnable -// { -// private FileModel document; -// private String unfiledContainerId; -// public Task(FileModel document, String unfiledContainerId) -// { -// this.document = document; -// this.unfiledContainerId = unfiledContainerId; -// } -// -// @Override -// public void run() -// { -// String parentId = ""; -// try -// { -// Record record = getRestAPIFactory().getFilesAPI(testUser).declareAsRecord(document.getNodeRefWithoutVersion()); -// assertStatusCode(CREATED); -// -// parentId = record.getParentId(); -// } -// catch (Exception e) -// { -// Counter.incrementFailCount(); -// fail("Should not be here"); -// } -// -// assertEquals(parentId, unfiledContainerId, "Declare as record was unsuccessful."); -// Counter.incrementSuccessCount(); -// } -// } -// -// static class Counter -// { -// private static int successCount; -// private static int failCount; -// -// public static void initSuccessCount(int initialCount) -// { -// successCount = initialCount; -// } -// -// public static void initFailCount(int initialCount) -// { -// failCount = initialCount; -// } -// -// public static synchronized void incrementSuccessCount() -// { -// successCount++; -// } -// -// public static int getSuccessCount() -// { -// return successCount; -// } -// -// public static synchronized void incrementFailCount() -// { -// failCount++; -// } -// -// public static int getFailCount() -// { -// return failCount; -// } -// } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java deleted file mode 100644 index ac104015f1..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.files; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.springframework.http.HttpStatus.ACCEPTED; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.io.File; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.util.DockerHelper; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.Utility; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * API tests for declaring a document version as record and filing to a record folder location within the file plan - * - * @author Rodica Sutu - * @since 3.4 - */ -@AlfrescoTest (jira = "APPS-35") -public class FileVersionAsRecordTests extends BaseRMRestTest -{ - private final static String DESTINATION_PATH_NOT_FOUND_EXC = "Unable to execute declare-version-record action, " + - "because the destination path could not be found."; - private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute declare-version-record action, " + - "because the destination path is invalid."; - private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute declare-version-record " + - "action, because the destination path is not a record folder."; - private final static String ACCESS_DENIED_EXC = "Access Denied. You do not have the appropriate " + - "permissions to perform this operation."; - private final static String HOLD_NAME = getRandomName("holdName"); - - private UserModel userFillingPermission, userReadOnlyPermission; - private SiteModel publicSite; - private FileModel testFile; - private FolderModel testFolder; - private RecordCategory recordCategory; - private RecordCategoryChild recordFolder, closedRecordFolder, heldRecordFolder; - private UnfiledContainerChild unfiledContainerFolder; - private String holdNodeRef; - - @Autowired - private RoleService roleService; - @Autowired - private DockerHelper dockerHelper; - @Autowired - private HoldsAPI holdsAPI; - - @BeforeClass (alwaysRun = true) - public void declareAndFileVersionAsRecordSetup() - { - STEP("Create test collaboration site to store documents in."); - publicSite = dataSite.usingAdmin().createPublicRandomSite(); - - STEP("Create a test folder within the collaboration site"); - testFolder = dataContent.usingAdmin().usingSite(publicSite).createFolder(); - - STEP("Create record categories and record folders"); - recordCategory = createRootCategory(getRandomName("recordCategory")); - recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder")); - closedRecordFolder = createFolder(recordCategory.getId(), getRandomName("closedRecordFolder")); - closeFolder(closedRecordFolder.getId()); - unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); - heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder")); - holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(), - HOLD_NAME); - - STEP("Create rm users with different permissions on the record category"); - userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, - ROLE_RM_POWER_USER, PERMISSION_FILING); - userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, - ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS); - } - - @BeforeMethod (alwaysRun = true) - public void createDocument() - { - STEP("Create a document in the collaboration site"); - testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - } - - /** - * Given I am calling the "declare version as record" action - * And I am not providing a location parameter value - * When I execute the action - * Then the document is declared as a version record - * And is placed in the Unfiled Records location - */ - @Test - public void declareVersionAndFileNoLocationUsingActionsAPI() throws Exception - { - STEP("Declare document version as record without providing a location parameter value using v1 actions api"); - getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareVersionAsRecord(testFile); - - STEP("Verify the declared version record is placed in the Unfiled Records folder and is a record version"); - assertTrue(isRecordVersionInUnfiledRecords(testFile, "1.0"), "Version record should be filed to Unfiled " + - "Records folder"); - } - - /** - * Given I am calling the "declare version as record" action - * And I provide a valid record folder in the location parameter - * When I execute the action - * Then the document is declared as a version record - * And is filed to the record folder specified - */ - @Test - public void fileVersionAsRecordToValidLocationUsingActionsAPI() throws Exception - { - STEP("Declare document version as record with a location parameter value"); - getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFileVersionAsRecord(testFile, - Utility.buildPath(recordCategory.getName(), recordFolder.getName())); - - STEP("Verify the declared version record is placed in the record folder"); - assertTrue(isRecordVersionInRecordFolder(testFile, recordFolder, "1.0"), "Record version should be filed to " + - "record folder"); - } - - /** - * Invalid destination paths where version records can't be filed - */ - @DataProvider (name = "invalidDestinationPaths") - public Object[][] getInvalidDestinationPaths() - { - return new String[][] - { - { "/", DESTINATION_PATH_NOT_FOUND_EXC }, - { "Unfiled Records", INVALID_DESTINATION_PATH_EXC }, - { "Transfers", INVALID_DESTINATION_PATH_EXC }, - { "Holds", INVALID_DESTINATION_PATH_EXC }, - { "rm/documentlibrary", DESTINATION_PATH_NOT_FOUND_EXC }, - { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC }, - // a closed record folder - { Utility.buildPath(recordCategory.getName(), closedRecordFolder.getName()), - ACCESS_DENIED_EXC }, - // a frozen record folder - { Utility.buildPath(recordCategory.getName(), heldRecordFolder.getName()), - ACCESS_DENIED_EXC }, - // an arbitrary unfiled records folder - { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC }, - // a collaboration site folder - { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_FOUND_EXC } - }; - } - - /** - * Given I am calling the "declare version as record" action - * And I provide an invalid record folder in the path parameter - * When I execute the action - * Then I receive an error indicating that I have attempted to file version as record a document into an invalid - * record folder - * And the document is not declared as a version record - */ - @Test (dataProvider = "invalidDestinationPaths") - public void declareVersionAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception - { - STEP("Declare document as record version with an invalid location parameter value"); - getRestAPIFactory().getActionsAPI().declareAndFileVersionAsRecord(testFile, containerPath); - assertStatusCode(ACCEPTED); - - STEP("Check the exception thrown in alfresco logs"); - dockerHelper.checkExceptionIsInAlfrescoLogs(expectedException); - } - - /** - * Given I am an user with read only permissions on a record folder - * When I declare and file a version record to the record folder - * Then I receive an error indicating that the access is denied - * And the document is not declared as a record - */ - @Test - public void declareAndFileByUserWithReadOnlyPermission() throws Exception - { - STEP("Declare document as record with a record folder as location parameter"); - getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareAndFileVersionAsRecord(testFile, - Utility.buildPath(recordCategory.getName(), recordFolder.getName())); - - STEP("Check that the record version is not added to the record folder"); - assertFalse(isRecordVersionInRecordFolder(testFile, recordFolder, "1.0"), "Record version is filed to " + - "record folder where the user doesn't have filling permission"); - } - - /** - * Given I am calling the "declare version as record" action for a minor document version - * And I am not providing a path parameter value - * When I execute the action - * Then the document version is declared as a version record - * And is placed in the Unfiled Records location - */ - @Test - public void declareVersionAsRecordMinorVersionUsingActionsAPI() throws Exception - { - STEP("Update document in the collaboration site"); - dataContent.usingSite(publicSite).usingAdmin().usingResource(testFile).updateContent("This is the new content" + - "for " + testFile.getName()); - - STEP("Declare document version as record with providing a location parameter value using v1 actions api"); - getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFileVersionAsRecord(testFile, - Utility.buildPath(recordCategory.getName(), recordFolder.getName())); - - STEP("Verify the declared version record is placed in the record folder and is a record version"); - assertTrue(isRecordVersionInRecordFolder(testFile, recordFolder, "1.1"), "Record should be filed to fileplan " + - "location"); - } - - /** - * Given I am calling the "declare version as record" action for a major document version - * And I am not providing a path parameter value - * When I execute the action - * Then the document version is declared as a version record version - * And is placed in the Unfiled Records location - */ - @Test - public void declareVersionAsRecordMajorVersionUsingActionsAPI() throws Exception - { - STEP("Update document in the collaboration site"); - File sampleFile = Utility.getResourceTestDataFile("SampleTextFile_10kb.txt"); - restClient.authenticateUser(getAdminUser()).withCoreAPI().usingParams("majorVersion=true").usingNode(testFile).updateNodeContent(sampleFile); - - STEP("Declare document version as record with providing a location parameter value using v1 actions api"); - getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFileVersionAsRecord(testFile, - Utility.buildPath(recordCategory.getName(), recordFolder.getName())); - - STEP("Verify the declared version record is placed in the record folder and is a record version"); - assertTrue(isRecordVersionInRecordFolder(testFile, recordFolder, "2.0"), "Version record should be filed to " + - "the record folder"); - } - - @AfterClass (alwaysRun = true) - public void declareAndFileVersionAsRecordCleanUp() - { - holdsAPI.deleteHold(getAdminUser(), holdNodeRef); - deleteRecordCategory(recordCategory.getId()); - - //delete created collaboration site - dataSite.deleteSite(publicSite); - - //delete users - getDataUser().deleteUser(userFillingPermission); - getDataUser().deleteUser(userReadOnlyPermission); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/AddToHoldsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/AddToHoldsTests.java deleted file mode 100644 index c7a16e577d..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/AddToHoldsTests.java +++ /dev/null @@ -1,365 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.hold; - - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.FROZEN_ASPECT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.rest.rm.community.utils.CoreUtil.toContentModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.commons.httpclient.HttpStatus.SC_BAD_REQUEST; -import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.springframework.http.HttpStatus.CREATED; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.AssertJUnit.assertFalse; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.dataprep.ContentActions; -import org.alfresco.rest.model.RestNodeModel; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.hold.HoldEntry; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * API tests for adding content/record folder/records to holds - * - * @author Rodica Sutu - * @since 3.2 - */ -@AlfrescoTest (jira = "RM-6874") -public class AddToHoldsTests extends BaseRMRestTest -{ - private static final String HOLD = "HOLD" + generateTestPrefix(AddToHoldsTests.class); - private static final String ACCESS_DENIED_ERROR_MESSAGE = "Access Denied. You do not have the appropriate " + - "permissions to perform this operation."; - private static final String INVALID_TYPE_ERROR_MESSAGE = "Items added to a hold must be either a record, a " + - "record folder or active content."; - private static final String LOCKED_FILE_ERROR_MESSAGE = "Locked content can't be added to a hold."; - private SiteModel testSite; - private String holdNodeRef; - private FileModel documentHeld, contentToAddToHold, contentAddToHoldNoPermission; - private UserModel userAddHoldPermission; - private final List users = new ArrayList<>(); - private final List nodesToBeClean = new ArrayList<>(); - - @Autowired - private HoldsAPI holdsAPI; - @Autowired - private RoleService roleService; - @Autowired - private ContentActions contentActions; - - @BeforeClass (alwaysRun = true) - public void preconditionForAddContentToHold() - { - STEP("Create a hold."); - holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(), - HOLD, HOLD_REASON, HOLD_DESCRIPTION); - - STEP("Create test files."); - testSite = dataSite.usingAdmin().createPublicRandomSite(); - documentHeld = dataContent.usingAdmin().usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - contentToAddToHold = dataContent.usingAdmin().usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - contentAddToHoldNoPermission = dataContent.usingAdmin().usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Add the content to the hold."); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), documentHeld - .getNodeRefWithoutVersion(), HOLD); - - STEP("Create users"); - userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, - UserRole.SiteCollaborator, holdNodeRef, UserRoles.ROLE_RM_MANAGER, PERMISSION_FILING); - users.add(userAddHoldPermission); - - } - - /** - * Given a hold that contains at least one active content - * When I use the existing REST API to retrieve the contents of the hold - * Then I should see all the active content on hold - */ - @Test - public void retrieveTheContentOfTheHoldUsingV1API() throws Exception - { - STEP("Retrieve the list of children from the hold and collect the entries that have the name of the active " + - "content held"); - List documentsHeld = restClient.authenticateUser(getAdminUser()).withCoreAPI() - .usingNode(toContentModel(holdNodeRef)) - .listChildren().getEntries().stream() - .filter(child -> child.onModel().getName().contains(documentHeld - .getName())) - .collect(Collectors.toList()); - STEP("Check the list of active content"); - assertEquals(documentsHeld.size(), 1, "The active content is not retrieve when getting the children from the " + - "hold folder"); - assertEquals(documentsHeld.get(0).onModel().getName(), documentHeld.getName()); - } - - /** - * Given a hold that contains at least one active content - * When I use the existing REST API to retrieve the holds the content is added - * Then the hold where the content held is returned - */ - @Test - public void retrieveTheHoldWhereTheContentIsAdded() - { - List holdEntries = holdsAPI.getHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - documentHeld.getNodeRefWithoutVersion(), true, null); - assertTrue(holdEntries.stream().anyMatch(holdEntry -> holdEntry.getName().contains(HOLD)), "Could not find " + - "hold with name " + HOLD); - } - - /** - * Valid nodes to be added to hold - */ - @DataProvider (name = "validNodesForAddToHold") - public Object[][] getValidNodesForAddToHold() - { - //create electronic and nonElectronic record in record folder - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - nodesToBeClean.add(recordFolder.getParentId()); - Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile - (IMAGE_FILE)); - assertStatusCode(CREATED); - - Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolder.getId()); - assertStatusCode(CREATED); - getRestAPIFactory().getRMUserAPI().addUserPermission(recordFolder.getId(), userAddHoldPermission, - PERMISSION_FILING); - - RecordCategoryChild folderToHold = createCategoryFolderInFilePlan(); - getRestAPIFactory().getRMUserAPI().addUserPermission(folderToHold.getId(), userAddHoldPermission, - PERMISSION_FILING); - nodesToBeClean.add(folderToHold.getParentId()); - - return new String[][] - { // record folder - { folderToHold.getId() }, - //electronic record - { electronicRecord.getId() }, - // non electronic record - { nonElectronicRecord.getId() }, - // document from collaboration site - { contentToAddToHold.getNodeRefWithoutVersion() }, - }; - } - - /** - * Given record folder/record/document not on hold - * And a hold - * And file permission on the hold - * And the appropriate capability to add to hold - * When I use the existing REST API to add the node to the hold - * Then the record folder/record/document is added to the hold - * And the item is frozen - * - * @throws Exception - */ - @Test (dataProvider = "validNodesForAddToHold") - public void addValidNodesToHoldWithAllowedUser(String nodeId) throws Exception - { - STEP("Add node to hold with user with permission."); - holdsAPI.addItemToHold(userAddHoldPermission.getUsername(), userAddHoldPermission.getPassword(), nodeId, HOLD); - - STEP("Check the node is frozen."); - assertTrue(hasAspect(nodeId, FROZEN_ASPECT)); - } - - /** - * Data provider with user without correct permission to add to hold and the node ref to be added to hold - * @return object with user model and the node ref to be added to hold - */ - @DataProvider (name = "userWithoutPermissionForAddToHold") - public Object[][] getUserWithoutPermissionForAddToHold() - { - //create record folder - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - //create a rm manager and grant read permission over the record folder created - UserModel user = roleService.createUserWithRMRoleAndRMNodePermission(ROLE_RM_MANAGER.roleId, recordFolder.getId(), - PERMISSION_READ_RECORDS); - getRestAPIFactory().getRMUserAPI().addUserPermission(holdNodeRef, user, PERMISSION_FILING); - nodesToBeClean.add(recordFolder.getParentId()); - return new Object[][] - { // user without write permission on the content - { - roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole.SiteConsumer, - holdNodeRef, UserRoles.ROLE_RM_MANAGER, PERMISSION_FILING), - contentAddToHoldNoPermission.getNodeRefWithoutVersion() - }, - // user with write permission on the content and without filling permission on a hold - { - roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole - .SiteCollaborator, - holdNodeRef, UserRoles.ROLE_RM_MANAGER, PERMISSION_READ_RECORDS), - contentAddToHoldNoPermission.getNodeRefWithoutVersion() - }, - // user with write permission on the content, filling permission on a hold without add to - // hold capability - { - roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole - .SiteCollaborator, - holdNodeRef, UserRoles.ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS), - contentAddToHoldNoPermission.getNodeRefWithoutVersion() - }, - //user without write permission on RM record folder - { - user, recordFolder.getId() - }, - - }; - } - - /** - * Given a node not on hold - * And a hold - * And user without right permission to add to hold - * When I use the existing REST API to add the node to the hold - * Then the node is not added to the hold - * And the node is not frozen - * - * @throws Exception - */ - @Test (dataProvider = "userWithoutPermissionForAddToHold") - public void addContentToHoldWithUserWithoutHoldPermission(UserModel userModel, String nodeToBeAddedToHold) throws Exception - { - users.add(userModel); - STEP("Add the node to the hold with user without permission."); - String response = holdsAPI.addToHoldAndGetMessage(userModel.getUsername(), userModel.getPassword(), - SC_INTERNAL_SERVER_ERROR, nodeToBeAddedToHold, holdNodeRef); - assertTrue(response.contains(ACCESS_DENIED_ERROR_MESSAGE)); - - STEP("Check the node is not frozen."); - assertFalse(hasAspect(nodeToBeAddedToHold,FROZEN_ASPECT)); - } - - /** - * Data provider with invalid node types that can be added to a hold - */ - @DataProvider (name = "invalidNodesForAddToHold") - public Object[][] getInvalidNodesForAddToHold() - { - //create locked file - FileModel contentLocked = dataContent.usingAdmin().usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - contentActions.checkOut(getAdminUser().getUsername(), getAdminUser().getPassword(), - testSite.getId(), contentLocked.getName()); - RecordCategory category = createRootCategory(getRandomAlphanumeric()); - nodesToBeClean.add(category.getId()); - return new Object[][] - { // file plan node id - { getFilePlan(FILE_PLAN_ALIAS).getId(), SC_BAD_REQUEST, INVALID_TYPE_ERROR_MESSAGE }, - //transfer container - { getTransferContainer(TRANSFERS_ALIAS).getId(), SC_BAD_REQUEST, INVALID_TYPE_ERROR_MESSAGE }, - // a record category - { category.getId(), SC_BAD_REQUEST, INVALID_TYPE_ERROR_MESSAGE }, - // unfiled records root - { getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId(), SC_BAD_REQUEST, - INVALID_TYPE_ERROR_MESSAGE }, - // an arbitrary unfiled records folder - { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + - getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId(), SC_BAD_REQUEST, - INVALID_TYPE_ERROR_MESSAGE }, - //folder, - { dataContent.usingAdmin().usingSite(testSite).createFolder().getNodeRef(), SC_BAD_REQUEST, - INVALID_TYPE_ERROR_MESSAGE }, - //document locked - { contentLocked.getNodeRefWithoutVersion(), SC_INTERNAL_SERVER_ERROR, LOCKED_FILE_ERROR_MESSAGE } - }; - } - - /** - * Given a node that is not a document/record/ record folder ( a valid node type to be added to hold) - * And a hold - * And user without right permission to add to hold - * When I use the existing REST API to add the node to the hold - * Then the node is not added to the hold - * And the node is not frozen - * - * @throws Exception - */ - @Test (dataProvider = "invalidNodesForAddToHold") - public void addInvalidNodesToHold(String itemNodeRef, int responseCode, String errorMessage) throws Exception - { - STEP("Add the node to the hold "); - String responseErrorMessage = holdsAPI.addToHoldAndGetMessage(getAdminUser().getUsername(), - getAdminUser().getPassword(), responseCode, itemNodeRef, holdNodeRef); - assertTrue(responseErrorMessage.contains(errorMessage), - "Actual error message " + responseErrorMessage + " expected " + errorMessage); - - STEP("Check node is not frozen."); - assertFalse(hasAspect(itemNodeRef, FROZEN_ASPECT)); - } - - @AfterClass (alwaysRun = true) - public void cleanUpAddContentToHold() - { - holdsAPI.deleteHold(getAdminUser(), holdNodeRef); - dataSite.usingAdmin().deleteSite(testSite); - users.forEach(user -> getDataUser().usingAdmin().deleteUser(user)); - nodesToBeClean.forEach( category -> deleteRecordCategory(category)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/PreventActionsOnFrozenContentTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/PreventActionsOnFrozenContentTests.java deleted file mode 100644 index c41f38c335..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/PreventActionsOnFrozenContentTests.java +++ /dev/null @@ -1,329 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.hold; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_VITAL_RECORD; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_VITAL_RECORD_DEFINITION; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.rest.rm.community.utils.CoreUtil.createBodyForMoveCopy; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; -import static org.springframework.http.HttpStatus.OK; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.AssertJUnit.assertFalse; - -import javax.json.Json; -import javax.json.JsonObject; -import java.io.File; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.core.JsonBodyGenerator; -import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.RMRolesAndActionsAPI; -import org.alfresco.rest.v0.service.DispositionScheduleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.Utility; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * API tests to check actions on frozen content - * - * @author Rodica Sutu - * @since 3.2 - */ -@AlfrescoTest (jira = "RM-6903") -public class PreventActionsOnFrozenContentTests extends BaseRMRestTest -{ - private static final String HOLD_ONE = "HOLD" + generateTestPrefix(PreventActionsOnFrozenContentTests.class); - private static String holdNodeRef; - private static FileModel contentHeld; - private static File updatedFile; - private static FolderModel folderModel; - private static RecordCategoryChild recordFolder; - private static Record recordFrozen, recordNotHeld; - private static RecordCategory categoryWithRS; - - @Autowired - private HoldsAPI holdsAPI; - - @Autowired - private DispositionScheduleService dispositionScheduleService; - - @Autowired - private RMRolesAndActionsAPI rmRolesAndActionsAPI; - - @BeforeClass (alwaysRun = true) - public void preconditionForPreventActionsOnFrozenContent() - { - STEP("Create a hold."); - holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(), - HOLD_ONE, HOLD_REASON, HOLD_DESCRIPTION); - - STEP("Create a test file."); - testSite = dataSite.usingAdmin().createPublicRandomSite(); - contentHeld = dataContent.usingAdmin().usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Add the file to the hold."); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentHeld - .getNodeRefWithoutVersion(), HOLD_ONE); - - STEP("Get a file resource."); - updatedFile = Utility.getResourceTestDataFile("SampleTextFile_10kb.txt"); - - STEP("Create a folder withing the test site ."); - folderModel = dataContent.usingAdmin().usingSite(testSite) - .createFolder(); - - STEP("Create a record folder with some records"); - recordFolder = createCategoryFolderInFilePlan(); - recordFrozen = createElectronicRecord(recordFolder.getId(), getRandomName("elRecordFrozen")); - recordNotHeld = createElectronicRecord(recordFolder.getId(), getRandomName("elRecordNotHeld")); - assertStatusCode(CREATED); - - STEP("Add the record to the hold."); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), recordFrozen.getId(), HOLD_ONE); - } - - /** - * Given active content on hold - * When I try to edit the properties - * Or perform an action that edits the properties - * Then I am not successful - * - */ - @Test - public void editPropertiesForContentHeld() throws Exception - { - STEP("Update name property of the held content"); - JsonObject nameUpdated = Json.createObjectBuilder().add("name", "HeldNameUpdated").build(); - restClient.authenticateUser(getAdminUser()).withCoreAPI().usingNode(contentHeld).updateNode(nameUpdated.toString()); - - STEP("Check the request failed."); - restClient.assertStatusCodeIs(FORBIDDEN); - restClient.assertLastError().containsSummary("Frozen content can't be updated."); - } - - /* - * Given active content on hold - * When I try to update the content - * Then I am not successful - */ - @Test - @AlfrescoTest (jira = "RM-6925") - public void updateContentForFrozenFile() throws Exception - { - STEP("Update content of the held file"); - restClient.authenticateUser(getAdminUser()).withCoreAPI().usingNode(contentHeld).updateNodeContent(updatedFile); - - STEP("Check the request failed."); - //TODO change this to FORBIDDEN when REPO-4632 is fixed - restClient.assertStatusCodeIs(INTERNAL_SERVER_ERROR); - restClient.assertLastError().containsSummary("Frozen content can't be updated."); - } - - /* - * Given active content on hold - * When I try to delete the content - * Then I am not successful - */ - @Test - public void deleteFrozenFile() throws Exception - { - STEP("Delete frozen file"); - restClient.authenticateUser(getAdminUser()).withCoreAPI().usingNode(contentHeld).deleteNode(contentHeld.getNodeRefWithoutVersion()); - - STEP("Check the request failed."); - restClient.assertStatusCodeIs(FORBIDDEN); - restClient.assertLastError().containsSummary("Frozen content can't be deleted."); - } - - /** - * Given active content on hold - * When I try to copy the content - * Then I am not successful - */ - @Test - @AlfrescoTest(jira = "RM-6924") - public void copyFrozenFile() - { - STEP("Copy frozen file"); - String postBody = JsonBodyGenerator.keyValueJson("targetParentId",folderModel.getNodeRef()); - getRestAPIFactory().getNodeAPI(contentHeld).copyNode(postBody); - - STEP("Check the request failed."); - assertStatusCode(FORBIDDEN); - getRestAPIFactory().getRmRestWrapper().assertLastError().containsSummary("Permission was denied"); - } - - /** - * Given active content on hold - * When I try to move the content - * Then I am not successful - * - */ - @Test - public void moveFrozenFile() throws Exception - { - STEP("Move frozen file"); - getRestAPIFactory().getNodeAPI(contentHeld).move(createBodyForMoveCopy(folderModel.getNodeRef())); - - STEP("Check the request failed."); - assertStatusCode(FORBIDDEN); - getRestAPIFactory().getRmRestWrapper().assertLastError().containsSummary("Frozen content can't be moved."); - } - - /** - * Given a record folder with a frozen record and another record not held - * When I update the record folder and make the records as vital - * Then I am successful and the records not held are marked as vital - * And the frozen nodes have the vital record search properties updated - */ - @Test - @AlfrescoTest (jira = "RM-6929") - public void updateRecordFolderVitalProperties() - { - STEP("Update the vital record properties for the record folder"); - // Create the record folder properties to update - RecordFolder recordFolderToUpdate = RecordFolder.builder() - .properties(RecordFolderProperties.builder() - .vitalRecordIndicator(true) - .reviewPeriod(new ReviewPeriod("month", "1")) - .build()) - .build(); - - // Update the record folder - RecordFolder updatedRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder - (recordFolderToUpdate, - recordFolder.getId()); - assertStatusCode(OK); - assertTrue(updatedRecordFolder.getAspectNames().contains(ASPECTS_VITAL_RECORD_DEFINITION)); - - - STEP("Check the frozen record was not marked as vital"); - recordFrozen = getRestAPIFactory().getRecordsAPI().getRecord(recordFrozen.getId()); - assertFalse(recordFrozen.getAspectNames().contains(ASPECTS_VITAL_RECORD)); - assertTrue(recordFrozen.getProperties().getRecordSearchVitalRecordReviewPeriod().contains("month")); - assertTrue(recordFrozen.getProperties().getRecordSearchVitalRecordReviewPeriodExpression().contains("1")); - - STEP("Check the record not held was marked as vital"); - recordNotHeld = getRestAPIFactory().getRecordsAPI().getRecord(recordNotHeld.getId()); - assertTrue(recordNotHeld.getAspectNames().contains(ASPECTS_VITAL_RECORD)); - assertNotNull(recordNotHeld.getProperties().getReviewAsOf()); - assertTrue(recordNotHeld.getProperties().getRecordSearchVitalRecordReviewPeriod().contains("month")); - assertTrue(recordNotHeld.getProperties().getRecordSearchVitalRecordReviewPeriodExpression().contains("1")); - } - - /** - * Given a record folder with a frozen record and another record not held - * When I add a disposition schedule - * Then I am successful - * And the record search disposition schedule properties are updated - */ - @Test - @AlfrescoTest (jira = "RM-6929") - public void createDispositionScheduleOnCategoryWithHeldChildren() - { - STEP("Create a retention schedule on the category with frozen children"); - RecordCategory categoryWithRS = getRestAPIFactory().getRecordCategoryAPI() - .getRecordCategory(recordFolder.getParentId()); - dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRS.getName(), false); - dispositionScheduleService.addCutOffAfterPeriodStep(categoryWithRS.getName(), "immediately"); - dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(categoryWithRS.getName(), "immediately"); - - STEP("Check the record folder has a disposition schedule"); - RecordFolder folderWithRS = getRestAPIFactory().getRecordFolderAPI().getRecordFolder(recordFolder.getId()); - assertNotNull(folderWithRS.getProperties().getRecordSearchDispositionAuthority()); - assertNotNull(folderWithRS.getProperties().getRecordSearchDispositionInstructions()); - - } - - /** - * Given a record category with a disposition schedule applied to records - * And the disposition schedule has a retain step immediately and destroy step immediately - * And a complete record added to one hold - * When I execute the retain action - * Then the action is executed - * And the record search disposition schedule properties are updated - */ - @Test - @AlfrescoTest (jira = "RM-6931") - public void retainActionOnFrozenHeldRecords() - { - STEP("Add a category with a disposition schedule."); - categoryWithRS = createRootCategory(getRandomName("CategoryWithRS")); - dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRS.getName(), true); - dispositionScheduleService.addRetainAfterPeriodStep(categoryWithRS.getName(), "immediately"); - dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(categoryWithRS.getName(), "immediately"); - - STEP("Create record folder with a record."); - RecordCategoryChild folder = createFolder(categoryWithRS.getId(), getRandomName("RecFolder")); - Record record = createElectronicRecord(folder.getId(), getRandomName("elRecord")); - completeRecord(record.getId()); - - STEP("Add the record to the hold"); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), record.getId(), HOLD_ONE); - - STEP("Execute the retain action"); - rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getPassword(), record.getName(), - RM_ACTIONS.END_RETENTION); - - STEP("Check the record search disposition properties"); - Record recordUpdated = getRestAPIFactory().getRecordsAPI().getRecord(record.getId()); - assertTrue(recordUpdated.getProperties().getRecordSearchDispositionActionName().contains(RM_ACTIONS.DESTROY.getAction())); - assertTrue(recordUpdated.getProperties().getRecordSearchDispositionPeriod().contains("immediately")); - } - - @AfterClass (alwaysRun = true) - public void cleanUpPreventActionsOnFrozenContent() - { - holdsAPI.deleteHold(getAdminUser(), holdNodeRef); - dataSite.usingAdmin().deleteSite(testSite); - deleteRecordCategory(recordFolder.getParentId()); - deleteRecordCategory(categoryWithRS.getId()); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/RemoveFromHoldsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/RemoveFromHoldsTests.java deleted file mode 100644 index d0f576d747..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/RemoveFromHoldsTests.java +++ /dev/null @@ -1,336 +0,0 @@ -/*- - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.hold; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION; -import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.FROZEN_ASPECT; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.springframework.http.HttpStatus.CREATED; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.hold.HoldEntry; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.v0.HoldsAPI; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * API tests for removing content/record folder/record from holds - * - * @author Rodica Sutu - * @since 3.2 - */ -@AlfrescoTest (jira = "RM-6874, RM-6873") -public class RemoveFromHoldsTests extends BaseRMRestTest -{ - private static final String HOLD_ONE = "HOLD_ONE" + generateTestPrefix(RemoveFromHoldsTests.class); - private static final String HOLD_TWO = "HOLD_TWO" + generateTestPrefix(RemoveFromHoldsTests.class); - private static final String ACCESS_DENIED_ERROR_MESSAGE = "Access Denied. You do not have the appropriate " + - "permissions to perform this operation."; - - private SiteModel testSite, privateSite; - private String holdNodeRefOne; - private String holdNodeRefTwo; - private FileModel contentHeld, contentAddToManyHolds; - private final Set usersToBeClean = new HashSet<>(); - private final Set nodesToBeClean = new HashSet<>(); - @Autowired - private HoldsAPI holdsAPI; - @Autowired - private RoleService roleService; - - @BeforeClass (alwaysRun = true) - public void preconditionForRemoveContentFromHold() - { - STEP("Create two holds."); - holdNodeRefOne = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(), - HOLD_ONE, HOLD_REASON, HOLD_DESCRIPTION); - holdNodeRefTwo = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser() - .getUsername(), HOLD_TWO, HOLD_REASON, HOLD_DESCRIPTION); - - STEP("Create test files."); - testSite = dataSite.usingAdmin().createPublicRandomSite(); - privateSite = dataSite.usingAdmin().createPrivateRandomSite(); - contentHeld = dataContent.usingAdmin().usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - contentAddToManyHolds = dataContent.usingSite(testSite) - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Add content to the holds."); - holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentHeld - .getNodeRefWithoutVersion(), HOLD_ONE); - holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - Collections.singletonList(contentAddToManyHolds.getNodeRefWithoutVersion()), asList(HOLD_ONE, HOLD_TWO)); - } - - /** - * Valid nodes to be removed from hold - */ - @DataProvider (name = "validNodesToRemoveFromHold") - public Object[][] getValidNodesToRemoveFromHold() - { - //create electronic and nonElectronic record in record folder - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - nodesToBeClean.add(recordFolder.getParentId()); - Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile - (IMAGE_FILE)); - assertStatusCode(CREATED); - Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolder.getId()); - assertStatusCode(CREATED); - - RecordCategoryChild folderToHeld = createCategoryFolderInFilePlan(); - nodesToBeClean.add(folderToHeld.getParentId()); - holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - asList(electronicRecord.getId(), nonElectronicRecord.getId(), folderToHeld.getId()), Collections.singletonList(HOLD_ONE)); - - return new String[][] - { // record folder - { folderToHeld.getId() }, - //electronic record - { electronicRecord.getId() }, - // non electronic record - { nonElectronicRecord.getId() }, - // document from collaboration site - { contentHeld.getNodeRefWithoutVersion() }, - }; - } - - /** - * Given content/record folder/record that is held - * And the corresponding hold - * When I use the existing REST API to remove the node from the hold - * Then the node is removed from the hold - * And is no longer frozen - */ - @Test(dataProvider = "validNodesToRemoveFromHold") - public void removeContentFromHold(String nodeId) throws Exception - { - STEP("Remove node from hold"); - holdsAPI.removeItemFromHold(getAdminUser().getUsername(), getAdminUser().getPassword(), nodeId, HOLD_ONE); - - STEP("Check the node is not held"); - assertFalse(hasAspect(nodeId, FROZEN_ASPECT)); - - STEP("Check node is not in any hold"); - List holdEntries = holdsAPI.getHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - nodeId, true, null); - assertTrue(holdEntries.isEmpty(), "Content held is still added to a hold."); - } - - /** - * Given active content that is held on many holds - * When I use the existing REST API to remove the active content from one hold - * Then the active content is removed from the specific hold - * And is frozen - * And in the other holds - */ - @Test - public void removeContentAddedToManyHolds() throws Exception - { - STEP("Remove content from hold. "); - holdsAPI.removeItemFromHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentAddToManyHolds - .getNodeRefWithoutVersion(), HOLD_ONE); - - STEP("Check the content is held. "); - assertTrue(hasAspect(contentAddToManyHolds.getNodeRefWithoutVersion(), FROZEN_ASPECT)); - - STEP("Check node is in hold HOLD_TWO. "); - List holdEntries = holdsAPI.getHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - contentAddToManyHolds.getNodeRefWithoutVersion(), true, null); - assertFalse(holdEntries.isEmpty(), "Content held is not held after removing from one hold."); - assertTrue(holdEntries.stream().anyMatch(holdEntry -> holdEntry.getName().contains(HOLD_TWO)), "Content held is " + - "not held after removing from one hold."); - } - - /** - * Data provider with user without right permission or capability to remove from hold a specific node - * @return user model and the node ref to be removed from hold - */ - @DataProvider (name = "userWithoutPermissionForRemoveFromHold") - public Object[][] getUserWithoutPermissionForAddToHold() - { - //create record folder - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - nodesToBeClean.add(recordFolder.getParentId()); - UserModel user = roleService.createUserWithRMRole(ROLE_RM_MANAGER.roleId); - getRestAPIFactory().getRMUserAPI().addUserPermission(holdNodeRefOne, user, PERMISSION_FILING); - //create files that will be removed from hold - FileModel contentNoHoldPerm = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - FileModel contentNoHoldCap = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - FileModel privateFile = dataContent.usingAdmin().usingSite(privateSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - //add files to hold - holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - asList(recordFolder.getId(), contentNoHoldCap.getNodeRefWithoutVersion(), - contentNoHoldPerm.getNodeRefWithoutVersion(), privateFile.getNodeRefWithoutVersion()), - Collections.singletonList(HOLD_ONE)); - - return new Object[][] - { - // user with read permission on the content, with remove from hold capability and without - // filling permission on a hold - { - roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole.SiteCollaborator, - holdNodeRefOne, UserRoles.ROLE_RM_MANAGER, PERMISSION_READ_RECORDS), - contentNoHoldPerm.getNodeRefWithoutVersion() - }, - // user with write permission on the content, filling permission on a hold without remove from - // hold capability - { - roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole - .SiteCollaborator, - holdNodeRefOne, UserRoles.ROLE_RM_POWER_USER, PERMISSION_FILING), - contentNoHoldCap.getNodeRefWithoutVersion() - }, - //user without read permission on RM record folder - { - user, recordFolder.getId() - }, - //user without read permission over the content from the private site - { - user, privateFile.getNodeRefWithoutVersion() - } - - - }; - } - /** - * Given node on hold in a single hold location - * And the user does not have sufficient permissions or capabilities to remove the node from the hold - * When the user tries to remove the node from the hold - * Then it's unsuccessful - * @throws Exception - */ - @Test (dataProvider = "userWithoutPermissionForRemoveFromHold") - public void removeFromHoldWithUserWithoutPermission(UserModel userModel, String nodeIdToBeRemoved) throws Exception - { - STEP("Update the list of users to be deleted after running the tests"); - usersToBeClean.add(userModel); - - STEP("Remove node from hold with user without right permission or capability"); - String responseNoHoldPermission = holdsAPI.removeFromHoldAndGetMessage(userModel.getUsername(), - userModel.getPassword(), SC_INTERNAL_SERVER_ERROR, nodeIdToBeRemoved, holdNodeRefOne); - assertTrue(responseNoHoldPermission.contains(ACCESS_DENIED_ERROR_MESSAGE)); - - STEP("Check node is frozen."); - assertTrue(hasAspect(nodeIdToBeRemoved, FROZEN_ASPECT)); - } - - /** - * Data provider with user with right permission or capability to remove from hold a specific node - * - * @return user model and the node ref to be removed from hold - */ - @DataProvider (name = "userWithPermissionForRemoveFromHold") - public Object[][] getUserWithPermissionForAddToHold() - { - //create record folder - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - nodesToBeClean.add(recordFolder.getParentId()); - UserModel user = roleService.createUserWithRMRoleAndRMNodePermission(ROLE_RM_MANAGER.roleId, recordFolder.getId(), - PERMISSION_READ_RECORDS); - getRestAPIFactory().getRMUserAPI().addUserPermission(holdNodeRefOne, user, PERMISSION_FILING); - //create file that will be removed from hold - FileModel contentPermission = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - //add files to hold - holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(), - asList(recordFolder.getId(), contentPermission.getNodeRefWithoutVersion()), Collections.singletonList(HOLD_ONE)); - - return new Object[][] - { - // user with write permission on the content - { - roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole.SiteConsumer, - holdNodeRefOne, UserRoles.ROLE_RM_MANAGER, PERMISSION_FILING), - contentPermission.getNodeRefWithoutVersion() - }, - //user with read permission on RM record folder - { - user, recordFolder.getId() - }, - - }; - } - @Test (dataProvider = "userWithPermissionForRemoveFromHold") - public void removeFromHoldWithUserWithPermission(UserModel userModel, String nodeIdToBeRemoved) throws Exception - { - STEP("Update the list of users to be deleted after running the tests"); - usersToBeClean.add(userModel); - - STEP("Remove node from hold with user with right permission and capability"); - holdsAPI.removeItemFromHold(userModel.getUsername(), - userModel.getPassword(), nodeIdToBeRemoved, HOLD_ONE); - - STEP("Check node is not frozen."); - assertFalse(hasAspect(nodeIdToBeRemoved, FROZEN_ASPECT)); - } - - @AfterClass (alwaysRun = true) - public void cleanUpRemoveContentFromHold() - { - holdsAPI.deleteHold(getAdminUser(), holdNodeRefOne); - holdsAPI.deleteHold(getAdminUser(), holdNodeRefTwo); - dataSite.usingAdmin().deleteSite(testSite); - dataSite.usingAdmin().deleteSite(privateSite); - usersToBeClean.forEach(user -> getDataUser().usingAdmin().deleteUser(user)); - nodesToBeClean.forEach(category -> deleteRecordCategory(category)); - - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/AutomaticDispositionTest.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/AutomaticDispositionTest.java deleted file mode 100644 index 789723da36..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/AutomaticDispositionTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.recordcategories; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.CUT_OFF_ASPECT; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.testng.Assert.assertTrue; - -import java.util.List; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; - -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.v0.service.DispositionScheduleService; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -public class AutomaticDispositionTest extends BaseRMRestTest -{ - @Autowired - private DispositionScheduleService dispositionScheduleService; - - private RecordCategory categoryWithRSOnRecords; - - /** - * Given there is a complete record eligible for cut off - * When the correct duration of time passes - * Then the record will be automatically cut off - */ - @Test(enabled = false) - public void testAutomaticCutOff() throws Exception - { - STEP("Create record category with retention schedule and apply it to records."); - categoryWithRSOnRecords = createRootCategory(getRandomName("categoryWithRSOnRecords")); - dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRSOnRecords.getName(), true); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(categoryWithRSOnRecords.getName(), "immediately"); - - STEP("Create a record folder with a record"); - RecordCategoryChild recordFolder = createRecordFolder(categoryWithRSOnRecords.getId(), getRandomName - ("recordFolder")); - Record record = createElectronicRecord(recordFolder.getId(), getRandomName("elRecord")); - - STEP("Complete the record and wait upon to 5 minutes for automatic job to execute"); - completeRecord(record.getId()); - - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - List aspects = recordsAPI.getRecord(record.getId()).getAspectNames(); - int count = 0; - while (!aspects.contains(CUT_OFF_ASPECT) && count < 30) - { - // sleep .. allowing the job time to execute - Thread.sleep(10000); - count++; - aspects = recordsAPI.getRecord(record.getId()).getAspectNames(); - } - assertTrue(aspects.contains(CUT_OFF_ASPECT), "Record should now be cut off"); - } - - @AfterClass (alwaysRun = true) - public void deleteCategory() - { - deleteRecordCategory(categoryWithRSOnRecords.getId()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/DispositionScheduleInheritanceTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/DispositionScheduleInheritanceTests.java deleted file mode 100644 index 2278196995..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/DispositionScheduleInheritanceTests.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.recordcategories; - -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.v0.service.DispositionScheduleService; -import org.alfresco.test.AlfrescoTest; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.Assert; -import org.testng.annotations.Test; - -public class DispositionScheduleInheritanceTests extends BaseRMRestTest -{ - private static final String RETAIN_STEP = "retain"; - private static final String CUTOFF_STEP = "cutoff"; - - @Autowired - private DispositionScheduleService dispositionScheduleService; - - /** - * Given following structure is created: - * rootCategory with RS applied on records level - * - subCategory without RS - * - recFolder - * - incomplete electronic record - * - complete non-electronic record - * Then both records should inherit the RS from rootCategory - */ - @AlfrescoTest (jira = "MNT-19967") - @Test - public void testRSInheritanceOnRecordsWhenOnlyACategoryHasRS() - { - STEP("Create record category with retention schedule and apply it to records."); - RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory")); - dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Add retention schedule retain step with immediate period."); - dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Create a subcategory with a record folder"); - RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory")); - RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder")); - - STEP("Create 2 records in the record folder. Complete one of them."); - Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord")); - Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord")); - getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId()); - - STEP("Check that both records inherit root category retention schedule"); - Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true"); - Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true"); - } - - /** - * Given following structure is created: - * rootCategory with RS applied on records folder level - * - subCategory without RS - * - recFolder - * Then recFolder should inherit the RS from rootCategory - */ - @Test - public void testRSInheritanceOnRecordFoldersWhenOnlyACategoryHasRS() - { - STEP("Create record category with retention schedule and apply it to record folders."); - RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory")); - dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Add retention schedule retain step with immediate period."); - dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Create a subcategory with a record folder"); - RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory")); - RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder")); - - STEP("Check that recFolder inherits root category retention schedule"); - Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true"); - } - - /** - * Given following structure is created: - * rootCategory with RS applied on records level - * - subCategory1 with another RS applied on records level - * - subCategory2 without RS - * - recFolder - * - incomplete electronic record - * - complete non-electronic record - * Then both records should inherit the RS from subCategory1 - */ - @Test - public void testRSInheritanceOnRecordsWhen2CategoriesHaveRS() - { - STEP("Create record category with retention schedule and apply it to records."); - RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory")); - dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Create a subcategory with retention schedule and apply it to records."); - RecordCategoryChild subCategory1 = createRecordCategory(rootCategory.getId(), getRandomName("subCategory")); - String subcategory1Path = rootCategory.getName() + "/" + subCategory1.getName(); - dispositionScheduleService.createCategoryRetentionSchedule(subcategory1Path, true); - - STEP("Add retention schedule retain step with 1 day after created date."); - dispositionScheduleService.addRetainAfterPeriodStep(subcategory1Path, "day|1"); - - STEP("Create a subcategory2 in subcategory1"); - RecordCategoryChild subCategory2 = createRecordCategory(subCategory1.getId(), getRandomName("subCategory")); - - STEP("Create a record folder with 2 records. Complete one of them."); - RecordCategoryChild recFolder = createFolder(subCategory2.getId(), getRandomName("recFolder")); - Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord")); - Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord")); - getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId()); - - STEP("Check that both records inherit subCategory1 retention schedule"); - Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true for incomplete record"); - Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true for complete record"); - Assert.assertEquals(elRecord.getProperties().getRecordSearchDispositionActionName(), - RETAIN_STEP, - "Disposition action should be retain and not cutoff for incomplete record"); - Assert.assertEquals(nonElRecord.getProperties().getRecordSearchDispositionActionName(), - RETAIN_STEP, - "Disposition action should be retain and not cutoff for complete record"); - } - - /** - * Given following structure is created: - * rootCategory with RS applied on records folder level - * - subCategory1 with another RS applied on records folder level - * - subCategory2 without RS - * - recFolder - * Then recFolder should inherit the RS from subCategory1 - */ - @Test - public void testRSInheritanceOnRecordFoldersWhen2CategoriesHaveRS() - { - STEP("Create record category with retention schedule and apply it to record folders."); - RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory")); - dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false); - - STEP("Add retention schedule retain step with 2 days after created date."); - dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "day|2"); - - STEP("Create a subcategory with retention schedule and apply it to record folders."); - RecordCategoryChild subCategory1 = createRecordCategory(rootCategory.getId(), getRandomName("subCategory")); - String subcategory1Path = rootCategory.getName() + "/" + subCategory1.getName(); - dispositionScheduleService.createCategoryRetentionSchedule(subcategory1Path, false); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(subcategory1Path, "immediately"); - - STEP("Create a subcategory2 with a record folder in subcategory1"); - RecordCategoryChild subCategory2 = createRecordCategory(subCategory1.getId(), getRandomName("subCategory")); - RecordCategoryChild recFolder = createFolder(subCategory2.getId(), getRandomName("recFolder")); - - STEP("Check that recFolder inherits subCategory1 retention schedule"); - Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true"); - Assert.assertEquals(recFolder.getProperties().getRecordSearchDispositionActionName(), - CUTOFF_STEP, - "Disposition action should be cutoff and not retain for the record folder"); - } - - /** - * Given following structure is created: - * rootCategory with RS applied on folder records level - * - subCategory with another RS applied on records level - * - recFolder - * - incomplete electronic record - * - complete non-electronic record - * Then both records should inherit the RS from subCategory - */ - @Test - public void testMixedRSInheritanceWhenFirstParentHasRSOnRecords() - { - STEP("Create record category with retention schedule and apply it to folder records."); - RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory")); - dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Create a subcategory with retention schedule and apply it to records."); - RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory")); - String subcategoryPath = rootCategory.getName() + "/" + subCategory.getName(); - dispositionScheduleService.createCategoryRetentionSchedule(subcategoryPath, true); - - STEP("Add retention schedule retain step with 1 day after created date."); - dispositionScheduleService.addRetainAfterPeriodStep(subcategoryPath, "day|1"); - - STEP("Create a record folder with 2 records. Complete one of them."); - RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder")); - Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord")); - Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord")); - getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId()); - - STEP("Check that both records inherit subCategory retention schedule"); - Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true for incomplete record"); - Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true for complete record"); - Assert.assertEquals(elRecord.getProperties().getRecordSearchDispositionActionName(), - RETAIN_STEP, - "Disposition action should be retain and not cutoff for incomplete record"); - Assert.assertEquals(nonElRecord.getProperties().getRecordSearchDispositionActionName(), - RETAIN_STEP, - "Disposition action should be retain and not cutoff for complete record"); - } - - /** - * Given following structure is created: - * rootCategory with RS applied on records level - * - subCategory with another RS applied on folder records level - * - recFolder - * - incomplete electronic record - * - complete non-electronic record - * Then both records should not have RS (rma:recordSearchHasDispositionSchedule property is set to false) - * and record folder inherits the RS from subCategory - */ - @Test - public void testMixedRSInheritanceWhenFirstParentHasRSOnFolders() - { - STEP("Create record category with retention schedule and apply it to records."); - RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory")); - dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true); - - STEP("Add retention schedule cut off step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately"); - - STEP("Create a subcategory with retention schedule and apply it to record folders."); - RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory")); - String subcategoryPath = rootCategory.getName() + "/" + subCategory.getName(); - dispositionScheduleService.createCategoryRetentionSchedule(subcategoryPath, false); - - STEP("Add retention schedule retain step with 1 day after created date."); - dispositionScheduleService.addRetainAfterPeriodStep(subcategoryPath, "day|1"); - - STEP("Create a record folder with 2 records. Complete one of them."); - RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder")); - Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord")); - Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord")); - getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId()); - - STEP("Check that the records don't have retention schedule"); - Assert.assertFalse(elRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be false for incomplete record"); - Assert.assertFalse(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be false for complete record"); - - STEP("Check that recFolder inherits subCategory retention schedule"); - Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(), - "rma:recordSearchHasDispositionSchedule property should be true"); - Assert.assertEquals(recFolder.getProperties().getRecordSearchDispositionActionName(), - RETAIN_STEP, - "Disposition action should be retain and not cutoff for the record folder"); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java deleted file mode 100644 index fd10c605ab..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java +++ /dev/null @@ -1,786 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.recordcategories; - -import static java.time.LocalDateTime.now; - -import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.TITLE_PREFIX; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryChildModel; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CONFLICT; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.NoSuchElementException; - -import org.alfresco.rest.core.v0.BaseAPI.RETENTION_SCHEDULE; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.base.DataProviderClass; -import org.alfresco.rest.rm.community.model.fileplan.FilePlan; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildCollection; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildProperties; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; -import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.v0.RecordCategoriesAPI; -import org.alfresco.utility.report.Bug; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Record category related API tests - * - * @author Kristijan Conkas - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordCategoryTests extends BaseRMRestTest -{ - public static final String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric(); - - /** Number of children (for children creation test) */ - private static final int NUMBER_OF_CHILDREN = 10; - private static final int NUMBER_OF_FOLDERS = 5; - - @Autowired - private RecordCategoriesAPI recordCategoriesAPI; - - /** - * Invalid containers that cannot be deleted with record category end-point - */ - @DataProvider (name = "invalidContainersToDelete") - public Object[][] getNodesToDelete() - { - return new String[][] { - { FILE_PLAN_ALIAS }, - { UNFILED_RECORDS_CONTAINER_ALIAS }, - { TRANSFERS_ALIAS }, - // an arbitrary record category - { createCategoryFolderInFilePlan(getAdminUser()).getId() }, - // an arbitrary unfiled records folder - { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId() } - }; - } - - /** - *
-     * Given that a record category exists
-     * When I ask the API to update the details of the record category
-     * Then the details of the record category are updated
-     * 
- */ - @Test - ( - description = "Rename root category" - ) - public void renameCategory() - { - // Create record category first - String categoryName = "Category name " + getRandomAlphanumeric(); - String categoryTitle = "Category title " + getRandomAlphanumeric(); - - // Create the root record category - RecordCategory rootRecordCategory = createRootCategory(categoryName, categoryTitle); - - String newCategoryName = "Rename " + categoryName; - - // Build the properties which will be updated - RecordCategory recordCategoryUpdated = RecordCategory.builder().name(newCategoryName).build(); - - // Update the record category - RecordCategory renamedRecordCategory = getRestAPIFactory().getRecordCategoryAPI().updateRecordCategory(recordCategoryUpdated, rootRecordCategory.getId()); - - // Verify the status code - assertStatusCode(OK); - - // Verify the returned file plan component - assertEquals(renamedRecordCategory.getName(), newCategoryName); - - // Get actual FILE_PLAN_ALIAS id - FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS); - - // verify renamed component still has this parent - assertEquals(renamedRecordCategory.getParentId(), filePlan.getId()); - } - - /** - *
-     * Given that a record category exists
-     * When I ask the API to delete the record category
-     * Then the record category and all its contents are deleted
-     * 
- */ - @Test - ( - description = "Delete category" - ) - public void deleteCategory() - { - // Create record category first - String categoryName = "Category name " + getRandomAlphanumeric(); - String categoryTitle = "Category title " + getRandomAlphanumeric(); - - // Create the root record category - RecordCategory rootRecordCategory = createRootCategory(categoryName, categoryTitle); - - int totalEntries= getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getPagination().getTotalItems(); - // Delete the record category - RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - String recordCategoryId = rootRecordCategory.getId(); - recordCategoryAPI.deleteRecordCategory(recordCategoryId); - - // Verify the status code - assertStatusCode(NO_CONTENT); - - // Deleted component should no longer be retrievable - recordCategoryAPI.getRecordCategory(recordCategoryId); - assertStatusCode(NOT_FOUND); - //check the number of entries after delete - int totalEntriesAfterDelete = getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getPagination().getTotalItems(); - assertEquals(totalEntriesAfterDelete,(totalEntries-1)); - } - - /** - *
-     * Given that  nodes that are not record category
-     * When I ask  to delete the nodes  with the delete request from the record-categories endpoint
-     * Then the request fails
-     * 
- */ - @Test - ( - description = "Delete invalid nodes with delete category endpoint", - dataProvider = "invalidContainersToDelete" - ) - public void deleteInvalidNodes(String nodeId) - { - - // Delete the record category - RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - recordCategoryAPI.deleteRecordCategory(nodeId); - - // Verify the status code - assertStatusCode(BAD_REQUEST); - - } - - /** - *
-     * Given that a record category exists
-     * When I ask the API to create a record category
-     * Then it is created within the record category
-     * 
- */ - @Test - ( - description = "Create child category" - ) - public void createSubcategory() - { - // Create root level category - RecordCategory rootCategory = createRootCategory(getRandomAlphanumeric()); - assertNotNull(rootCategory.getId()); - - // Create sub-category as a child of rootCategory - RecordCategoryChild recordCategory = createRecordCategoryChild(rootCategory.getId(), RECORD_CATEGORY_NAME, RECORD_CATEGORY_TYPE); - - // Child category created? - assertNotNull(recordCategory.getId()); - - // Verify child category - assertEquals(recordCategory.getParentId(), rootCategory.getId()); - assertTrue(recordCategory.getIsRecordCategory()); - assertFalse(recordCategory.getIsRecordFolder()); - assertEquals(recordCategory.getNodeType(), RECORD_CATEGORY_TYPE); - - - //get the sub-category - RecordCategory subCategory = getRestAPIFactory().getRecordCategoryAPI().getRecordCategory(recordCategory.getId(),"include=isRecordCategory,isRecordFolder"); - // Verify child category - assertEquals(subCategory.getParentId(), rootCategory.getId()); - assertEquals(subCategory.getNodeType(), RECORD_CATEGORY_TYPE); - assertFalse(subCategory.getAspectNames().isEmpty()); - assertNotNull(subCategory.getProperties().getIdentifier()); - } - - /** - *
-     * Given that a record category exists
-     * When I use the API to create children of type record folder
-     * Then  a record folder it is created within the record category
-     * 
- *
-     * Given that a record category exists
-     * When I use the API to create children of type folder (cm:folder type)
-     * Then the folder is converted to rma:recordFolder within the record category
-     * (see RM-4572 comments)
-     * 
- */ - @Test - ( - description = "Create a record folder into a record category.", - dataProviderClass = DataProviderClass.class, - dataProvider = "folderTypes" - ) - @Bug (id = "RM-4572") - public void createFolderTest(String folderType) - { - // Authenticate with admin user - RecordCategory rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric()); - - // Create the record folder - RecordCategoryChild recordFolder = createRecordCategoryChild(rootRecordCategory.getId(), RECORD_FOLDER_NAME, folderType); - - // Assert status code - assertStatusCode(CREATED); - - // Check record folder has been created within the record category - assertEquals(rootRecordCategory.getId(), recordFolder.getParentId()); - - // Verify the returned values for the record folder - assertFalse(recordFolder.getIsRecordCategory()); - assertTrue(recordFolder.getIsRecordFolder()); - assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME); - assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE); - assertEquals(recordFolder.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Verify the returned record folder properties - RecordCategoryChildProperties folderProperties = recordFolder.getProperties(); - assertEquals(folderProperties.getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME); - assertNotNull(folderProperties.getIdentifier()); - } - @Test - ( - dataProviderClass = DataProviderClass.class, - dataProvider = "categoryChild" - ) - @Bug(id = "RM-5116") - public void createdDuplicateChild(String childType) - { - // create a root category - String rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric()).getId(); - - // Create the record category child - RecordCategoryChild recordFolder = createRecordCategoryChild(rootRecordCategory, RECORD_FOLDER_NAME, childType); - - // check the response code - assertStatusCode(CREATED); - assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME); - - // Create a record category child with the same name as the exiting one - - RecordCategoryChild recordFolderDuplicate = getRestAPIFactory().getRecordCategoryAPI().createRecordCategoryChild( - createRecordCategoryChildModel(RECORD_FOLDER_NAME, childType), rootRecordCategory); - - // check the response code - assertStatusCode(CONFLICT); - - // Create a record folder with the same name as the exiting one and with the autoRename parameter on true - recordFolderDuplicate = getRestAPIFactory().getRecordCategoryAPI() - .createRecordCategoryChild(createRecordCategoryChildModel(RECORD_FOLDER_NAME, - childType), - rootRecordCategory, "autoRename=true"); - // check the response code - assertStatusCode(CREATED); - assertNotEquals(recordFolderDuplicate.getName(), RECORD_FOLDER_NAME); - assertTrue(recordFolderDuplicate.getName().contains(RECORD_FOLDER_NAME)); - } - - /** - *
-     * Given that a record category exists
-     * And contains a number of record categories and record folders
-     * When I ask the API to get me the children of the record category
-     * Then I am returned the contained record categories and record folders and their details
-     * 
- *
-     * Given that a record category with a disposition schedule exists
-     * And contains a number of record categories and record folders
-     * When I ask the API to get me the children of the record category
-     * Then I am returned the contained record categories and record folders but not the disposition schedule
-     * 
- */ - @Test - ( - description = "Get children of a record category excluding the disposition schedule" - ) - @Bug (id="RM-5115") - public void getRecordCategoryChildren() - { - // Create root level category - RecordCategory rootRecordCategory = createRootCategory(getRandomAlphanumeric()); - assertNotNull(rootRecordCategory.getId()); - - // Create disposition schedule - String userName = getAdminUser().getUsername(); - String userPassword = getAdminUser().getPassword(); - String categoryName = rootRecordCategory.getName(); - recordCategoriesAPI.createRetentionSchedule(userName, userPassword, categoryName); - - // Add disposition schedule cut off step - HashMap cutOffStep = new HashMap<>(); - cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff"); - cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, "day|2"); - cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after 2 days"); - recordCategoriesAPI.addDispositionScheduleSteps(userName, userPassword, categoryName, cutOffStep); - - // Add record category children - List children = new ArrayList<>(); - for (int i=0; i < NUMBER_OF_CHILDREN; i++) - { - // Create a record category child - RecordCategoryChild child = createRecordCategoryChild(rootRecordCategory.getId(), - getRandomAlphanumeric(), - // half of the children should be sub-categories, the other sub-folders - (i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE); - assertNotNull(child.getId()); - children.add(child); - } - - // Get children from API - RecordCategoryChildCollection recordCategoryChildren = getRestAPIFactory().getRecordCategoryAPI().getRecordCategoryChildren(rootRecordCategory.getId(),"include=isRecordCategory,isRecordFolder"); - - // Check status code - assertStatusCode(OK); - logger.info("Parent: " + rootRecordCategory.getId()); - - // Check listed children against created list - recordCategoryChildren.getEntries().forEach(c -> - { - RecordCategoryChild recordCategoryChild = c.getEntry(); - String recordCategoryChildId = recordCategoryChild.getId(); - - assertNotNull(recordCategoryChildId); - logger.info("Checking child " + recordCategoryChildId); - - try - { - // Find this child in created children list - RecordCategoryChild createdComponent = children.stream() - .filter(child -> child.getId().equals(recordCategoryChildId)) - .findFirst() - .orElseThrow(); - - // Created by - assertEquals(recordCategoryChild.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Is parent id set correctly? - assertEquals(recordCategoryChild.getParentId(), rootRecordCategory.getId()); - - // Boolean properties related to node type - // Only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created - if (recordCategoryChild.getNodeType().equals(RECORD_CATEGORY_TYPE)) - { - assertTrue(recordCategoryChild.getIsRecordCategory()); - assertFalse(recordCategoryChild.getIsRecordFolder()); - } - else - { - assertTrue(recordCategoryChild.getIsRecordFolder()); - assertFalse(recordCategoryChild.getIsRecordCategory()); - } - - // Does returned object have the same contents as the created one? - assertEquals(createdComponent.getName(), recordCategoryChild.getName()); - assertEquals(createdComponent.getNodeType(), recordCategoryChild.getNodeType()); - - // verify the record categories children identifier - assertNotNull(createdComponent.getProperties().getIdentifier()); - } - catch (NoSuchElementException e) - { - fail("No child element for " + recordCategoryChildId); - } - }); - } - - /** - *
-     * Given that a record category exists
-     * When I ask to create an object type which is not a record category or a record folder as a child
-     * Then the children are not created and the 422 response code is returned
-     * 
- */ - @Test - ( - description = "Create node types not allowed inside a category", - dataProviderClass = DataProviderClass.class, - dataProvider = "childrenNotAllowedForCategory" - ) - @Bug (id="RM-4367, RM-4572") - public void createTypesNotAllowedInCategory(String nodeType) - { - String componentName = "Component" + getRandomAlphanumeric(); - - // Create the category - RecordCategory rootRecordCategory = createRootCategory(componentName); - - // Create the invalid node type - createRecordCategoryChild(rootRecordCategory.getId(), componentName, nodeType); - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - *
-     * Given that a record category exists
-     * And contains several record folders
-     * When I use the API to get the record category children for an existing record category
-     * Then I am provided with a list of the contained record category children and their details
-     * 
- */ - @Test - ( - description = "Get children of a record category" - ) - public void getFolders() - { - // Authenticate with admin user - RecordCategory rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric()); - - // Add child folders - ArrayList children = new ArrayList<>(); - for (int i = 0; i < NUMBER_OF_FOLDERS; i++) - { - // Create a record folder - RecordCategoryChild recordCategoryChild = createRecordFolder(rootRecordCategory.getId(), getRandomAlphanumeric()); - assertNotNull(recordCategoryChild.getId()); - children.add(recordCategoryChild); - } - - // Get record category children from API - RecordCategoryChildCollection recordCategoryChildren = getRestAPIFactory().getRecordCategoryAPI().getRecordCategoryChildren(rootRecordCategory.getId(), "include=isRecordCategory,isRecordFolder"); - - // Check status code - assertStatusCode(OK); - - // Check children against created list - recordCategoryChildren.getEntries().forEach(c -> - { - RecordCategoryChild recordCategoryChild = c.getEntry(); - String recordCategoryChildId = recordCategoryChild.getId(); - assertNotNull(recordCategoryChildId); - logger.info("Checking child " + recordCategoryChildId); - - try - { - // Find this child in created children list - RecordCategoryChild createdComponent = children.stream() - .filter(child -> child.getId().equals(recordCategoryChildId)) - .findFirst() - .orElseThrow(); - - // Created by - assertEquals(recordCategoryChild.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Is parent id set correctly - assertEquals(recordCategoryChild.getParentId(), rootRecordCategory.getId()); - - // Boolean properties related to node type - assertTrue(recordCategoryChild.getIsRecordFolder()); - assertFalse(recordCategoryChild.getIsRecordCategory()); - - assertEquals(createdComponent.getName(), recordCategoryChild.getName()); - assertEquals(createdComponent.getNodeType(), recordCategoryChild.getNodeType()); - - } catch (NoSuchElementException e) - { - fail("No child element for " + recordCategoryChildId); - } - } - ); - - } - - /** - *
-     * Given that I want to create a record folder
-     * When I use the API with the relativePath
-     * Then the categories specified in the relativePath that don't exist are created
-     * 
- */ - @Test - ( - description = "Create a folder using record-categories endpoint, based on the relativePath. " + - "Containers in the relativePath that do not exist are created before the node is created" - ) - public void createRecordFolderWithRelativePath() - { - // The record category to be created - RecordCategory recordCategoryModel = RecordCategory.builder() - .name(RECORD_CATEGORY_NAME + getRandomAlphanumeric()) - .nodeType(RECORD_CATEGORY_TYPE) - .build(); - FilePlanAPI filePlansAPI = getRestAPIFactory().getFilePlansAPI(); - RecordCategory createRootRecordCategory = filePlansAPI.createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS, "include=" + PATH); - // Check the API response code - assertStatusCode(CREATED); - String recordCategoryId = createRootRecordCategory.getId(); - - // relativePath specify the container structure to create relative to the record folder to be created - String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth(); - - // The record folder to be created - RecordCategoryChild recordFolderModel = RecordCategoryChild.builder() - .name(RECORD_FOLDER_NAME) - .nodeType(RECORD_FOLDER_TYPE) - .relativePath(relativePath) - .build(); - - // Create the record folder - RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - RecordCategoryChild recordCategoryChild = recordCategoryAPI.createRecordCategoryChild(recordFolderModel, recordCategoryId, "include=" + PATH); - - // Check the API response code - assertStatusCode(CREATED); - - // Verify the returned details for the record folder - assertFalse(recordCategoryChild.getIsRecordCategory()); - assertTrue(recordCategoryChild.getIsRecordFolder()); - - // Check the path return contains the relativePath - assertTrue(recordCategoryChild.getPath().getName().contains(relativePath)); - - // Check the parent is a category - assertNotNull(recordCategoryAPI.getRecordCategory(recordCategoryChild.getParentId()).getId()); - - // Check the created folder from the server - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - RecordFolder recordFolder = recordFolderAPI.getRecordFolder(recordCategoryChild.getId(), "include=" + PATH); - - // Check the API response code - assertStatusCode(OK); - - // Verify the returned details for the record folder - assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE); - - // Check the path return contains the relativePath - assertTrue(recordFolder.getPath().getName().contains(relativePath)); - - // New relative path only a part of containers need to be created before the record folder - String newRelativePath = now().getYear() + "/" + now().getMonth() + "/" + (now().getDayOfMonth() + 1); - - // The record folder to be created - RecordCategoryChild newRecordFolderModel = RecordCategoryChild.builder() - .name(RECORD_FOLDER_NAME) - .nodeType(RECORD_FOLDER_TYPE) - .relativePath(newRelativePath) - .build(); - - // Create the record folder - RecordCategoryChild newRecordCategoryChild = recordCategoryAPI.createRecordCategoryChild(newRecordFolderModel, recordCategoryId, "include=" + PATH); - - // Check the API response code - assertStatusCode(CREATED); - - // Verify the returned properties for the file plan component - record folder - assertFalse(newRecordCategoryChild.getIsRecordCategory()); - assertTrue(newRecordCategoryChild.getIsRecordFolder()); - - // Check the path return contains the newRelativePath - assertTrue(newRecordCategoryChild.getPath().getName().contains(newRelativePath)); - - // Check the parent is a category - assertNotNull(recordCategoryAPI.getRecordCategory(newRecordCategoryChild.getParentId()).getId()); - - // Check the folder created on the server - RecordFolder newRecordFolder = recordFolderAPI.getRecordFolder(newRecordCategoryChild.getId(), "include=" + PATH); - - // Check the API response code - assertStatusCode(OK); - - // Verify the returned details for the record folder - assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE); - - // Check the path return contains the newRelativePath - assertTrue(newRecordFolder.getPath().getName().contains(newRelativePath)); - } - - - /** - *
-     * Given that I want to create a record sub-category
-     * When I use the API with the relativePath
-     * Then the categories specified in the relativePath that don't exist are created
-     * 
- */ - @Test - ( - description = "Create a sub-category using record-categories endpoint, based on the relativePath. " + - "Containers in the relativePath that do not exist are created before the node is created" - ) - public void createRecordSubCategoryWithRelativePath() - { - // The record category to be created - RecordCategory recordCategoryModel = RecordCategory.builder() - .name(RECORD_CATEGORY_NAME + getRandomAlphanumeric()) - .nodeType(RECORD_CATEGORY_TYPE) - .build(); - FilePlanAPI filePlansAPI = getRestAPIFactory().getFilePlansAPI(); - RecordCategory createRootRecordCategory = filePlansAPI.createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS, "include=" + PATH); - // Check the API response code - assertStatusCode(CREATED); - String recordCategoryId = createRootRecordCategory.getId(); - - // relativePath specify the container structure to create relative to the record folder to be created - String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth()+ "/"+getRandomAlphanumeric(); - - // The record folder to be created - RecordCategoryChild recordFolderModel = RecordCategoryChild.builder() - .name(RECORD_CATEGORY_NAME) - .nodeType(RECORD_CATEGORY_TYPE) - .relativePath(relativePath) - .build(); - - // Create the record folder - RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - RecordCategoryChild recordCategoryChild = recordCategoryAPI.createRecordCategoryChild(recordFolderModel, recordCategoryId, "include=" + PATH); - - // Check the API response code - assertStatusCode(CREATED); - - // Verify the returned details for the record sub-category - assertTrue(recordCategoryChild.getIsRecordCategory()); - assertFalse(recordCategoryChild.getIsRecordFolder()); - - // Check the path return contains the relativePath - assertTrue(recordCategoryChild.getPath().getName().contains(relativePath)); - - // Check the parent is a category - assertNotNull(recordCategoryAPI.getRecordCategory(recordCategoryChild.getParentId()).getId()); - - // Check the created folder from the server - RecordCategory recordSubCategory = recordCategoryAPI.getRecordCategory(recordCategoryChild.getId(), "include=" + PATH); - - // Check the API response code - assertStatusCode(OK); - - // Verify the returned details for the record folder - assertEquals(recordSubCategory.getNodeType(), RECORD_CATEGORY_TYPE); - - // Check the path return contains the relativePath - assertTrue(recordSubCategory.getPath().getName().contains(relativePath)); - - // New relative path only a part of containers need to be created before the record folder - String newRelativePath = now().getYear() + "/" + now().getMonth() + "/" + (now().getDayOfMonth() + 1) +"/"+getRandomAlphanumeric(); - - // The record folder to be created - RecordCategoryChild newRecordFolderModel = RecordCategoryChild.builder() - .name(RECORD_CATEGORY_NAME) - .nodeType(RECORD_CATEGORY_TYPE) - .relativePath(newRelativePath) - .build(); - - // Create the record folder - RecordCategoryChild newRecordCategoryChild = recordCategoryAPI.createRecordCategoryChild(newRecordFolderModel, recordCategoryId, "include=" + PATH); - - // Check the API response code - assertStatusCode(CREATED); - - // Verify the returned properties for the file plan component - record folder - assertTrue(newRecordCategoryChild.getIsRecordCategory()); - assertFalse(newRecordCategoryChild.getIsRecordFolder()); - - // Check the path return contains the newRelativePath - assertTrue(newRecordCategoryChild.getPath().getName().contains(newRelativePath)); - - // Check the parent is a category - assertNotNull(recordCategoryAPI.getRecordCategory(newRecordCategoryChild.getParentId()).getId()); - - // Check the folder created on the server - RecordCategory newRecordFolder = recordCategoryAPI.getRecordCategory(newRecordCategoryChild.getId(), "include=" + PATH); - - // Check the API response code - assertStatusCode(OK); - - // Verify the returned details for the record folder - assertEquals(recordSubCategory.getNodeType(), RECORD_CATEGORY_TYPE); - - // Check the path return contains the newRelativePath - assertTrue(newRecordFolder.getPath().getName().contains(newRelativePath)); - } - - /** - *
-     * Given that RM site is created
-     * When I use the API to create a new record folder into transfers/holds/unfiled containers
-     * Then the operation fails
-     * 
- */ - @Test - ( - description = "Create a record folder into transfers/unfiled/file plan container", - dataProviderClass = DataProviderClass.class, - dataProvider = "getContainers" - ) - @Bug (id = "RM-4327") - public void createRecordFolderIntoSpecialContainers(String containerAlias) - { - String containerId; - if (FILE_PLAN_ALIAS.equalsIgnoreCase(containerAlias)) - { - containerId = getRestAPIFactory().getFilePlansAPI().getFilePlan(containerAlias).getId(); - } else if (TRANSFERS_ALIAS.equalsIgnoreCase(containerAlias)) - { - containerId = getRestAPIFactory().getTransferContainerAPI().getTransferContainer(containerAlias).getId(); - } else - { - //is unfiled container - containerId = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(containerAlias).getId(); - } - - // Create a record folder - createRecordFolder(containerId, RECORD_FOLDER_NAME); - - // Check the API Response code - assertStatusCode(BAD_REQUEST); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java deleted file mode 100644 index 98c63b78a7..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.recordfolders; - -import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicUnfiledContainerChildModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.utility.report.Bug; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Create/File electronic records tests - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class ElectronicRecordTests extends BaseRMRestTest -{ - /** Invalid parent containers where electronic records can't be created */ - @DataProvider(name = "invalidParentContainers") - public Object[][] invalidParentContainers() - { - return new String[][] - { - // record category - { createCategoryFolderInFilePlan().getParentId() }, - // file plan root - { FILE_PLAN_ALIAS }, - // transfers - { TRANSFERS_ALIAS } - }; - } - - /** - *
-     * Given a parent container that is NOT a record folder or an unfiled record folder
-     * When I try to create an electronic record within the parent container
-     * Then nothing happens
-     * And an error is reported
-     * 
- * @param container The parent container - */ - @Test - ( - dataProvider = "invalidParentContainers", - description = "Electronic records can't be created in invalid parent containers" - ) - public void cantCreateElectronicRecordsInInvalidContainers(String container) - { - // Create an electronic record in the given container, this should throw an IllegalArgumentException - getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), container, getFile(IMAGE_FILE)); - - // Verify the create request status code - assertStatusCode(BAD_REQUEST); - } - - /** - *
-     * Given a parent container that is a record folder
-     * And the record folder is closed
-     * When I try to create an electronic record within the parent container
-     * Then nothing happens
-     * And an error is reported
-     * 
- */ - @Test - ( - description = "Electronic record can't be created in closed record folder" - ) - public void cantCreateElectronicRecordInClosedFolder() - { - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - - // The folder should be open - assertFalse(recordFolder.getProperties().getIsClosed()); - - // Close the folder - closeFolder(recordFolder.getId()); - - // Try to create an electronic record, this should throw IllegalArgumentException - getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)); - - // Verify the status code - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - *
-     * Given a parent container that is a record folder
-     * And the record folder is open
-     * When I try to create an electronic record within the parent container
-     * And I do not provide all the required mandatory property values
-     * Then nothing happens
-     * And an error is reported
-     * 
- * and - *
-     *
-     *
-     * Given a parent container that is an unfiled record folder or the root unfiled record container
-     * When I try to create an electronic record within the parent container
-     * And I do not provide all the required mandatory property values
-     * Then nothing happens
-     * And an error is reported
-     * 
- * @param folderId The folder, which the record will be created in - * @param type The type of the record folder, which the record will be created in - * @throws Exception if record can't be created - */ - @Test - ( - dataProvider = "validRootContainers", - description = "Electronic record can only be created if all mandatory properties are given" - ) - public void canCreateElectronicRecordOnlyWithMandatoryProperties(String folderId, String type) throws Exception - { - logger.info("Root container:\n" + toJson(folderId)); - - if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - // Only record folders can be opened or closed - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - assertFalse(recordFolderAPI.getRecordFolder(folderId).getProperties().getIsClosed()); - - // Record without name - Record recordModel = Record.builder().nodeType(CONTENT_TYPE).build(); - - // Try to create it - recordFolderAPI.createRecord(recordModel, folderId); - } - else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type)) - { - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build(); - unfiledContainersAPI.createUnfiledContainerChild(recordModel, folderId); - } - else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build(); - unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(recordModel, folderId); - } - else - { - throw new Exception("Unsuported type = " + type); - } - - // Verify the status code is BAD_REQUEST - assertStatusCode(BAD_REQUEST); - } - - /** - *
-     * Given a parent container that is a record folder
-     * And the record folder is open
-     * When I try to create an electronic record within the parent container
-     * Then the electronic record is created
-     * And the details of the new record are returned
-     * 
- * and - *
-     *
-     * Given a parent container that is an unfiled record folder or the root unfiled record container
-     * When I try to create an electronic record within the parent container
-     * Then the electronic record is created
-     * And the details of the new record are returned
-     * 
- * @param folderId The folder, which the record will be created in - * @param type The type of the folder, which the record will be created in - * @throws Exception if record can't be created - */ - @Test - ( - dataProvider = "validRootContainers", - description = "Electronic records can be created in record folders, unfiled record folders or unfiled record folder root" - ) - public void canCreateElectronicRecordsInValidContainers(String folderId, String type) throws Exception - { - String newRecordId; - String expectedName; - if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - Record recordModel = createElectronicRecordModel(); - newRecordId = recordFolderAPI.createRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId(); - expectedName = recordModel.getName(); - } - else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type)) - { - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - UnfiledContainerChild recordModel = createElectronicUnfiledContainerChildModel(); - newRecordId = unfiledContainersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId(); - expectedName = recordModel.getName(); - } - else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - UnfiledContainerChild recordModel = createElectronicUnfiledContainerChildModel(); - newRecordId = unfiledRecordFoldersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId(); - expectedName = recordModel.getName(); - } - else - { - throw new Exception("Unsuported type = " + type); - } - // Verify the create request status code - assertStatusCode(CREATED); - - // Get newly created electronic record and verify its properties - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - Record record = recordsAPI.getRecord(newRecordId); - String recordName = record.getName(); - - // Created record will have record identifier inserted in its name but will be prefixed with the name it was created as - assertTrue(recordName.startsWith(expectedName)); - assertTrue(recordName.contains(record.getProperties().getIdentifier())); - } - - /** - *
-     * Given that a record name isn't specified
-     * When I create an electronic record
-     * Then the record name defaults to filed file name.
-     * 
- * @param folderId The folder, which the record will be created in - * @param type The type of the folder, which the record will be created in - * @throws Exception if record can't be created - */ - @Test - ( - dataProvider = "validRootContainers", - description = "Electronic records can be created in unfiled record folder or unfiled record root" - ) - public void recordNameDerivedFromFileName(String folderId, String type) throws Exception - { - String newRecordId; - if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - // Create a record model without a name - Record recordModel = Record.builder().nodeType(CONTENT_TYPE).build(); - - // Create an electronic record - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - newRecordId = recordFolderAPI.createRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId(); - } - else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type)) - { - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build(); - newRecordId = unfiledContainersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId(); - } - else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build(); - newRecordId = unfiledRecordFoldersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId(); - } - else - { - throw new Exception("Unsuported type = " + type); - } - // Verify the create request status code - assertStatusCode(CREATED); - - // Get newly created electronic record and verify its properties - Record electronicRecord = getRestAPIFactory().getRecordsAPI().getRecord(newRecordId); - - // Record will have record identifier inserted in its name but will for sure start with file name and end with its extension - assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf(".")))); - assertTrue(electronicRecord.getName().contains(electronicRecord.getProperties().getIdentifier())); - } - - /** - *
-     * Given that I want to create an electronic record in one unfiled record folder
-     * When I use the path relative to the one unfiled record folder
-     * Then the containers in the relativePath that don't exist are created before creating the electronic record
-     * 
-     */
-    @Test
-    @Bug (id = "RM-4568")
-    public void createElectronicRecordWithRelativePath()
-    {
-        // The containers specified on the relativePath parameter don't exist on server
-        String parentUbnfiledRecordFolderName = "ParentUnfiledRecordFolder" + getRandomAlphanumeric();
-        String unfiledRecordFolderPathEl1 = "UnfiledRecordFolderPathEl1" + getRandomAlphanumeric();
-        String unfiledRecordFolderPathEl2 = "UnfiledRecordFolderPathEl2" + getRandomAlphanumeric();
-        String unfiledRecordFolderPathEl3 = "UnfiledRecordFolderPathEl3" + getRandomAlphanumeric();
-
-        String parentUnfiledRecordFolderId = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, parentUbnfiledRecordFolderName, UNFILED_RECORD_FOLDER_TYPE).getId();
-
-        String relativePath = unfiledRecordFolderPathEl1 + "/" + unfiledRecordFolderPathEl2 + "/" + unfiledRecordFolderPathEl3;
-        UnfiledContainerChild unfiledContainerChildModel= UnfiledContainerChild.builder()
-                                                                                .name(ELECTRONIC_RECORD_NAME)
-                                                                                .nodeType(CONTENT_TYPE)
-                                                                                .relativePath(relativePath)
-                                                                                .build();
-
-
-
-        UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
-        UnfiledContainerChild recordCreated = unfiledRecordFoldersAPI.uploadRecord(unfiledContainerChildModel, parentUnfiledRecordFolderId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
-
-        // Verify the create request status code
-        assertStatusCode(CREATED);
-
-        // Get newly created electronic record and verify its properties
-        RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
-        Record record = recordsAPI.getRecord(recordCreated.getId());
-
-        assertTrue(record.getName().startsWith(ELECTRONIC_RECORD_NAME));
-        assertEquals(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName(), unfiledRecordFolderPathEl3);
-
-        // The first relative path element exists and the second one does not exist
-        String unfiledRecordFolderPathEl4 = "UnfiledRecordFolderPathEl4" + getRandomAlphanumeric();
-        relativePath = unfiledRecordFolderPathEl1 + "/" + unfiledRecordFolderPathEl4;
-        unfiledContainerChildModel.setRelativePath(relativePath);
-        recordCreated = unfiledRecordFoldersAPI.uploadRecord(unfiledContainerChildModel, parentUnfiledRecordFolderId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
-        // verify the create request status code
-        assertStatusCode(CREATED);
-
-        // get newly created electronic record and verify its properties
-        record = recordsAPI.getRecord(recordCreated.getId());
-
-        assertTrue(record.getName().startsWith(ELECTRONIC_RECORD_NAME));
-        assertTrue(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName().equals(unfiledRecordFolderPathEl4));
-
-        //the containers from the RELATIVE PATH exists
-        unfiledContainerChildModel.setName(ELECTRONIC_RECORD_NAME + getRandomAlphanumeric());
-        recordCreated = unfiledRecordFoldersAPI.uploadRecord(unfiledContainerChildModel, parentUnfiledRecordFolderId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
-        // verify the create request status code
-        assertStatusCode(CREATED);
-        // get newly created electronic record and verify its properties
-        record = recordsAPI.getRecord(recordCreated.getId());
-
-        assertTrue(record.getName().startsWith(ELECTRONIC_RECORD_NAME));
-
-        assertTrue(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName().equals(unfiledRecordFolderPathEl4));
-    }
-
-    /**
-     * 
-     * Given a parent container that is a record folder
-     * When I try to create a record with name1 and create another one with the same given name
-     * Then the second record is created with success
-     * 
- */ - @Test(description = "Electronic records can be created in record folder with duplicate name") - @Bug(id ="RM-5116, RM-5012") - public void canCreateElectronicRecordsWithDuplicateName() - { - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - - // Create an electronic record with the name "Record 1" - Record recordModel = Record.builder().name("Record 1").nodeType(CONTENT_TYPE).build(); - getRestAPIFactory().getRecordFolderAPI().createRecord(recordModel, recordFolder.getId()); - // Verify the status code - assertStatusCode(CREATED); - - // Try to create another electronic record with the same name - getRestAPIFactory().getRecordFolderAPI().createRecord(recordModel, recordFolder.getId()); - - // Verify the status code - assertStatusCode(CREATED); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/NonElectronicRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/NonElectronicRecordTests.java deleted file mode 100644 index 4ff6976bbf..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/NonElectronicRecordTests.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.recordfolders; - -import static java.lang.Integer.MAX_VALUE; -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicUnfiledContainerChildRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.verifyFullNonElectronicRecord; -import static org.alfresco.utility.constants.UserRole.SiteManager; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertFalse; - -import java.util.Random; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordProperties; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.testng.annotations.Test; - -/** - * Create/File Non-Electronic Record into Unfiled Record Container/Record Folder ReST API tests - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class NonElectronicRecordTests extends BaseRMRestTest -{ - /** - *
-     * Given a parent container that is a record folder
-     * And the record folder is open
-     * When I try to create a non-electronic record within the parent container
-     * Then the non-electronic record is created
-     * And the details of the new record are returned
-     * 
-     * and
-     * 
-     *
-     *
-     * Given a parent container that is an unfiled record folder or the root unfiled record container
-     * When I try to create a non-electronic record within the parent container
-     * Then the non-electronic record is created
-     * And the details of the new record are returned
-     * 
- * @throws Exception if record can't be created - */ - @Test - ( - dataProvider = "validRootContainers", - description = "Non-electronic records can be created in valid containers" - ) - public void canCreateInValidContainers(String folderId, String type) throws Exception - { - logger.info("Root container:\n" + toJson(folderId)); - - // Use these properties for non-electronic record to be created - String title = "Title " + getRandomAlphanumeric(); - String description = "Description " + getRandomAlphanumeric(); - String box = "Box "+ getRandomAlphanumeric(); - String file = "File " + getRandomAlphanumeric(); - String shelf = "Shelf " + getRandomAlphanumeric(); - String storageLocation = "Storage Location " + getRandomAlphanumeric(); - String name = "Record " + getRandomAlphanumeric(); - - Random random = new Random(); - Integer numberOfCopies = random.nextInt(MAX_VALUE); - Integer physicalSize = random.nextInt(MAX_VALUE); - - String nonElectronicId; - if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - // Only record folders can be opened or closed - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - assertFalse(recordFolderAPI.getRecordFolder(folderId).getProperties().getIsClosed()); - - // Set values of all available properties for the non electronic records - Record nonElectrinicRecordModel = createFullNonElectronicRecordModel(name, title, description, box, file, shelf, storageLocation, numberOfCopies, physicalSize); - - // Create non-electronic record - nonElectronicId = recordFolderAPI.createRecord(nonElectrinicRecordModel, folderId).getId(); - } - else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type)) - { - // Set values of all available properties for the non electronic records - UnfiledContainerChild nonElectrinicRecordModel = createFullNonElectronicUnfiledContainerChildRecordModel(name, title, description, box, file, shelf, - storageLocation, numberOfCopies, physicalSize); - - // Create non-electronic record - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - nonElectronicId = unfiledContainersAPI.createUnfiledContainerChild(nonElectrinicRecordModel, folderId).getId(); - } - else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type)) - { - // Set values of all available properties for the non electronic records - UnfiledContainerChild nonElectrinicRecordModel = createFullNonElectronicUnfiledContainerChildRecordModel(name, title, description, box, file, shelf, - storageLocation, numberOfCopies, physicalSize); - - // Create non-electronic record - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - nonElectronicId = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(nonElectrinicRecordModel, folderId).getId(); - } - else - { - throw new Exception("Unsuported type = " + type); - } - - // Verify the create request status code - assertStatusCode(CREATED); - - // Get newly created non-electronic record and verify its properties - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - Record nonElectronicRecord = recordsAPI.getRecord(nonElectronicId); - verifyFullNonElectronicRecord(nonElectronicRecord, name, title, description, box, file, shelf, storageLocation, numberOfCopies, physicalSize); - } - - /** - *
-     * Given a parent container that is a record folder
-     * And the record folder is closed
-     * When I try to create a non-electronic record within the parent container
-     * Then nothing happens
-     * And an error is reported
-     * 
- */ - @Test(description = "Non-electronic record can't be created in closed record folder") - public void cantCreateInClosedFolder() - { - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - - // The folder should be open - assertFalse(recordFolder.getProperties().getIsClosed()); - - // Close the folder - closeFolder(recordFolder.getId()); - - // Try to create it, this should fail and throw an exception - getRestAPIFactory().getRecordFolderAPI().createRecord(createNonElectronicRecordModel(), recordFolder.getId()); - - // Verify the status code - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - *
-     * Given a parent container that is a record folder
-     * And the record folder is open
-     * When I try to create a non-electronic record within the parent container
-     * And I do not provide all the required mandatory property values
-     * Then nothing happens
-     * And an error is reported
-     * 
- * and - *
-     *
-     * Given a parent container that is an unfiled record folder or the root unfiled record container
-     * When I try to create a non-electronic record within the parent container
-     * And I do not provide all the required mandatory property values
-     * Then nothing happens
-     * And an error is reported
-     * 
- */ - @Test - ( - dataProvider = "validRootContainers", - description = "Non-electronic record can only be created if all mandatory properties are given" - ) - public void allMandatoryPropertiesRequired(String folderId, String type) - { - logger.info("Root container:\n" + toJson(folderId)); - - if (type.equals(RECORD_FOLDER_TYPE)) - { - // Only record folders can be opened or closed - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - assertFalse(recordFolderAPI.getRecordFolder(folderId).getProperties().getIsClosed()); - // Component without name and title - Record noNameOrTitle = Record.builder().nodeType(NON_ELECTRONIC_RECORD_TYPE).build(); - - // Component with title only - Record titleOnly = Record.builder() - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .properties(RecordProperties.builder() - .title("Title " + getRandomAlphanumeric()) - .build()) - .build(); - - // Try to create invalid components - asList(noNameOrTitle, titleOnly).forEach(c -> - { - logger.info("Creating non-electronic record with body:\n" + toJson(c)); - - getRestAPIFactory().getRecordFolderAPI().createRecord(c, folderId); - // Verify the status code is BAD_REQUEST - assertStatusCode(BAD_REQUEST); - }); - } - else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type)) - { - // Component without name and title - UnfiledContainerChild noNameOrTitle = UnfiledContainerChild.builder().nodeType(NON_ELECTRONIC_RECORD_TYPE).build(); - - // Component with title only - UnfiledContainerChild titleOnly = UnfiledContainerChild.builder() - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .properties(UnfiledContainerChildProperties.builder() - .title("Title " + getRandomAlphanumeric()) - .build()) - .build(); - - // Try to create invalid components - asList(noNameOrTitle, titleOnly).forEach(c -> - { - logger.info("Creating non-electronic record with body:\n" + toJson(c)); - - getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(c, folderId); - // Verify the status code is BAD_REQUEST - assertStatusCode(BAD_REQUEST); - }); - } - else - { - //we have unfiled record folder type - // Component without name and title - UnfiledContainerChild noNameOrTitle = UnfiledContainerChild.builder().nodeType(NON_ELECTRONIC_RECORD_TYPE).build(); - - // Component with title only - UnfiledContainerChild titleOnly = UnfiledContainerChild.builder() - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .properties(UnfiledContainerChildProperties.builder() - .title("Title " + getRandomAlphanumeric()) - .build()) - .build(); - - // Try to create invalid components - asList(noNameOrTitle, titleOnly).forEach(c -> - { - logger.info("Creating non-electronic record with body:\n" + toJson(c)); - - getRestAPIFactory().getUnfiledRecordFoldersAPI().createUnfiledRecordFolderChild(c, folderId); - - // Verify the status code is BAD_REQUEST - assertStatusCode(BAD_REQUEST); - }); - } - } - - /** - *
-     * Given that I am a user without RM privileges
-     * When I try to create a non-electronic record
-     * Then nothing happens
-     * And an error is reported
-     * 
- */ - @Test - ( - dataProvider = "validRootContainers", - description = "Non-electronic record can't be created if user doesn't have RM privileges" - ) - public void cantCreateIfNoRmPrivileges(String folderId, String type) - { - UserModel user = createSiteManager("zzzuser"); - - if (type.equals(RECORD_FOLDER_TYPE)) - { - // Try to create a record model - Record recordModel = Record.builder() - .properties(RecordProperties.builder() - .description("Description") - .title("Title") - .build()) - .name("Record Name") - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - - getRestAPIFactory().getRecordFolderAPI(user).createRecord(recordModel, folderId); - } - else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type)) - { - // Try to create a record model - UnfiledContainerChild recordModel = UnfiledContainerChild.builder() - .properties(UnfiledContainerChildProperties.builder() - .description("Description") - .title("Title") - .build()) - .name("Record Name") - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - - getRestAPIFactory().getUnfiledContainersAPI(user).createUnfiledContainerChild(recordModel, folderId); - } - else - { - // Try to create a record model - UnfiledContainerChild recordModel = UnfiledContainerChild.builder() - .properties(UnfiledContainerChildProperties.builder() - .description("Description") - .title("Title") - .build()) - .name("Record Name") - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - - getRestAPIFactory().getUnfiledRecordFoldersAPI(user).createUnfiledRecordFolderChild(recordModel, folderId); - } - // User who isn't an RM site member can't access the container path - assertStatusCode(FORBIDDEN); - } - - /** - * Create user with site manager role and add it to RM site - *
- * Checks whether the user exists in RM site and creates it if required, with password identical - * to user name. Note the role is a Core API role, not an RM role. - *
- * For already existing users, no site membership or role verification is performed. - *

- * @param userName user name to add - */ - private UserModel createSiteManager(String userName) - { - String siteId = getRestAPIFactory().getRMSiteAPI().getSite().getId(); - - // Check if user exists - UserModel user = new UserModel(userName, userName); - - if (!getDataUser().isUserInRepo(userName)) - { - // User doesn't exist, create it - user = getDataUser().createUser(userName, userName); - getDataUser().addUserToSite(user, new SiteModel(siteId), SiteManager); - } - - return user; - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java deleted file mode 100644 index f4f6d26852..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java +++ /dev/null @@ -1,476 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.recordfolders; - -import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.TITLE_PREFIX; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.util.ArrayList; -import java.util.NoSuchElementException; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.common.ReviewPeriod; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordProperties; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderCollection; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.utility.report.Bug; -import org.testng.AssertJUnit; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests for the Record Folder CRUD API - * - * @author Rodica Sutu - * @since 2.6 - */ -public class RecordFolderTests extends BaseRMRestTest -{ - public static final String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric(); - public static final String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); - public static final String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric(); - private RecordCategory rootCategory; - - @BeforeClass (alwaysRun = true) - public void preconditionRecordFolderTests() - { - rootCategory = createRootCategory(RECORD_CATEGORY_NAME); - } - - /** - * Data Provider with: - * with the object types not allowed as children for a record folder - * - * @return node type to be created - */ - @DataProvider - public static Object[][] childrenNotAllowedForFolder() - { - return new String[][] { - { FILE_PLAN_TYPE }, - { TRANSFER_CONTAINER_TYPE }, - { UNFILED_CONTAINER_TYPE }, - { UNFILED_RECORD_FOLDER_TYPE }, - { TRANSFER_TYPE }, - { RECORD_CATEGORY_TYPE }, - { FOLDER_TYPE } - }; - } - - /** - * Invalid containers that cannot be updated/deleted with record folder endpoint - */ - @DataProvider - public Object[][] getInvalidNodesForRecordFolders() - { - return new String[][] { - { getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS).getId()}, - { getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, - { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() }, - // an arbitrary record category - { rootCategory.getId()}, - // an arbitrary unfiled records folder - { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId() }, - { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Record " + getRandomAlphanumeric(), CONTENT_TYPE).getId()} - }; - } - - - /** - *

-     * Given that RM site is created
-     * When I use the API to create a children of wrong type inside a record folder
-     * Then the operation fails
-     * 
- */ - //TODO enable this test when REPO-2454 is fixed - @Test - ( - enabled = false, - description = "Create invalid types as children for a record folder", - dataProvider = "childrenNotAllowedForFolder" - ) - public void createInvalidChildrenForFolder(String nodeType) - { - //create a record folder - RecordCategoryChild folder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); - Record record = Record.builder() - .name(ELECTRONIC_RECORD_NAME) - .nodeType(nodeType) - .build(); - //create invalid child type for the record folder - getRestAPIFactory().getRecordFolderAPI().createRecord(record,folder.getId()); - // Check the API Response code - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - *
-     * Given that a record folder exists
-     * When I ask for the details of a record folder
-     * Then I am given the details of a record folder
-     * 
- */ - @Test - ( - description = "Check the details of a record folder" - ) - public void checkRecordFolderDetails() - { - // Create a folder - RecordCategoryChild recordCategoryChild = createRecordFolder(rootCategory.getId(), RECORD_FOLDER_NAME); - - // Get the folder including extra information - RecordFolder recordFolder = getRestAPIFactory().getRecordFolderAPI().getRecordFolder(recordCategoryChild.getId(), "include=" + IS_CLOSED); - - // Verify the returned record folder details - assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE); - assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME); - assertEquals(recordFolder.getCreatedByUser().getId(), getAdminUser().getUsername()); - assertEquals(recordFolder.getModifiedByUser().getId(), getAdminUser().getUsername()); - assertEquals(recordFolder.getProperties().getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME); - assertNotNull(recordFolder.getProperties().getIdentifier(),"The record folder doesn't have a identifier"); - assertFalse(recordFolder.getProperties().getVitalRecordIndicator(), "The record folder has the vital record identifier"); - assertFalse(recordFolder.getProperties().getIsClosed(), "The record folder is closed"); - } - - /** - *
-     * Given that a record folder exists
-     * When I use the API to update its details
-     * Then the details of the record folder are updated
-     * The above test does treat any custom metadata
-     * Note: The details of the record folder includes any custom meta-data
-     * 
- */ - @Test - ( - description = "Update the details of a record folder" - ) - public void updateRecordFolderDetails() - { - // Create a record folder - RecordCategoryChild recordCategoryChild = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); - - // Create record category first - String folderDescription = "The folder description is updated" + getRandomAlphanumeric(); - String folderName = "The folder name is updated" + getRandomAlphanumeric(); - String folderTitle = "Update title " + getRandomAlphanumeric(); - String location = "Location "+ getRandomAlphanumeric(); - - // Create the record folder properties to update - RecordFolder recordFolder = RecordFolder.builder() - .name(folderName) - .properties(RecordFolderProperties.builder() - .title(folderTitle) - .description(folderDescription) - .vitalRecordIndicator(true) - .reviewPeriod(new ReviewPeriod("month","1")) - .location(location) - .build()) - .build(); - - // Update the record folder - RecordFolder updatedRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(recordFolder, recordCategoryChild.getId()); - - // Check the Response Status Code - assertStatusCode(OK); - - // Verify the returned details for the record folder - AssertJUnit.assertEquals(updatedRecordFolder.getName(), folderName); - RecordFolderProperties recordFolderProperties = updatedRecordFolder.getProperties(); - AssertJUnit.assertEquals(recordFolderProperties.getDescription(), folderDescription); - AssertJUnit.assertEquals(recordFolderProperties.getTitle(), folderTitle); - assertTrue(recordFolderProperties.getVitalRecordIndicator()); - AssertJUnit.assertEquals(recordFolderProperties.getLocation(), location); - assertNotNull(recordFolderProperties.getReviewPeriod().getPeriodType()); - assertNotNull(recordFolderProperties.getReviewPeriod().getExpression()); - } - - /** - *
-     * Given other nodes type than record folders exists
-     * When I use the API to update its details
-     * Then the request fails
-     * 
- */ - @Test - ( - description = "Update the details for other nodes than record folder with the request used for record-folders ", - dataProvider = "getInvalidNodesForRecordFolders" - ) - public void updateOtherNodeTypesDetails(String nodeId) - { - // Create record category first - String nodeDescription = "The folder description is updated" + getRandomAlphanumeric(); - String nodeName = "The folder name is updated" + getRandomAlphanumeric(); - String nodeTitle = "Update title " + getRandomAlphanumeric(); - - - // Create the record folder properties to update - RecordFolder recordFolder = RecordFolder.builder() - .name(nodeName) - .properties(RecordFolderProperties.builder() - .title(nodeTitle) - .description(nodeDescription) - .vitalRecordIndicator(true) - .reviewPeriod(new ReviewPeriod("month", "1")) - .build()) - .build(); - - // Update the record folder - getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(recordFolder, nodeId); - - // Check the Response Status Code - assertStatusCode(BAD_REQUEST); - } - - /** - *
-     * Given other nodes type than record folders exists
-     * When I use the API from record-folders to delete the nodes
-     * Then the request fails
-     * 
- */ - @Test - ( - description = "Delete invalid nodes type with the DELETE record folders request", - dataProvider = "getInvalidNodesForRecordFolders" - ) - public void deleteInvalidNodesRecordFolder(String nodeId) - { - // Delete the nodes with record-folders end-point - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - recordFolderAPI.deleteRecordFolder(nodeId); - - // Check the response status code - assertStatusCode(BAD_REQUEST); - } - - /** - *
-     * Given that a record folder exists
-     * When I use the API to delete the record folder
-     * Then it is deleted according to the normal rules governing the deletion of record folders
-     * 
- */ - @Test - ( - description = "Delete record folder" - ) - public void deleteRecordFolder() - { - // Create the record folder - RecordCategoryChild recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); - - // Delete the record folder - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - String recordFolderId = recordFolder.getId(); - recordFolderAPI.deleteRecordFolder(recordFolderId); - - // Check the response status code - assertStatusCode(NO_CONTENT); - - // Check the record folder is not found - recordFolderAPI.getRecordFolder(recordFolderId); - - // Check the response status code - assertStatusCode(NOT_FOUND); - } - - /** - * Given that a record folder exists - * When the record folder is closed - * Then a request can be made to reopen it - */ - @Test - ( - description = "A closed record folder can be reopened" - ) - @Bug(id="RM-4808") - public void openClosedRecordFolder() - { - // Create a record folder - RecordCategoryChild recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); - - // Assert that the record folder is not closed - assertFalse(recordFolder.getProperties().getIsClosed()); - - // Get the record folder API - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - - // Create a record folder model to close it - RecordFolder recordFolderModel = RecordFolder.builder() - .properties(RecordFolderProperties.builder() - .isClosed(true) - .build()) - .build(); - - // Make a request to close the record folder - RecordFolder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId()); - - // Verify that the record folder is closed now - assertTrue(updatedRecordFolder.getProperties().getIsClosed()); - - // Create a record folder model to reopen it - recordFolderModel = RecordFolder.builder() - .properties(RecordFolderProperties.builder() - .isClosed(false) - .build()) - .build(); - - // Make a request to reopen the record folder - updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId()); - - // Verify that the record folder is open now - assertFalse(updatedRecordFolder.getProperties().getIsClosed()); - } - - /** - * Given a container that is a record folder - * When I try to list the records from the record folder - * Then I receive a list of all the records contained within the record folder - */ - @Test - public void listRecordsFromRecordFolder() - { - final int NUMBER_OF_RECORDS = 5; - String containerId = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")).getId(); - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - // Create Electronic Records - ArrayList children = new ArrayList<>(); - for (int i = 0; i < NUMBER_OF_RECORDS; i++) - { - //build the electronic record - Record record = Record.builder() - .name(ELECTRONIC_RECORD_NAME + i) - .nodeType(CONTENT_TYPE) - .build(); - //create a child - Record child = recordFolderAPI.createRecord(record, containerId, createTempFile(ELECTRONIC_RECORD_NAME + i, ELECTRONIC_RECORD_NAME + i)); - - children.add(child); - } - //Create NonElectronicRecords - for (int i = 0; i < NUMBER_OF_RECORDS; i++) - { - Record nonelectronicRecord = Record.builder() - .properties(RecordProperties.builder() - .description("Description") - .title("Title") - .build()) - .name(NONELECTRONIC_RECORD_NAME + i) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - //create records - Record child = recordFolderAPI.createRecord(nonelectronicRecord, containerId); - - children.add(child); - } - - // List children from API - RecordFolderCollection apiChildren = (RecordFolderCollection) recordFolderAPI.getRecordFolderChildren(containerId,"include=properties").assertThat().entriesListIsNotEmpty(); - - // Check status code - assertStatusCode(OK); - - - // Check listed children against created list - apiChildren.getEntries().forEach(c -> - { - Record record = c.getEntry(); - assertNotNull(record.getId()); - logger.info("Checking child " + record.getId()); - - try - { - // Find this child in created children list - Record createdComponent = children.stream() - .filter(child -> child.getId().equals(record.getId())) - .findFirst() - .orElseThrow(); - - // Created by - assertEquals(record.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Is parent Id set correctly - assertEquals(record.getParentId(), containerId); - - //check the record name - assertEquals(createdComponent.getName(), record.getName(), - "Record Name" + record.getName() + " doesn't match the one returned on create"); - assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()), - "Record Name"+ createdComponent.getName()+" doesn't contain the record identifier in response when creating"); - assertEquals(createdComponent.getNodeType(), record.getNodeType()); - - } catch (NoSuchElementException e) - { - fail("No child element for " + record.getId()); - } - }); - } - - @AfterClass (alwaysRun = true) - public void tearDown() - { - deleteRecordCategory(rootCategory.getId()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java deleted file mode 100644 index 7429fb5b1e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.test.AlfrescoTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests for - * Complete Record Action REST API - * - * @author Sara Aspery - * @since 2.6 - */ -public class CompleteRecordTests extends BaseRMRestTest -{ - private static final Boolean COMPLETE = true; - private static final Boolean INCOMPLETE = false; - private static final String PARAMETERS = "include=isCompleted"; - - /** - * Incomplete records with mandatory meta-data missing - */ - @DataProvider (name = "IncompleteRecordsMandatoryMetadataMissing") - public Object[][] getIncompleteRecordsMandatoryMetadataMissing() - { - //create RM site - createRMSite(createDOD5015RMSiteModel()); - - // create electronic and non-electronic records - return createAndVerifyRecordsInFolder(); - } - - /** - * Incomplete records with mandatory meta-data present - */ - @DataProvider (name = "IncompleteRecordsMandatoryMetadataPresent") - public Object[][] getIncompleteRecordsMandatoryMetadataPresent() - { - // create electronic and non-electronic records - return createAndVerifyRecordsInFolder(); - } - - /** - *
-     * Given the repository is configured to check mandatory data before completing a record
-     * And an incomplete record with its mandatory meta-data missing
-     * When I complete the record
-     * Then I receive an error indicating that I can't complete the operation,
-     * because some of the mandatory meta-data of the record is missing
-     * 
- */ - @Test - ( - dataProvider = "IncompleteRecordsMandatoryMetadataMissing", - description = "Cannot complete electronic and non-electronic records with mandatory metadata missing", - priority = 1 - ) - @AlfrescoTest (jira = "RM-4431") - public void completeRecordWithMandatoryMetadataMissing(Record record) - { - verifyRecordCompletionStatus(record, INCOMPLETE); - - // Complete record - completeRecord(record); - assertStatusCode(UNPROCESSABLE_ENTITY); - - verifyRecordCompletionStatus(record, INCOMPLETE); - } - - /** - *
-     * Given the repository is configured to check mandatory data before completing a record
-     * And an incomplete record with all mandatory meta-data present
-     * When I complete the record
-     * Then the record is successfully completed
-     * 
- */ - @Test - ( - dataProvider = "IncompleteRecordsMandatoryMetadataPresent", - description = "Can complete electronic and non-electronic records with mandatory metadata present" - ) - @AlfrescoTest (jira = "RM-4431") - public void completeRecordWithMandatoryMetadataPresent(Record record) - { - verifyRecordCompletionStatus(record, INCOMPLETE); - - // Complete record - completeRecord(record); - assertStatusCode(CREATED); - - verifyRecordCompletionStatus(record, COMPLETE); - } - - /** - *
-     * Given a document that is not a record or any non-document node
-     * When I complete the item
-     * Then I receive an unsupported operation error
-     * 
- */ - @Test (description = "Cannot complete a document that is not a record") - @AlfrescoTest (jira = "RM-4431") - public void completeNonRecord() - { - // Get the recordsAPI - getRestAPIFactory().getRecordsAPI() - .completeRecord(createCategoryFolderInFilePlan().getId(), PARAMETERS); - assertStatusCode(BAD_REQUEST); - } - - /** - *
-     * Given a record that is already completed
-     * When I complete the record
-     * Then I receive an error indicating that I can't complete the operation, because the record is already complete
-     * 
- */ - @Test - ( - dataProvider = "IncompleteRecordsMandatoryMetadataPresent", - description = "Cannot complete a record that is already completed" - ) - @AlfrescoTest (jira = "RM-4431") - public void completeAlreadyCompletedRecord(Record record) - { - verifyRecordCompletionStatus(record, INCOMPLETE); - - // Complete record - completeRecord(record); - assertStatusCode(CREATED); - - verifyRecordCompletionStatus(record, COMPLETE); - - // Complete record - completeRecord(record); - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - * Helper method to create records and and assert successful creation - */ - private Record[][] createAndVerifyRecordsInFolder() - { - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - - // create record folder - String recordFolderId = createCategoryFolderInFilePlan().getId(); - - // create electronic record in record folder - Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - - // create non-electronic record in record folder - Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolderId); - assertStatusCode(CREATED); - - return new Record[][] - { - { electronicRecord }, - { nonElectronicRecord } - }; - } - - /** - * Helper method to verify record is complete or incomplete - */ - private void verifyRecordCompletionStatus(Record record, Boolean completionStatus) - { - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - Record recordModel = recordsAPI.getRecord(record.getId(), PARAMETERS); - assertEquals(recordModel.getIsCompleted(), completionStatus); - } - - /** - * Helper method to complete a record - */ - private void completeRecord(Record record) - { - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - recordsAPI.completeRecord(record.getId(), PARAMETERS); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java deleted file mode 100644 index 9662943dae..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java +++ /dev/null @@ -1,463 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicUnfiledContainerChildModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicUnfiledContainerChildModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.core.RestResponse; -import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS; -import org.alfresco.rest.model.RestNodeBodyMoveCopyModel; -import org.alfresco.rest.model.RestNodeModel; -import org.alfresco.rest.requests.Node; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordBodyFile; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.v0.RMRolesAndActionsAPI; -import org.alfresco.rest.v0.service.DispositionScheduleService; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.data.RandomData; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FolderModel; -import org.alfresco.utility.model.RepoTestModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Delete records tests - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class DeleteRecordTests extends BaseRMRestTest -{ - @Autowired - private DispositionScheduleService dispositionScheduleService; - @Autowired - private RMRolesAndActionsAPI rmRolesAndActionsAPI; - @Autowired - private org.alfresco.rest.v0.RecordsAPI recordsAPI; - @Autowired - private RoleService roleService; - private RecordCategoryChild recordFolder; - private UnfiledContainerChild unfiledRecordFolder; - - @BeforeClass (alwaysRun = true) - public void setupDeleteRecordTests() - { - testSite = dataSite.usingAdmin().createPublicRandomSite(); - recordFolder = createCategoryFolderInFilePlan(); - unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomName("Unfiled Folder "), - UNFILED_RECORD_FOLDER_TYPE); - } - - /** Data provider with electronic and non-electronic records to be deleted */ - @DataProvider (name = "recordsToBeDeleted") - public Object[][] getRecordsToBeDeleted() - { - return new String[][] - { - // records created in an arbitrary record folder - {getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)).getId()}, - {getRestAPIFactory().getRecordFolderAPI().createRecord(createNonElectronicRecordModel(), recordFolder.getId()).getId()}, - // records created in unfiled records root - {getRestAPIFactory().getUnfiledContainersAPI().uploadRecord(createElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS, getFile(IMAGE_FILE)).getId()}, - {getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(createNonElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS).getId()}, - // records created in an arbitrary unfiled records folder - {getRestAPIFactory().getUnfiledRecordFoldersAPI().uploadRecord(createElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId(), getFile(IMAGE_FILE)).getId()}, - {getRestAPIFactory().getUnfiledRecordFoldersAPI().createUnfiledRecordFolderChild(createNonElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId()).getId()} - }; - } - - /** - *
-     * Given an electronic record
-     * And that I have the "Delete Record" capability
-     * And write permissions
-     * When I delete the record
-     * Then it is deleted from the file plan
-     * 
- */ - @Test - ( - dataProvider = "recordsToBeDeleted", - description = "Admin user can delete records" - ) - @AlfrescoTest(jira="RM-4363") - public void adminCanDeleteRecords(String recordId) - { - // Delete record and verify successful deletion - deleteAndVerify(recordId); - } - - /** - *
-     * Given a non-electronic record
-     * And that I don't have write permissions
-     * When I try to delete the record
-     * Then nothing happens
-     * And error gets reported
-     * 
- */ - @Test - ( - description = "User without write permissions can't delete a record" - ) - @AlfrescoTest(jira="RM-4363") - public void userWithoutWritePermissionsCantDeleteRecord() - { - // Create a non-electronic record in unfiled records - UnfiledContainerChild nonElectronicRecord = UnfiledContainerChild.builder() - .name("Record " + RandomData.getRandomAlphanumeric()) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - UnfiledContainerChild newRecord = getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(nonElectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS); - - assertStatusCode(CREATED); - - // Create test user with RM Manager role - UserModel deleteUser = roleService.createUserWithRMRole(ROLE_RM_MANAGER.roleId); - - // Try to delete newRecord - getRestAPIFactory().getRecordsAPI(deleteUser).deleteRecord(newRecord.getId()); - assertStatusCode(FORBIDDEN); - } - - /** - *
-     * Given a record
-     * And that I don't have the "Delete Record" capability
-     * When I try to delete the record
-     * Then nothing happens
-     * And error gets reported
-     * 
- */ - @Test - ( - description = "User without delete records capability can't delete a record" - ) - @AlfrescoTest(jira="RM-4363") - public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() - { - // Create test user and add it with collaboration privileges - // Add RM role to user, RM Power User doesn't have the "Delete Record" capabilities - UserModel deleteUser = roleService.createUserWithRMRole(ROLE_RM_POWER_USER.roleId); - - // Grant "deleteUser" filing permissions on "randomFolder" parent, this will be inherited to randomFolder - RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategoryAPI.getRecordCategory(recordFolder.getParentId()).getId(), deleteUser, PERMISSION_FILING); - assertStatusCode(OK); - - // Create a non-electronic record in "randomFolder" - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - Record newRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolder.getId()); - assertStatusCode(CREATED); - - // Verify the user can see "newRecord" - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(deleteUser); - recordsAPI.getRecord(newRecord.getId()); - assertStatusCode(OK); - - // Try to delete "newRecord" - recordsAPI.deleteRecord(newRecord.getId()); - assertStatusCode(FORBIDDEN); - } - - /** - *
-     * Given a record
-     * And a copy of that record
-     * When I delete the copy
-     * Then it is still possible to view the content of the original record
-     * 
- */ - @Test(description = "Deleting copy of record doesn't delete original content") - @AlfrescoTest(jira="MNT-18806") - public void deleteCopyOfRecord() - { - STEP("Create another record category with a folder."); - RecordCategoryChild recordFolderB = createCategoryFolderInFilePlan(); - - STEP("Create a record in first folder and copy it into second folder."); - String recordId = getRestAPIFactory().getRecordFolderAPI() - .createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)).getId(); - String copyId = copyNode(recordId, recordFolderB.getId()).getId(); - assertStatusCode(CREATED); - - STEP("Check that it's possible to load the original content."); - getNodeContent(recordId); - assertStatusCode(OK); - - STEP("Delete the copy."); - deleteAndVerify(copyId); - - STEP("Check that the original record node and content still exist."); - checkNodeExists(recordId); - getNodeContent(recordId); - } - - - /** - *
-     * Given a file that has a copy
-     * And the original file is declared as record
-     * When I delete the original
-     * Then it is still possible to view the content of the copy
-     * 
- */ - @Test (description = "Deleting record doesn't delete the content for the copies") - @AlfrescoTest (jira = "MNT-20145") - public void deleteOriginOfRecord() - { - STEP("Create a file."); - FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Create a copy of the file."); - RestNodeModel copyOfTestFile = copyNode(testFile.getNodeRefWithoutVersion(), testSite.getGuid()); - - STEP("Declare original file as record"); - getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Delete the record."); - deleteAndVerify(testFile.getNodeRefWithoutVersion()); - - STEP("Check that it's possible to load the copy content."); - getNodeContent(copyOfTestFile.getId()); - assertStatusCode(OK); - } - - /** - *
-     * Given a file that has a copy
-     * And the original file is declared as record
-     * And the record becomes part of a disposition schedule with a destroy step
-     * When the record is destroyed
-     * Then it is still possible to view the content of the copy
-     * 
- */ - @Test (description = "Destroying record doesn't delete the content for the associated copy") - @AlfrescoTest (jira = "MNT-20145") - public void destroyOfRecord() - { - STEP("Create a file."); - FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - FolderModel folderModel = dataContent.usingAdmin().usingSite(testSite).createFolder(); - - STEP("Create a copy of the file."); - RestNodeModel copy = copyNode(testFile.getNodeRefWithoutVersion(), folderModel.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Declare the file as record."); - getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Create a record category with a disposition schedule."); - RecordCategory recordCategory = createRootCategory(getRandomName("Category with disposition")); - dispositionScheduleService.createCategoryRetentionSchedule(recordCategory.getName(), true); - - STEP("Add retention schedule cut off and destroy step with immediate period."); - dispositionScheduleService.addCutOffAfterPeriodStep(recordCategory.getName(), "immediately"); - dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(recordCategory.getName(), "immediately"); - - STEP("Create a record folder and file the record"); - RecordCategoryChild recFolder = createFolder(recordCategory.getId(), getRandomName("recFolder")); - RecordBodyFile recordBodyFile = RecordBodyFile.builder().targetParentId(recFolder.getId()).build(); - Record recordFiled = getRestAPIFactory().getRecordsAPI().fileRecord(recordBodyFile, testFile.getNodeRefWithoutVersion()); - getRestAPIFactory().getRecordsAPI().completeRecord(recordFiled.getId()); - assertStatusCode(CREATED); - - STEP("Execute the disposition schedule steps."); - rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getUsername(), recordFiled.getName(), - RM_ACTIONS.CUT_OFF); - rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getUsername(), recordFiled.getName(), - RM_ACTIONS.DESTROY); - - STEP("Check that it's possible to load the copy content."); - getNodeContent(copy.getId()); - assertStatusCode(OK); - } - - /** - *
-     * Given a file that has version declared as record
-     * When the record is deleted
-     * Then it is still possible to view the content of the file
-     * 
- */ - @Test (description = "Deleting record made from version doesn't delete the content for the file") - @AlfrescoTest (jira = "MNT-20145") - public void deleteVersionDeclaredAsRecord() - { - STEP("Create a file."); - FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Declare file version as record."); - recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(), - testFile.getName()); - UnfiledContainerChild unfiledContainerChild = getRestAPIFactory().getUnfiledContainersAPI() - .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS) - .getEntries().stream() - .filter(child -> child.getEntry().getName() - .startsWith(testFile.getName().substring(0, testFile.getName().indexOf(".")))) - .findFirst() - .get().getEntry(); - - STEP("Delete the record."); - deleteAndVerify(unfiledContainerChild.getId()); - - STEP("Check that it's possible to load the file declared version as record."); - getNodeContent(testFile.getNodeRefWithoutVersion()); - assertStatusCode(OK); - } - - - /** - * Utility method to delete a record and verify successful deletion - * - * @param recordId The id of the record - */ - private void deleteAndVerify(String recordId) - { - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - - // Delete record and verify status - recordsAPI.deleteRecord(recordId); - assertStatusCode(NO_CONTENT); - - // Try to get deleted record - recordsAPI.getRecord(recordId); - assertStatusCode(NOT_FOUND); - } - - /** - * Copy a node to a folder. - * - * @param nodeId The id of the node to copy. - * @param destinationFolder The id of the folder to copy it to. - * @return The model returned by the copy API. - */ - private RestNodeModel copyNode(String nodeId, String destinationFolder) - { - Node node = getNode(nodeId); - RestNodeBodyMoveCopyModel copyBody = new RestNodeBodyMoveCopyModel(); - copyBody.setTargetParentId(destinationFolder); - try - { - return node.copy(copyBody); - } - catch (Exception e) - { - throw new RuntimeException("Problem copying record.", e); - } - } - - /** - * Get the content from a node. - * - * @param nodeId - * @return The response containing the node content. - */ - private RestResponse getNodeContent(String nodeId) - { - try - { - return getNode(nodeId).getNodeContent(); - } - catch (Exception e) - { - throw new RuntimeException("Failed to load content for node.", e); - } - } - - /** - * Check that the given node exists. - * - * @param nodeId The node to check. - */ - private void checkNodeExists(String nodeId) - { - try - { - getNode(nodeId).getNode(); - } - catch (Exception e) - { - throw new RuntimeException("Node does not exist.", e); - } - } - - /** - * Get the node from a record id. - * - * @param recordId The record to get. - * @return The node object. - */ - private Node getNode(String recordId) - { - RepoTestModel repoTestModel = new RepoTestModel() {}; - repoTestModel.setNodeRef(recordId); - return getRestAPIFactory().getNodeAPI(repoTestModel); - } - - @AfterClass(alwaysRun = true) - public void cleanupDeleteRecordTests() - { - dataSite.deleteSite(testSite); - deleteRecordCategory(recordFolder.getParentId()); - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledRecordFolder.getId()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java deleted file mode 100644 index 72911908a6..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME; -import static org.alfresco.rest.rm.community.base.TestData.NONELECTRONIC_RECORD_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.RECORD_SEARCH_ASPECT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordBodyFile; -import org.alfresco.rest.rm.community.model.record.RecordContent; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.report.Bug; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests for - * File Unfiled Record Action REST API - * - * @author Rodica Sutu - * @since 2.6 - */ -public class FileRecordsTests extends BaseRMRestTest -{ - private UnfiledContainerChild electronicRecord = UnfiledContainerChild.builder() - .name(ELECTRONIC_RECORD_NAME) - .nodeType(CONTENT_TYPE) - .content(RecordContent.builder().mimeType("text/plain").build()) - .build(); - - private UnfiledContainerChild nonelectronicRecord = UnfiledContainerChild.builder() - .properties(UnfiledContainerChildProperties.builder() - .description(NONELECTRONIC_RECORD_NAME) - .title("Title") - .build()) - .name(NONELECTRONIC_RECORD_NAME) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - - private String targetFolderId, folderToLink, closedFolderId, unfiledRecordFolderId; - - @BeforeClass (alwaysRun = true) - public void setupFileRecordsTests() - { - // create 3 record folders and close one of them - targetFolderId = createCategoryFolderInFilePlan().getId(); - folderToLink = createCategoryFolderInFilePlan().getId(); - closedFolderId = createCategoryFolderInFilePlan().getId(); - closeFolder(closedFolderId); - - // create one unfiled record folder - unfiledRecordFolderId = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId(); - } - - /** - * Invalid containers where electronic and non-electronic records can be filed - */ - @DataProvider (name = "invalidContainersToFile") - public Object[][] getFolderContainers() - { - return new String[][] { - { FILE_PLAN_ALIAS}, - { UNFILED_RECORDS_CONTAINER_ALIAS}, - { TRANSFERS_ALIAS }, - // an arbitrary record category - { createRootCategory(getAdminUser(), "Category " + getRandomAlphanumeric()).getId()}, - // an arbitrary unfiled records folder - { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId() } - }; - } - - /** - * Returns the ids of unfiled electronic and non-electronic records from Unfiled Records container - */ - @DataProvider (name = "unfiledRecordsFromUnfiledRecordsContainer") - public Object[][] getRecordsFromUnfiledRecordsContainer() - { - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - return new String[][] { - { unfiledContainersAPI.uploadRecord(electronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS, - createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)).getId()}, - { unfiledContainersAPI.createUnfiledContainerChild(nonelectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS).getId()} - }; - } - - /** - * Returns the ids of unfiled electronic and non-electronic records from an Unfiled Record Folder - */ - @DataProvider (name = "unfiledRecordsFromUnfiledRecordFolder") - public Object[][] getRecordsFromUnfiledRecordFolder() - { - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - - return new String[][] { - { unfiledRecordFoldersAPI.uploadRecord(electronicRecord, unfiledRecordFolderId, - createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)).getId()}, - { unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(nonelectronicRecord, unfiledRecordFolderId).getId()} - }; - } - - /** - * Given an unfiled record in the root unfiled record container - * And an open record folder - * When I file the unfiled record into the record folder - * Then the record is filed - */ - @Test (dataProvider = "unfiledRecordsFromUnfiledRecordsContainer") - @AlfrescoTest (jira = "RM-7060") - public void fileRecordFromUnfiledContainerToOpenFolder(String unfiledRecordId) throws Exception - { - // file the record to the folder created - Record recordFiled = fileRecordToFolder(unfiledRecordId, targetFolderId); - // check the response status - assertStatusCode(CREATED); - // check the parent id for the record returned - assertEquals(recordFiled.getParentId(), targetFolderId); - - // check the record is filed to the record folder - assertTrue(isRecordChildOfRecordFolder(unfiledRecordId, targetFolderId), unfiledRecordId + " is not filed to " + targetFolderId); - - // check the record doesn't exist into unfiled record container - assertFalse(isRecordChildOfUnfiledContainer(unfiledRecordId), unfiledRecordId + " exists in Unfiled Records"); - assertTrue(hasAspect(unfiledRecordId, RECORD_SEARCH_ASPECT), "recordSearch aspect is lost after filing!"); - } - - /** - * Given an unfiled record in a unfiled record folder - * And an open record folder - * When I file the unfiled record into the record folder - * Then the record is filed - */ - @Test (dataProvider = "unfiledRecordsFromUnfiledRecordFolder") - @AlfrescoTest (jira = "RM-7060") - public void fileRecordFromUnfiledRecordFolderToOpenFolder(String unfiledRecordId) throws Exception - { - // file the record to the folder created - Record recordFiled = fileRecordToFolder(unfiledRecordId, targetFolderId); - // check the response status - assertStatusCode(CREATED); - // check the parent id for the record returned - assertEquals(recordFiled.getParentId(), targetFolderId); - - // check the record is filed to the record folder - assertTrue(isRecordChildOfRecordFolder(unfiledRecordId, targetFolderId), unfiledRecordId + " is not filed to " + targetFolderId); - - // check the record doesn't exist into unfiled record folder - assertFalse(isRecordChildOfUnfiledRecordFolder(unfiledRecordId), - unfiledRecordId + " exists in " + unfiledRecordFolderId); - assertTrue(hasAspect(unfiledRecordId, RECORD_SEARCH_ASPECT), "recordSearch aspect is lost after filing!"); - } - - /** - * Given an unfiled record in the root unfiled record container - * And a closed record folder - * When I file the unfiled record into the record folder - * Then I get an unsupported operation exception - * - */ - @Test (dataProvider = "unfiledRecordsFromUnfiledRecordsContainer") - public void fileRecordFromUnfiledContainerToClosedFolder(String unfiledRecordId) - { - // file the record to the closed record folder - fileRecordToFolder(unfiledRecordId, closedFolderId); - // check the response status - assertStatusCode(FORBIDDEN); - - // check the record is not filed to the record folder - assertFalse(isRecordChildOfRecordFolder(unfiledRecordId, closedFolderId), unfiledRecordId + " is filed to " + closedFolderId); - - // check the record exist into unfiled record container - assertTrue(isRecordChildOfUnfiledContainer(unfiledRecordId), unfiledRecordId + " doesn't exist in Unfiled Records"); - } - - /** - * Given an unfiled record in a unfiled record folder - * And a closed record folder - * When I file the unfiled record into the record folder - * Then I get an unsupported operation exception - * - */ - @Test(dataProvider = "unfiledRecordsFromUnfiledRecordFolder") - public void fileRecordFromUnfiledRecordFolderToClosedFolder(String unfiledRecordId) - { - // file the record into the closed folder created - fileRecordToFolder(unfiledRecordId, closedFolderId); - // check the response status - assertStatusCode(FORBIDDEN); - - // check the record is not filed into the record folder - assertFalse(isRecordChildOfRecordFolder(unfiledRecordId, closedFolderId), unfiledRecordId + " is filed to " + closedFolderId); - - // check the record exist into unfiled record folder - assertTrue(isRecordChildOfUnfiledRecordFolder(unfiledRecordId), - unfiledRecordId + " doesn't exist in " + unfiledRecordFolderId); - } - - /** - * Given a filed record in a record folder - * And an open record folder - * When I file the filed record into the record folder - * Then the record is filed in both locations - */ - @Test (dataProvider = "unfiledRecordsFromUnfiledRecordsContainer") - @Bug (id = "RM-4578") - public void linkRecordInto(String unfiledRecordId) - { - // file the record to the open folder created - Record recordFiled = fileRecordToFolder(unfiledRecordId, targetFolderId); - // check the response status - assertStatusCode(CREATED); - - // link the record to the second folder - Record recordLink = fileRecordToFolder(unfiledRecordId, folderToLink); - assertStatusCode(CREATED); - assertEquals(recordLink.getParentId(), targetFolderId); - - // check the record is added into the record folder - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - assertTrue(recordFolderAPI.getRecordFolderChildren(targetFolderId) - .getEntries() - .stream() - .anyMatch(c -> c.getEntry().getId().equals(recordFiled.getId()) && - c.getEntry().getParentId().equals(targetFolderId))); - - // check the record has a link in the second folder - assertTrue(recordFolderAPI.getRecordFolderChildren(folderToLink) - .getEntries().stream() - .anyMatch(c -> c.getEntry().getId().equals(recordFiled.getId()) && - c.getEntry().getParentId().equals(targetFolderId) && - !c.getEntry().getParentId().equals(folderToLink))); - } - - /** - * Given an unfiled container or filed record - * And a container that is NOT a record folder - * When I file the unfiled container or filed record to the container - * Then I get an unsupported operation exception - */ - @Test - ( - dataProvider = "invalidContainersToFile", - description = "File the unfiled record to the container that is not a record folder" - ) - public void invalidContainerToFile(String containerId) - { - // create records - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - - UnfiledContainerChild recordElectronic = unfiledContainersAPI.uploadRecord(electronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)); - UnfiledContainerChild recordNonElect = unfiledContainersAPI.createUnfiledContainerChild(nonelectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS); - - // file the records to a container that is not a record folder - fileRecordToFolder(recordElectronic.getId(), containerId); - assertStatusCode(BAD_REQUEST); - - fileRecordToFolder(recordNonElect.getId(), containerId); - assertStatusCode(BAD_REQUEST); - } - - /** - * Files the given record in the target record folder. - * - * @param recordId the id of the record to be filed - * @param targetFolderId the id of the target record folder - */ - private Record fileRecordToFolder(String recordId, String targetFolderId) - { - RecordBodyFile recordBodyFile = RecordBodyFile.builder().targetParentId(targetFolderId).build(); - return getRestAPIFactory().getRecordsAPI().fileRecord(recordBodyFile, recordId); - } - - /** - * Returns whether any child of the record folder match the provided record - * - * @param recordId the record id - * @param recordFolderId the record folder id - * @return true if any child of the record folder match the provided record, false otherwise - */ - private boolean isRecordChildOfRecordFolder(String recordId, String recordFolderId) - { - return getRestAPIFactory().getRecordFolderAPI() - .getRecordFolderChildren(recordFolderId) - .getEntries() - .stream() - .anyMatch(c -> c.getEntry().getId().equals(recordId)); - } - - /** - * Returns whether any child of the unfiled record folder match the provided record - * - * @param recordId the record id - * @return true if any child of the unfiled record folder match the provided record, false otherwise - */ - private boolean isRecordChildOfUnfiledRecordFolder(String recordId) - { - return getRestAPIFactory().getUnfiledRecordFoldersAPI() - .getUnfiledRecordFolderChildren(unfiledRecordFolderId) - .getEntries() - .stream() - .anyMatch(c -> c.getEntry().getId().equals(recordId)); - } - - /** - * Returns whether any child of the unfiled container match the provided record - * - * @param recordId the record id - * @return true if any child of the unfiled container match the provided record, false otherwise - */ - private boolean isRecordChildOfUnfiledContainer(String recordId) - { - return getRestAPIFactory().getUnfiledContainersAPI() - .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS) - .getEntries() - .stream() - .anyMatch(c -> c.getEntry().getId().equals(recordId)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/MoveRecordsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/MoveRecordsTests.java deleted file mode 100644 index 38525a71ac..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/MoveRecordsTests.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.RECORD_SEARCH_ASPECT; -import static org.alfresco.rest.rm.community.utils.CoreUtil.createBodyForMoveCopy; -import static org.alfresco.rest.rm.community.utils.CoreUtil.toContentModel; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.springframework.http.HttpStatus.OK; -import static org.testng.Assert.assertTrue; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.test.AlfrescoTest; -import org.testng.annotations.Test; - -/** - * Move records tests - * - * @author Claudia Agache - * @since 3.3 - */ -public class MoveRecordsTests extends BaseRMRestTest -{ - @Test (description = "rma:recordSearch aspect is reapplied after record move") - @AlfrescoTest (jira = "RM-7060") - public void moveRecord() throws Exception - { - String parentFolderId = createCategoryFolderInFilePlan().getId(); - String targetFolderId = createCategoryFolderInFilePlan().getId(); - String electronicRecordId = createElectronicRecord(parentFolderId, ELECTRONIC_RECORD_NAME).getId(); - STEP("Move record from one folder to the other"); - getRestAPIFactory().getNodeAPI(toContentModel(electronicRecordId)).move(createBodyForMoveCopy(targetFolderId)); - assertStatusCode(OK); - - STEP("Check the record still has rma:recordSearch aspect."); - assertTrue(hasAspect(electronicRecordId, RECORD_SEARCH_ASPECT), "recordSearch aspect is lost after move!"); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java deleted file mode 100644 index 0de24378f5..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.CONTENT; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_COMPLETED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.OK; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; -import static org.testng.AssertJUnit.assertTrue; - -import java.io.FileInputStream; -import java.io.InputStream; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.base.TestData; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordContent; -import org.alfresco.rest.rm.community.model.record.RecordProperties; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildCollection; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.test.AlfrescoTest; -import org.apache.commons.codec.digest.DigestUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests for Read Records API - * - * @author Rodica Sutu - * @since 2.6 - */ -public class ReadRecordTests extends BaseRMRestTest -{ - public static final String CATEGORY_NAME = TestData.RECORD_CATEGORY_NAME + getRandomAlphanumeric(); - - public static final String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric(); - public static final String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); - - private Record electronicRecord = Record.builder() - .name(ELECTRONIC_RECORD_NAME) - .nodeType(CONTENT_TYPE) - .build(); - - private Record nonelectronicRecord = Record.builder() - .properties(RecordProperties.builder() - .description(NONELECTRONIC_RECORD_NAME) - .title("Title") - .build()) - .name(NONELECTRONIC_RECORD_NAME) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - - private RecordCategory rootCategory, rootCategory2; - private RecordCategoryChild recordFolder; - - @BeforeClass(alwaysRun = true) - public void setupReadRecordTests() - { - rootCategory = createRootCategory(getRandomName("rootCategory")); - rootCategory2 = createRootCategory(getRandomName("rootCategory2")); - recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); - } - /** - * Given a record category or a container which can't contain records - * When I try to read the children filtering the results to records - * Then I receive an empty list - */ - @DataProvider (name = "invalidContainersForRecords") - public Object[][] getInvalidContainersForRecords() - { - return new String[][] { - { FILE_PLAN_ALIAS }, - { TRANSFERS_ALIAS }, - { rootCategory.getId()} - }; - } - @Test - ( - dataProvider = "invalidContainersForRecords", - description = "Reading records from invalid containers" - ) - @AlfrescoTest(jira="RM-4361") - public void readRecordsFromInvalidContainers(String container) - { - Record electronicRecord = Record.builder() - .name(ELECTRONIC_RECORD_NAME) - .nodeType(CONTENT_TYPE) - .content(RecordContent.builder().mimeType("text/plain").build()) - .build(); - Record nonelectronicRecord = Record.builder() - .properties(RecordProperties.builder() - .description("Description") - .title("Title") - .build()) - .name(NONELECTRONIC_RECORD_NAME) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - //create records - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - recordFolderAPI.createRecord(electronicRecord, container); - assertStatusCode(BAD_REQUEST); - recordFolderAPI.createRecord(nonelectronicRecord, container); - assertStatusCode(BAD_REQUEST); - - if(FILE_PLAN_ALIAS.equals(container)) - { - getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(container, "") - .assertThat()//check the list returned is not empty - .entriesListIsNotEmpty().assertThat().paginationExist(); - //check response status code - assertStatusCode(OK); - } - else if(TRANSFERS_ALIAS.equals(container)) - { - getRestAPIFactory().getTransferContainerAPI().getTransfers(container, "where=(isRecord=true)") - .assertThat()//check the list returned is empty - .entriesListIsEmpty().assertThat().paginationExist(); - //check response status code - assertStatusCode(OK); - } - else - { - RecordCategoryChildCollection children = getRestAPIFactory().getRecordCategoryAPI().getRecordCategoryChildren(container); - //check response status code - assertStatusCode(OK); - children.assertThat() //check the list returned is not empty because there is a record folder created inside - .entriesListCountIs(1).assertThat().paginationExist(); - assertEquals(children.getEntries().get(0).getEntry().getNodeType(), RECORD_FOLDER_TYPE); - } - } - - /** - * Given a record - * When I try to read the meta-data - * Then I successfully receive the meta-data values for that record - */ - @Test - @AlfrescoTest (jira = "RM-4361") - public void readRecordMetadata() - { - String RELATIVE_PATH = "/" + CATEGORY_NAME + getRandomAlphanumeric() + "/folder"; - - RecordCategory recordCategoryModel = createRecordCategoryModel(CATEGORY_NAME, CATEGORY_NAME); - String recordCategoryId = getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS).getId(); - - //create the containers from the relativePath - RecordCategoryChild recordFolderModel = RecordCategoryChild.builder() - .name(RECORD_FOLDER_NAME) - .nodeType(RECORD_FOLDER_TYPE) - .relativePath(RELATIVE_PATH) - .build(); - - String recordFolderId = getRestAPIFactory().getRecordCategoryAPI().createRecordCategoryChild(recordFolderModel, recordCategoryId, "include=" + PATH).getId(); - - //create electronic record - String recordWithContentId = getRestAPIFactory().getRecordFolderAPI().createRecord(electronicRecord, recordFolderId, getFile(IMAGE_FILE)).getId(); - - //Get the record created - Record recordWithContent= getRestAPIFactory().getRecordsAPI().getRecord(recordWithContentId, "include="+IS_COMPLETED +"," + CONTENT); - - //Check the metadata returned - assertTrue(recordWithContent.getName().startsWith(ELECTRONIC_RECORD_NAME)); - assertNotNull(recordWithContent.getContent().getEncoding()); - assertEquals(recordWithContent.getNodeType(),CONTENT_TYPE); - assertNotNull(recordWithContent.getContent().getEncoding()); - assertNotNull(recordWithContent.getContent().getMimeType()); - assertNotNull(recordWithContent.getAspectNames()); - assertNotEquals(ELECTRONIC_RECORD_NAME, recordWithContent.getName()); - assertTrue(recordWithContent.getName().contains(recordWithContent.getProperties().getIdentifier())); - assertStatusCode(OK); - - //create non-electronic record - String nonElectronicRecordId = getRestAPIFactory().getRecordFolderAPI().createRecord(nonelectronicRecord, recordFolderId).getId(); - //Get the record created - Record nonElectronicRecord = getRestAPIFactory().getRecordsAPI().getRecord(nonElectronicRecordId, "include=" + IS_COMPLETED +"," + CONTENT); - - //Check the metadata returned - assertTrue(nonElectronicRecord.getName().startsWith(NONELECTRONIC_RECORD_NAME)); - assertNull(nonElectronicRecord.getContent()); - assertEquals(nonElectronicRecord.getNodeType(), NON_ELECTRONIC_RECORD_TYPE); - assertNotNull(nonElectronicRecord.getAspectNames()); - assertEquals(nonElectronicRecord.getProperties().getDescription(), NONELECTRONIC_RECORD_NAME); - assertNotEquals(NONELECTRONIC_RECORD_NAME, nonElectronicRecord.getName()); - assertTrue(nonElectronicRecord.getName().contains(nonElectronicRecord.getProperties().getIdentifier())); - assertStatusCode(OK); - } - - /** - * Given an electronic record - * When I try to read the content - * Then I successfully receive the content of the record - */ - @Test - @AlfrescoTest (jira = "RM-4361") - public void readRecordContent() throws Exception - { - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - - String RECORD_ELECTRONIC = "Record " + getRandomAlphanumeric(); - String RECORD_ELECTRONIC_BINARY = "Binary Record" + getRandomAlphanumeric(); - - String RELATIVE_PATH = "/" + CATEGORY_NAME + getRandomAlphanumeric() + "/folder"; - - // create the containers from the relativePath - RecordCategoryChild recordFolder = RecordCategoryChild.builder() - .name(RECORD_FOLDER_NAME) - .nodeType(RECORD_FOLDER_TYPE) - .relativePath(RELATIVE_PATH) - .build(); - RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); - String folderId = recordCategoryAPI.createRecordCategoryChild(recordFolder, rootCategory2.getId()).getId(); - - // text file as an electronic record - Record recordText = Record.builder() - .name(RECORD_ELECTRONIC) - .nodeType(CONTENT_TYPE) - .build(); - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - String recordId = recordFolderAPI.createRecord(recordText, folderId, createTempFile(RECORD_ELECTRONIC, RECORD_ELECTRONIC)).getId(); - assertEquals(recordsAPI.getRecordContent(recordId).asString(), RECORD_ELECTRONIC); - // Check status code - assertStatusCode(OK); - - // binary file as an electronic record - Record recordBinary = Record.builder() - .name(RECORD_ELECTRONIC_BINARY) - .nodeType(CONTENT_TYPE) - .build(); - - String binaryRecordId = recordFolderAPI.createRecord(recordBinary, folderId, getFile(IMAGE_FILE)).getId(); - // binary content, therefore compare respective SHA1 checksums in order to verify this is identical content - try - ( - InputStream recordContentStream = recordsAPI.getRecordContent(binaryRecordId).asInputStream(); - FileInputStream localFileStream = new FileInputStream(getFile(IMAGE_FILE)) - ) - { - assertEquals(DigestUtils.sha1(recordContentStream), DigestUtils.sha1(localFileStream)); - } - assertStatusCode(OK); - - // electronic record with no content - Record recordNoContent = Record.builder() - .name(RECORD_ELECTRONIC) - .nodeType(CONTENT_TYPE) - .build(); - String recordNoContentId = recordFolderAPI.createRecord(recordNoContent,folderId).getId(); - assertTrue(recordsAPI.getRecordContent(recordNoContentId).asString().isEmpty()); - assertStatusCode(OK); - } - /** - * Given a non-electronic record - * When I try to read the content - * Then I am informed that the record has no content - */ - @Test - @AlfrescoTest (jira = "RM-4361") - public void readNonElectronicRecordContent() - { - Record record = Record.builder() - .name(getRandomName("Record nonelectronic")) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - String nonElectronicRecord = recordFolderAPI.createRecord(record, recordFolder.getId()).getId(); - - getRestAPIFactory().getRecordsAPI().getRecordContent(nonElectronicRecord); - assertStatusCode(BAD_REQUEST); - } - - /** - * Given a container (eg record folder, record category, etc) - * When I try to read the content - * Then I receive an error - */ - @DataProvider(name="noContentNodes") - public Object[][] getNonRecordTypes() - { - return new String[][] { - { getFilePlan(FILE_PLAN_ALIAS).getId() }, - { getTransferContainer(TRANSFERS_ALIAS).getId() }, - { rootCategory.getId()} - }; - } - @Test - ( - dataProvider = "noContentNodes", - description = "Reading records from invalid containers" - ) - @AlfrescoTest (jira = "RM-4361") - public void readContentFromInvalidContainers(String container) - { - getRestAPIFactory().getRecordsAPI().getRecordContent(container).asString(); - assertStatusCode(BAD_REQUEST); - } - - @AfterClass(alwaysRun = true) - public void cleanupReadRecordTests() - { - deleteRecordCategory(rootCategory.getId()); - deleteRecordCategory(rootCategory2.getId()); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/RejectRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/RejectRecordTests.java deleted file mode 100644 index 1a64e89a34..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/RejectRecordTests.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static org.alfresco.rest.core.v0.BaseAPI.NODE_PREFIX; -import static org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI.PARENT_ID_PARAM; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.springframework.http.HttpStatus.CREATED; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.util.Collections; - -import org.alfresco.dataprep.CMISUtil; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordBodyFile; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.rules.ActionsOnRule; -import org.alfresco.rest.rm.community.model.rules.RuleDefinition; -import org.alfresco.rest.v0.RecordsAPI; -import org.alfresco.rest.v0.RulesAPI; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.SiteModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * API tests for rejecting records - * @author Ross Gale - * @since 3.1 - */ -public class RejectRecordTests extends BaseRMRestTest -{ - private final static String REJECT_REASON = "Just because"; - private SiteModel publicSite; - private RecordCategory recordCategory; - private RecordCategoryChild recordFolder, linkRecordFolder; - - @Autowired - private RecordsAPI recordsAPI; - @Autowired - private RulesAPI rulesAPI; - - @BeforeClass (alwaysRun = true) - public void setUp() - { - publicSite = dataSite.usingAdmin().createPublicRandomSite(); - recordCategory = createRootCategory(getRandomName("recordCategory")); - recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder")); - linkRecordFolder = createFolder(recordCategory.getId(), getRandomName("linkRecordFolder")); - } - - /** - * Test that when rejecting a linked record that the link is also removed - */ - @Test - @AlfrescoTest(jira = "RM-6869") - public void rejectLinkedRecord() - { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Declare document as record with a location parameter value"); - Record record = getRestAPIFactory().getFilesAPI() - .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) - .declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Link record to new folder"); - RecordBodyFile linkRecordBody = RecordBodyFile.builder().targetParentId(linkRecordFolder.getId()).build(); - getRestAPIFactory().getRecordsAPI().fileRecord(linkRecordBody, record.getId()); - - STEP("Verify the linked record has been added"); - assertTrue(isMatchingRecordInRecordFolder(testFile, linkRecordFolder), "Linked record not created"); - - STEP("Reject record"); - recordsAPI.rejectRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), record.getName(), REJECT_REASON); - - STEP("Check record has been rejected"); - assertFalse(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record rejection failure"); - - STEP("Verify the linked record has been removed"); - assertFalse(isMatchingRecordInRecordFolder(testFile, linkRecordFolder), "Record link not removed"); - } - - /** - * Test that rejecting a completed record is not possible - */ - @Test - @AlfrescoTest(jira = "RM-6881") - public void rejectCompletedRecord() - { - STEP("Create a document in the collaboration site"); - FileModel testFile = dataContent.usingSite(publicSite) - .usingAdmin() - .createContent(CMISUtil.DocumentType.TEXT_PLAIN); - - STEP("Create a record folder with a reject rule"); - RecordCategoryChild folderWithRule = createFolder(recordCategory.getId(), getRandomName("recordFolder")); - RuleDefinition ruleDefinition = RuleDefinition.createNewRule().title("name").description("description") - .applyToChildren(true).rejectReason(REJECT_REASON) - .actions(Collections.singletonList(ActionsOnRule.REJECT.getActionValue())); - rulesAPI.createRule(getAdminUser().getUsername(), getAdminUser().getPassword(), NODE_PREFIX + folderWithRule.getId(), ruleDefinition); - - - STEP("Declare document as record to Unfiled Records folder"); - Record record = getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion()); - assertStatusCode(CREATED); - - STEP("Complete, then file the record to the folder with rule"); - completeRecord(record.getId()); - RecordBodyFile recordBodyFile = RecordBodyFile.builder().targetParentId(folderWithRule.getId()).build(); - getRestAPIFactory().getRecordsAPI().fileRecord(recordBodyFile, record.getId()); - assertStatusCode(CREATED); - - STEP("Check record hasn't been rejected through rule"); - assertTrue(isMatchingRecordInRecordFolder(testFile, folderWithRule), "Record rejection succeeded!"); - - STEP("Reject record directly through api"); - recordsAPI.rejectRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), SC_INTERNAL_SERVER_ERROR, - record.getName(), REJECT_REASON); - } - - @AfterClass (alwaysRun = true) - public void cleanUp() - { - deleteRecordCategory(recordCategory.getId()); - dataSite.deleteSite(publicSite); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java deleted file mode 100644 index 4af4bd0c38..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.records; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.base.TestData.NONELECTRONIC_RECORD_NAME; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_SECURITY_OFFICER; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicUnfiledContainerChildModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicUnfiledContainerChildModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordModel; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.OK; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.model.UserModel; -import org.alfresco.utility.report.Bug; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Update records tests - *
- * These tests only test the update of electronic and non-electronic tests - *

- * @author Kristijan Conkas - * @since 2.6 - */ -public class UpdateRecordsTests extends BaseRMRestTest -{ - @Autowired - private RoleService roleService; - - private RecordCategory rootCategory; - private UnfiledContainerChild unfiledRecordFolder; - private final List unfiledRecords = new ArrayList<>(); - private UserModel updateUser; - - @BeforeClass (alwaysRun = true) - public void preconditionUpdateRecordsTests() - { - rootCategory = createRootCategory(getRandomName("CATEGORY NAME")); - unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - getRandomName("UnfiledRecordFolder"), UNFILED_RECORD_FOLDER_TYPE); - // RM Security Officer is the lowest role with Edit Record Metadata capabilities - // Grant updateUser Filing privileges on root category, this will be inherited to record folders - updateUser = roleService.createUserWithRMRoleAndCategoryPermission(ROLE_RM_SECURITY_OFFICER.roleId, - rootCategory, UserPermissions.PERMISSION_FILING); - } - - /** Incomplete electronic and non electronic records created in one record folder, unfiled records container and one unfiled record folder */ - @DataProvider(name = "incompleteRecords") - public Object[][] getIncompleteRecords() - { - //create electronic and nonElectronic record in record folder - String recordFolderId = createRecordFolder(rootCategory.getId(), getRandomName("recFolder1")).getId(); - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - - Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - - Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolderId); - assertStatusCode(CREATED); - - //create electronic record and nonElectronic record in unfiled records container - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - UnfiledContainerChild electronicRecord1 = unfiledContainersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS, getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - unfiledRecords.add(electronicRecord1); - - UnfiledContainerChild nonElectronicRecord1 = unfiledContainersAPI.createUnfiledContainerChild(createNonElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS); - assertStatusCode(CREATED); - unfiledRecords.add(nonElectronicRecord1); - - //create electronic record and nonElectronic record in unfiled record folder - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - UnfiledContainerChild electronicRecord2 = unfiledRecordFoldersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId(), getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - - UnfiledContainerChild nonElectronicRecord2 = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(createNonElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId()); - assertStatusCode(CREATED); - - return new String[][] - { - // an arbitrary record folder - { electronicRecord.getId() }, - { nonElectronicRecord.getId() }, - // unfiled records root - { electronicRecord1.getId() }, - { nonElectronicRecord1.getId() }, - // an arbitrary unfiled records folder - { electronicRecord2.getId() }, - { nonElectronicRecord2.getId() } - }; - } - - /** Complete electronic and non electronic records created in one record folder, unfiled records container and one unfiled record folder */ - @DataProvider(name = "completeRecords") - public Object[][] getCompleteRecords() - { - //create electronic and nonElectronic record in record folder - String recordFolderId = createRecordFolder(rootCategory.getId(), getRandomName("recFolder2")).getId(); - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - - Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - completeRecord(electronicRecord.getId()); - - Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolderId); - assertStatusCode(CREATED); - completeRecord(nonElectronicRecord.getId()); - - //create electronic record and nonElectronic record in unfiled records container - UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI(); - UnfiledContainerChild electronicRecord1 = unfiledContainersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS, getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - completeRecord(electronicRecord1.getId()); - unfiledRecords.add(electronicRecord1); - - UnfiledContainerChild nonElectronicRecord1 = unfiledContainersAPI.createUnfiledContainerChild(createNonElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS); - assertStatusCode(CREATED); - completeRecord(nonElectronicRecord1.getId()); - unfiledRecords.add(nonElectronicRecord1); - - //create electronic record and nonElectronic record in unfiled record folder - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - UnfiledContainerChild electronicRecord2 = unfiledRecordFoldersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId(), getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - completeRecord(electronicRecord2.getId()); - - UnfiledContainerChild nonElectronicRecord2 = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(createNonElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId()); - assertStatusCode(CREATED); - completeRecord(nonElectronicRecord2.getId()); - - return new String[][] - { - // an arbitrary record folder - { electronicRecord.getId(), nonElectronicRecord.getId()}, - // unfiled records root - { electronicRecord1.getId(), nonElectronicRecord1.getId()}, - // an arbitrary unfiled records folder - { electronicRecord2.getId(), nonElectronicRecord2.getId()} - }; - } - - /** - *

-     * Given an incomplete record
-     * When I try to update the records meta-data
-     * Then the record is successfully updated
-     * 
- */ - @Test - ( - dataProvider = "incompleteRecords", - description = "Incomplete records can be updated" - ) - @AlfrescoTest(jira="RM-4362") - public void incompleteRecordsCanBeUpdated(String recordId) - { - // Get the recordsAPI - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - Record record = recordsAPI.getRecord(recordId); - - // Generate update metadata - String newName = getModifiedPropertyValue(record.getName()); - String newTitle = getModifiedPropertyValue(record.getProperties().getTitle()); - String newDescription = getModifiedPropertyValue(record.getProperties().getDescription()); - - // Update record - recordsAPI.updateRecord(createRecordModel(newName, newDescription, newTitle), record.getId()); - assertStatusCode(OK); - - // Verify the original record meta data has been retained - Record updatedRecord = recordsAPI.getRecord(record.getId()); - assertEquals(updatedRecord.getName(), newName); - assertEquals(updatedRecord.getProperties().getTitle(), newTitle); - assertEquals(updatedRecord.getProperties().getDescription(), newDescription); - } - - /** - *
-     * Given an incomplete record
-     * And that I am a non-admin user with metadata update capabilities
-     * When I try to update the records meta-data
-     * Then the record is successfully updated
-     * 
- */ - @Test (description = "User with Edit Metadata capabilities can update incomplete record's metadata") - @AlfrescoTest(jira="RM-4362") - public void userWithEditMetadataCapsCanUpdateMetadata() - { - // Create random folder - RecordCategoryChild recFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")); - - // Create electronic and non-electronic records in a folder - RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI(); - Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recFolder.getId(), getFile(IMAGE_FILE)); - assertStatusCode(CREATED); - Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recFolder.getId()); - assertStatusCode(CREATED); - - // Get recordsAPI instance initialised to updateUser - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(updateUser); - - for (Record record: asList(electronicRecord, nonElectronicRecord)) - { - recordsAPI.getRecord(record.getId()); - assertStatusCode(OK); - - // Generate update metadata - String newName = getModifiedPropertyValue(record.getName()); - String newTitle = getModifiedPropertyValue(record.getProperties().getTitle()); - String newDescription = getModifiedPropertyValue(record.getProperties().getDescription()); - - // Update record - recordsAPI.updateRecord(createRecordModel(newName, newDescription, newTitle), record.getId()); - assertStatusCode(OK); - - // Verify the update got applied - Record updatedRecord = recordsAPI.getRecord(record.getId()); - assertEquals(updatedRecord.getName(), newName); - assertEquals(updatedRecord.getProperties().getTitle(), newTitle); - assertEquals(updatedRecord.getProperties().getDescription(), newDescription); - assertEquals(updatedRecord.getModifiedByUser().getId(), updateUser.getUsername()); - } - } - - /** - *
-     * Given a complete record
-     * When I try to update the records meta-data
-     * Then it fails
-     * And the records meta-data is unchanged
-     * 
- */ - @Test - ( - dataProvider = "completeRecords", - description = "Complete records can't be updated" - ) - @AlfrescoTest(jira="RM-4362") - @Bug (id = "APPS-132") - public void completeRecordsCantBeUpdated(String electronicRecordId, String nonElectronicRecordId) - { - // Get the recordsAPI - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - Record electronicRecord = recordsAPI.getRecord(electronicRecordId); - Record nonElectronicRecord = recordsAPI.getRecord(nonElectronicRecordId); - - for (Record record: asList(electronicRecord, nonElectronicRecord)) - { - // Generate update metadata - String newName = getModifiedPropertyValue(record.getName()); - String newTitle = getModifiedPropertyValue(record.getProperties().getTitle()); - String newDescription = getModifiedPropertyValue(record.getProperties().getDescription()); - Record recordModel = createRecordModel(newName, newDescription, newTitle); - - // Update record - recordsAPI.updateRecord(recordModel, record.getId()); - assertStatusCode(FORBIDDEN); - - // Verify the original record meta data has been retained - Record updatedRecord = recordsAPI.getRecord(record.getId()); - assertEquals(updatedRecord.getName(), record.getName()); - assertEquals(updatedRecord.getProperties().getTitle(), record.getProperties().getTitle()); - assertEquals(updatedRecord.getProperties().getDescription(), record.getProperties().getDescription()); - } - } - - /** - * Helper method to generate modified property value based on original value - * @param originalValue original value - * @return modified value - */ - private String getModifiedPropertyValue(String originalValue) - { - /* to be used to append to modifications */ - String MODIFIED_PREFIX = "modified_"; - return MODIFIED_PREFIX + originalValue; - } - /** - *
-     * Given a created record
-     * When I try to update the record aspects with an empty list
-     * Then it fails
-     * 
- */ - @Test(description = "Cannot remove mandatory aspects from record") - @AlfrescoTest(jira = "RM-4926") - public void electronicRecordMandatoryAspectsCannotBeRemoved() - { - final List expectedAspects = asList("rma:record", "rma:filePlanComponent", - "rma:recordComponentIdentifier", "rma:commonRecordDetails"); - final List emptyAspectList = new ArrayList<>(); - Record recordModelToUpdate = Record.builder().aspectNames(emptyAspectList).build(); - // Get the recordsAPI - RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - - // Create random folder - String recordFolderId = createRecordFolder(rootCategory.getId(), getRandomName("recordFolder")).getId(); - - // Create an electronic record and check it has all the records aspects - Record electronicRecord = getRestAPIFactory().getRecordFolderAPI() - .createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE)); - assertTrue( electronicRecord.getAspectNames().containsAll(expectedAspects)); - - // Update record - recordsAPI.updateRecord(recordModelToUpdate, electronicRecord.getId()); - assertStatusCode(UNPROCESSABLE_ENTITY); - - // Create an electronic record in the unfiled record folder and check it has all the records aspects - UnfiledContainerChild unfiledRecordModel = UnfiledContainerChild.builder() - .properties(UnfiledContainerChildProperties.builder().description(NONELECTRONIC_RECORD_NAME).title("Title").build()) - .name(NONELECTRONIC_RECORD_NAME).nodeType(NON_ELECTRONIC_RECORD_TYPE).build(); - UnfiledContainerChild unfiledRecord = getRestAPIFactory().getUnfiledRecordFoldersAPI() - .createUnfiledRecordFolderChild(unfiledRecordModel, unfiledRecordFolder.getId()); - assertTrue(unfiledRecord.getAspectNames().containsAll(expectedAspects)); - - // Update record - recordsAPI.updateRecord(recordModelToUpdate, unfiledRecord.getId()); - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - @AfterClass (alwaysRun = true) - public void tearDown() - { - deleteRecordCategory(rootCategory.getId()); - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledRecordFolder.getId()); - unfiledRecords.forEach(unfiledRecord -> getRestAPIFactory().getRecordsAPI().deleteRecord(unfiledRecord.getId())); - getDataUser().deleteUser(updateUser); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/rmroles/RMRolesTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/rmroles/RMRolesTests.java deleted file mode 100644 index b2dec1cd1f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/rmroles/RMRolesTests.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.rmroles; - -import static java.util.Collections.singleton; - -import static com.google.common.collect.Sets.newHashSet; - -import static org.alfresco.rest.rm.community.base.TestData.RM_ROLES; -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.Set; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.user.UserCapabilities; -import org.alfresco.rest.v0.RMRolesAndActionsAPI; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.Test; - -/** - * API tests of RM roles. - * - * @author Tom Page - * @since 2.7 - */ -public class RMRolesTests extends BaseRMRestTest -{ - /** A list of capabilities. */ - private static final java.util.HashSet CAPABILITIES = newHashSet(UserCapabilities.VIEW_RECORDS_CAP, UserCapabilities.DECLARE_RECORDS_CAP); - /** The API for managing RM roles and capabilities. */ - @Autowired - private RMRolesAndActionsAPI rmRolesAndActionsAPI; - - /** Check that the roles API returns the default RM roles. */ - @Test(description = "Check the default RM roles exist.") - public void checkRMRolesExist() - { - Set configuredRoles = rmRolesAndActionsAPI - .getConfiguredRoles(getAdminUser().getUsername(), getAdminUser().getPassword()); - RM_ROLES.forEach(role -> assertTrue("Could not found role " + role, configuredRoles.contains(role))); - } - - /** Check that the RM user has the capability to view and declare records. */ - @Test(description = "Check the capabilities for the RM user.") - public void checkCapabilitiesForUser() - { - Set capabilities = rmRolesAndActionsAPI - .getCapabilitiesForRole(getAdminUser().getUsername(), getAdminUser().getPassword(), ROLE_RM_USER - .roleId); - assertEquals("Unexpected capabilities found for RM User.", capabilities, CAPABILITIES); - } - - /** Check that a new role can be created and retrieved. */ - @Test(description = "Create a new role.") - public void createNewRole() - { - String roleName = generateTestPrefix(RMRolesTests.class) + "newName"; - - // Call the endpoint under test. - rmRolesAndActionsAPI.createRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName, - "New Role Label", CAPABILITIES); - - Set actualCapabilities = rmRolesAndActionsAPI - .getCapabilitiesForRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName); - assertEquals("Unexpected capabilities found for RM User.", actualCapabilities, CAPABILITIES); - } - - /** Check that a role can be edited. */ - @Test(description = "Update a role.") - public void updateRole() - { - String roleName = generateTestPrefix(RMRolesTests.class) + "Name"; - rmRolesAndActionsAPI.createRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName, "Label", - singleton(UserCapabilities.VIEW_RECORDS_CAP)); - - // Call the endpoint under test. - rmRolesAndActionsAPI.updateRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName, - "Updated Label", singleton(UserCapabilities.DECLARE_RECORDS_CAP)); - - Set actualCapabilities = rmRolesAndActionsAPI - .getCapabilitiesForRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName); - assertEquals("Unexpected capabilities for edited RM User.", actualCapabilities, singleton(UserCapabilities.DECLARE_RECORDS_CAP)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/CmisQueryTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/CmisQueryTests.java deleted file mode 100644 index cd834c69fe..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/CmisQueryTests.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.search; - -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertTrue; - - -import org.alfresco.dataprep.ContentActions; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.test.AlfrescoTest; -import org.alfresco.utility.Utility; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FileType; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.apache.chemistry.opencmis.client.api.ItemIterable; -import org.apache.chemistry.opencmis.client.api.OperationContext; -import org.apache.chemistry.opencmis.client.api.QueryResult; -import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * Test to check that RM doesn't break CMIS query - * - * @author jcule, Rodica Sutu - * @since 2.5.4 - * @since 3.3 - */ -public class CmisQueryTests extends BaseRMRestTest -{ - private static final String SEARCH_TERM = generateTestPrefix(CmisQueryTests.class); - private static final String sqlWithName = - "SELECT cmis:name FROM cmis:document where CONTAINS('cmis:name:*" + SEARCH_TERM + "*')"; - - private SiteModel collaborationSite; - private UserModel nonRMUser, rmUser; - private RecordCategoryChild recordFolder; - - @Autowired - private ContentActions contentActions; - @Autowired - private RoleService roleService; - - /** - * Create some test data: - *
-     *     - a collaboration site with documents
-     *     - in place records
-     *     - category with folder and records
-     *     - a user with no rm rights (no rights to see the record from file plan)
-     *     - a user with rights to see the records and the other documents created
-     * 
- */ - @BeforeClass (alwaysRun = true) - public void setupCmisQuery() throws Exception - { - STEP("Create a collaboration site"); - collaborationSite = dataSite.usingAdmin().createPrivateRandomSite(); - - STEP("Create 10 documents ending with SEARCH_TERM"); - for (int i = 0; ++i <= 10; ) - { - FileModel fileModel = new FileModel(String.format("%s%s%s.%s", "Doc", i, SEARCH_TERM, - FileType.TEXT_PLAIN.extension)); - dataContent.usingAdmin().usingSite(collaborationSite).createContent(fileModel); - } - - STEP("Create a collaborator user for the collaboration site"); - nonRMUser = getDataUser().createRandomTestUser(); - getDataUser().addUserToSite(nonRMUser, collaborationSite, UserRole.SiteCollaborator); - - STEP("Create 10 documents and declare as records"); - for (int i = 0; ++i <= 10; ) - { - FileModel fileModel = new FileModel(String.format("%s%s%s.%s", "InPlace ", SEARCH_TERM, i, - FileType.TEXT_PLAIN.extension)); - fileModel = dataContent.usingUser(nonRMUser).usingSite(collaborationSite).createContent(fileModel); - getRestAPIFactory().getFilesAPI(nonRMUser).declareAsRecord(fileModel.getNodeRefWithoutVersion()); - } - - STEP("Create record folder and some records "); - recordFolder = createCategoryFolderInFilePlan(); - for (int i = 0; ++i <= 10; ) - { - createElectronicRecord(recordFolder.getId(), String.format("%s%s%s.%s", "Record ", SEARCH_TERM, i, - FileType.TEXT_PLAIN.extension)); - } - STEP("Create an rm user with read permission over the category created and contributor role within the " + - "collaboration site"); - rmUser = roleService.createUserWithSiteRoleRMRoleAndPermission(collaborationSite, UserRole.SiteContributor, - recordFolder.getParentId(), ROLE_RM_MANAGER, UserPermissions.PERMISSION_READ_RECORDS); - - //do a cmis query to wait for solr indexing - Utility.sleep(5000, 80000, () -> - { - ItemIterable results = - contentActions.getCMISSession(getAdminUser().getUsername(), getAdminUser().getPassword()).query(sqlWithName, - false); - assertEquals("Total number of items is not 30, got " + results.getTotalNumItems() + " total items", - 30, results.getTotalNumItems()); - }); - } - - /** - *
-     * Given the RM site created
-     * When I execute a cmis query to get all the documents names
-     * Then I get all documents names 100 per page
-     * 
- */ - @Test - @AlfrescoTest (jira = "MNT-19442") - public void getAllDocumentsNamesCmisQuery() - { - // execute the cmis query - String cq = "SELECT cmis:name FROM cmis:document"; - ItemIterable results = - contentActions.getCMISSession(getAdminUser().getUsername(), getAdminUser().getPassword()).query(cq, - false); - - // check the total number of items is greater than 100 and has more items is true - assertTrue("Has more items not true.", results.getHasMoreItems()); - assertTrue("Total number of items is not greater than 100. Total number of items received" + results.getTotalNumItems(), - results.getTotalNumItems() > 100); - assertEquals("Expected 100 items per page and got " + results.getPageNumItems() + " per page.", 100, - results.getPageNumItems()); - } - - /** - *
-     * Given the RM site created
-     * When I execute a cmis query to get all the documents names with a particular name
-     * Then I get all documents names user has permission
-     * 
- */ - @Test - @AlfrescoTest (jira = "MNT-19442") - public void getDocumentsWithSpecificNamesCmisQuery() - { - // execute the cmis query - ItemIterable results = - contentActions.getCMISSession(nonRMUser.getUsername(), nonRMUser.getPassword()).query(sqlWithName, - false); - assertEquals("Total number of items is not 20, got " + results.getTotalNumItems() + " total items", - 20, results.getTotalNumItems()); - // check the has more items is false - assertFalse("Has more items not false.", results.getHasMoreItems()); - assertEquals("Expected 20 items per page and got " + results.getPageNumItems() + " per page.", 20, - results.getPageNumItems()); - } - - /** - *
-     * Given the RM site created
-     * When I execute a cmis query to get all the documents names with a specific number per page
-     * Then I get all documents names paged as requested that the user has permission
-     * 
- */ - @Test - @AlfrescoTest (jira = "MNT-19442") - public void getDocumentsCmisQueryWithPagination() - { - OperationContext oc = new OperationContextImpl(); - oc.setMaxItemsPerPage(10); - ItemIterable results = - contentActions.getCMISSession(rmUser.getUsername(), rmUser.getPassword()).query(sqlWithName, - false, oc); - - // check the total number of items and has more items is true - assertTrue("Has more items not true. ", results.getHasMoreItems()); - assertEquals("Total number of items is not 30, got " + results.getTotalNumItems(), 30, - results.getTotalNumItems()); - assertEquals("Expected 10 items per page and got " + results.getPageNumItems() + " per page.", - 10, results.getPageNumItems()); - } - - @AfterClass - private void clearCmisQueryTests() - { - dataSite.usingAdmin().deleteSite(collaborationSite); - deleteRecordCategory(recordFolder.getParentId()); - getDataUser().usingAdmin().deleteUser(rmUser); - getDataUser().usingAdmin().deleteUser(nonRMUser); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java deleted file mode 100644 index 3ea8b5b62f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.search; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import org.alfresco.rest.core.search.SearchRequestBuilder; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.search.RestRequestQueryModel; -import org.alfresco.rest.search.SearchResponse; -import org.alfresco.rest.v0.UserTrashcanAPI; -import org.alfresco.utility.Utility; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FileType; -import org.alfresco.utility.model.SiteModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * This class contains the tests for v1 Search API with documents with CMIS and AFTS queries - */ -public class SearchDocumentsV1Test extends BaseRMRestTest -{ - private static final String SEARCH_TERM = generateTestPrefix(SearchDocumentsV1Test.class); - private SiteModel collaborationSite; - private FileModel fileModel; - - @Autowired - private UserTrashcanAPI userTrashcanAPI; - - /** - * Data Provider with: queries using CMIS and AFTS languages - */ - @DataProvider - public static Object[][] queryTypes() - { - RestRequestQueryModel cmisQueryModel = new RestRequestQueryModel(); - cmisQueryModel.setQuery("select * from cmis:document WHERE cmis:name LIKE '%" + SEARCH_TERM + ".txt'"); - cmisQueryModel.setLanguage("cmis"); - - RestRequestQueryModel aftsQueryModel = new RestRequestQueryModel(); - aftsQueryModel.setQuery("cm:name:*" + SEARCH_TERM); - aftsQueryModel.setLanguage("afts"); - - return new RestRequestQueryModel[][] { - { cmisQueryModel }, - { aftsQueryModel } - }; - } - - /** - * Create a collaboration site and some documents. - */ - @BeforeClass (alwaysRun = true) - public void setupSearchDocumentsV1Test() throws Exception - { - STEP("Create a collaboration site"); - collaborationSite = dataSite.usingAdmin().createPrivateRandomSite(); - - STEP("Create 10 documents ending with SEARCH_TERM"); - for (int i = 0; ++i <= 10; ) - { - fileModel = new FileModel(String.format("%s.%s", "Doc" + i + SEARCH_TERM, FileType.TEXT_PLAIN.extension)); - dataContent.usingAdmin().usingSite(collaborationSite).createContent(fileModel); - } - waitIndexing(); - } - - /** - * Do the query to wait for solr indexing - * - * @throws Exception when maximum retry period is reached - */ - private void waitIndexing() throws Exception - { - RestRequestQueryModel queryType = new RestRequestQueryModel(); - queryType.setQuery("cm:name:*" + SEARCH_TERM); - queryType.setLanguage("afts"); - Utility.sleep(1000, 80000, () -> - { - SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType) - .setPagingBuilder(new SearchRequestBuilder().setPagination(100, 0)) - .setFieldsBuilder(asList("id", "name")); - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(null).search(sqlRequest); - assertEquals(searchResponse.getPagination().getTotalItems().intValue(), 10, - "Total number of items is not retrieved yet"); - }); - } - - /** - * Given some documents ending with a particular text - * When executing the search query with paging - * And setting the skipCount and maxItems to reach the number of total items - * Then hasMoreItems will be set to false - */ - @Test(dataProvider = "queryTypes") - public void searchWhenMaxItemsReach(RestRequestQueryModel queryType) - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType) - .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 5)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI().search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 5, "Expected maxItems to be five"); - assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five"); - assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false"); - assertEquals(searchResponse.getEntries().size(), 5, "Expected total entries to be five"); - } - - /** - * Given some documents ending with a particular text - * When executing the search query with paging - * And setting skipCount and maxItems to exceed the number of total items - * Then hasMoreItems will be set to false - */ - @Test(dataProvider = "queryTypes") - public void searchWhenTotalItemsExceed(RestRequestQueryModel queryType) - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType) - .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 6)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI().search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four"); - assertEquals(searchResponse.getPagination().getSkipCount(), 6, "Expected skip count to be six"); - assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false"); - assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four"); - } - - /** - * Given some documents ending with a particular text - * When executing the search query with paging - * And setting skipCount and maxItems under the number of total items - * Then hasMoreItems will be set to true - */ - @Test(dataProvider = "queryTypes") - public void searchResultsUnderTotalItems(RestRequestQueryModel queryType) - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType) - .setPagingBuilder(new SearchRequestBuilder().setPagination(4, 5)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI().search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four"); - assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five"); - assertTrue(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be true"); - assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four"); - } - - @AfterClass (alwaysRun = true) - public void tearDown() - { - dataSite.usingAdmin().deleteSite(collaborationSite); - userTrashcanAPI.emptyTrashcan(getAdminUser().getUsername(), getAdminUser().getPassword()); - } - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java deleted file mode 100644 index 9720b2b847..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.search; - -import static java.util.Arrays.asList; - -import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER; -import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix; -import static org.alfresco.utility.report.log.Step.STEP; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import org.alfresco.rest.core.search.SearchRequestBuilder; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.user.UserPermissions; -import org.alfresco.rest.search.RestRequestQueryModel; -import org.alfresco.rest.search.SearchResponse; -import org.alfresco.rest.v0.UserTrashcanAPI; -import org.alfresco.rest.v0.service.RoleService; -import org.alfresco.utility.Utility; -import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.FileType; -import org.alfresco.utility.model.SiteModel; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * This class contains the tests for v1 Search API with records with CMIS query - */ -public class SearchRecordsV1CmisTests extends BaseRMRestTest -{ - private static final String SEARCH_TERM = generateTestPrefix(SearchRecordsV1CmisTests.class); - private SiteModel collaborationSite; - private UserModel nonRMUser, rmUser; - private FileModel fileModel; - private RestRequestQueryModel queryModel; - - @Autowired - private UserTrashcanAPI userTrashcanAPI; - - @Autowired - private RoleService roleService; - - /** - * Create a collaboration site and some in place records. - */ - @BeforeClass (alwaysRun = true) - public void setupSearchRecordsV1Cmis() throws Exception - { - STEP("Create a collaboration site"); - collaborationSite = dataSite.usingAdmin().createPrivateRandomSite(); - - STEP("Create a site manager user for the collaboration site"); - nonRMUser = getDataUser().createRandomTestUser(); - getDataUser().addUserToSite(nonRMUser, collaborationSite, UserRole.SiteManager); - - STEP("Create an rm user"); - rmUser = getDataUser().createRandomTestUser(); - - STEP("Create 10 documents and declare as records"); - for (int i = 0; ++i <= 10; ) - { - fileModel = new FileModel(String.format("%s.%s", "Record" + SEARCH_TERM + i, FileType.TEXT_PLAIN.extension)); - fileModel = dataContent.usingUser(nonRMUser).usingSite(collaborationSite).createContent(fileModel); - getRestAPIFactory().getFilesAPI(nonRMUser).declareAsRecord(fileModel.getNodeRefWithoutVersion()); - } - STEP("Create record folder and some records "); - RecordCategoryChild recordFolder = createCategoryFolderInFilePlan(); - roleService.assignUserPermissionsOnCategoryAndRMRole(rmUser, recordFolder.getId(), - UserPermissions.PERMISSION_READ_RECORDS, ROLE_RM_MANAGER.roleId); - for (int i = 0; ++i <= 10; ) - { - createElectronicRecord(recordFolder.getId(), "Record" + SEARCH_TERM + i); - } - - queryModel = new RestRequestQueryModel(); - queryModel.setQuery("select * from cmis:document WHERE cmis:name LIKE 'Record" + SEARCH_TERM + "%'"); - queryModel.setLanguage("cmis"); - - //wait for solr indexing - Utility.sleep(1000, 80000, () -> - { - SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(100, 0)) - .setFieldsBuilder(asList("id", "name")); - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(null).search(sqlRequest); - assertEquals(searchResponse.getPagination().getTotalItems().intValue(), 20, - "Total number of items is not retrieved yet"); - }); - } - - /** - * Given some documents with names starting with a particular test - * When executing the search query with paging - * And setting the skipCount and maxItems to reach the number of total items - * Then hasMoreItems will be set to false - */ - @Test - public void searchWhenTotalItemsReach() - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 15)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(rmUser).search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 5, "Expected maxItems to be five"); - assertEquals(searchResponse.getPagination().getSkipCount(), 15, "Expected skip count to be fifteen"); - assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false"); - assertEquals(searchResponse.getEntries().size(), 5, "Expected total entries to be five"); - } - - // TODO enable the test when APPS-46 is fixed - @Test (enabled = false) - public void searchWhenTotalItemsReachWithNonRM() - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 0)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(nonRMUser).search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 5, "Expected maxItems to be five"); - assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five"); - assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false"); - assertEquals(searchResponse.getEntries().size(), 5, "Expected total entries to be five"); - } - - /** - * Given some documents with names starting with a particular text - * When executing the search query with paging - * And setting skipCount and maxItems to exceed the number of total items - * Then hasMoreItems will be set to false - */ - @Test - public void searchWhenTotalItemsExceedRMUser() - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 16)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(rmUser).search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four"); - assertEquals(searchResponse.getPagination().getSkipCount(), 16, "Expected skip count to be sixteen"); - assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false"); - assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four"); - } - - // TODO enable the test when APPS-46 is fixed - @Test (enabled = false) - public void searchWhenTotalItemsExceedNonRMUser() - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 6)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(nonRMUser).search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four"); - assertEquals(searchResponse.getPagination().getSkipCount(), 6, "Expected skip count to be six"); - assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false"); - assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four"); - } - - /** - * Given some documents ending with a particular text - * When executing the search query with paging - * And setting skipCount and maxItems under the number of total items - * Then hasMoreItems will be set to true - */ - // TODO enable the test when APPS-46 is fixed - @Test (enabled = false) - public void searchResultsUnderTotalItemsRMUser() - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(4, 15)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(rmUser).search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four"); - assertEquals(searchResponse.getPagination().getSkipCount(), 15, "Expected skip count to be fifteen"); - assertTrue(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be true"); - assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four"); - } - - // TODO enable the test when APPS-46 is fixed - @Test (enabled = false) - public void searchResultsUnderTotalItemsNonRMUser() - { - final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) - .setPagingBuilder(new SearchRequestBuilder().setPagination(4, 5)) - .setFieldsBuilder(asList("id", "name")); - - SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(nonRMUser).search(sqlRequest); - assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four"); - assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five"); - assertTrue(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be true"); - assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four"); - } - - @AfterClass (alwaysRun = true) - public void tearDown() - { - dataSite.usingAdmin().deleteSite(collaborationSite); - userTrashcanAPI.emptyTrashcan(getAdminUser().getUsername(), getAdminUser().getPassword()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/ShareLiveSearchTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/ShareLiveSearchTests.java deleted file mode 100644 index 11ac02e5d0..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/ShareLiveSearchTests.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rest.rm.community.search; - -import static org.testng.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.v0.SearchAPI; -import org.alfresco.test.AlfrescoTest; -import org.springframework.beans.factory.annotation.Autowired; -import org.testng.annotations.Test; - -public class ShareLiveSearchTests extends BaseRMRestTest -{ - @Autowired - SearchAPI searchApi; - - /** - * Given the RM site has been created When I search for "vital" Then the "Vital Records Due for Review" search - * object should not appear as a link in the quick search results drop down - */ - @Test - @AlfrescoTest(jira = "RM-5882") - public void liveSearchForVitalWord() - { - List results = searchApi.liveSearchForDocumentsAsUser(getAdminUser().getUsername(), getAdminUser().getPassword(), "vital"); - assertTrue(results.isEmpty() || results.stream().noneMatch("Vital Records due for Review"::equalsIgnoreCase), - "Share Live Search should return 0 results when searching for RM Saved Search filter words, but it returned:" - + Arrays.toString(results.toArray())); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java deleted file mode 100644 index 31df16ce36..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.site; - -import static org.alfresco.rest.rm.community.base.TestData.ANOTHER_ADMIN; -import static org.alfresco.rest.rm.community.base.TestData.DEFAULT_PASSWORD; -import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015; -import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_DESCRIPTION; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_ID; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_TITLE; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createRMSiteModel; -import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel; -import static org.alfresco.utility.constants.UserRole.SiteManager; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CONFLICT; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.FORBIDDEN; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; - -import org.alfresco.dataprep.SiteService.Visibility; -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.base.TestData; -import org.alfresco.rest.rm.community.model.site.RMSite; -import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI; -import org.alfresco.utility.data.RandomData; -import org.alfresco.utility.model.UserModel; -import org.alfresco.utility.report.Bug; -import org.testng.annotations.Test; - -/** - * This class contains the tests for - * the RM site CRUD API - * - * @author Rodica Sutu - * @since 2.6 - */ -public class RMSiteTests extends BaseRMRestTest -{ - /** - * Given that RM module is installed - * When I want to create the RM site with specific title, description and compliance - * Then the RM site is created - */ - @Test (description = "Create RM site with Standard Compliance as admin user", priority = 2) - // Run after createRMSiteAsAnotherAdminUser. In this way the Dod site is deleted and standard site is created for the rest of the tests - public void createRMSiteAsAdminUser() - { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); - - // Check if the RM site exists - if (rmSiteAPI.existsRMSite()) - { - // Delete the RM site - rmSiteAPI.deleteRMSite(); - } - - // Create the RM site - RMSite rmSiteResponse = rmSiteAPI.createRMSite(createStandardRMSiteModel()); - - // Verify the status code - assertStatusCode(CREATED); - - // Verify the returned file plan component - assertEquals(rmSiteResponse.getId(), RM_ID); - assertEquals(rmSiteResponse.getTitle(), RM_TITLE); - assertEquals(rmSiteResponse.getDescription(), RM_DESCRIPTION); - assertEquals(rmSiteResponse.getCompliance(), STANDARD); - assertEquals(rmSiteResponse.getVisibility(), Visibility.PUBLIC); - assertEquals(rmSiteResponse.getRole(), SiteManager.toString()); - } - - /** - * Given that RM site exists - * When I want to create the RM site - * Then the response code 409 (Site with the given identifier already exists) is return - */ - @Test (description = "Create RM site when site already exist with admin user", priority = 3) - // Run test after the other tests with priority 0, 1 or 2 - public void createRMSiteWhenSiteExists() - { - // Create the RM site if it does not exist - createRMSiteIfNotExists(); - - // Construct new properties - String newTitle = RM_TITLE + "createRMSiteWhenSiteExists"; - String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists"; - - // Create the RM site - RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription); - getRestAPIFactory().getRMSiteAPI().createRMSite(rmSiteModel); - - // Verify the status code - assertStatusCode(CONFLICT); - } - - /** - * Given that RM site exists - * When I want to delete the RM site - * Then RM site is successfully deleted - */ - @Test (description = "Delete RM site as admin user") - public void deleteRMSite() - { - // Create the RM site if it does not exist - createRMSiteIfNotExists(); - - // Delete the RM site - getRestAPIFactory().getRMSiteAPI().deleteRMSite(); - - // Verify the status code - assertStatusCode(NO_CONTENT); - } - - /** - * Given that RM site exists - * When I GET the retrieve the RM site details - * Then RM site details are returned - */ - @Test (description = "GET the RM site as admin user", priority = 3) - // Run test after the tests with priority 0, 1 or 2 - public void getRMSite() - { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); - - // Check if RM site exists - if (!rmSiteAPI.existsRMSite()) - { - // Verify the status code when RM site doesn't exist - assertStatusCode(NOT_FOUND); - createRMSiteIfNotExists(); - } - else - { - // Get the RM site - RMSite rmSiteModel = rmSiteAPI.getSite(); - - // Verify the status code - assertStatusCode(OK); - assertEquals(rmSiteModel.getId(), RM_ID); - assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION); - assertEquals(rmSiteModel.getCompliance(), STANDARD); - assertEquals(rmSiteModel.getVisibility(), Visibility.PUBLIC); - } - } - - /** - * Given that an user is created and RM site doesn't exist - * When the user wants to create a RM site with DOD compliance - * Then RM site is created - */ - // Run test after deleteRMSite. In this way rmSiteAPI.deleteRMSite isn't called because site is already deleted - @Test (description = "Create RM site with DOD compliance as an another admin user", priority = 1) - @Bug (id="RM-4289") - public void createRMSiteAsAnotherAdminUser() - { - RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI(); - - // Check if the RM site exists - if (rmSiteAPI.existsRMSite()) - { - // Delete the RM site - rmSiteAPI.deleteRMSite(); - } - - // Create user - getRestAPIFactory().getRMUserAPI().createUser(ANOTHER_ADMIN, TestData.DEFAULT_PASSWORD, TestData.DEFAULT_EMAIL); - - // Create the RM site - RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel()); - - // Verify the status code - assertStatusCode(CREATED); - - // Verify the returned file plan component - assertEquals(rmSiteModel.getId(), RM_ID); - assertEquals(rmSiteModel.getTitle(), RM_TITLE); - assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION); - assertEquals(rmSiteModel.getCompliance(), DOD5015); - assertEquals(rmSiteModel.getVisibility(), Visibility.PUBLIC); - assertEquals(rmSiteModel.getRole(), SiteManager.toString()); - } - - /** - * Given that RM site exist - * When a non-RM user wants to update the RM site details (title or description) - * Then 403 response status code is return - * When the admin user wants to update the RM site details (title or description) - * Then RM site details are updated - */ - @Test(priority = 3) // Run test after the other tests with priority 0, 1 or 2 - public void updateRMSiteDetails() - { - String NEW_TITLE = RM_TITLE + RandomData.getRandomAlphanumeric(); - String NEW_DESCRIPTION = RM_DESCRIPTION + RandomData.getRandomAlphanumeric(); - - // Create the site if it does not exist - createRMSiteIfNotExists(); - - // Create RM site model - RMSite rmSiteToUpdate = RMSite.builder().title(NEW_TITLE).description(NEW_DESCRIPTION).build(); - - // Create the RM site - getRestAPIFactory().getRMSiteAPI(getDataUser().createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate); - - // Verify the status code - assertStatusCode(FORBIDDEN); - - // Update the RM Site - RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate); - - // Verify the response status code - assertStatusCode(OK); - - // Verify the returned file plan component - assertEquals(rmSiteModel.getId(), RM_ID); - assertEquals(rmSiteModel.getTitle(), NEW_TITLE); - assertEquals(rmSiteModel.getDescription(), NEW_DESCRIPTION); - assertNotNull(rmSiteModel.getCompliance()); - assertEquals(rmSiteModel.getVisibility(), Visibility.PUBLIC); - } - - /** - * Given that RM site exist - * When the admin user wants to update the RM site compliance - * Then RM site compliance is not updated - */ - @Test(priority = 3) // Run test after the other tests with priority 0, 1 or 2 - public void updateRMSiteComplianceAsAdmin() - { - // Create the RM site if it does not exist - createRMSiteIfNotExists(); - - // Build the RM site properties - RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build(); - - // Update the RM site - getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate); - - // Verify the response status code - assertStatusCode(BAD_REQUEST); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java deleted file mode 100644 index db983f4b04..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java +++ /dev/null @@ -1,477 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.unfiledcontainers; - -import static java.time.LocalDateTime.now; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CONFLICT; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.OK; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.NoSuchElementException; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.base.DataProviderClass; -import org.alfresco.rest.rm.community.model.fileplan.FilePlan; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder; -import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil; -import org.alfresco.utility.report.Bug; -import org.springframework.http.HttpStatus; -import org.testng.annotations.AfterClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Unfiled container related API tests - * - * @author Ana Bozianu - * @since 2.6 - */ -public class UnfiledContainerTests extends BaseRMRestTest -{ - /** Number of children (for children creation test) */ - private static final int NUMBER_OF_CHILDREN = 10; - private final List unfiledChildren = new ArrayList<>(); - - /** - * Data Provider with: - * with the object types for creating a Unfiled Record Folder - * - * @return file plan component alias - */ - @DataProvider (name = "unfiledFolderTypes") - public static Object[][] unfiledFolderTypes() - { - return new String[][] { - { UNFILED_RECORD_FOLDER_TYPE }, - { FOLDER_TYPE } - }; - } - - - /** - *
-     * Given the RM site exists
-     * When I retrieve the unfiled record conteiner by placeholder
-     * Then the details of the unfiled record container is returned
-     * 
- */ - @Test - ( - description = "Get the unfiled records container" - ) - public void getUnfiledRecordsContainer() - { - // Get the unfiled records container - UnfiledContainer container = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS); - - // Check the response code - assertStatusCode(OK); - - // Check the response contains the right node type - assertEquals(container.getNodeType(), UNFILED_CONTAINER_TYPE); - } - - /** - *
-     * Given that an unfiled container exists
-     * When I ask the API to update the details of the unfiled container
-     * Then the details of the unfiled container are updated
-     * 
- */ - @Test - ( - description = "Rename unfiled container" - ) - public void renameUnfiledContainer() - { - String newContainerName = "RenamedUnfiledContainer (" + getRandomAlphanumeric() + ")"; - - // Build the properties which will be updated - UnfiledContainer unfiledContainerUpdate = UnfiledContainer.builder().name(newContainerName).build(); - - // Update the unfiled records container - UnfiledContainer renamedUnfiledContainer = getRestAPIFactory().getUnfiledContainersAPI().updateUnfiledContainer(unfiledContainerUpdate, UNFILED_RECORDS_CONTAINER_ALIAS); - - // Verify the status code - assertStatusCode(OK); - - // Verify the returned unfiled records container - assertEquals(renamedUnfiledContainer.getName(), newContainerName); - - // Get actual FILE_PLAN_ALIAS id - FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS); - - // verify renamed component still has this parent - assertEquals(renamedUnfiledContainer.getParentId(), filePlan.getId()); - } - - /** - *
-     * Given that an unfiled records container exists
-     * When I ask the API to create a child unfiled record folder
-     * Then it is created within the unfiled records container
-     * 
- */ - @Test - ( - description = "Create unfiled record folder child in unfiled root container", - dataProvider = "unfiledFolderTypes" - ) - public void createUnfiledRecordFolderChild(String folderType) - { - String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric(); - UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, unfiledRecordFolderName, folderType); - unfiledChildren.add(unfiledRecordFolderChild); - - assertNotNull(unfiledRecordFolderChild.getId()); - - // Verify the returned file plan component - assertFalse(unfiledRecordFolderChild.getIsRecord()); - assertTrue(unfiledRecordFolderChild.getIsUnfiledRecordFolder()); // it is not a _normal_ record folder! - - assertEquals(unfiledRecordFolderChild.getName(), unfiledRecordFolderName); - assertEquals(unfiledRecordFolderChild.getNodeType(), UNFILED_RECORD_FOLDER_TYPE); - - assertEquals(unfiledRecordFolderChild.getCreatedByUser().getId(), getAdminUser().getUsername()); - - UnfiledRecordFolder unfiledRecordFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledRecordFolderChild.getId()); - // Verify the returned file plan component properties - UnfiledContainerChildProperties unfiledRecordFolderChildProperties = unfiledRecordFolder.getProperties(); - assertEquals(unfiledRecordFolderChildProperties.getTitle(), FilePlanComponentsUtil.TITLE_PREFIX + unfiledRecordFolderName); - assertNotNull(unfiledRecordFolderChildProperties.getIdentifier()); - assertEquals(unfiledRecordFolder.getParentId(), - getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId()); - } - - @Test - ( description = "Create duplicate unfiled folder child", - dataProvider = "unfiledFolderTypes" - ) - @Bug(id ="RM-5116, RM-5148") - public void createDuplicateUnfiledFolderChild(String folderType) - { - String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric(); - UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - unfiledRecordFolderName, folderType); - - // Verify the status code - assertStatusCode(CREATED); - unfiledChildren.add(unfiledRecordFolderChild); - assertEquals(unfiledRecordFolderChild.getName(), unfiledRecordFolderName); - - // create the same unfiled folder - UnfiledContainerChild unfiledRecordFolderDuplicate = getRestAPIFactory().getUnfiledContainersAPI() - .createUnfiledContainerChild(createUnfiledContainerChildModel(unfiledRecordFolderName, folderType), - UNFILED_RECORDS_CONTAINER_ALIAS); - - // Verify the status code - assertStatusCode(CONFLICT); - - // create the same unfiled folder with the autoRename parameter on true - unfiledRecordFolderDuplicate = getRestAPIFactory().getUnfiledContainersAPI() - .createUnfiledContainerChild(createUnfiledContainerChildModel(unfiledRecordFolderName, folderType), - UNFILED_RECORDS_CONTAINER_ALIAS, "autoRename=true"); - - //verify the response status code - assertStatusCode(CREATED); - unfiledChildren.add(unfiledRecordFolderDuplicate); - assertNotEquals(unfiledRecordFolderDuplicate.getName(), unfiledRecordFolderName); - assertTrue(unfiledRecordFolderDuplicate.getName().startsWith(unfiledRecordFolderName)); - } - - /** - *
-     * Given that an unfiled records container exists
-     * When I ask the API to create a child unfiled record folder with relative path
-     * Then it is not supported
-     * 
- */ - @Test - ( - description = "Create unfiled record folder child in unfiled root container" - ) - public void createUnfiledRecordFolderChildWithRelativePathNotSuported() - { - // relativePath specify the container structure to create relative to - // the record folder to be created - String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth(); - UnfiledContainerChild unfiledFolderModel = UnfiledContainerChild.builder() - .name(getRandomName("UnfiledRecordFolder")) - .nodeType(UNFILED_RECORD_FOLDER_TYPE) - .relativePath(relativePath) - .build(); - getRestAPIFactory().getUnfiledContainersAPI() - .createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS); - - // Check the API response code - assertStatusCode(BAD_REQUEST); - } - - /** - *
-     * Given that an unfiled records container exists
-     * When I ask the API to create a child record
-     * Then it is created within the unfiled records container
-     * 
- */ - @Test - ( - description = "Create non-electronic record child in unfiled root container" - ) - public void createNonElectronicRecordChild() - { - String recordName = "NERecord-" + getRandomAlphanumeric(); - UnfiledContainerChild unfiledRecord = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, recordName, NON_ELECTRONIC_RECORD_TYPE); - unfiledChildren.add(unfiledRecord); - - assertNotNull(unfiledRecord.getId()); - assertTrue(unfiledRecord.getIsRecord()); - assertEquals(unfiledRecord.getNodeType(), NON_ELECTRONIC_RECORD_TYPE); - // check it was created in the unfiled root container - UnfiledContainer container = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS); - assertEquals(unfiledRecord.getParentId(), container.getId()); - // check the name contains the identifier - String identifier = unfiledRecord.getProperties().getIdentifier(); - assertNotNull(identifier); - assertEquals(unfiledRecord.getName(), recordName + " (" + identifier + ")"); - } - - /** - *
-     * Given that an unfiled records container exists
-     * When I ask the API to create a child record
-     * Then it is created within the unfiled records container
-     * 
- */ - @Test - ( - description = "Create electronic record child in unfiled root container" - ) - public void createElectronicRecordChild() - { - String recordName = "ERecord-" + getRandomAlphanumeric(); - UnfiledContainerChild unfiledRecord = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, recordName, CONTENT_TYPE); - unfiledChildren.add(unfiledRecord); - - assertNotNull(unfiledRecord.getId()); - assertTrue(unfiledRecord.getIsRecord()); - assertEquals(unfiledRecord.getNodeType(), CONTENT_TYPE); - // check it was created in the unfiled root container - UnfiledContainer container = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS); - assertEquals(unfiledRecord.getParentId(), container.getId()); - // check the name contains the identifier - String identifier = unfiledRecord.getProperties().getIdentifier(); - assertNotNull(identifier); - assertEquals(unfiledRecord.getName(), recordName + " (" + identifier + ")"); - } - - /** - *
-     * Given the RM site is created
-     * And contains a number of records and unfiled record folders
-     * When I ask the API to get me the children of the unfiled root container
-     * Then I am returned the contained record and unfiled record folders
-     * 
- */ - @Test - ( - description = "Get children of the root unfiled root container" - ) - public void getUnfiledRootContainerChildren() - { - // Add unfiled root container children - List createdChildren = new LinkedList<>(); - for (int i = 0; i < NUMBER_OF_CHILDREN; i++) - { - String childType; - if (i % 3 == 0) - { - childType = CONTENT_TYPE; - } - else if (i % 3 == 1) - { - childType = NON_ELECTRONIC_RECORD_TYPE; - } - else - { - childType = UNFILED_RECORD_FOLDER_TYPE; - } - UnfiledContainerChild child = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomAlphanumeric(), childType); - assertNotNull(child.getId()); - createdChildren.add(child); - } - - // Get children from API - UnfiledContainerChildCollection listedChildren = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS,"include=properties"); - - // Check status code - assertStatusCode(OK); - - // Check listed children contains created list - UnfiledContainer unfiledContainer = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS); - List verifiedChildren = new LinkedList<>(); - listedChildren.getEntries().forEach(c -> - { - UnfiledContainerChild containerChild = c.getEntry(); - String childId = containerChild.getId(); - - assertNotNull(childId); - logger.info("Checking child " + childId); - - try - { - // Get the element from the created children list - UnfiledContainerChild createdComponent = createdChildren.stream() - .filter(child -> child.getId().equals(childId)) - .findFirst().orElseThrow(); - - // Created by - assertEquals(containerChild.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Is parent id set correctly? - assertEquals(containerChild.getParentId(), unfiledContainer.getId()); - - // Boolean properties related to node type - if (containerChild.getNodeType().equals(UNFILED_RECORD_FOLDER_TYPE)) - { - assertFalse(containerChild.getIsRecord()); - } - else - { - assertTrue(containerChild.getIsRecord()); - assertTrue(containerChild.getName().contains(containerChild.getProperties().getIdentifier()), - "Records don't have in name the identifier"); - } - - // Does returned object have the same contents as the created one? - assertEquals(createdComponent.getName(), containerChild.getName()); - assertEquals(createdComponent.getNodeType(), containerChild.getNodeType()); - - // check rm identifier - assertNotNull(createdComponent.getProperties().getIdentifier()); - - // add the element to the matched children list - verifiedChildren.add(createdComponent); - } - catch (NoSuchElementException e) - { - // the element was not created in this test, continue - } - }); - - // check all the created elements have been returned - assertTrue(verifiedChildren.containsAll(createdChildren)); - assertTrue(createdChildren.containsAll(verifiedChildren)); - unfiledChildren.addAll(createdChildren); - } - - /** - * Negative test to check that invalid types cannot be created at unfiled container root level - * Only unfiled record folders and records can be created into unfiled container - */ - @Test - ( - dataProvider = "invalidRootTypes", - dataProviderClass = DataProviderClass.class, - description = "Only unfiled records folders and records can be created as children for unfiled container root" - ) - public void createInvalidUnfiledChildren(String filePlanComponentType) - { - String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric(); - - logger.info("creating " + filePlanComponentType); - - // Build unfiled records folder properties - UnfiledContainerChild unfiledFolderModel = createUnfiledContainerChildModel(unfiledRecordFolderName, filePlanComponentType); - - getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS); - // Verify the status code - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - @Test(description = "Create a record with custom record identifier in unfiled container") - public void createRecordWithCustomIdentifier() - { - String recordName = "customIdRecord-" + getRandomAlphanumeric(); - String customIdentifier = "customId"; - UnfiledContainerChildProperties propertiesModel = UnfiledContainerChildProperties.builder().identifier(customIdentifier).build(); - - UnfiledContainerChild childModel = UnfiledContainerChild.builder() - .name(recordName) - .nodeType(CONTENT_TYPE) - .properties(propertiesModel) - .build(); - - UnfiledContainerChild child = getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(childModel, UNFILED_RECORDS_CONTAINER_ALIAS); - - assertStatusCode(HttpStatus.CREATED); - unfiledChildren.add(child); - assertEquals(child.getProperties().getIdentifier(), customIdentifier); - assertEquals(child.getName(), recordName + " (" + customIdentifier + ")"); - } - - @AfterClass (alwaysRun = true) - public void tearDown() - { - unfiledChildren.forEach(unfiledChild -> - { - if (unfiledChild.getIsRecord()) - { - getRestAPIFactory().getRecordsAPI().deleteRecord(unfiledChild.getId()); - } - else - { - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledChild.getId()); - } - }); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java deleted file mode 100644 index c89bb5a37e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java +++ /dev/null @@ -1,490 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.unfiledrecordfolders; - -import static java.time.LocalDateTime.now; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile; -import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.alfresco.utility.data.RandomData.getRandomName; -import static org.springframework.http.HttpStatus.BAD_REQUEST; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.NOT_FOUND; -import static org.springframework.http.HttpStatus.NO_CONTENT; -import static org.springframework.http.HttpStatus.OK; -import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.stream.Collectors; - -import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.base.DataProviderClass; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder; -import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI; -import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Unfiled Records folder CRUD API tests - * - * @author Kristijan Conkas - * @since 2.6 - */ -public class UnfiledRecordsFolderTests extends BaseRMRestTest -{ - public static final String ELECTRONIC_RECORD_NAME = getRandomName("Record electronic"); - public static final String NONELECTRONIC_RECORD_NAME = getRandomName("Record nonelectronic"); - - private RecordCategory rootCategory; - private UnfiledContainerChild unfiledRecordFolder, rootUnfiledRecordFolder, unfiledRecord; - - @BeforeClass(alwaysRun = true) - public void preconditionUnfiledRecordsFolderTests() - { - rootCategory = createRootCategory(getRandomName("CATEGORY NAME")); - rootUnfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - getRandomName("RootUnfiledRecFolder"), UNFILED_RECORD_FOLDER_TYPE); - unfiledRecord = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, - getRandomName("Unfiled Record"), CONTENT_TYPE); - } - /** - * valid root level types, at unfiled record folder level these possible to create - */ - @DataProvider (name = "validChildren") - public Object[][] childrenForUnfiledRecord() - { - return new String[][] - { - { UNFILED_RECORD_FOLDER_TYPE }, - { CONTENT_TYPE }, - { NON_ELECTRONIC_RECORD_TYPE } - }; - } - - /** - * Invalid containers that cannot be updated/deleted with record folder endpoint - */ - @DataProvider (name = "invalidNodesForDelete") - public Object[][] getInvalidNodes() - { - return new String[][] { - { getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS).getId() }, - { getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() }, - { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() }, - // an arbitrary record category - { rootCategory.getId() }, - // an arbitrary unfiled records folder - {createRecordFolder(rootCategory.getId(), getRandomName("recFolder")).getId()}, - {unfiledRecord.getId() } - }; - } - - /** - *
-     * Given that I want to create an unfiled record folder
-     * When I use the API with the relativePath
-     * Then the folders specified in the relativePath that don't exist are created
-     * 
- */ - @Test - ( - description = "Create a child into unfiled record folder based on the relativePath. " + - "Containers in the relativePath that do not exist are created before the node is created", - dataProvider = "validChildren" - ) - public void createUnfiledRecordFolderWithRelativePath(String nodeType) - { - // relativePath specify the container structure to create relative to the record folder to be created - String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth(); - - // The record folder to be created - UnfiledContainerChild unfiledChildModel = UnfiledContainerChild.builder() - .name(getRandomName("UnfiledRecordFolder")) - .nodeType(nodeType) - .relativePath(relativePath) - .build(); - - UnfiledContainerChild unfiledRecordFolderChild = getRestAPIFactory().getUnfiledRecordFoldersAPI() - .createUnfiledRecordFolderChild(unfiledChildModel, rootUnfiledRecordFolder.getId(), "include=" + PATH); - - // Check the API response code - assertStatusCode(CREATED); - - // Verify the returned node type - assertEquals(unfiledRecordFolderChild.getNodeType(), nodeType); - - // Check the path return contains the relativePath - assertTrue(unfiledRecordFolderChild.getPath().getName().contains(relativePath)); - - // Check the parent is a folder, not a record - assertEquals(getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledRecordFolderChild.getParentId()).getNodeType(), - UNFILED_RECORD_FOLDER_TYPE); - - // New relative path only a part of containers need to be created before the record folder - String newRelativePath = now().getYear() + "/" + now().getMonth() + "/" + (now().getDayOfMonth() + 1); - - // The record folder to be created - UnfiledContainerChild newUnfiledFolderModel = UnfiledContainerChild.builder() - .name(getRandomName("UnfiledRecordFolder")) - .nodeType(nodeType) - .relativePath(newRelativePath) - .build(); - - UnfiledContainerChild newUnfiledRecordFolderChild = getRestAPIFactory().getUnfiledRecordFoldersAPI() - .createUnfiledRecordFolderChild(newUnfiledFolderModel, rootUnfiledRecordFolder.getId(), "include=" + PATH); - - // Check the API response code - assertStatusCode(CREATED); - - // Check the path return contains the newRelativePath - assertTrue(newUnfiledRecordFolderChild.getPath().getName().contains(newRelativePath)); - - // Check the parent is a folder, not a record - assertFalse(getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(newUnfiledRecordFolderChild.getParentId()).equals(UNFILED_RECORD_FOLDER_TYPE)); - // Verify the returned node type - assertEquals(newUnfiledRecordFolderChild.getNodeType(), nodeType); - } - - /** - * Negative test to check that invalid types cannot be created at unfiled container root level - * Only unfiled record folders and records can be created into unfiled container - */ - @Test - ( - dataProvider = "invalidRootTypes", - dataProviderClass = DataProviderClass.class, - description = "Only unfiled records folders and records can be created as children for unfiled container root" - ) - public void createInvalidUnfiledChildren(String filePlanComponentType) - { - // Build unfiled records folder properties - UnfiledContainerChild unfiledFolderModel = createUnfiledContainerChildModel(getRandomName("UnfiledRecFolder"), filePlanComponentType); - - getRestAPIFactory().getUnfiledRecordFoldersAPI().createUnfiledRecordFolderChild(unfiledFolderModel, rootUnfiledRecordFolder.getId()); - - // Verify the status code - assertStatusCode(UNPROCESSABLE_ENTITY); - } - - /** - * Given an unfiled record folder - * When I create an unfiled record folder via the ReST API - * Then an unfiled record folder is created within the unfiled record folder - */ - @Test(description = "Child unfiled records folder can be created in a parent unfiled records folder") - public void childUnfiledRecordsFolderCanBeCreated() - { - String unfiledParentFolderName = "UnfiledParentFolder" + getRandomAlphanumeric(); - String unfiledChildFolderName = "UnfiledChildFolder " + getRandomAlphanumeric(); - - // No need for fine control, create it using utility function - UnfiledContainerChild unfiledParentFolder = createUnfiledRecordsFolderChild(rootUnfiledRecordFolder.getId(), - unfiledParentFolderName, UNFILED_RECORD_FOLDER_TYPE); - assertEquals(unfiledParentFolderName, unfiledParentFolder.getName()); - - // Build the unfiled records folder properties - UnfiledContainerChild unfiledChildFolderModel = - UnfiledContainerChild.builder() - .name(unfiledChildFolderName) - .nodeType(UNFILED_RECORD_FOLDER_TYPE) - .properties(UnfiledContainerChildProperties.builder() - .title(FilePlanComponentsUtil.TITLE_PREFIX + unfiledChildFolderName) - .description(FilePlanComponentsUtil.DESCRIPTION_PREFIX + unfiledChildFolderName).build()) - .build(); - - // Create it as a child of parentFolder - UnfiledContainerChild unfiledChildFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI() - .createUnfiledRecordFolderChild(unfiledChildFolderModel, unfiledParentFolder.getId()); - - // Verify the status code - assertStatusCode(CREATED); - - // Verify the returned unfiled child folder - assertTrue(unfiledChildFolder.getIsUnfiledRecordFolder()); - assertFalse(unfiledChildFolder.getIsRecord()); - - assertEquals(unfiledChildFolder.getName(), unfiledChildFolderName); - assertEquals(unfiledChildFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE); - assertEquals(unfiledChildFolder.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Verify the returned file plan component properties - UnfiledRecordFolder unfiledChildRecordFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI() - .getUnfiledRecordFolder(unfiledChildFolder.getId()); - // Verify the returned file plan component properties - UnfiledContainerChildProperties unfiledChildFolderProperties = unfiledChildRecordFolder.getProperties(); - assertEquals(unfiledChildFolderProperties.getTitle(), FilePlanComponentsUtil.TITLE_PREFIX + unfiledChildFolderName); - assertEquals(unfiledChildFolderProperties.getDescription(), FilePlanComponentsUtil.DESCRIPTION_PREFIX + unfiledChildFolderName); - - // Does this child point to its parent? - assertEquals(unfiledChildFolder.getParentId(), unfiledParentFolder.getId()); - - // Does child's parent point to it? - // Perform another call as our parentFolder had been executed before childFolder existed - UnfiledContainerChildCollection parentsChildren = getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolderChildren(unfiledParentFolder.getId()); - assertStatusCode(OK); - List childIds = parentsChildren.getEntries() - .stream() - .map(c -> c.getEntry().getId()) - .collect(Collectors.toList()); - - // Child folder is listed in parent - assertTrue(childIds.contains(unfiledChildFolder.getId())); - - // There should be only one child - assertEquals(1, childIds.size()); - } - - /** - * Given an unfiled record folder - * When I modify the unfiled record folder details via the ReST API - * Then the details of the unfiled record folder are modified - */ - @Test(description = "Unfiled record folder") - public void editUnfiledRecordsFolder() - { - String modified = "Modified "; - String unfiledFolderName = "UnfiledFolderToModify" + getRandomAlphanumeric(); - - // No need for fine control, create it using utility function - UnfiledContainerChild unfiledFolderToModify = createUnfiledRecordsFolderChild(rootUnfiledRecordFolder.getId(), - unfiledFolderName, UNFILED_RECORD_FOLDER_TYPE); - assertEquals(unfiledFolderName, unfiledFolderToModify.getName()); - - // Build the properties which will be updated - UnfiledRecordFolder unfiledChildFolderModel = - UnfiledRecordFolder.builder() - .name(modified + unfiledFolderName) - .properties - (UnfiledContainerChildProperties.builder() - .title(modified + unfiledFolderToModify.getProperties().getTitle()) - .description(modified + unfiledFolderToModify.getProperties().getDescription()) - .build() - ) - .build(); - - - - - // Update the unfiled records folder - UnfiledRecordFolder updatedRecordFolder=getRestAPIFactory().getUnfiledRecordFoldersAPI().updateUnfiledRecordFolder(unfiledChildFolderModel, unfiledFolderToModify.getId()); - - // Verify the status code - assertStatusCode(OK); - // Verify the returned file plan component - assertEquals(unfiledChildFolderModel.getName(), - updatedRecordFolder.getName()); - assertEquals(unfiledChildFolderModel.getProperties().getTitle(), - updatedRecordFolder.getProperties().getTitle()); - assertEquals(unfiledChildFolderModel.getProperties().getDescription(), - updatedRecordFolder.getProperties().getDescription()); - // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT - UnfiledRecordFolder renamedUnfiledFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledFolderToModify.getId()); - - // Verify the returned file plan component - assertEquals(modified + unfiledFolderToModify.getName(), renamedUnfiledFolder.getName()); - assertEquals(modified + unfiledFolderToModify.getProperties().getTitle(), renamedUnfiledFolder.getProperties().getTitle()); - assertEquals(modified + unfiledFolderToModify.getProperties().getDescription(), renamedUnfiledFolder.getProperties().getDescription()); - } - - /** - * Given an unfiled record folder and some records inside - * When I delete the unfiled record folder via the ReST API - * Then the unfiled record folder is deleted and its content too - */ - @Test(description = "Delete unfiled record folder") - public void deleteUnfiledRecordsFolder() - { - String unfiledFolderName = "UnfiledFolderToDelete" + getRandomAlphanumeric(); - String nonElectronicRecordName = "NonElectronicRecord" + getRandomAlphanumeric(); - String electronicRecordName = "ElectronicRecord" + getRandomAlphanumeric(); - - // Create unfiledFolderToDelete - UnfiledContainerChild unfiledFolderToDelete = createUnfiledRecordsFolderChild(rootUnfiledRecordFolder.getId(), - unfiledFolderName, UNFILED_RECORD_FOLDER_TYPE); - assertEquals(unfiledFolderName, unfiledFolderToDelete.getName()); - - // Create a non electronic record under unfiledFolderToDelete - UnfiledContainerChild nonElectronicRecord = createUnfiledRecordsFolderChild(unfiledFolderToDelete.getId(), - nonElectronicRecordName, NON_ELECTRONIC_RECORD_TYPE); - assertEquals(nonElectronicRecord.getParentId(), unfiledFolderToDelete.getId()); - - // Create an electronic record under unfiledFolderToDelete - UnfiledContainerChild electronicRecord = createUnfiledRecordsFolderChild(unfiledFolderToDelete.getId(), - electronicRecordName, CONTENT_TYPE); - assertEquals(electronicRecord.getParentId(), unfiledFolderToDelete.getId()); - - // Delete folderToDelete - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledFolderToDelete.getId()); - - // Verify the status code - assertStatusCode(NO_CONTENT); - - // Deleted component should no longer be retrievable - getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledFolderToDelete.getId()); - assertStatusCode(NOT_FOUND); - } - - /** - *
-     * Given other nodes type than unfiled record folders exists
-     * When I use the API from unfiled record-folders to delete the nodes
-     * Then the request fails
-     * 
- */ - @Test - ( - description = "Delete invalid nodes type with the DELETE unfiled record folders request", - dataProvider = "invalidNodesForDelete" - ) - public void deleteInvalidNodesUnfiled(String nodeId) - { - // Delete the nodes with record-folders end-point - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(nodeId); - - // Check the response status code - assertStatusCode(BAD_REQUEST); - } - - /** - * Given a container that is a unfiled record folder - * When I try to record the containers records - * Then I receive a list of all the records contained within the unfiled record folder - */ - @Test - public void readRecordsFromUnfiledRecordFolder() - { - unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomName("UnfiledRecordFolder"), UNFILED_RECORD_FOLDER_TYPE); - String containerId = unfiledRecordFolder.getId(); - - //we have unfiled record folder - UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI(); - - ArrayList children = new ArrayList<>(); - for (int i = 0; i < 5; i++) - { - // Create Electronic Records - UnfiledContainerChild record = UnfiledContainerChild.builder() - .name(ELECTRONIC_RECORD_NAME + i) - .nodeType(CONTENT_TYPE) - .build(); - UnfiledContainerChild child = unfiledRecordFoldersAPI.uploadRecord(record, containerId, createTempFile(ELECTRONIC_RECORD_NAME + i, ELECTRONIC_RECORD_NAME + i)); - children.add(child); - - //Create NonElectronicRecords - UnfiledContainerChild nonelectronicRecord = UnfiledContainerChild.builder() - .properties(UnfiledContainerChildProperties.builder() - .description("Description") - .title("Title") - .build()) - .name(NONELECTRONIC_RECORD_NAME + i) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .build(); - child = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(nonelectronicRecord, containerId); - children.add(child); - } - - // List children from API - UnfiledContainerChildCollection apiChildren = (UnfiledContainerChildCollection) unfiledRecordFoldersAPI.getUnfiledRecordFolderChildren(containerId,"include=properties").assertThat().entriesListIsNotEmpty(); - - // Check status code - assertStatusCode(OK); - - - // Check listed children against created list - apiChildren.getEntries().forEach(c -> - { - UnfiledContainerChild record = c.getEntry(); - assertNotNull(record.getId()); - logger.info("Checking child " + record.getId()); - - try - { - // Find this child in created children list - UnfiledContainerChild createdComponent = children.stream() - .filter(child -> child.getId().equals(record.getId())) - .findFirst() - .orElseThrow(); - - // Created by - assertEquals(record.getCreatedByUser().getId(), getAdminUser().getUsername()); - - // Is parent Id set correctly - assertEquals(record.getParentId(), containerId); - assertTrue(record.getIsRecord()); - - // Boolean properties related to node type - assertFalse(record.getIsUnfiledRecordFolder()); - - //check the record name - assertEquals(createdComponent.getName(), record.getName(), - "The record name " + record.getName() + " is not equal with the record name returned when creating the record " + createdComponent.getName()); - String identifier = " \\(" + record.getProperties().getIdentifier() + "\\)"; - String regex= "(" + NONELECTRONIC_RECORD_NAME + "|" + ELECTRONIC_RECORD_NAME + ")" + "[0-9]+" + identifier; - assertTrue(record.getName().matches(regex), - "The record name:" + record.getName() + " doesn't match the expression " + regex); - assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier())); - assertEquals(createdComponent.getNodeType(), record.getNodeType()); - - } - catch (NoSuchElementException e) - { - fail("No child element for " + record.getId()); - } - }); - } - - @AfterClass (alwaysRun = true) - public void tearDown() - { - deleteRecordCategory(rootCategory.getId()); - getRestAPIFactory().getRecordsAPI().deleteRecord(unfiledRecord.getId()); - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(rootUnfiledRecordFolder.getId()); - getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledRecordFolder.getId()); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java deleted file mode 100644 index 980dd4a66f..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.utils; - -import java.lang.reflect.InvocationTargetException; - -import org.alfresco.rest.model.RestNodeBodyMoveCopyModel; -import org.alfresco.utility.model.ContentModel; -import org.alfresco.utility.model.FileModel; -import org.alfresco.utility.model.RepoTestModel; - -/** - * Utility class for core components models - * - * @author Rodica Sutu - * @since 2.6 - */ -public class CoreUtil -{ - private CoreUtil() - { - // Intentionally blank - } - - /** - * Creates a body model for move/copy with the given the target node id - * - * @param nodeId The node id - * @return The {@link RestNodeBodyMoveCopyModel} with for the given node id - */ - public static RestNodeBodyMoveCopyModel createBodyForMoveCopy(String nodeId) - { - RestNodeBodyMoveCopyModel moveDestinationInfo = new RestNodeBodyMoveCopyModel(); - moveDestinationInfo.setTargetParentId(nodeId); - return moveDestinationInfo; - } - - /** - * Helper method to create a Content Model - * - * @return ContentModel - */ - public static ContentModel toContentModel(String nodeId) - { - return toModel(nodeId, ContentModel.class); - } - - /** - * Helper method to create a File Model - * - * @return ContentModel - */ - public static FileModel toFileModel(String nodeId) - { - return toModel(nodeId,FileModel.class); - } - - /** - * Helper method to create a RepoTestModel using the node id - * - * @param nodeId node ref of the test model - * @param classOf repo test model class - * @return - */ - private static T toModel(String nodeId, Class classOf) - { - T target = null; - try - { - target = (T) classOf.getDeclaredConstructor().newInstance(); - } - catch (InvocationTargetException| NoSuchMethodException| IllegalAccessException | InstantiationException e) - { - e.printStackTrace(); - } - - target.setNodeRef(nodeId); - return target; - - } - - -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java deleted file mode 100644 index 56dd5da2bb..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.utils; - -import static java.nio.charset.Charset.forName; - -import static com.google.common.io.Resources.getResource; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStreamWriter; - -import org.alfresco.rest.rm.community.model.record.Record; -import org.alfresco.rest.rm.community.model.record.RecordProperties; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildProperties; -import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryProperties; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder; -import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; -import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties; - -/** - * Utility class for file plan component models - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class FilePlanComponentsUtil -{ - private FilePlanComponentsUtil() - { - // Intentionally blank - } - - /** Name of the image resource file to be used for records body */ - public static final String IMAGE_FILE = "money.JPG"; - - /** Title prefix for record category children */ - public static final String TITLE_PREFIX = "Title for "; - - /** Description prefix for record category children */ - public static final String DESCRIPTION_PREFIX = "This is the description for"; - - - /** - * Helper method to get a file by its name - * - * @return The file - */ - public static File getFile(String fileName) - { - return new File(getResource(fileName).getFile()); - } - - /** - * Creates a record model with the given type and a random name (with "Record " prefix) - * - * @param nodeType The node type - * @return The {@link Record} with for the given node type - */ - private static Record createRecordModel(String nodeType) - { - return Record.builder() - .name("Record " + getRandomAlphanumeric()) - .nodeType(nodeType) - .build(); - } - - /** - * Creates an electronic record model with a random name (with "Record " prefix) - * - * @return The electronic record as {@link Record} - */ - public static Record createElectronicRecordModel() - { - return createRecordModel(CONTENT_TYPE); - } - - /** - * Creates a non-electronic unfiled container child model with a random name (with "Record " prefix) - * - * @return The electronic record as {@link UnfiledContainerChild} - */ - public static UnfiledContainerChild createElectronicUnfiledContainerChildModel() - { - return createUnfiledContainerChildRecordModel("Record " + getRandomAlphanumeric(), CONTENT_TYPE); - } - - /** - * Creates an electronic unfiled container child model with a random name (with "Record " prefix) - * - * @return The electronic record as {@link UnfiledContainerChild} - */ - public static UnfiledContainerChild createNonElectronicUnfiledContainerChildModel() - { - return createUnfiledContainerChildRecordModel("Record " + getRandomAlphanumeric(), NON_ELECTRONIC_RECORD_TYPE); - } - - /** - * Creates an unfiled records container child record model with the given name and type - * - * @param name The name of the unfiled records container child - * @param nodeType The type of the record category child - * @return The {@link UnfiledContainerChild} with the given details - */ - public static UnfiledContainerChild createUnfiledContainerChildRecordModel(String name, String nodeType) - { - return UnfiledContainerChild.builder() - .name(name) - .nodeType(nodeType) - .build(); - } - - /** - * Creates a nonElectronic container child record model with all available properties for the non electronic records - * - * @param name The name of the unfiled records container child - * @param nodeType The type of the record category child - * @return The {@link UnfiledContainerChild} with the given details - */ - public static UnfiledContainerChild createFullNonElectronicUnfiledContainerChildRecordModel(String name, String title, String description, String box, String file, - String shelf, String storageLocation, Integer numberOfCopies, Integer physicalSize) - { - return UnfiledContainerChild.builder() - .name(name) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .properties(UnfiledContainerChildProperties.builder() - .title(title) - .description(description) - .box(box) - .file(file) - .shelf(shelf) - .storageLocation(storageLocation) - .numberOfCopies(numberOfCopies) - .physicalSize(physicalSize) - .build()) - .build(); - } - - /** - * Creates a non-electronic record model with a random name (with "Record " prefix) - * - * @return The non-electronic record as {@link Record} - */ - public static Record createNonElectronicRecordModel() - { - return createRecordModel(NON_ELECTRONIC_RECORD_TYPE); - } - - /** - * Creates a non-electronic record model with with all available properties for the non electronic records - * - * @return The non-electronic record as {@link Record} - */ - public static Record createFullNonElectronicRecordModel(String name, String title, String description, String box, String file, - String shelf, String storageLocation, Integer numberOfCopies, Integer physicalSize) - { - return Record.builder() - .name(name) - .nodeType(NON_ELECTRONIC_RECORD_TYPE) - .properties(RecordProperties.builder() - .title(title) - .description(description) - .box(box) - .file(file) - .shelf(shelf) - .storageLocation(storageLocation) - .numberOfCopies(numberOfCopies) - .physicalSize(physicalSize) - .build()) - .build(); - } - - /** - * Creates a record model with the given name, description and title - * - * @param name The name of the record - * @param description The description of the record - * @param title The title of the record - * @return The {@link Record} with the given details - */ - public static Record createRecordModel(String name, String description, String title) - { - return Record.builder() - .name(name) - .properties(RecordProperties.builder() - .description(description) - .title(title) - .build()) - .build(); - } - - /** - * Creates a record category child model with the given name and type - * - * @param name The name of the record category child - * @param nodeType The type of the record category child - * @return The {@link RecordCategoryChild} with the given details - */ - public static RecordCategoryChild createRecordCategoryChildModel(String name, String nodeType) - { - return RecordCategoryChild.builder() - .name(name) - .nodeType(nodeType) - .properties(RecordCategoryChildProperties.builder() - .title(TITLE_PREFIX + name) - .build()) - .build(); - } - - /** - * Creates a record category model with the given name and title - * - * @param name The name of the record category - * @param title The title of the record category - * @return The {@link RecordCategory} with the given details - */ - public static RecordCategory createRecordCategoryModel(String name, String title) - { - return RecordCategory.builder() - .name(name) - .nodeType(RECORD_CATEGORY_TYPE) - .properties(RecordCategoryProperties.builder() - .title(title) - .build()) - .build(); - } - - /** - * Creates a record folder model with the given name and title - * - * @param name The name of the record folder - * @param title The title of the record folder - * @return The {@link RecordFolder} with the given details - */ - public static RecordFolder createRecordFolderModel(String name, String title) - { - return RecordFolder.builder() - .name(name) - .nodeType(RECORD_FOLDER_TYPE) - .properties(RecordFolderProperties.builder() - .title(title) - .build()) - .build(); - } - - /** - * Creates an unfiled records container child model with the given name and type - * - * @param name The name of the unfiled records container child - * @param nodeType The type of the record category child - * @return The {@link UnfiledContainerChild} with the given details - */ - public static UnfiledContainerChild createUnfiledContainerChildModel(String name, String nodeType) - { - return UnfiledContainerChild.builder() - .name(name) - .nodeType(nodeType) - .properties(UnfiledContainerChildProperties.builder() - .title(TITLE_PREFIX + name) - .build()) - .build(); - } - - /** - * Create temp file with content - * - * @param name The file name - * @return {@link File} The created file - */ - public static File createTempFile(final String name, String content) - { - try - { - // Create file - final File file = File.createTempFile(name, ".txt"); - - // Create writer - try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), forName("UTF-8").newEncoder())) - { - // place content in file - writer.write(content); - } - - return file; - } - catch (Exception exception) - { - throw new RuntimeException("Unable to create test file.", exception); - } - } - - /** - * Helper method to verify all properties of a nonElectronic record - * - * @param nonElectronicRecord - * @param name - * @param title - * @param description - * @param box - * @param file - * @param shelf - * @param storageLocation - * @param numberOfCopies - * @param physicalSize - */ - public static void verifyFullNonElectronicRecord(Record nonElectronicRecord, String name, String title, String description, String box, String file, - String shelf, String storageLocation, Integer numberOfCopies, Integer physicalSize) - { - RecordProperties properties = nonElectronicRecord.getProperties(); - assertEquals(title, properties.getTitle()); - assertEquals(description, properties.getDescription()); - assertEquals(box, properties.getBox()); - assertEquals(file, properties.getFile()); - assertEquals(shelf, properties.getShelf()); - assertEquals(storageLocation, properties.getStorageLocation()); - assertEquals(numberOfCopies, properties.getNumberOfCopies()); - assertEquals(physicalSize, properties.getPhysicalSize()); - assertTrue(nonElectronicRecord.getName().contains(properties.getIdentifier())); - assertTrue(nonElectronicRecord.getName().contains(name)); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java deleted file mode 100644 index 8e6823585e..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.utils; - -import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015; -import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD; - -import org.alfresco.rest.rm.community.model.site.RMSiteCompliance; -import org.alfresco.rest.rm.community.model.site.RMSite; - -/** - * Utility class for the RM Site - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class RMSiteUtil -{ - private RMSiteUtil() - { - // Intentionally blank - } - - /** Constants */ - public static final String RM_ID = "rm"; - public static final String RM_TITLE = "Records Management"; - public static final String RM_DESCRIPTION = "Records Management Site"; - public static final String FILE_PLAN_PATH = "/rm/documentLibrary"; - - /** - * Creates an RM Site model for the given compliance, title and description - * - * @param compliance The RM site compliance - * @param title The site title - * @param description The site description - * @return The {@link RMSite} with the given details - */ - public static RMSite createRMSiteModel(RMSiteCompliance compliance, String title, String description) - { - return RMSite.builder().compliance(compliance).title(title).description(description).build(); - } - - /** - * Creates an RM Site for the given compliance and default title and description - * - * @param compliance The RM site compliance - * @return The {@link RMSite} with the given details - */ - private static RMSite createRMSiteModel(RMSiteCompliance compliance) - { - return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION); - } - - /** - * Creates a standard RM site with the default title and description - * - * @return The standard RM site - */ - public static RMSite createStandardRMSiteModel() - { - return createRMSiteModel(STANDARD); - } - - /** - * Creates a DOD5015 compliance RM site with the default title and description - * - * @return The DOD5015 compliance RM site - */ - public static RMSite createDOD5015RMSiteModel() - { - return createRMSiteModel(DOD5015); - } -} diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties deleted file mode 100644 index e01a70def8..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties +++ /dev/null @@ -1,11 +0,0 @@ -# Root logger option -log4j.rootLogger=INFO, file - -# Direct log messages to a log file -log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File=./target/reports/rm-automation-community-rest-api.log -log4j.appender.file.MaxBackupIndex=10 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n - -log4j.logger.com.example=debug diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/money.JPG b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/money.JPG deleted file mode 100644 index 5939b17709..0000000000 Binary files a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/money.JPG and /dev/null differ diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/shared-resources/testdata/SampleTextFile_10kb.txt b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/shared-resources/testdata/SampleTextFile_10kb.txt deleted file mode 100644 index e0f98f53f9..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/shared-resources/testdata/SampleTextFile_10kb.txt +++ /dev/null @@ -1,27 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus condimentum sagittis lacus, laoreet luctus ligula laoreet ut. Vestibulum ullamcorper accumsan velit vel vehicula. Proin tempor lacus arcu. Nunc at elit condimentum, semper nisi et, condimentum mi. In venenatis blandit nibh at sollicitudin. Vestibulum dapibus mauris at orci maximus pellentesque. Nullam id elementum ipsum. Suspendisse cursus lobortis viverra. Proin et erat at mauris tincidunt porttitor vitae ac dui. - -Donec vulputate lorem tortor, nec fermentum nibh bibendum vel. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dictum luctus massa, non euismod lacus. Pellentesque condimentum dolor est, ut dapibus lectus luctus ac. Ut sagittis commodo arcu. Integer nisi nulla, facilisis sit amet nulla quis, eleifend suscipit purus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam euismod ultrices lorem, sit amet imperdiet est tincidunt vel. Phasellus dictum justo sit amet ligula varius aliquet auctor et metus. Fusce vitae tortor et nisi pulvinar vestibulum eget in risus. Donec ante ex, placerat a lorem eget, ultricies bibendum purus. Nam sit amet neque non ante laoreet rutrum. Nullam aliquet commodo urna, sed ullamcorper odio feugiat id. Mauris nisi sapien, porttitor in condimentum nec, venenatis eu urna. Pellentesque feugiat diam est, at rhoncus orci porttitor non. - -Nulla luctus sem sit amet nisi consequat, id ornare ipsum dignissim. Sed elementum elit nibh, eu condimentum orci viverra quis. Aenean suscipit vitae felis non suscipit. Suspendisse pharetra turpis non eros semper dictum. Etiam tincidunt venenatis venenatis. Praesent eget gravida lorem, ut congue diam. Etiam facilisis elit at porttitor egestas. Praesent consequat, velit non vulputate convallis, ligula diam sagittis urna, in venenatis nisi justo ut mauris. Vestibulum posuere sollicitudin mi, et vulputate nisl fringilla non. Nulla ornare pretium velit a euismod. Nunc sagittis venenatis vestibulum. Nunc sodales libero a est ornare ultricies. Sed sed leo sed orci pellentesque ultrices. Mauris sollicitudin, sem quis placerat ornare, velit arcu convallis ligula, pretium finibus nisl sapien vel sem. Vivamus sit amet tortor id lorem consequat hendrerit. Nullam at dui risus. - -Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed feugiat semper velit consequat facilisis. Etiam facilisis justo non iaculis dictum. Fusce turpis neque, pharetra ut odio eu, hendrerit rhoncus lacus. Nunc orci felis, imperdiet vel interdum quis, porta eu ipsum. Pellentesque dictum sem lacinia, auctor dui in, malesuada nunc. Maecenas sit amet mollis eros. Proin fringilla viverra ligula, sollicitudin viverra ante sollicitudin congue. Donec mollis felis eu libero malesuada, et lacinia risus interdum. - -Etiam vitae accumsan augue. Ut urna orci, malesuada ut nisi a, condimentum gravida magna. Nulla bibendum ex in vulputate sagittis. Nulla facilisi. Nullam faucibus et metus ac consequat. Quisque tempor eros velit, id mattis nibh aliquet a. Aenean tempor elit ut finibus auctor. Sed at imperdiet mauris. Vestibulum pharetra non lacus sed pulvinar. Sed pellentesque magna a eros volutpat ullamcorper. In hac habitasse platea dictumst. Donec ipsum mi, feugiat in eros sed, varius lacinia turpis. Donec vulputate tincidunt dui ac laoreet. Sed in eros dui. Pellentesque placerat tristique ligula eu finibus. Proin nec faucibus felis, eu commodo ipsum. - -Integer eu hendrerit diam, sed consectetur nunc. Aliquam a sem vitae leo fermentum faucibus quis at sem. Etiam blandit, quam quis fermentum varius, ante urna ultricies lectus, vel pellentesque ligula arcu nec elit. Donec placerat ante in enim scelerisque pretium. Donec et rhoncus erat. Aenean tempor nisi vitae augue tincidunt luctus. Nam condimentum dictum ante, et laoreet neque pellentesque id. Curabitur consectetur cursus neque aliquam porta. Ut interdum nunc nec nibh vestibulum, in sagittis metus facilisis. Pellentesque feugiat condimentum metus. Etiam venenatis quam at ante rhoncus vestibulum. Maecenas suscipit congue pellentesque. Vestibulum suscipit scelerisque fermentum. Nulla iaculis risus ac vulputate porttitor. - -Mauris nec metus vel dolor blandit faucibus et vel magna. Ut tincidunt ipsum non nunc dapibus, sed blandit mi condimentum. Quisque pharetra interdum quam nec feugiat. Sed pellentesque nulla et turpis blandit interdum. Curabitur at metus vitae augue elementum viverra. Sed mattis lorem non enim fermentum finibus. Sed at dui in magna dignissim accumsan. Proin tincidunt ultricies cursus. Maecenas tincidunt magna at urna faucibus lacinia. - -Quisque venenatis justo sit amet tortor condimentum, nec tincidunt tellus viverra. Morbi risus ipsum, consequat convallis malesuada non, fermentum non velit. Nulla facilisis orci eget ligula mattis fermentum. Aliquam vel velit ultricies, sollicitudin nibh eu, congue velit. Donec nulla lorem, euismod id cursus at, sollicitudin et arcu. Proin vitae tincidunt ipsum. Vivamus elementum eleifend justo, placerat interdum nulla rutrum id. - -Phasellus fringilla luctus magna, a finibus justo dapibus a. Nam risus felis, rhoncus eget diam sit amet, congue facilisis nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent consequat euismod diam, eget volutpat magna convallis at. Mauris placerat pellentesque imperdiet. Nulla porta scelerisque enim, et scelerisque neque bibendum in. Proin eget turpis nisi. Suspendisse ut est a erat egestas eleifend at euismod arcu. Donec aliquet, nisi sed faucibus condimentum, nisi metus dictum eros, nec dignissim justo odio id nulla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Maecenas sollicitudin, justo id elementum eleifend, justo neque aliquet nibh, finibus malesuada metus erat eget neque. Suspendisse nec auctor orci. Aenean et vestibulum nulla. Nullam hendrerit augue tristique, commodo metus id, sodales lorem. Etiam feugiat dui est, vitae auctor risus convallis non. - -Maecenas turpis enim, consectetur eget lectus eu, hendrerit posuere lacus. Praesent efficitur, felis eget dapibus consectetur, nisi massa dignissim enim, nec semper dolor est eu urna. Nullam ut sodales lorem. Aliquam dapibus faucibus diam. Vestibulum vel magna et dolor gravida imperdiet ut sit amet sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur elementum metus tincidunt nulla euismod ultricies. Duis elementum nec neque in porttitor. Nulla sagittis lorem elit, et consectetur ante laoreet eu. Maecenas nulla tellus, scelerisque ac erat sed, fermentum dapibus metus. Donec tincidunt fermentum molestie. - -Sed consequat mi at maximus faucibus. Pellentesque aliquet tincidunt sapien vel auctor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent accumsan nunc eget leo aliquam, facilisis hendrerit turpis egestas. Morbi in ultricies mauris, a eleifend turpis. Quisque fringilla massa iaculis risus ultrices, sit amet tincidunt dui varius. Quisque maximus porta tristique. Proin tincidunt, turpis ut tempor pretium, lectus ipsum ullamcorper leo, ac tincidunt felis dui non leo. Aenean porta augue ligula, non consequat ipsum aliquet et. Suspendisse ut suscipit ex. Pellentesque vitae lacinia arcu. Curabitur eget tincidunt nulla, non bibendum metus. Nullam mi ipsum, eleifend vitae tortor pulvinar, facilisis sollicitudin ipsum. - -Vestibulum molestie risus lorem, at feugiat lorem congue sed. Phasellus ullamcorper laoreet enim, nec aliquam turpis scelerisque et. Etiam dictum metus in elit aliquam dapibus. Vivamus vel lectus velit. Nam sed purus luctus, commodo dui quis, malesuada dui. Nulla porttitor aliquet elit sit amet viverra. Proin tempor nulla urna, non aliquet metus maximus quis. Aliquam ac lectus nec mi aliquam sagittis. Quisque venenatis quam eget nisl tempor, egestas rutrum eros eleifend. Nullam venenatis commodo velit, non tempor mauris fermentum ut. In a metus quis erat cursus sagittis. Donec congue nisl in viverra egestas. - -Vestibulum facilisis ligula magna, eu ornare lectus varius et. Mauris facilisis faucibus quam, quis mollis eros convallis non. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent sit amet rutrum erat. Suspendisse potenti. Donec lorem mi, sagittis a fringilla sit amet, sagittis bibendum mauris. In in diam et lorem rutrum eleifend a et felis. Sed ac magna quis enim faucibus dictum. Suspendisse blandit enim eu ex laoreet gravida. - -Suspendisse sed semper felis. Etiam mattis magna mi, suscipit ullamcorper tellus euismod sed. Aenean congue scelerisque ligula id sodales. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc sem lectus, gravida ac dui non, pharetra posuere leo. Maecenas lacus libero, facilisis et elit vitae, commodo facilisis sem. Vivamus id nisl nulla. Integer at maximus dui. Ut a tincidunt lorem. Vivamus vitae ligula vel lacus cursus condimentum. Phasellus quis mauris lobortis, finibus lorem in, vulputate ex. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed faucibus aliquam metus, quis varius elit porttitor id. Vivamus dignissim sollicitudin scelerisque. Morbi tincidunt, dolor quis vehicula consequat, dui diam condimentum nunc, vitae scelerisque odio libero nec ligula. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml deleted file mode 100644 index 26a79d669c..0000000000 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/amps/ags/rm-community/.editorConfig b/amps/ags/rm-community/.editorConfig deleted file mode 100644 index 48fa6b4b8e..0000000000 --- a/amps/ags/rm-community/.editorConfig +++ /dev/null @@ -1,17 +0,0 @@ - -# EditorConfig file: http://editorconfig.org/ -# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties - -# This is the Top level for the RM project -root = true - -# All files should use spaces. -[*] -indent_style = space - -# Just JS for now. -[*.js] -indent_size = 3 -trim_trailing_whitespace = true - -#TODO: css, xml, ftl, etc. diff --git a/amps/ags/rm-community/.jshintrc b/amps/ags/rm-community/.jshintrc deleted file mode 100644 index a54fb37ca2..0000000000 --- a/amps/ags/rm-community/.jshintrc +++ /dev/null @@ -1,45 +0,0 @@ - -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "es3": true, - "forin": true, - "freeze": true, - "funcscope": true, - "immed": true, - "indent": 3, - "iterator": true, - "latedef": true, - "maxcomplexity": 10, - "maxdepth": 50, - "maxerr": 50, - "maxlen": 250, - "maxparams": 50, - "maxstatements": 30, - "newcap": true, - "noarg": true, - "nonbsp": true, - "nonew": true, - "notypeof": true, - "shadow": "outer", - "undef": true, - "unused": true, - - "globals": { - "module": false, - "model": true, - "Alfresco": true, - "YAHOO": false, - "appContext": false, - "PDFJS": false, - "AlfrescoUtil": true, - "msg": false - }, - - "expr": true, - "strict": false, - - "browser": true, - "dojo": true -} \ No newline at end of file diff --git a/amps/ags/rm-community/LICENSE.txt b/amps/ags/rm-community/LICENSE.txt deleted file mode 100644 index cca7fc278f..0000000000 --- a/amps/ags/rm-community/LICENSE.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/amps/ags/rm-community/documentation/PatchService.md b/amps/ags/rm-community/documentation/PatchService.md deleted file mode 100644 index 3472dde7fe..0000000000 --- a/amps/ags/rm-community/documentation/PatchService.md +++ /dev/null @@ -1,14 +0,0 @@ -# RM Patch Service - -The RM Patch service operates independently of the Core Patch service & behaves differently. - -Schema numbering is sequential, it’s a 4 digit number, prefixed with the major/minor version number, e.g. schema from a 2.4 version will be 24xx. This is a different policy to the core numbering (which bumps the schema number by 10 for each release). - -Patches run in a single transaction. They may process data in batches, but it’s all wrapped in a single transaction, which is rolled back if the patch fails or is interrupted. AbstractModulePatch#245. When we implement applyInternal within a patch, that whole method runs inside a transaction. - -DB Schema numbers update only after every patch runs. This means if a patch fails, earlier patches will re run. (see: ModulePatchExecuterImpl.executeInternal#140). This behaviour is different than core’s behaviour, which updates the schema number after each successful patch. - -DB Schema number is stored in the attribute service (key: “module-schema”) against the RM’s module ID. This is not exposed in the UI. Nor in a REST API. The attribute service stores it directly in the DB, so isn’t even accessible via the node browser. -If a customer wants to determine the schema number for a running system, they’ll need to execute a DB query. - -It's possible to configure a patch not to run if being upgraded from a earlier schema version by setting `fixesFromSchema` in the patch config xml. diff --git a/amps/ags/rm-community/documentation/README.md b/amps/ags/rm-community/documentation/README.md deleted file mode 100644 index 8e5cf85337..0000000000 --- a/amps/ags/rm-community/documentation/README.md +++ /dev/null @@ -1,31 +0,0 @@ -## Community Technical Documentation Index - -* [Enterprise Technical Documentation](../../rm-enterprise/documentation/README.md) (the link will only work if this repository contains the enterprise code) -* [Overview of the design of RM](overview.md) -* Records Management - * File Plan - * List of Values - * Records - * EMail Records - * Filed and Unfiled Records - * Easy Access Records - * Physical Records - * Record Import and Export - * [Version Records](./versionRecords) - * Retention - * [Destruction](./destruction) - * Retention Schedules and Events - * Transfer and Accession -* Security - * [Extended permission service](security/extendedPermissionService.md) - * [Roles and Capabilities](security/rolesAndCapabilities.md) -* Discovery - * Governance Search - * Legal Holds -* Compliance - * Governance Audit - * Governance Rules -* Core Module Services - * [RM Patch Service](./PatchService.md) -* Build and Release - * [Build](./build) diff --git a/amps/ags/rm-community/documentation/build/README.md b/amps/ags/rm-community/documentation/build/README.md deleted file mode 100644 index 8a50c3219a..0000000000 --- a/amps/ags/rm-community/documentation/build/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## GS Build ![](https://img.shields.io/badge/Document_Level-In_Progress-yellow.svg?style=flat-square) - -Build location: https://bamboo.alfresco.com/bamboo/browse/RM (not externally accessible.) - -Build Flow: -![build](./resource/build.png) \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/build/resource/build.png b/amps/ags/rm-community/documentation/build/resource/build.png deleted file mode 100644 index 902e37424b..0000000000 Binary files a/amps/ags/rm-community/documentation/build/resource/build.png and /dev/null differ diff --git a/amps/ags/rm-community/documentation/build/resource/build.puml b/amps/ags/rm-community/documentation/build/resource/build.puml deleted file mode 100644 index 7c56bef154..0000000000 --- a/amps/ags/rm-community/documentation/build/resource/build.puml +++ /dev/null @@ -1,66 +0,0 @@ -@startuml - -Title: Governance Services Build Pipeline (RM HEAD) - -'build plans: -'Ent UI: Automated UI Tests Enterprise -'Com API: Automation Community REST API -'Ent API: Automation Enterprise REST API -'Community -'Com UI: Community Automated UI Tests -'Enterprise -'Ent L1: Enterprise Level 1 Automated UI Tests -'Ent L2: Level 2 Automated UI Tests Enterprise -'RM Benchmark Driver - - -start - -if(Trigger) then (commit to path) - if (rm-community/*) - :Community; - fork - :Ent L1; - fork again - :Enterprise; - fork - :Ent L2; - fork again - :Ent UI; - end fork - end fork - elseif (rm-enterprise/*) - :Enterprise; - fork - :Ent L2; - fork again - :Ent UI; - end fork - elseif (rm-automation/*) - fork - :Ent L1; - fork again - :Ent L2; - fork again - :Ent UI; - end fork - stop - elseif (rm-community-rest-api/*) - :Com API; - stop - elseif (rm-enterprise-rest-api/*) - :Ent API; - stop - elseif (rm-benchmark-driver/*) - :Benchmark; - stop - else - end - endif -else (Time: 1am) - :Community UI; - stop -endif -:Release Step; -end -@enduml \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/destruction/README.md b/amps/ags/rm-community/documentation/destruction/README.md deleted file mode 100644 index 67c3cd923a..0000000000 --- a/amps/ags/rm-community/documentation/destruction/README.md +++ /dev/null @@ -1,60 +0,0 @@ -## Destruction - -### Purpose - -Ensure the immediate and permanent destruction of sensitive content. - -This includes: - - * Records - * Classified content - -### Overview - -Sensitive content is immediately deleted from the content store. It does not get added to the trashcan or any other recoverable location and as such should not be recoverable. - -It is possible to configure the component to include a cleansing step prior to content deletion. This allows the binary content to be repeatedly overwritten prior to deletion to make it harder to forensically recover the binary data. - -Recorded content can be explicitly destroyed whilst maintaining the original node and associated meta-data. This is configured as a characteristic of the destruction step within a retention schedule. - -### Artifacts and Guidance - -* Source Code Link: [GitHub](https://github.com/Alfresco/records-management) -* License: Alfresco Community -* Issue Tracker Link: [JIRA RM](https://issues.alfresco.com/jira/projects/RM/summary) -* Contribution Model: Alfresco Closed Source -* Documentation: [docs.alfresco.com (Records Management)](http://docs.alfresco.com/rm2.4/concepts/welcome-rm.html) - -*** - -### Design - -#### Component Model - -#### Content Model - -* uri - http://www.alfresco.org/model/recordsmanagement/1.0 -* prefix - rma -* rma:ghosted - aspect that indicates that a records content has been destroyed, but the records meta-data is still available. - -#### Flows - -![Alfresco Destruction Flow Diagram](./resource/sequence/destruction-sequence.png) - -#### Class Diagram - -![Alfresco Destruction Class Diagram](./resource/class/destruction-class.png) - -*** - -### Interfaces and APIs - -*** - -### Configuration - -*** - -### Considerations - -*** diff --git a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.png b/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.png deleted file mode 100644 index 1b8b0e3832..0000000000 Binary files a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.png and /dev/null differ diff --git a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.puml b/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.puml deleted file mode 100644 index f2377c0ffb..0000000000 --- a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.puml +++ /dev/null @@ -1,43 +0,0 @@ -@startuml - -DestroyAction --> ContentDestructionComponent -ContentDestructionComponent <|-- ExtendedContentDestructionComponent -ContentDestructionComponent --> EagerContentStoreCleaner -EagerContentStoreCleaner --> ContentCleanser -ContentCleanser <|-- ContentCleanser522022M -ContentCleanser +-- OverwriteOperation - -class DestroyAction { - + boolean ghostingEnabled -} - -class ContentDestructionComponent { - + boolean cleansingEnabled - + void destroyContent(NodeRef nodeRef) - + void destroyContent(NodeRef nodeRef, boolean includeRenditions) - + void registerAllContentForDestruction(NodeRef nodeRef, boolean clearContentProperty) -} - -class ExtendedContentDestructionComponent { - + void onBeforeNodeDelete(NodeRef nodeRef) -} - -class EagerContentStoreCleaner { - + void registerOrphanedContentUrlForCleansing(String contentUrl) - # boolean deleteFromStore(String contentUrl, ContentStore store) -} - -abstract class ContentCleanser { - # OverwriteOperation overwriteZeros - # OverwriteOperation overwriteOnes - # OverwriteOperation overwriteRandom - + {abstract} void cleanse(File file) - # void overwrite(File file, OverwriteOperation overwriteOperation) -} - -abstract class OverwriteOperation { - + {abstract} void operation(OutputStream os) throws IOException -} - -@enduml - diff --git a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.png b/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.png deleted file mode 100644 index 06d4fb4426..0000000000 Binary files a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.png and /dev/null differ diff --git a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.puml b/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.puml deleted file mode 100644 index 3dc04692c2..0000000000 --- a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.puml +++ /dev/null @@ -1,40 +0,0 @@ -@startuml - -Title: Content Destruction and Cleansing Flow - -participant "Repository" as R -participant "Behaviour" as B -participant "ContentDestructionComponent" as CDC -participant "EagerContentStoreCleaner" as ECSC -participant ConentCleanser as CC -participant ContentStore as CS - -R->B:beforeNodeDelete -activate B - -note right of B: sensitive content -B->CDC:registerAllContentForDestruction -deactivate B -activate CDC -note right of CDC: cleansing enabled - -CDC->ECSC:registerOrphanedContentUrlForCleansing -deactivate CDC -activate ECSC - -ECSC->ECSC: registerOrphanedContentUrl - -R->ECSC:afterCommit - -ECSC->CC:cleanse -activate CC -CC->ECSC -deactivate CC - -ECSC->CS:delete -activate CS -CS->ECSC -deactivate CS -deactivate ECSC - -@enduml \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/overview.md b/amps/ags/rm-community/documentation/overview.md deleted file mode 100644 index c5918e396a..0000000000 --- a/amps/ags/rm-community/documentation/overview.md +++ /dev/null @@ -1,77 +0,0 @@ -## Records Management Technical Overview - -![Completeness Badge](https://img.shields.io/badge/Document_Level-Complete-green.svg?style=flat-square) - -![Version Badge](https://img.shields.io/badge/Version-Current-blue.svg?style=flat-square) - -### Purpose -The Alfresco Records Management (RM) modules are installed on top of Alfresco Content Services and use a similar REST API and service architecture. This document provides an overview of the standard patterns that have been used throughout the RM modules. - -*** - -### Overview -RM is split into two main parts - a repository integration and a Share integration. The Share module communicates with the repository module using REST API calls. The repository module includes integration with the Alfresco database. - -*** - -### Artifacts and Guidance - -* [Community Source Code](https://github.com/Alfresco/records-management) -* [Enterprise Source Code](https://github.com/Alfresco/governance-services) (for partners and customers) -* [Community License](../LICENSE.txt) -* [Enterprise License](../../rm-enterprise/LICENSE.txt) (this file will only be present in clones of the Enterprise repository) -* [Issue Tracker Link](https://issues.alfresco.com/jira/projects/RM) -* [Community Documentation Link](http://docs.alfresco.com/rm-community/concepts/welcome-rm.html) -* [Enterprise Documentation Link](http://docs.alfresco.com/rm/concepts/welcome-rm.html) -* [Contribution Model](../../CONTRIBUTING.md) - -*** - -### Prerequisite Knowledge -An understanding of Alfresco Content Services is assumed. The following pages from the [developer documentation](http://docs.alfresco.com/5.2/concepts/dev-for-developers.html) give useful background information: - -* [ACS Architecture](http://docs.alfresco.com/5.2/concepts/dev-arch-overview.html) -* [Platform Extensions](http://docs.alfresco.com/5.2/concepts/dev-platform-extensions.html) -* [Share Extensions](http://docs.alfresco.com/5.2/concepts/dev-extensions-share.html) - -*** - -### APIs and Interfaces -The RM Share module communicates with the repository module via REST APIs. Internally the RM repository module uses a three layer model: - -* A REST API layer responsible for converting API requests into service calls. -* A Java service layer responsible for handling business logic. -* A DAO layer responsible for CRUD operations against the database. - -#### REST API -The REST API endpoints fall into two main types - v0 (Webscripts) and v1. The [v0 API](http://docs.alfresco.com/5.2/references/dev-extension-points-webscripts.html) is older and not recommended for integrations. The [v1 API](http://docs.alfresco.com/5.1/pra/1/topics/pra-welcome-aara.html) is newer but isn't yet feature complete. If you are running RM locally then the GS API Explorer will be available at [this link](http://localhost:8080/gs-api-explorer/). - -Internally the GS v1 REST API is built on the [Alfresco v1 REST API framework](https://community.alfresco.com/community/ecm/blog/2016/10/11/v1-rest-api-part-1-introduction). It aims to be consistent with this in terms of behaviour and naming. - -#### Java Public API -The Java service layer is fronted by a [Java Public API](http://docs.alfresco.com/5.2/concepts/java-public-api-list.html), which we will ensure backward compatible with previous releases. Before we remove any methods there will first be a release containing that method deprecated to allow third party integrations to migrate to a new method. The Java Public API also includes a set of POJO objects which are needed to communicate with the services. It is easy to identify classes that are part of the Java Public API as they are annotated `@AlfrescoPublicApi`. - -Each Java service will have at least four beans defined for it: - -* A 'lowerCase' inner bean, which is the actual service implementation. -* An 'UpperCase' wrapper bean, which includes security and transaction management. This is the bean that should be used by third party integrations. -* A bean to handle transactions on the service methods. -* A bean to handle security restricting who can call different service methods. - -#### DAOs -The DAOs are not part of the Java Public API, but handle CRUD operations against RM stored data. We have some custom queries to improve performance for particularly heavy operations. - -We use standard Alfresco [data modelling](http://docs.alfresco.com/5.2/references/dev-extension-points-content-model.html) to store RM metadata. We extend the [Alfresco patching mechanism](http://docs.alfresco.com/5.2/references/dev-extension-points-patch.html) to provide community and enterprise schema upgrades. - -*** - -### Component Overview -![Information Governance Component Overview](./resource/component/ig-component.png) - -*** - -### Design Decisions - -| Decision | Rationale | Date | -| --------------- |:--------------------------:| ------------:| -| | | | diff --git a/amps/ags/rm-community/documentation/resource/class/governance-services.png b/amps/ags/rm-community/documentation/resource/class/governance-services.png deleted file mode 100644 index f682a9d1eb..0000000000 Binary files a/amps/ags/rm-community/documentation/resource/class/governance-services.png and /dev/null differ diff --git a/amps/ags/rm-community/documentation/resource/class/governance-services.puml b/amps/ags/rm-community/documentation/resource/class/governance-services.puml deleted file mode 100644 index 2dda190d31..0000000000 --- a/amps/ags/rm-community/documentation/resource/class/governance-services.puml +++ /dev/null @@ -1,308 +0,0 @@ -@startuml - -'Core ACS entities - -package "ACS core - content" { - - class Content { - } - - class Folder { - } - - class File { - } - - class Site { - } - -} - -package "RM Core" { - - class FilePlanComponent { - rootNodeRef: NodeRef - } - - class RecordsManagementContainer { - recordComponentIdentifier: String - } - - class RmSite { - } - - class FilePlan { - } - - class RecordCategory { - } - - class RecordFolder { - recordComponentIdentifier: String - } - - class Record { - recordComponentIdentifier: String - dateFiled: Date - originalName: String - location: String - } - - class DodRecord { - publicationDate: Date - originator: String - originatingOrganization: String - mediaType: String - format: String - dateReceived: Date - address: String - otherAddress: String - } - - class NonElectronicRecord { - physicalSize: Int - numberOfCopies: Int - storageLocation: String - shelf: String - box: String - file: String - } - - class EasyAccessRecord { - } - - class UnfiledRecordContainer { - } - - class UnfiledRecordFolder { - } - -} - -package "ACS core - people" { - - class User { - } - - class Group { - } -} - -package "RM Roles and Capabilities" { - class Role { - } - - class Capability { - name:String - } - -} - -package "Information Lifecycle Management" { - - class TransferContainer { - } - - class Transfer { - location : String - pdfIndicator : boolean - } - - class RetentionSchedule { - authority: String - instructions: String - recordLevelDisposition: Boolean - } - - class DispositionActionDefinition { - dispositionActionName: String - dispositionDescription: String - dispositionLocation: String - dispositionPeriod: Period - dispositionPeriodProperty: String - dispositionEvent: String - dispositionEventCombination: String - combineDispositionStepConditions: String - } - - class DispositionEvent { - } - - class DispositionLifecycle { - } - - class DispositionAction { - dispositionActionId: String - dispositionAction: String - dispositionAsOf: Date - manuallySetAsOf: Date - dispositionEventsEligible: Boolean - dispositionActionStartedAt: Date - dispositionActionStartedBy: String - dispositionActionCompletedAt: Date - dispositionActionCompletedBy: String - } - - class EventExecution { - } - -} - -note bottom of RetentionSchedule { - Retention is the new name for disposition. - Retention is the user facing name, - code refers to disposition -} - -note bottom of Transfer { - A holding pen for records - that are being transferred - out of the system -} - -package "Legal Holds" { - class HoldContainer { - } - - class Hold { - holdReason: String - } - - class Frozen { - frozenAt: Date - frozenBy: String - } - -} - -package "Security Controls" { - - class SecurityGroup <> { - enum groupType - {HIERARCHICAL, - USER_REQUIRES_ANY, - USER_REQUIRES_ALL} - unmarkedMark: SecurityMark - } - - class SecurityMark <> { - } - - class SecurityClassification <> { - } - - class ClassificationReason <> { - } - - class ClassificationExemption <> { - } - - class ClassificationInfo <> { - classification: SecurityClassification - reason:ClassificationReason[] - classifiedBy: String - agency:String - } - - class SourceReference <> { - name:String - originatingOrg:String - publicationDate:Date - } - - class DowngradeSchedule <> { - date:Date - event:String - instructions:String - } - - class DeclassificationSchedule <> { - date:Date - event:String - exemption:Exemption[] - } - - class ClassificationGuide <> { - } - - class DeclassificationTimeframe <> { - } -} - -Content <|-- Folder -Content <|-- File - -File <|-- Record -Folder <|-- RecordFolder - -Site <|-- RmSite - -Record <|- EasyAccessRecord -Folder "1" o-- "*" EasyAccessRecord - -Record <|-- DodRecord - -FilePlanComponent <|-- RecordsManagementContainer -FilePlanComponent <|-- RecordFolder -FilePlanComponent <|-- NonElectronicRecord -FilePlanComponent <|-- Record -RecordsManagementContainer <|-- Hold -RecordsManagementContainer <|-- UnfiledRecordContainer -RecordsManagementContainer <|-- HoldContainer -RecordsManagementContainer <|-- TransferContainer -RecordsManagementContainer <|-- FilePlan -RecordsManagementContainer <|-- RecordCategory - -RecordCategory "1" *- "*" RecordFolder -RecordCategory *- "*" RecordCategory - -note bottom of RecordCategory { - A RecordCategory may contain either RecordFolders or - RecordCategories but not both. A RecordCategory may only exist - as the child of either another RecordCategory or the FilePlan -} - -RecordFolder *- "*" Record : contains -RecordFolder *-- "*" NonElectronicRecord : contains - -UnfiledRecordContainer *-- "*" UnfiledRecordFolder -UnfiledRecordFolder *-- "*" Record - -FilePlan *- "*" RecordsManagementContainer -FilePlan "1" *- "*" RecordCategory - -RmSite "1" *- "1" FilePlan - -Hold "*" o- "*" FilePlanComponent : contains -HoldContainer *- "*" Hold -(FilePlanComponent, Hold) .. Frozen - -TransferContainer *- "*" Transfer -Transfer *- "*" Record - -DispositionLifecycle o- "0..1" DispositionAction: nextDispositionAction -DispositionLifecycle o- "*" DispositionAction: dispositionActionHistory - -RetentionSchedule o- "*" DispositionActionDefinition -RetentionSchedule o- "*" FilePlanComponent - -DispositionAction O-- "*" EventExecution - -Role o- "*" Capability -User o- "*" Role -Group o- "*" Role - -Content o-- "*" SecurityMark : securityControls -User o-- "*" SecurityMark : clearance -Group o-- "*" SecurityMark : clearance - -SecurityGroup "1" *- "*" SecurityMark -SecurityMark <|-- SecurityClassification -Content o- "0..1" SecurityClassification - -(Content, SecurityClassification) .. ClassificationInfo - -ClassificationInfo *-- "*" SourceReference -ClassificationInfo *-- "0..1" DowngradeSchedule - -@enduml \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/resource/component/ig-component.png b/amps/ags/rm-community/documentation/resource/component/ig-component.png deleted file mode 100644 index 788642c604..0000000000 Binary files a/amps/ags/rm-community/documentation/resource/component/ig-component.png and /dev/null differ diff --git a/amps/ags/rm-community/documentation/resource/component/ig-component.puml b/amps/ags/rm-community/documentation/resource/component/ig-component.puml deleted file mode 100644 index 1c446ccb46..0000000000 --- a/amps/ags/rm-community/documentation/resource/component/ig-component.puml +++ /dev/null @@ -1,58 +0,0 @@ -@startuml - -skinparam componentArrowColor white - -' IG Component Breakdown -rectangle "Information Governance" as IG { - - rectangle "Records Management" as RM { - - component "File Plan" as FP - - rectangle "Records" as Rec { - component "Filed and Unfiled Records" - component "Easy Access Records" - component "Version Records" - component "Physical Records" - component "Email Records" - component "Record Import and Export" - } - - rectangle "Retention" as Ret { - component "Retention Schedules and Events" - component "Transfer and Accession" - component "Destruction" - } - component "List of Values" as LOV - } - - rectangle "Security" as Sec { - component "Roles, Capabilities and Permissions" - component "Security Marks" - component "Content Classification" - } - - rectangle "Discovery" as Dis { - component "Search" - component "Legal Holds" - } - - rectangle "Compliance" as Comp { - component "Audit" - component "DoD 5015.2" - } - - rectangle "Automation" as Auto { - component "Rules" - } -} - -' Fomatting -RM -[hidden]---- Sec -RM -[hidden]---- Dis -Dis -[hidden]- Comp -Rec -[hidden]-- Ret -FP -[hidden]- LOV -Sec -[hidden]-- Auto - -@enduml \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/resource/image/CapabilitiesAndRoles.png b/amps/ags/rm-community/documentation/resource/image/CapabilitiesAndRoles.png deleted file mode 100644 index 606a7d3a73..0000000000 Binary files a/amps/ags/rm-community/documentation/resource/image/CapabilitiesAndRoles.png and /dev/null differ diff --git a/amps/ags/rm-community/documentation/security/extendedPermissionService.md b/amps/ags/rm-community/documentation/security/extendedPermissionService.md deleted file mode 100644 index abc7d4a7d5..0000000000 --- a/amps/ags/rm-community/documentation/security/extendedPermissionService.md +++ /dev/null @@ -1,68 +0,0 @@ -## Alfresco Governance Services' Extended Permission Service - -![Completeness Badge](https://img.shields.io/badge/Document_Level-Complete-green.svg?style=flat-square) - -![Version Badge](https://img.shields.io/badge/Version-Current-blue.svg?style=flat-square) - -### Purpose - -When working on the Records Management module, we needed additional functionality around permissions, and therefore -introduced the [ExtendedPermissionService](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java). - -### Overview - -The ExtendedPermissionService is wired in, via [Spring config](../../rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml), -to extend Alfresco's core PermissionService, and adds support for: -* the [RMPermissionModel](../../rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java), which defines the available permissions capabilities. -* the [PermissionProcessorRegistry](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java), which introduces pre- and post- processors. -* other minor method extensions (e.g. to setInheritParentPermissions) - -### Permission Processor Registry - -This was added in RM 2.4 to support the requirements around the additional security classifications and markings. - -The registry is simply two array lists, one for pre-processors and one for post-processors, which are iterated around -before / after (respectively) the wrapped call PermissionService.hasPermission - -Out of the box, a system with the RM module installed will have the following permissions processors defined: - -#### Community: - -##### Pre-processors: -* None. - -##### Post-processors: -* [RecordsManagementPermissionPostProcessor](../../rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java) - * If the node is an RM node (i.e. it has the [RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT](../../rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java) marker aspect) and the - core permissions evaluates to DENIED, then this post processor allows read/writes if the appropriate read/file - permissions are present. - -#### Enterprise: -(links only work in clones of Enterprise repos) - -##### Pre-processors: -* [SecurityMarksPermissionPreProcessor](../../rm-enterprise/rm-enterprise-repo/src/main/java/org/alfresco/module/org_alfresco_module_rm/securitymarks/permission/SecurityMarksPermissionPreProcessor.java) - * For all content: denies the result if the required security clearance rules (for classification or marks) are not satisfied. (uses -[securityClearanceService.isClearedFor](../../rm-enterprise/rm-enterprise-repo/src/main/java/org/alfresco/module/org_alfresco_module_rm/securitymarks/SecurityClearanceServiceImpl.java)) - -##### Post-processors: -* None. - - -### Configuration and Extension points - -Additional processors can be defined by extending either [PermissionPreProcessorBaseImpl](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java) -or [PermissionPostProcessorBaseImpl](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java) -which call the add method on the appropriate list during init. - -### Performance Implications - -There is certainly a performance overhead when adding additional processing to permission checks. This is most noticeable - in the SecurityMarksPermissionPreProcessor where we need to call out to an external service. This has been profiled - heavily and optimised during 2.5 and 2.6 development. - - ###TODO: - Not yet documented (in related areas of the code) are: - * Capabilities (see rm-capabilities-*.xml, declarativeCapability.java and DeclarativeCompositeCapability.java) - * RM's permission system has an any allow allows policy unlike alfresco which policy is any deny denies - \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/security/rolesAndCapabilities.md b/amps/ags/rm-community/documentation/security/rolesAndCapabilities.md deleted file mode 100644 index c3372d5b1c..0000000000 --- a/amps/ags/rm-community/documentation/security/rolesAndCapabilities.md +++ /dev/null @@ -1,41 +0,0 @@ -## Alfresco Governance Services' Roles and Capabilities - -![Completeness Badge](https://img.shields.io/badge/Document_Level-InProgress-yellow.svg?style=flat-square) - -![Version Badge](https://img.shields.io/badge/Version-Current-blue.svg?style=flat-square) - -### Purpose - -Roles and capabilities allow the GS system to provide a finer grain security evaluation, determining whether an authority has the capability to perform a perticular action on a node. - -### Overview - -Roles are defined as a collection of capabilities. A capability, generally, has a one to one relationship with an action within the system. - -Authorities are assigned roles. If an authority is assigned to a role then it that authority has the capabilities contained within that role, allowing them to perform the related actions. - -An authority can be assigned many roles, with the associated capabilities being additive. - -Capabilties are evaluated in addition to any ACLs attached to a node, but they are mutally exclusive. A authority may have the capability, but not the permissions on a node and vice versa. - -### Design - -Roles are implementented as groups. So for every role that is created, there is a corresponding group within the system. - -Capabilities are implemented as permissions. In order add a new capability to the system, the extended RM permission model needs to be extended. - -When a capability is added to a role, then the capability group is assigned the capability role on the root file plan node. - -In this way the permissions of the systems roles reflect their capabilities on the file plan via the capability permissions assigned. - -When an authority is assigned to a role, that authority is added as a member of the corresponding role group. In this way they inherit the capability permissions on the file plan that relate to that role group. - -If a user attempts to perform an action on a records management artifact which has a related capability. Assuming the user has permission to see the artifact in the first place, then the users capability to perform the action is evaluated. - -This is done by firstly determining whether the capability is relevant for this 'kind' of records management artifact. For example the addHold capability is not relevant for a record category. - -Then the capability permission is evaluated by traversing to the file plan node and checking whether the current user has the capabilty permission byt virtue of it's membership of the right role group. - -Finally any further conditions attached to the capability are evaluated. - -![](../resource/image/CapabilitiesAndRoles.png) \ No newline at end of file diff --git a/amps/ags/rm-community/documentation/versionRecords/README.md b/amps/ags/rm-community/documentation/versionRecords/README.md deleted file mode 100644 index 405827ed13..0000000000 --- a/amps/ags/rm-community/documentation/versionRecords/README.md +++ /dev/null @@ -1,20 +0,0 @@ -## Version Records ![](https://img.shields.io/badge/Document_Level-In_Progress-yellow.svg?style=flat-square) - -### Notes: - -NodesService varies depending on store. Version Service has a different service that hydrates effectively fake nodes (which contain url, version details, associations, aspects, as denormalised meta data) back into a full node - -Recorded Versions take content out of version store and create a record by version store implementation extension. - -Declaring record as version - standard use case is auto declaring or via records. Head version is extracted to a record, rather than a new version being created - -Records are linked by association - -Disposition events can be triggered automatically from versioning events. - -### Diagram: - -![Version Records Primer](./RecordedVersions.png) - - - diff --git a/amps/ags/rm-community/documentation/versionRecords/RecordedVersions.png b/amps/ags/rm-community/documentation/versionRecords/RecordedVersions.png deleted file mode 100644 index 7ac208b9e2..0000000000 Binary files a/amps/ags/rm-community/documentation/versionRecords/RecordedVersions.png and /dev/null differ diff --git a/amps/ags/rm-community/pom.xml b/amps/ags/rm-community/pom.xml deleted file mode 100644 index c154e185f1..0000000000 --- a/amps/ags/rm-community/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - alfresco-governance-services-community-repo-parent - pom - Alfresco Governance Services Community - - - org.alfresco - alfresco-governance-services-community-parent - 11.28-SNAPSHOT - - - - rm-community-rest-api-explorer - rm-community-repo - - - - - LGPL 3 - - - diff --git a/amps/ags/rm-community/rm-community-repo/.env b/amps/ags/rm-community/rm-community-repo/.env deleted file mode 100644 index bf5f645726..0000000000 --- a/amps/ags/rm-community/rm-community-repo/.env +++ /dev/null @@ -1,4 +0,0 @@ -TRANSFORMERS_TAG=2.3.10 -SOLR6_TAG=2.0.1 -POSTGRES_TAG=13.1 -ACTIVEMQ_TAG=5.16.1 diff --git a/amps/ags/rm-community/rm-community-repo/.maven-dockerignore b/amps/ags/rm-community/rm-community-repo/.maven-dockerignore deleted file mode 100644 index 112bd18249..0000000000 --- a/amps/ags/rm-community/rm-community-repo/.maven-dockerignore +++ /dev/null @@ -1 +0,0 @@ -target/docker/ \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/Dockerfile b/amps/ags/rm-community/rm-community-repo/Dockerfile deleted file mode 100644 index 751002a18b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -### Apply AGS community repo AMP to ACS image -FROM alfresco/alfresco-community-repo-base:${image.tag} - -# Alfresco user does not have permissions to modify webapps or configuration. Switch to root. -# The access will be fixed after all operations are done. -USER root - -COPY target/alfresco-governance-services-community-repo-*.amp /usr/local/tomcat/amps/ -COPY target/alfresco-share-services-*.amp /usr/local/tomcat/amps/ - -# Install amps on alfresco.war -RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \ - /usr/local/tomcat/amps \ - /usr/local/tomcat/webapps/alfresco -directory -nobackup - -### Copy gs-api-explorer war into webapps folder -COPY target/gs-api-explorer-*.war /usr/local/tomcat/webapps/ - -### Unpack gs-api-explorer.war -RUN mkdir /usr/local/tomcat/webapps/gs-api-explorer && cd /usr/local/tomcat/webapps/gs-api-explorer && \ - jar -xvf /usr/local/tomcat/webapps/gs-api-explorer-*.war && rm -f /usr/local/tomcat/webapps/gs-api-explorer-*.war - -# All files in the tomcat folder must be owned by root user and Alfresco group as mentioned in the parent Dockerfile -RUN chgrp -R Alfresco /usr/local/tomcat && \ - find /usr/local/tomcat/webapps -type d -exec chmod 0750 {} \; && \ - find /usr/local/tomcat/webapps -type f -exec chmod 0640 {} \; && \ - chmod -R g+r /usr/local/tomcat/webapps - -# Switching back to alfresco user after having added amps files to run the container as non-root -USER alfresco diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml deleted file mode 100644 index 16728d43c7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml deleted file mode 100644 index e7358d2770..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - {http://www.alfresco.org/model/content/1.0}content - - - - - - - - - - - - - - - - {http://www.alfresco.org/model/content/1.0}content - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties deleted file mode 100644 index a669cf8351..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties +++ /dev/null @@ -1,137 +0,0 @@ -# Enable ghosting of records on deletion -rm.ghosting.enabled=true - -# Notification configuration -rm.notification.role=RecordsManager -# NOTE: the notification subject can now be set within the usual I18N property files per notification template - -# -# Turn off imap server attachments if we are using RM. -# TODO : Longer term needs to have a query based, dynamic -# exclusion for RM sites. -# -imap.server.attachments.extraction.enabled=false - -# -# Enable auditing -# -audit.enabled=true -audit.rm.enabled=true -audit.rm.viewLog.maxSize=100 -#audit.rm.runas=admin - -#audit.filter.alfresco-access.transaction.user=~null;.* - -# -# Extended permission service cache sizing -# -cache.writersSharedCache.maxItems=10000 -cache.writersSharedCache.cluster.type=fully-distributed - -# -#A cache for the json Conversion Component cache -# -cache.jsonConversionComponentCache.cluster.type=fully-distributed -cache.jsonConversionComponentCache.tx.maxItems=50 -cache.jsonConversionComponentCache.tx.statsEnabled=${caches.tx.statsEnabled} -cache.jsonConversionComponentCache.maxItems=0 -cache.jsonConversionComponentCache.timeToLiveSeconds=0 -cache.jsonConversionComponentCache.maxIdleSeconds=0 -cache.jsonConversionComponentCache.backup-count=1 -cache.jsonConversionComponentCache.eviction-policy=NONE -cache.jsonConversionComponentCache.merge-policy=com.hazelcast.map.merge.PutIfAbsentMapMergePolicy -cache.jsonConversionComponentCache.nearCache.maxSize=50 -cache.jsonConversionComponentCache.nearCache.maxIdleSeconds=0 -cache.jsonConversionComponentCache.nearCache.timeToLiveSeconds=0 -cache.jsonConversionComponentCache.readBackupData=false - -# -# Indicates whether RM rules will be run as Admin or not by default -# -rm.rule.runasadmin=true - -# -# Auto-complete suggestion parameters -# -# The minimum size of fragment supplied that will trigger a search for suggestions for auto completion -rm.autocompletesuggestion.minfragmentsize=2 -# The maximum number of path suggestions to supply -rm.autocompletesuggestion.maxsuggestions.path=5 -# The maximum number of node suggestions to supply -rm.autocompletesuggestion.maxsuggestions.node=5 -# The maximum number of date suggestions to supply -rm.autocompletesuggestion.maxsuggestions.date=5 -# Comma separated list of types/aspects to be used by the node parameter autocomplete suggester -rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes=rma:record,cm:content - -# -# Global RM retention lifecycle trigger cron job expression -# -rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ? - -# -# Global RM retention lifecycle cron job execution batch size -# -rm.dispositionlifecycletrigger.batchsize=500 - -# -# Global RM notify of records due for review cron job expression -# -rm.notifyOfRecordsDueForReview.cronExpression=0 0/15 * * * ? - -# -# Records contributors group -# -# 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 - -# -# Content cleansing -# -rm.content.cleansing.enabled=false -rm.content.cleaner=contentCleanser.522022M - -# Indicates whether mandatory properties are checked before completing a record -# -rm.completerecord.mandatorypropertiescheck.enabled=true - -# -# Indicates whether the existing file plan is converted to a standard file plan during -# upgrade to V2.2, otherwise it will be converted to a DoD compliant file plan. -# -# Note that when converted to a standard file plan that DoD related record meta-data remains -# on the individual records and will not be visible in the UI, but can be assessed via -# deprecated model properties in the rma namespace. -# -rm.patch.v22.convertToStandardFilePlan=false - -# Permission mapping -# these take a comma separated string of permissions from org.alfresco.service.cmr.security.PermissionService -# read maps to ReadRecords and write to FileRecords -rm.haspermissionmap.read=ReadProperties,ReadChildren -rm.haspermissionmap.write=WriteProperties,AddChildren - -# -# Extended auto-version behaviour. If true and other auto-version properties are satisfied, then -# a document will be auto-versioned when its type is changed. -# -version.store.enableAutoVersionOnTypeChange=false - -# -# Enable auto-version to be created when there is a difference between the document and latest record state -# to ensure that the created version record matches the current document state, -# otherwise create the version record from the version history -# -rm.enableAutoVersionOnRecordCreation=false - -# -# Metadata Extraction -# -content.metadata.async.extract.6.enabled=false - -# Max number of entries returned in Record search view -rm.recordSearch.maxItems=500 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml deleted file mode 100644 index 7e8cfc0eb6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml deleted file mode 100644 index 38fd599a62..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - workspace - SpacesStore - rm_config_folder - Records Management - Records Management - Configuration information for the Records Management application. - - - - - - - - - - - workspace - SpacesStore - rm_event_config - Records management event configuration. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json|mimetype=text/plain|encoding=UTF-8 - rm_event_config.json - rm_event_config.json - - - - - - - - - workspace - SpacesStore - records_management_custom_model - Records Management Custom Model - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml|mimetype=text/plain|encoding=UTF-8 - recordsCustomModel.xml - recordsCustomModel.xml - {http://www.alfresco.org/model/rmcustom/1.0}rmcustom - Records Management Custom Model - Alfresco - 1.0 - true - - - - - - workspace - SpacesStore - rm_behavior_scripts - Records Management Behavior Scripts - Records Management Behavior Scripts - Scripts intended for execution in response to RM events. - - - - - - - - - - workspace - SpacesStore - Records management sample script. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js|mimetype=text/javascript|encoding=UTF-8 - onCreate_supersedes.js - onCreate_supersedes.js - - - - - - - - - workspace - SpacesStore - rm_scripts - Records Management Scripts - Records Management Scripts - Scripts specific to RM that can also be executed by RM rules. - - - - - - workspace - SpacesStore - records_management_email_templates - Records Management Email Templates - Records Management Email Templates - Email templates for records management. - - - - - - - - - - - - - true - - Email template for notify records due for review job. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_ - notify-records-due-for-review-email.ftl - - notify-records-due-for-review-email.ftl - org_alfresco_module_rm_notificationTemplatePatch - - - - - - - - - - - workspace - SpacesStore - record_superseded_template - Record superseded email template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl|mimetype=text/plain|encoding=UTF-8 - record-superseded-email.ftl - record-superseded-email.ftl - org_alfresco_module_rm_notificationTemplatePatch - - - - - - - - - - workspace - SpacesStore - record_rejected_template - Record rejected email template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl|mimetype=text/plain|encoding=UTF-8 - record-rejected-email.ftl - record-rejected-email.ftl - org_alfresco_module_rm_notificationTemplatePatch - - - - - - - - - workspace - SpacesStore - rm_report_templates - Records Management Report Templates - Records Management Report Templates - Records management report templates. - - - - - - - - - - workspace - SpacesStore - rmr_destructionReport - Desruction report template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl|mimetype=text/plain|encoding=UTF-8 - Destruction Report Template - report_rmr_destructionReport.html.ftl - - - - - - - - - - - workspace - SpacesStore - rmr_transferReport - Transfer report template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl|mimetype=text/plain|encoding=UTF-8 - Transfer Report Template - report_rmr_transferReport.html.ftl - - - - - - - - - - - workspace - SpacesStore - rmr_holdReport - Hold report template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl|mimetype=text/plain|encoding=UTF-8 - Hold Report Template - report_rmr_holdReport.html.ftl - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl deleted file mode 100644 index fd8dae9589..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl +++ /dev/null @@ -1,150 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
- Records due for review. -
-
- ${date?datetime?string.full} -
-
-
-

Hi,

- -

The following records are now due for review:

- - <#if (args.records)??> - - <#list args.records as record> - - - - <#if record_has_next> - - - -
- - - - - -
- - - - - - - - - - - - -
${record.properties["rma:identifier"]!} ${record.name}
Click on this link to view the record:
- - ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${record.storeType}://${record.storeId}/${record.id} -
-
-
- - -

Sincerely,
- Alfresco ${productName!""}

-
-
-
-
 
-
- To find out more about Alfresco ${productName!""} visit http://www.alfresco.com -
-
 
-
- -
-
-
- - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js deleted file mode 100644 index 4c893604fa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Main entrypoint for script. - * - * @method main - */ -function main() -{ - // Log debug message - logger.log("Record " + node.name + " has been superseded. Sending notification"); - - // Send notification - rmService.sendSupersededNotification(node); -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl deleted file mode 100644 index 705f2ac459..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl +++ /dev/null @@ -1,146 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
- Record has been rejected -
-
- ${args.rejectDate?datetime?string.full} -
-
-
-

Hello ${args.recordCreator},

- -

${args.rejectedPerson} has rejected the following record with this reason:

- -

${args.rejectReason}

- - - - - - -
- - - - - -
- - - - - - - - - - - - -
${args.recordId} ${args.recordName}
Click on this link to view the record:
- - ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id} -
-
-
- -

Sincerely,
- Alfresco ${productName!""}

-
-
-
-
 
-
- To find out more about Alfresco ${productName!""} visit http://www.alfresco.com -
-
 
-
- -
-
-
- - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl deleted file mode 100644 index f85a05aa81..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl +++ /dev/null @@ -1,144 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
- Superseded record. -
-
- ${date?datetime?string.full} -
-
-
-

Hi,

- -

The following record been superseded:

- - - - - - -
- - - - - -
- - - - - - - - - - - - -
${args.record.properties["rma:identifier"]!} ${args.record.name}
Click on this link to view the record:
- - ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id} -
-
-
- -

Sincerely,
- Alfresco ${productName!""}

-
-
-
-
 
-
- To find out more about Alfresco ${productName!""} visit http://www.alfresco.com -
-
 
-
- -
-
-
- - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml deleted file mode 100644 index 15fad5c368..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - Records Management Custom Model - Alfresco - 1.0 - - - - - - - - - - - - - - - - - - - - - - - listconstraint.rmc_smList.title - - - - - true - - - - - listconstraint.rmc_tlList.title - - - - - true - - - - - - - - - - Supplemental Marking List - d:text - false - true - - - - - - - - - - Records Management Custom Associations - - - - - Superseded By__Supersedes - - false - true - - - rma:record - false - true - - - - - Obsoleted By__Obsoletes - - false - true - - - rma:record - false - true - - - - - Next Version__Previous Version - - false - true - - - rma:record - false - true - - - - - Supporting Documentation__Supported Documentation - - false - true - - - rma:record - false - true - - - - - Cross-Reference - - false - true - - - rma:record - false - true - - - - - Rendition - - false - true - - - rma:record - false - true - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json deleted file mode 100644 index 41a44c405e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "events" : - [ - { - "eventType" : "rmEventType.simple", - "eventName" : "case_closed", - "eventDisplayLabel" : "rmevent.case_closed" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "abolished", - "eventDisplayLabel" : "rmevent.abolished" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "re_designated", - "eventDisplayLabel" : "rmevent.re_designated" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "no_longer_needed", - "eventDisplayLabel" : "rmevent.no_longer_needed" - }, - { - "eventType" : "rmEventType.superseded", - "eventName" : "superseded", - "eventDisplayLabel" : "rmevent.superseded" - }, - { - "eventType" : "rmEventType.versioned", - "eventName" : "versioned", - "eventDisplayLabel" : "rmevent.versioned" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "study_complete", - "eventDisplayLabel" : "rmevent.study_complete" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "training_complete", - "eventDisplayLabel" : "rmevent.training_complete" - }, - { - "eventType" : "rmEventType.crossReferencedRecordTransfered", - "eventName" : "related_record_trasfered_inactive_storage", - "eventDisplayLabel" : "rmevent.related_record_trasfered_inactive_storage" - }, - { - "eventType" : "rmEventType.obsolete", - "eventName" : "obsolete", - "eventDisplayLabel" : "rmevent.obsolete" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "all_allowances_granted_are_terminated", - "eventDisplayLabel" : "rmevent.all_allowances_granted_are_terminated" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "WGI_action_complete", - "eventDisplayLabel" : "rmevent.WGI_action_complete" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "separation", - "eventDisplayLabel" : "rmevent.separation" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "case_complete", - "eventDisplayLabel" : "rmevent.case_complete" - }, - { - "eventType": "rmEventType.simple", - "eventName": "declassification_review", - "eventDisplayLabel": "rmevent.declassification_review" - } - ] -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js deleted file mode 100644 index ce98d3f166..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Main entrypoint for script. - * This sample script simply echoes the name of the node with the changed property. - * - * @method main - */ -function main() -{ - logger.log("Sample RM script. No-op run on node " + node.name); -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl deleted file mode 100644 index 7b15caf329..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl +++ /dev/null @@ -1,142 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - - - - - - - -
- - - - -
- - - - - - - -
- - - - -
- - - - - -
- - -
- ${message("file.report.destruction.report")} -
-
-
- - - - - - - - - - - - - -
${message("file.report.destroyed")} <#if node.hasAspect("rma:record")>${message("file.report.record")}<#else>${message("file.report.record.folder")}:${node.properties["rma:identifier"]} ${node.properties.name}
${message("file.report.disposition.authority")}: - <#if node.properties["rma:recordSearchDispositionAuthority"]??> - ${node.properties["rma:recordSearchDispositionAuthority"]} - -
${message("file.report.disposition.instructions")}: - <#if node.properties["rma:recordSearchDispositionInstructions"]??> - ${node.properties["rma:recordSearchDispositionInstructions"]} - -
- <#if node.childAssociations["cm:contains"]??> -
- - - - - -
${message("file.report.destroyed.records")}:
- - - - -
- - <#list node.childAssociations["cm:contains"] as child> - - - - - -
- - - - - - -
${child.properties["rma:identifier"]} ${child.properties.name}
-
-
- -
-
-
-
- -
-
-
- - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl deleted file mode 100644 index 823fa92bbe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl +++ /dev/null @@ -1,151 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - - - - - - - -
- - - - -
- - - - - - - -
- - - - -
- - - - - -
- - -
- ${message("file.report.hold.report")} -
-
-
- - - - - - - - - - - - - - - - - - - - - -
${message("file.report.hold.name")}:${node.properties["cm:name"]}
${message("file.report.hold.description")}: - <#if node.properties["cm:description"]??> - ${node.properties["cm:description"]} - -
${message("file.report.hold.reason")}:${node.properties["rma:holdReason"]}
${message("file.report.createdby")}:${reportUser}
${message("file.report.createdon")}:${reportDate}
- <#if node.childAssociations["rma:frozenContent"]??> -
- - - - - -
${message("file.report.hold.held")}:
- - - - -
- - <#list node.childAssociations["rma:frozenContent"] as child> - - - - - -
- - - - - - -
- <#if child.properties["rma:identifier"]??> - ${child.properties["rma:identifier"]} - - ${child.properties.name} -
-
-
- -
-
-
-
- -
-
-
- - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl deleted file mode 100644 index f11ea4f258..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl +++ /dev/null @@ -1,113 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - <#assign isAccession=node.properties["rma:transferAccessionIndicator"]> - - <#if isAccession> - ${message("file.report.acession.report")} - <#else> - ${message("file.report.transfer.report")} - - - - - <#if isAccession> -

${message("file.report.acession.report")}

- <#else> -

${message("file.report.transfer.report")}

- - - - - - - - - - - - - - - - - - -
${message("file.report.transfer.date")}:${node.properties["cm:created"]?string(message("file.report.date.format"))?html}
${message("file.report.transfer.location")}: - <#if isAccession> - ${message("file.report.nara")} - <#else> - ${node.properties["rma:transferLocation"]?html} - -
${message("file.report.performed.by")}:${node.properties["cm:creator"]?html}
${message("file.report.disposition.authority")}:${properties["dispositionAuthority"]?html}
-

${message("file.report.transferred.items")}

-
- <#list properties.transferNodes as transferNode> - <#if transferNode.properties["isFolder"]> - <@generateTransferFolderHTML transferNode/> - <#else> - <@generateTransferRecordHTML transferNode/> - - -
- - - -<#macro generateTransferFolderHTML transferNode> - - ${transferNode.properties["name"]?html} - - (${message("file.report.unique.folder.identifier")}: ${transferNode.properties["identifier"]?html}) -
- <#list transferNode.properties["records"] as record> - <@generateTransferRecordHTML record/> - -
- - -<#macro generateTransferRecordHTML transferNode> -
- - ${transferNode.properties["name"]?html} - - (${message("file.report.unique.record.identifier")}: ${transferNode.properties["identifier"]?html}) - <#if transferNode.properties["isDeclared"]> - ${message("file.report.declared.by")} - ${transferNode.properties["declaredBy"]?html} - ${message("file.report.declared.on")} - ${transferNode.properties["declaredOn"]?string(message("file.report.date.format"))?html} - -
- diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config.xml deleted file mode 100644 index cac7222746..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - surf-config - SpacesStore - en_US_ - workspace - false - - - - - - - - - - - - components - SpacesStore - en_US_ - workspace - false - - - - - - - - - - - - page.title.site~${siteId}~dashboard.xml - SpacesStore - en_US_ - contentUrl=surf-config/content0.bin|mimetype=application/octet-stream|size=260|encoding=UTF-8|locale=en_US_ - workspace - false - - - - - - - - - - - page.navigation.site~${siteId}~dashboard.xml - SpacesStore - en_US_ - contentUrl=surf-config/content1.bin|mimetype=application/octet-stream|size=280|encoding=UTF-8|locale=en_US_ - workspace - false - - - - - - - - - - - page.component-1-1.site~${siteId}~dashboard.xml - SpacesStore - en_US_ - contentUrl=surf-config/content2.bin|mimetype=application/octet-stream|size=326|encoding=UTF-8|locale=en_US_ - workspace - false - - - - - - - - - - - page.component-2-1.site~${siteId}~dashboard.xml - SpacesStore - en_US_ - contentUrl=surf-config/content3.bin|mimetype=application/octet-stream|size=270|encoding=UTF-8|locale=en_US_ - workspace - false - - - - - - - - - - - page.component-2-2.site~${siteId}~dashboard.xml - SpacesStore - en_US_ - contentUrl=surf-config/content4.bin|mimetype=application/octet-stream|size=272|encoding=UTF-8|locale=en_US_ - workspace - false - - - - - - - - - - - - - - pages - SpacesStore - en_US_ - workspace - false - - - - - - - - - - - - site - SpacesStore - en_US_ - workspace - false - - - - - - - - - - - - ${siteId} - SpacesStore - en_US_ - workspace - false - - - - - - - - - - - - dashboard.xml - SpacesStore - en_US_ - contentUrl=surf-config/content5.bin|mimetype=application/octet-stream|size=481|encoding=UTF-8|locale=en_US_ - workspace - false - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content0.bin b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content0.bin deleted file mode 100644 index 39e5ce4c50..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content0.bin +++ /dev/null @@ -1,9 +0,0 @@ - - - - page.title.site~${siteId}~dashboard - page - title - site/${siteId}/dashboard - /components/title/collaboration-title - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content1.bin b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content1.bin deleted file mode 100644 index f02b325028..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content1.bin +++ /dev/null @@ -1,9 +0,0 @@ - - - - page.navigation.site~${siteId}~dashboard - page - navigation - site/${siteId}/dashboard - /components/navigation/collaboration-navigation - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content2.bin b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content2.bin deleted file mode 100644 index f0702153f5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content2.bin +++ /dev/null @@ -1,12 +0,0 @@ - - - - page.component-1-1.site~${siteId}~dashboard - page - component-1-1 - site/${siteId}/dashboard - /components/dashlets/colleagues - - 504 - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content3.bin b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content3.bin deleted file mode 100644 index 9b7378c963..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content3.bin +++ /dev/null @@ -1,9 +0,0 @@ - - - - page.component-2-1.site~${siteId}~dashboard - page - component-2-1 - site/${siteId}/dashboard - /components/dashlets/docsummary - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content4.bin b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content4.bin deleted file mode 100644 index 2d07e1d2ac..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content4.bin +++ /dev/null @@ -1,9 +0,0 @@ - - - - page.component-2-2.site~${siteId}~dashboard - page - component-2-2 - site/${siteId}/dashboard - /components/dashlets/activityfeed - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content5.bin b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content5.bin deleted file mode 100644 index b11c5990c1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/site/surf-config/content5.bin +++ /dev/null @@ -1,14 +0,0 @@ - - - - Records Management Site Dashboard - page.rmSiteDashboard.title - Records Management site's dashboard page - page.rmSiteDashboard.description - dashboard-2-columns-wide-right - user - - [{"pageId":"documentlibrary"}, {"pageId":"rm-search"}] - {"documentlibrary":{"titleId":"page.rmDocumentLibrary.title", "descriptionId":"page.rmDocumentLibrary.description", "type":"dod5015"}} - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml deleted file mode 100644 index cd2480e1f4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml deleted file mode 100644 index a8f7bc8941..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml deleted file mode 100644 index d008a44c01..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml deleted file mode 100644 index 62ab932604..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml deleted file mode 100644 index fc8b3cd0e9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - FILE_PLAN_COMPONENT - - - - - - - - - - - - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - TRANSFER - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml deleted file mode 100644 index 4059dbb88a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml deleted file mode 100644 index a5dfa0f8fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FILE_PLAN - - - - - - - - - - - - - - - - RECORD_CATEGORY - DISPOSITION_SCHEDULE - - - - - - - - - - - - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - TRANSFER_CONTAINER - TRANSFER - - - - - - - - - - - - - - TRANSFER_CONTAINER - - - - - - - - - - - - - - - HOLD_CONTAINER - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml deleted file mode 100644 index c07f8bf69f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - FILE_PLAN - HOLD_CONTAINER - - - - - - - - - - - - - - - - - HOLD_CONTAINER - HOLD - - - - - - - - - - - - - - - - - HOLD - - - - - - - - - - - - - - - - - HOLD - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - HOLD - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - HOLD - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml deleted file mode 100644 index 955c4f6548..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml deleted file mode 100644 index 40a454449b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - RECORD - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml deleted file mode 100644 index 97f9aee406..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml deleted file mode 100644 index 3f2e5174c4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml deleted file mode 100644 index 2a6e997bcf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml deleted file mode 100644 index 8eb23e4180..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml deleted file mode 100644 index d8e94ea0ba..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.acp b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.acp deleted file mode 100644 index a7d23b0890..0000000000 Binary files a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.acp and /dev/null differ diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml deleted file mode 100644 index be126f3e62..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml +++ /dev/null @@ -1,1046 +0,0 @@ - - - - - - - Reports - 0318 - Reports - Record series for reports - - - - - - - - - - - - - AIS Audit Records - 0318-01 - AIS Audit Records - Consisting of AIS Security Officer or Terminal Area Security Officer weekly audit records of audit actions performed on all AIS as required by applicable policy which are maintained by any JS/combatant command activity. - week|1 - true - - - - - - - - - N1-218-00-4 item 023 - Cut off monthly, hold 1 month, then destroy. - - - - - - - - cutoff - monthend|1 - - - - - destroy - month|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - January AIS Audit Records - January AIS Audit Records - 0318-01-01 - week|1 - true - - - - - - - - - - - - - - - Unit Manning Documents - 0318-02 - Unit Manning Documents - Consisting of manpower document and monthly strength report forwarded to OSD and other activities which are maintained by personnel office as the official record copy. - - - - - - - - - N1-218-89-1 item 002 - Cut off every 3 months, hold 3 months, then destroy. - - - - - - - - cutoff - quarterend|1 - - - - - destroy - month|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - 1st Quarter Unit Manning Documents - 0318-02-01 - 1st Quarter Unit Manning Documents - - - - - - - - - - - - - - - Overtime Reports - 0318-03 - Overtime reports and related documents - Overtime reports and related documents which are maintained by JS/combatant controller as the official record copy. - - - - - - - - - N1-218-00-7 item 28 - Cut off at end of FY, hold 3 years, then destroy. - - - - - - - cutoff - fyend|1 - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - FY08 Overtime Reports - 0318-03-01 - FY08 Overtime Reports - - - - - - - - - - - - - - - Bi-Weekly Cost Reports - 0318-04 - Bi-Weekly Cost Reports - Bi-wekly cost reports which are maintained by JS/combatant command controler as the official record copy. - - - - - - - - - N1-218-00-7 item 2 - Cut off at end of CY, hold 2 years, then destroy. - - - - - - - cutoff - yearend|1 - - - - - destroy - year|2 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - CY08 Unit Manning Documents - 0318-04-01 - CY08 Unit Manning Documents - - - - - - - - - - - - - - - - Military Files - 0412 - Military Files - Record series for military files - - - - - - - - - - - - - Military Assignment Documents - 0412-01 - Military Assignment Documents - Policy matters pertaining to military assignments which are maintained by any JS/combatant command activity as the official record copy. - - - - - - - - - N1-218-00-3 item 30 - Cut off when superseded, hold 5 years, then destroy. - true - - - - - - - cutoff - superseded - - - - - destroy - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - - - - - - - - Official Military Personnel Privilege Card Applications - 0412-02 - Official Military Personnel Privilege Card Applications - Consisting of: documents reflecting applications for priviege cards and ration cards, including Department of Defense Forms (DD Forms) 1172 (Application for Unifomed Services Identification and Privilege Card) and similar documents which are maintained by any JS/combatant command activity. - - - - - - - - - N1-218-00-3 item 20 - Cut off when no longer needed and destroy immediately. - - - - - - - cutoff - no_longer_needed - - - - - destroy - immediately|0 - - - - - - - - - - - - COL Bob Johnson - 0412-02-01 - COL Bob Johnson - - - - - PFC Alan Murphy - 0412-02-02 - PFC Alan Murphy - - - - - - - - - - - - - - - Personnel Security Program Records - 0412-03 - Personnel Security Program Records - Position sensitivity files including requests for information relating to the designation of sensitive and non-sensitive personnel positions in an agency and results of final actions taken consisting of approved requests which are maintained by any JS/combatant command activity - - - - - - - - - N1-218-00-4 item 017 - Cutoff when position is abolished, re-designated, or no longer needed, whichever is later. Destroy immediately after cutoff. - - - - - - - cutoff - - abolished - re_designated - no_longer_needed - - and - - - - - destroy - immediately|0 - - - - - - - - - - - - Commander's Administrative Assistant - 0412-03-01 - Commander's Administrative Assistant - - - - - Equal Opportunity Coordinator - 0412-03-02 - Equal Opportunity Coordinator - - - - - - - - - - - - - - - - Civilian Files - 0430 - Civilian Files - Record series for civilian files - - - - - - - - - - - - - Employee Performance File System Records - 0430-01 - Employee Performance File System Records - Consisting of: performance records superseded through an administrative, judicial, or quasi-judicial procedure which are maintained by any JS/combatant command activity - - - - - - - - - GRS 1 item 23b(1) - Cutoff when superseded. Destroy immediately after cutoff - true - - - - - - - cutoff - superseded - - - - - destroy - immediately|0 - - - - - - - - - - - - - - - - - - - Foreign Employee Award Files - 0430-02 - Foreign Employee Award Files - Decorations to foreign nationals and US citizens not employed by the US Government consisting of: case files of recommendations, decisions, awards announcements, board meeting minutes, and related documents which are maintained by any JS/combatant command activity - - - - - - - - N1-218-00-3 item 18 - Permanent. Cut off on completion of case, hold 2 years, then retire to offline storage. Transfer to federal records holding area 5 years after retirement to offline storage. Transfer to NARA 25 years after cutoff. - - - - - - - cutoff - case_complete - - - - - transfer - Retire to offline storage. - Offline Storage - year|2 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - transfer - Transfer to federal records holding area. - Federal Records Holding - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAsOf - - - - - accession - Transfer to NARA. - NARA - year|25 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Christian Bohr - 0430-02-01 - Christian Bohr - - - - - Karl Planck - 0430-02-02 - Karl Planck - - - - - - - - - - - - - - - Case Files and Papers - 0430-03 - Case Files and Papers - Consisting of library containing information on personnel actions which are maintained by R&A Br and Deputy Chief Information Office - None - Disposal not authorized. Disposition pending NARA approval. - - - - - - - Gilbert Competency Hearing - 0430-03-01 - Gilbert Competency Hearing - - - - - - - - - - - - - - - Withholding of Within-Grade Increase (WGI) Records - 0430-04 - Withholding of Within-Grade Increase (WGI) Records - Files concerning an employee’s performance rating of record with work examples which establish less than fully successful performance, notice of withholding of WGI, employee's request for reconsideration of denied WGI, and decision concerning such a reconsideration request which are maintained by any JS/combatant command activity. - - - - - - - - - N1-218-00-3 item 16 - Cut off on completion of WGI action or on separation, whichever is earlier; hold 3 years, then destroy/delete. - - - - - - - cutoff - - WGI_action_complete - separation - - or - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Gilbert WGI Records - 0430-04-01 - Gilbert WGI Records - - - - - - - - - - - - - - - Payroll Differential and Allowances - 0430-05 - Payroll Differential and Allowances - Consisting of: information to assist overseas civilian personnel offices to document employee eligibility for foreign post differential and foreign quarters and post allowances, including SF 1190 (Foreign Allowances Application, Grant, and Report) and similar information which are maintained by any JS/combatant command activity. - - - - - - - - - N1-218-00-3 item 3 - Cut off at end of Fiscal Year (FY) in which all allowances granted are terminated, hold 3 years, then destroy. - - - - - - - retain - all_allowances_granted_are_terminated - - - - - cutoff - fyend|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAsOf - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Martin Payroll Differential and Allowances - 0430-05-01 - Martin Payroll Differential and Allowances - - - - - - - - - - - - - - - - Miscellaneous Files - 0950 - Miscellaneous Files - Record series for miscellaneous files - - - - - - - - - - - - - Civilian Employee Training Program Records - 0950-01 - Civilian Employee Training Program Records - Decorations to foreign nationals and US citizens not employed by the US Government consisting of: case files of recommendations, decisions, awards announcements, board meeting minutes, and related documents which are maintained by any JS/combatant command activity - - - - - - - - GRS 1 item 29b - Cut off annually, hold 5 years, then destroy, or destroy when obsolete, whichever is earlier. - - - - - - - cutoff - year|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}dateFiled - - - - - destroy - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - obsolete - - - - - - - - - - - - Bob Prentice Training Records (2008) - 0950-01-01 - Bob Prentice Training Records (2008) - - - - - Beth Tanaka Training Records (2008) - 0950-01-02 - Beth Tanaka Training Records (2008) - - - - - Chuck Stevens Training Records (2008) - 0950-01-03 - Chuck Stevens Training Records (2008) - - - - - - - - - - - - - - - Purchase of Foreign Award Medals and Decorations - 0950-02 - Purchase of Foreign Award Medals and Decorations - Forms reflecting purchase of foreign award medals and decorations. - - - - - - - - - N1-218-00-3 item 11 - Cutoff when related record is transferred to inactive storage, hold 1 year, destroy. - true - - - - - - - cutoff - related_record_trasfered_inactive_storage - - - - - destroy - year|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - - - - - - - Monthly Cockpit Crew Training - 0950-03 - Monthly Cockpit/Crew Training - Consisting of skills training/evaluation forms, e.g., AF Form 4031. - - - - - - - - - N1-218-00-3 item 13 - Cutoff after training is complete, hold 1 year, destroy. - - - - - - - cutoff - training_complete - - - - - destroy - year|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - January Cockpit Crew Training - 0950-03-01 - January Cockpit/Crew Training - - - - - February Cockpit Crew Training - 0950-03-02 - February Cockpit/Crew Training - - - - - - - - - - - - - - - Science Advisor Records - 0950-04 - Science Advisor Records - Consisting of: reports, studies, tasking orders, and similar records. Reports are usually informal and unpublished. Records may be generated at all activities - - - - - - - - - N1-218-00-10 item 44 - Cut off on completion of study, hold 5 years, then transfer to Inactive Storage. Transfer to NARA 25 years after cutoff. - - - - - - - cutoff - study_complete - - - - - transfer - Transfer to inactive storage. - Inactive Storage - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - accession - Transfer to NARA. - NARA - year|25 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Phoenix Mars Mission - 0950-04-01 - Phoenix Mars Mission - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml deleted file mode 100644 index 2cafcf36a1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml deleted file mode 100644 index f5649b294d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml - - - - - alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model - - - - - - - - - - - - - - - - - - - - - - alfresco.module.org_alfresco_module_rm.dod5015.messages.dod5015 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml deleted file mode 100644 index 502f565bf6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - DOD 5015 Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - Image Formats - - - Binary Image Interchange Format (BIIF) - GIF 89a - Graphic Image Format (GIF) 87a - Joint Photographic Experts Group (JPEG) (all versions) - Portable Network Graphics (PNG) 1.0 - Tagged Image Interchange Format (TIFF) 4.0 - TIFF 5.0 - TIFF 6.0 - - - true - - - - - - - - - DOD5015 Site - rma:rmsite - - - - - - DOD5015 File Plan - rma:filePlan - - - - - Record Series - rma:recordCategory - - - - - - - - - - DOD5015 Record - - - - Publication Date - d:date - true - - - - Originator - d:text - true - - true - false - false - - - - - Originating Organization - d:text - true - - true - false - false - - - - - Media Type - d:text - false - - true - false - false - - - - - Format - d:text - false - - true - false - false - - - - - Date Received - d:date - false - - - - - Addressee - d:text - false - - true - false - false - - - - Other Addressee - d:text - false - - true - false - false - - - - - - - - - Scanned Record - - - Image Format - d:text - - true - false - false - - - - Image Format and Version - d:text - true - - true - false - false - - - - - - - Image Resolution X - d:int - true - - - Image Resolution Y - d:int - true - - - Scanned Bit Depth - d:int - false - - - - - - PDF Record - - - Producing Application - d:text - true - - true - false - false - - - - Producing Application Version - d:text - true - - - PDF Version - d:text - true - - true - false - false - - - - Creating Application - d:text - false - - true - false - false - - - - Document Security Settings - d:text - false - - true - false - false - - - - - - - Digital Photograph Record - - - Caption - d:text - true - - - Photographer - d:text - false - - true - false - false - - - - Copyright - d:text - false - - true - false - false - - - - Bit Depth - d:text - false - - true - false - false - - - - Image Size X - d:int - false - - - Image Size Y - d:int - false - - - Image Source - d:text - false - - true - false - false - - - - Compression - d:text - false - - true - false - false - - - - ICC/ICM Profile - d:text - false - - true - false - false - - - - EXIF Information - d:text - false - - true - false - false - - - - - - - Web Record - - - Web File Name - d:text - true - - true - false - false - - - - Web Platform - d:text - true - - true - false - false - - - - Web Site Name - d:text - true - - true - false - false - - - - Web Site URL - d:text - true - - true - false - false - - - - Capture Method - d:text - true - - true - false - false - - - - Capture Date - d:date - true - - - Contact - d:text - true - - true - false - false - - - - Content Management System - d:text - false - - true - false - false - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties deleted file mode 100644 index 0fa8cbc480..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=DOD5015 Content Model - -dod_dod5015.type.dod_site.title=DOD5015 Site -dod_dod5015.type.dod_site.description=DOD5015 Site - -dod_dod5015.type.dod_filePlan.title=DOD5015 File Plan -dod_dod5015.type.dod_filePlan.description=DOD5015 File Plan - -dod_dod5015.type.dod_recordSeries.title=Record Series (Deprecated) -dod_dod5015.type.dod_recordSeries.description=Record Series (Deprecated) - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015 Record -dod_dod5015.aspect.dod_dod5015record.description=DOD5015 Record -dod_dod5015.property.dod_publicationDate.title=Publication Date -dod_dod5015.property.dod_publicationDate.decription=Publication Date -dod_dod5015.property.dod_originator.title=Originator -dod_dod5015.property.dod_originator.decription=Originator -dod_dod5015.property.dod_originatingOrganization.title=Originating Organization -dod_dod5015.property.dod_originatingOrganization.decription=Originating Organization -dod_dod5015.property.dod_mediaType.title=Media Type -dod_dod5015.property.dod_mediaType.decription=Media Type -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Date Received -dod_dod5015.property.dod_dateReceived.decription=Date Received -dod_dod5015.property.dod_address.title=Addressee -dod_dod5015.property.dod_address.decription=Addressee -dod_dod5015.property.dod_otherAddress.title=Other Addressee -dod_dod5015.property.dod_otherAddress.decription=Other Addressee - -dod_dod5015.aspect.dod_scannedRecord.title=Scanned Record -dod_dod5015.aspect.dod_scannedRecord.description=Scanned Record -dod_dod5015.property.dod_scannedFormat.title=Image Format -dod_dod5015.property.dod_scannedFormat.description=Image Format -dod_dod5015.property.dod_scannedFormatVersion.title=Image Format and Version -dod_dod5015.property.dod_scannedFormatVersion.description=Image Format and Version -dod_dod5015.property.dod_resolutionX.title=Image Resolution X -dod_dod5015.property.dod_resolutionX.description=Image Resolution X -dod_dod5015.property.dod_resolutionY.title=Image Resolution Y -dod_dod5015.property.dod_resolutionY.description=Image Resolution Y -dod_dod5015.property.dod_scannedBitDepth.title=Scanned Bit Depth -dod_dod5015.property.dod_scannedBitDepth.description=Scanned Bit Depth - -dod_dod5015.aspect.dod_pdfRecord.title=PDF Record -dod_dod5015.aspect.dod_pdfRecord.description=PDF Record -dod_dod5015.property.dod_producingApplication.title=Producing Application -dod_dod5015.property.dod_producingApplication.description=Producing Application -dod_dod5015.property.dod_producingApplicationVersion.title=Producing Application Version -dod_dod5015.property.dod_producingApplicationVersion.description=Producing Application Version -dod_dod5015.property.dod_pdfVersion.title=PDF Version -dod_dod5015.property.dod_pdfVersion.description=PDF Version -dod_dod5015.property.dod_creatingApplication.title=Creating Application -dod_dod5015.property.dod_creatingApplication.description=Creating Application -dod_dod5015.property.dod_documentSecuritySettings.title=Document Security Settings -dod_dod5015.property.dod_documentSecuritySettings.description=Document Security Settings - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digital Photograph Record -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digital Photograph Record -dod_dod5015.property.dod_caption.title=Caption -dod_dod5015.property.dod_caption.description=Caption -dod_dod5015.property.dod_photographer.title=Photographer -dod_dod5015.property.dod_photographer.description=Photographer -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Bit Depth -dod_dod5015.property.dod_bitDepth.description=Bit Depth -dod_dod5015.property.dod_imageSizeX.title=Image Size X -dod_dod5015.property.dod_imageSizeX.description=Image Size X -dod_dod5015.property.dod_imageSizeY.title=Image Size Y -dod_dod5015.property.dod_imageSizeY.description=Image Size Y -dod_dod5015.property.dod_imageSource.title=Image Source -dod_dod5015.property.dod_imageSource.description=Image Source -dod_dod5015.property.dod_compression.title=Compression -dod_dod5015.property.dod_compression.description=Compression -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM Profile -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM Profile -dod_dod5015.property.dod_exifInformation.title=EXIF Information -dod_dod5015.property.dod_exifInformation.description=EXIF Information - -dod_dod5015.aspect.dod_webRecord.title=Web Record -dod_dod5015.aspect.dod_webRecord.description=Web Record -dod_dod5015.property.dod_webFileName.title=Web File Name -dod_dod5015.property.dod_webFileName.description=Web File Name -dod_dod5015.property.dod_webPlatform.title=Web Platform -dod_dod5015.property.dod_webPlatform.description=Web Platform -dod_dod5015.property.dod_webSiteName.title=Web Site Name -dod_dod5015.property.dod_webSiteName.description=Web Site Name -dod_dod5015.property.dod_webSiteURL.title=Web Site URL -dod_dod5015.property.dod_webSiteURL.description=Web Site URL -dod_dod5015.property.dod_captureMethod.title=Capture Method -dod_dod5015.property.dod_captureMethod.description=Capture Method -dod_dod5015.property.dod_captureDate.title=Capture Date -dod_dod5015.property.dod_captureDate.description=Capture Date -dod_dod5015.property.dod_contact.title=Contact -dod_dod5015.property.dod_contact.description=Contact -dod_dod5015.property.dod_contentManagementSystem.title=Content Management System -dod_dod5015.property.dod_contentManagementSystem.description=Content Management System - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties deleted file mode 100644 index 3f7f128ddd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=DoD 5015-konformes Content-Modell - -dod_dod5015.type.dod_site.title=DoD 5015-konforme Site -dod_dod5015.type.dod_site.description=DoD 5015-konforme Site - -dod_dod5015.type.dod_filePlan.title=DoD 5015 Ablageplan -dod_dod5015.type.dod_filePlan.description=DoD 5015 Ablageplan - -dod_dod5015.type.dod_recordSeries.title=Record-Serien (abgelehnt) -dod_dod5015.type.dod_recordSeries.description=Record-Serien (abgelehnt) - -dod_dod5015.aspect.dod_dod5015record.title=DoD 5015-konformer Record -dod_dod5015.aspect.dod_dod5015record.description=DoD 5015-konformer Record -dod_dod5015.property.dod_publicationDate.title=Ver\u00f6ffentlichungsdatum -dod_dod5015.property.dod_publicationDate.decription=Ver\u00f6ffentlichungsdatum -dod_dod5015.property.dod_originator.title=Ersteller -dod_dod5015.property.dod_originator.decription=Ersteller -dod_dod5015.property.dod_originatingOrganization.title=Erstellende Organisation -dod_dod5015.property.dod_originatingOrganization.decription=Erstellende Organisation -dod_dod5015.property.dod_mediaType.title=Medientyp -dod_dod5015.property.dod_mediaType.decription=Medientyp -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Eingangsdatum -dod_dod5015.property.dod_dateReceived.decription=Eingangsdatum -dod_dod5015.property.dod_address.title=Empf\u00e4nger -dod_dod5015.property.dod_address.decription=Empf\u00e4nger -dod_dod5015.property.dod_otherAddress.title=Anderer Empf\u00e4nger -dod_dod5015.property.dod_otherAddress.decription=Anderer Empf\u00e4nger - -dod_dod5015.aspect.dod_scannedRecord.title=Eingescannter Record -dod_dod5015.aspect.dod_scannedRecord.description=Eingescannter Record -dod_dod5015.property.dod_scannedFormat.title=Bildformat -dod_dod5015.property.dod_scannedFormat.description=Bildformat -dod_dod5015.property.dod_scannedFormatVersion.title=Bildformat und Version -dod_dod5015.property.dod_scannedFormatVersion.description=Bildformat und Version -dod_dod5015.property.dod_resolutionX.title=Bildaufl\u00f6sung X -dod_dod5015.property.dod_resolutionX.description=Bildaufl\u00f6sung X -dod_dod5015.property.dod_resolutionY.title=Bildaufl\u00f6sung Y -dod_dod5015.property.dod_resolutionY.description=Bildaufl\u00f6sung Y -dod_dod5015.property.dod_scannedBitDepth.title=Bittiefe des Scans -dod_dod5015.property.dod_scannedBitDepth.description=Bittiefe des Scans - -dod_dod5015.aspect.dod_pdfRecord.title=PDF-Record -dod_dod5015.aspect.dod_pdfRecord.description=PDF-Record -dod_dod5015.property.dod_producingApplication.title=Quellanwendung -dod_dod5015.property.dod_producingApplication.description=Quellanwendung -dod_dod5015.property.dod_producingApplicationVersion.title=Version der Quellanwendung -dod_dod5015.property.dod_producingApplicationVersion.description=Version der Quellanwendung -dod_dod5015.property.dod_pdfVersion.title=PDF-Version -dod_dod5015.property.dod_pdfVersion.description=PDF-Version -dod_dod5015.property.dod_creatingApplication.title=Quellsystem -dod_dod5015.property.dod_creatingApplication.description=Quellsystem -dod_dod5015.property.dod_documentSecuritySettings.title=Sicherheitseinstellungen des Dokuments -dod_dod5015.property.dod_documentSecuritySettings.description=Sicherheitseinstellungen des Dokuments - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Record - Digitales Bild -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Record - Digitales Bild -dod_dod5015.property.dod_caption.title=Beschriftung -dod_dod5015.property.dod_caption.description=Beschriftung -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=Bittiefe -dod_dod5015.property.dod_bitDepth.description=Bittiefe -dod_dod5015.property.dod_imageSizeX.title=Bildgr\u00f6\u00dfe X -dod_dod5015.property.dod_imageSizeX.description=Bildgr\u00f6\u00dfe X -dod_dod5015.property.dod_imageSizeY.title=Bildgr\u00f6\u00dfe Y -dod_dod5015.property.dod_imageSizeY.description=Bildgr\u00f6\u00dfe Y -dod_dod5015.property.dod_imageSource.title=Bildquelle -dod_dod5015.property.dod_imageSource.description=Bildquelle -dod_dod5015.property.dod_compression.title=Komprimierung -dod_dod5015.property.dod_compression.description=Komprimierung -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-Informationen -dod_dod5015.property.dod_exifInformation.description=EXIF-Informationen - -dod_dod5015.aspect.dod_webRecord.title=Web-Record -dod_dod5015.aspect.dod_webRecord.description=Web-Record -dod_dod5015.property.dod_webFileName.title=Webdateiname -dod_dod5015.property.dod_webFileName.description=Webdateiname -dod_dod5015.property.dod_webPlatform.title=Webplattform -dod_dod5015.property.dod_webPlatform.description=Webplattform -dod_dod5015.property.dod_webSiteName.title=Website-Name -dod_dod5015.property.dod_webSiteName.description=Website-Name -dod_dod5015.property.dod_webSiteURL.title=Website-URL -dod_dod5015.property.dod_webSiteURL.description=Website-URL -dod_dod5015.property.dod_captureMethod.title=Erfassungsmethode -dod_dod5015.property.dod_captureMethod.description=Erfassungsmethode -dod_dod5015.property.dod_captureDate.title=Erfassungsdatum -dod_dod5015.property.dod_captureDate.description=Erfassungsdatum -dod_dod5015.property.dod_contact.title=Kontakt -dod_dod5015.property.dod_contact.description=Kontakt -dod_dod5015.property.dod_contentManagementSystem.title=Content Management System -dod_dod5015.property.dod_contentManagementSystem.description=Content Management System - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties deleted file mode 100644 index e77499dd40..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=Modelo de contenido de DOD5015 - -dod_dod5015.type.dod_site.title=Sitio de DOD5015 -dod_dod5015.type.dod_site.description=Sitio de DOD5015 - -dod_dod5015.type.dod_filePlan.title=Cuadro de clasificaci\u00f3n DOD5015 -dod_dod5015.type.dod_filePlan.description=Cuadro de clasificaci\u00f3n DOD5015 - -dod_dod5015.type.dod_recordSeries.title=Serie de documentos de archivo (depreciada) -dod_dod5015.type.dod_recordSeries.description=Serie de documentos de archivo (depreciada) - -dod_dod5015.aspect.dod_dod5015record.title=Documento de archivo de DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Documento de archivo de DOD5015 -dod_dod5015.property.dod_publicationDate.title=Fecha de publicaci\u00f3n -dod_dod5015.property.dod_publicationDate.decription=Fecha de publicaci\u00f3n -dod_dod5015.property.dod_originator.title=Creador -dod_dod5015.property.dod_originator.decription=Creador -dod_dod5015.property.dod_originatingOrganization.title=Organizaci\u00f3n creadora -dod_dod5015.property.dod_originatingOrganization.decription=Organizaci\u00f3n creadora -dod_dod5015.property.dod_mediaType.title=Tipo de medio -dod_dod5015.property.dod_mediaType.decription=Tipo de medio -dod_dod5015.property.dod_format.title=Formato -dod_dod5015.property.dod_format.decription=Formato -dod_dod5015.property.dod_dateReceived.title=Fecha de recepci\u00f3n -dod_dod5015.property.dod_dateReceived.decription=Fecha de recepci\u00f3n -dod_dod5015.property.dod_address.title=Destinatario -dod_dod5015.property.dod_address.decription=Destinatario -dod_dod5015.property.dod_otherAddress.title=Otro destinatario -dod_dod5015.property.dod_otherAddress.decription=Otro destinatario - -dod_dod5015.aspect.dod_scannedRecord.title=Documento de archivo escaneado -dod_dod5015.aspect.dod_scannedRecord.description=Documento de archivo escaneado -dod_dod5015.property.dod_scannedFormat.title=Formato de imagen -dod_dod5015.property.dod_scannedFormat.description=Formato de imagen -dod_dod5015.property.dod_scannedFormatVersion.title=Formato de imagen y versi\u00f3n -dod_dod5015.property.dod_scannedFormatVersion.description=Formato de imagen y versi\u00f3n -dod_dod5015.property.dod_resolutionX.title=Resoluci\u00f3n de imagen X -dod_dod5015.property.dod_resolutionX.description=Resoluci\u00f3n de imagen X -dod_dod5015.property.dod_resolutionY.title=Resoluci\u00f3n de imagen Y -dod_dod5015.property.dod_resolutionY.description=Resoluci\u00f3n de imagen Y -dod_dod5015.property.dod_scannedBitDepth.title=Profundidad de bits de escaneado -dod_dod5015.property.dod_scannedBitDepth.description=Profundidad de bits de escaneado - -dod_dod5015.aspect.dod_pdfRecord.title=Documento de archivo PDF -dod_dod5015.aspect.dod_pdfRecord.description=Documento de archivo PDF -dod_dod5015.property.dod_producingApplication.title=Produciendo aplicaci\u00f3n -dod_dod5015.property.dod_producingApplication.description=Produciendo aplicaci\u00f3n -dod_dod5015.property.dod_producingApplicationVersion.title=Produciendo versi\u00f3n de la aplicaci\u00f3n -dod_dod5015.property.dod_producingApplicationVersion.description=Produciendo versi\u00f3n de la aplicaci\u00f3n -dod_dod5015.property.dod_pdfVersion.title=Versi\u00f3n PDF -dod_dod5015.property.dod_pdfVersion.description=Versi\u00f3n PDF -dod_dod5015.property.dod_creatingApplication.title=Creando aplicaci\u00f3n -dod_dod5015.property.dod_creatingApplication.description=Creando aplicaci\u00f3n -dod_dod5015.property.dod_documentSecuritySettings.title=Configuraci\u00f3n de seguridad del documento -dod_dod5015.property.dod_documentSecuritySettings.description=Configuraci\u00f3n de seguridad del documento - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Documento de archivo fotogr\u00e1fico digital -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Documento de archivo fotogr\u00e1fico digital -dod_dod5015.property.dod_caption.title=T\u00edtulo -dod_dod5015.property.dod_caption.description=T\u00edtulo -dod_dod5015.property.dod_photographer.title=Fot\u00f3grafo -dod_dod5015.property.dod_photographer.description=Fot\u00f3grafo -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Profundidad de bits -dod_dod5015.property.dod_bitDepth.description=Profundidad de bits -dod_dod5015.property.dod_imageSizeX.title=Tama\u00f1o de imagen X -dod_dod5015.property.dod_imageSizeX.description=Tama\u00f1o de imagen X -dod_dod5015.property.dod_imageSizeY.title=Tama\u00f1o de imagen Y -dod_dod5015.property.dod_imageSizeY.description=Tama\u00f1o de imagen Y -dod_dod5015.property.dod_imageSource.title=Procedencia de la imagen -dod_dod5015.property.dod_imageSource.description=Procedencia de la imagen -dod_dod5015.property.dod_compression.title=Compresi\u00f3n -dod_dod5015.property.dod_compression.description=Compresi\u00f3n -dod_dod5015.property.dod_iccIcmProfile.title=Perfil ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Perfil ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informaci\u00f3n EXIF -dod_dod5015.property.dod_exifInformation.description=Informaci\u00f3n EXIF - -dod_dod5015.aspect.dod_webRecord.title=Documento de archivo web -dod_dod5015.aspect.dod_webRecord.description=Documento de archivo web -dod_dod5015.property.dod_webFileName.title=Nombre del fichero web -dod_dod5015.property.dod_webFileName.description=Nombre del fichero web -dod_dod5015.property.dod_webPlatform.title=Plataforma web -dod_dod5015.property.dod_webPlatform.description=Plataforma web -dod_dod5015.property.dod_webSiteName.title=Nombre del sitio web -dod_dod5015.property.dod_webSiteName.description=Nombre del sitio web -dod_dod5015.property.dod_webSiteURL.title=URL del sitio web -dod_dod5015.property.dod_webSiteURL.description=URL del sitio web -dod_dod5015.property.dod_captureMethod.title=M\u00e9todo de captura -dod_dod5015.property.dod_captureMethod.description=M\u00e9todo de captura -dod_dod5015.property.dod_captureDate.title=Fecha de captura -dod_dod5015.property.dod_captureDate.description=Fecha de captura -dod_dod5015.property.dod_contact.title=Contacto -dod_dod5015.property.dod_contact.description=Contacto -dod_dod5015.property.dod_contentManagementSystem.title=Sistema de gesti\u00f3n de contenidos -dod_dod5015.property.dod_contentManagementSystem.description=Sistema de gesti\u00f3n de contenidos - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties deleted file mode 100644 index 4d79116fc4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=Mod\u00e8le de contenu DOD5015 - -dod_dod5015.type.dod_site.title=Site DOD5015 -dod_dod5015.type.dod_site.description=Site DOD5015 - -dod_dod5015.type.dod_filePlan.title=Plan de classement DOD5015 -dod_dod5015.type.dod_filePlan.description=Plan de classement DOD5015 - -dod_dod5015.type.dod_recordSeries.title=S\u00e9rie de documents d'archives (\u00e0 \u00e9viter) -dod_dod5015.type.dod_recordSeries.description=S\u00e9rie de documents d'archives (\u00e0 \u00e9viter) - -dod_dod5015.aspect.dod_dod5015record.title=Document d'archives DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Document d'archives DOD5015 -dod_dod5015.property.dod_publicationDate.title=Date de publication -dod_dod5015.property.dod_publicationDate.decription=Date de publication -dod_dod5015.property.dod_originator.title=\u00c9metteur -dod_dod5015.property.dod_originator.decription=\u00c9metteur -dod_dod5015.property.dod_originatingOrganization.title=Organisation \u00e9mettrice -dod_dod5015.property.dod_originatingOrganization.decription=Organisation \u00e9mettrice -dod_dod5015.property.dod_mediaType.title=Type de support -dod_dod5015.property.dod_mediaType.decription=Type de support -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Date de r\u00e9ception -dod_dod5015.property.dod_dateReceived.decription=Date de r\u00e9ception -dod_dod5015.property.dod_address.title=Destinataire -dod_dod5015.property.dod_address.decription=Destinataire -dod_dod5015.property.dod_otherAddress.title=Autre destinataire -dod_dod5015.property.dod_otherAddress.decription=Autre destinataire - -dod_dod5015.aspect.dod_scannedRecord.title=Document d'archives num\u00e9ris\u00e9 -dod_dod5015.aspect.dod_scannedRecord.description=Document d'archives num\u00e9ris\u00e9 -dod_dod5015.property.dod_scannedFormat.title=Format d'image -dod_dod5015.property.dod_scannedFormat.description=Format d'image -dod_dod5015.property.dod_scannedFormatVersion.title=Format et version d'image -dod_dod5015.property.dod_scannedFormatVersion.description=Format et version d'image -dod_dod5015.property.dod_resolutionX.title=R\u00e9solution d'image X -dod_dod5015.property.dod_resolutionX.description=R\u00e9solution d'image X -dod_dod5015.property.dod_resolutionY.title=R\u00e9solution d'image Y -dod_dod5015.property.dod_resolutionY.description=R\u00e9solution d'image Y -dod_dod5015.property.dod_scannedBitDepth.title=Profondeur de couleur num\u00e9ris\u00e9e -dod_dod5015.property.dod_scannedBitDepth.description=Profondeur de couleur num\u00e9ris\u00e9e - -dod_dod5015.aspect.dod_pdfRecord.title=Document d'archives PDF -dod_dod5015.aspect.dod_pdfRecord.description=Document d'archives PDF -dod_dod5015.property.dod_producingApplication.title=Application native -dod_dod5015.property.dod_producingApplication.description=Application native -dod_dod5015.property.dod_producingApplicationVersion.title=Version de l'application native -dod_dod5015.property.dod_producingApplicationVersion.description=Version de l'application native -dod_dod5015.property.dod_pdfVersion.title=Version PDF -dod_dod5015.property.dod_pdfVersion.description=Version PDF -dod_dod5015.property.dod_creatingApplication.title=Application native -dod_dod5015.property.dod_creatingApplication.description=Application native -dod_dod5015.property.dod_documentSecuritySettings.title=Param\u00e8tres de s\u00e9curit\u00e9 du document -dod_dod5015.property.dod_documentSecuritySettings.description=Param\u00e8tres de s\u00e9curit\u00e9 du document - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Photographie num\u00e9rique d'archives -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Photographie num\u00e9rique d'archives -dod_dod5015.property.dod_caption.title=L\u00e9gende -dod_dod5015.property.dod_caption.description=L\u00e9gende -dod_dod5015.property.dod_photographer.title=Photographe -dod_dod5015.property.dod_photographer.description=Photographe -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Profondeur de couleur -dod_dod5015.property.dod_bitDepth.description=Profondeur de couleur -dod_dod5015.property.dod_imageSizeX.title=Taille d'image X -dod_dod5015.property.dod_imageSizeX.description=Taille d'image X -dod_dod5015.property.dod_imageSizeY.title=Taille d'image Y -dod_dod5015.property.dod_imageSizeY.description=Taille d'image Y -dod_dod5015.property.dod_imageSource.title=Source de l'image -dod_dod5015.property.dod_imageSource.description=Source de l'image -dod_dod5015.property.dod_compression.title=Compression -dod_dod5015.property.dod_compression.description=Compression -dod_dod5015.property.dod_iccIcmProfile.title=Profil ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Profil ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informations EXIF -dod_dod5015.property.dod_exifInformation.description=Informations EXIF - -dod_dod5015.aspect.dod_webRecord.title=Document d'archives Web -dod_dod5015.aspect.dod_webRecord.description=Document d'archives Web -dod_dod5015.property.dod_webFileName.title=Nom de fichier Web -dod_dod5015.property.dod_webFileName.description=Nom de fichier Web -dod_dod5015.property.dod_webPlatform.title=Plate-forme Web -dod_dod5015.property.dod_webPlatform.description=Plate-forme Web -dod_dod5015.property.dod_webSiteName.title=Nom du site Web -dod_dod5015.property.dod_webSiteName.description=Nom du site Web -dod_dod5015.property.dod_webSiteURL.title=URL de site Web -dod_dod5015.property.dod_webSiteURL.description=URL de site Web -dod_dod5015.property.dod_captureMethod.title=M\u00e9thode de capture -dod_dod5015.property.dod_captureMethod.description=M\u00e9thode de capture -dod_dod5015.property.dod_captureDate.title=Date de capture -dod_dod5015.property.dod_captureDate.description=Date de capture -dod_dod5015.property.dod_contact.title=Contact -dod_dod5015.property.dod_contact.description=Contact -dod_dod5015.property.dod_contentManagementSystem.title=Syst\u00e8me de gestion de contenu -dod_dod5015.property.dod_contentManagementSystem.description=Syst\u00e8me de gestion de contenu - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties deleted file mode 100644 index 6bacfc7981..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=Modello di contenuto DOD5015 - -dod_dod5015.type.dod_site.title=Sito DOD5015 -dod_dod5015.type.dod_site.description=Sito DOD5015 - -dod_dod5015.type.dod_filePlan.title=Piano di fascicolazione DOD5015 -dod_dod5015.type.dod_filePlan.description=Piano di fascicolazione DOD5015 - -dod_dod5015.type.dod_recordSeries.title=Serie record (obsoleta) -dod_dod5015.type.dod_recordSeries.description=Serie record (obsoleta) - -dod_dod5015.aspect.dod_dod5015record.title=Record DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Record DOD5015 -dod_dod5015.property.dod_publicationDate.title=Data di pubblicazione -dod_dod5015.property.dod_publicationDate.decription=Data di pubblicazione -dod_dod5015.property.dod_originator.title=Iniziatore -dod_dod5015.property.dod_originator.decription=Iniziatore -dod_dod5015.property.dod_originatingOrganization.title=Organizzazione di origine -dod_dod5015.property.dod_originatingOrganization.decription=Organizzazione di origine -dod_dod5015.property.dod_mediaType.title=Tipo di supporto -dod_dod5015.property.dod_mediaType.decription=Tipo di supporto -dod_dod5015.property.dod_format.title=Formato -dod_dod5015.property.dod_format.decription=Formato -dod_dod5015.property.dod_dateReceived.title=Data di ricezione -dod_dod5015.property.dod_dateReceived.decription=Data di ricezione -dod_dod5015.property.dod_address.title=Destinatario -dod_dod5015.property.dod_address.decription=Destinatario -dod_dod5015.property.dod_otherAddress.title=Altro destinatario -dod_dod5015.property.dod_otherAddress.decription=Altro destinatario - -dod_dod5015.aspect.dod_scannedRecord.title=Record scansionato -dod_dod5015.aspect.dod_scannedRecord.description=Record scansionato -dod_dod5015.property.dod_scannedFormat.title=Formato immagine -dod_dod5015.property.dod_scannedFormat.description=Formato immagine -dod_dod5015.property.dod_scannedFormatVersion.title=Formato immagine e versione -dod_dod5015.property.dod_scannedFormatVersion.description=Formato immagine e versione -dod_dod5015.property.dod_resolutionX.title=Risoluzione immagine X -dod_dod5015.property.dod_resolutionX.description=Risoluzione immagine X -dod_dod5015.property.dod_resolutionY.title=Risoluzione immagine Y -dod_dod5015.property.dod_resolutionY.description=Risoluzione immagine Y -dod_dod5015.property.dod_scannedBitDepth.title=Profondit\u00e0 in bit scansionata -dod_dod5015.property.dod_scannedBitDepth.description=Profondit\u00e0 in bit scansionata - -dod_dod5015.aspect.dod_pdfRecord.title=Record PDF -dod_dod5015.aspect.dod_pdfRecord.description=Record PDF -dod_dod5015.property.dod_producingApplication.title=Generazione applicazione -dod_dod5015.property.dod_producingApplication.description=Generazione applicazione -dod_dod5015.property.dod_producingApplicationVersion.title=Generazione versione applicazione -dod_dod5015.property.dod_producingApplicationVersion.description=Generazione versione applicazione -dod_dod5015.property.dod_pdfVersion.title=Versione PDF -dod_dod5015.property.dod_pdfVersion.description=Versione PDF -dod_dod5015.property.dod_creatingApplication.title=Creazione applicazione -dod_dod5015.property.dod_creatingApplication.description=Creazione applicazione -dod_dod5015.property.dod_documentSecuritySettings.title=Impostazioni di protezione documento -dod_dod5015.property.dod_documentSecuritySettings.description=Impostazioni di protezione documento - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Record fotografia digitale -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Record fotografia digitale -dod_dod5015.property.dod_caption.title=Didascalia -dod_dod5015.property.dod_caption.description=Didascalia -dod_dod5015.property.dod_photographer.title=Fotografo -dod_dod5015.property.dod_photographer.description=Fotografo -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Profondit\u00e0 in bit -dod_dod5015.property.dod_bitDepth.description=Profondit\u00e0 in bit -dod_dod5015.property.dod_imageSizeX.title=Dimensioni immagine X -dod_dod5015.property.dod_imageSizeX.description=Dimensioni immagine X -dod_dod5015.property.dod_imageSizeY.title=Dimensioni immagine Y -dod_dod5015.property.dod_imageSizeY.description=Dimensioni immagine Y -dod_dod5015.property.dod_imageSource.title=Origine immagine -dod_dod5015.property.dod_imageSource.description=Origine immagine -dod_dod5015.property.dod_compression.title=Compressione -dod_dod5015.property.dod_compression.description=Compressione -dod_dod5015.property.dod_iccIcmProfile.title=Profilo ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Profilo ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informazioni EXIF -dod_dod5015.property.dod_exifInformation.description=Informazioni EXIF - -dod_dod5015.aspect.dod_webRecord.title=Record Web -dod_dod5015.aspect.dod_webRecord.description=Record Web -dod_dod5015.property.dod_webFileName.title=Nome file Web -dod_dod5015.property.dod_webFileName.description=Nome file Web -dod_dod5015.property.dod_webPlatform.title=Piattaforma Web -dod_dod5015.property.dod_webPlatform.description=Piattaforma Web -dod_dod5015.property.dod_webSiteName.title=Nome sito Web -dod_dod5015.property.dod_webSiteName.description=Nome sito Web -dod_dod5015.property.dod_webSiteURL.title=URL sito Web -dod_dod5015.property.dod_webSiteURL.description=URL sito Web -dod_dod5015.property.dod_captureMethod.title=Metodo di acquisizione -dod_dod5015.property.dod_captureMethod.description=Metodo di acquisizione -dod_dod5015.property.dod_captureDate.title=Data di acquisizione -dod_dod5015.property.dod_captureDate.description=Data di acquisizione -dod_dod5015.property.dod_contact.title=Contatto -dod_dod5015.property.dod_contact.description=Contatto -dod_dod5015.property.dod_contentManagementSystem.title=Sistema di gestione dei contenuti -dod_dod5015.property.dod_contentManagementSystem.description=Sistema di gestione dei contenuti - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties deleted file mode 100644 index 28a2b8e8dc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=DOD5015\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb - -dod_dod5015.type.dod_site.title=DOD5015\u30b5\u30a4\u30c8 -dod_dod5015.type.dod_site.description=DOD5015\u30b5\u30a4\u30c8 - -dod_dod5015.type.dod_filePlan.title=DOD5015 \u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 -dod_dod5015.type.dod_filePlan.description=DOD5015 \u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 - -dod_dod5015.type.dod_recordSeries.title=\u30ec\u30b3\u30fc\u30c9\u30b7\u30ea\u30fc\u30ba\uff08\u975e\u63a8\u5968\uff09 -dod_dod5015.type.dod_recordSeries.description=\u30ec\u30b3\u30fc\u30c9\u30b7\u30ea\u30fc\u30ba\uff08\u975e\u63a8\u5968\uff09 - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_dod5015record.description=DOD5015\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_publicationDate.title=\u516c\u958b\u65e5 -dod_dod5015.property.dod_publicationDate.decription=\u516c\u958b\u65e5 -dod_dod5015.property.dod_originator.title=\u767a\u4fe1\u5143 -dod_dod5015.property.dod_originator.decription=\u767a\u4fe1\u5143 -dod_dod5015.property.dod_originatingOrganization.title=\u767a\u4fe1\u5143\u7d44\u7e54 -dod_dod5015.property.dod_originatingOrganization.decription=\u767a\u4fe1\u5143\u7d44\u7e54 -dod_dod5015.property.dod_mediaType.title=\u30e1\u30c7\u30a3\u30a2\u30bf\u30a4\u30d7 -dod_dod5015.property.dod_mediaType.decription=\u30e1\u30c7\u30a3\u30a2\u30bf\u30a4\u30d7 -dod_dod5015.property.dod_format.title=\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_format.decription=\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_dateReceived.title=\u53d7\u4fe1\u65e5 -dod_dod5015.property.dod_dateReceived.decription=\u53d7\u4fe1\u65e5 -dod_dod5015.property.dod_address.title=\u53d7\u4fe1\u8005 -dod_dod5015.property.dod_address.decription=\u53d7\u4fe1\u8005 -dod_dod5015.property.dod_otherAddress.title=\u305d\u306e\u4ed6\u306e\u53d7\u4fe1\u8005 -dod_dod5015.property.dod_otherAddress.decription=\u305d\u306e\u4ed6\u306e\u53d7\u4fe1\u8005 - -dod_dod5015.aspect.dod_scannedRecord.title=\u30b9\u30ad\u30e3\u30f3\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_scannedRecord.description=\u30b9\u30ad\u30e3\u30f3\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_scannedFormat.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_scannedFormat.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_scannedFormatVersion.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_scannedFormatVersion.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_resolutionX.title=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6X -dod_dod5015.property.dod_resolutionX.description=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6X -dod_dod5015.property.dod_resolutionY.title=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6Y -dod_dod5015.property.dod_resolutionY.description=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6Y -dod_dod5015.property.dod_scannedBitDepth.title=\u30b9\u30ad\u30e3\u30f3\u3057\u305f\u30d3\u30c3\u30c8\u6df1\u5ea6 -dod_dod5015.property.dod_scannedBitDepth.description=\u30b9\u30ad\u30e3\u30f3\u3057\u305f\u30d3\u30c3\u30c8\u6df1\u5ea6 - -dod_dod5015.aspect.dod_pdfRecord.title=PDF\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_pdfRecord.description=PDF\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_producingApplication.title=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_producingApplication.description=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_producingApplicationVersion.title=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_producingApplicationVersion.description=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_pdfVersion.title=PDF\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_pdfVersion.description=PDF\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_creatingApplication.title=\u4f5c\u6210\u5143\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_creatingApplication.description=\u4f5c\u6210\u5143\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_documentSecuritySettings.title=\u6587\u66f8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a -dod_dod5015.property.dod_documentSecuritySettings.description=\u6587\u66f8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u30c7\u30b8\u30bf\u30eb\u5199\u771f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u30c7\u30b8\u30bf\u30eb\u5199\u771f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_caption.title=\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_caption.description=\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_photographer.title=\u5199\u771f\u5bb6 -dod_dod5015.property.dod_photographer.description=\u5199\u771f\u5bb6 -dod_dod5015.property.dod_copyright.title=\u8457\u4f5c\u6a29 -dod_dod5015.property.dod_copyright.description=\u8457\u4f5c\u6a29 -dod_dod5015.property.dod_bitDepth.title=\u30d3\u30c3\u30c8\u6df1\u5ea6 -dod_dod5015.property.dod_bitDepth.description=\u30d3\u30c3\u30c8\u6df1\u5ea6 -dod_dod5015.property.dod_imageSizeX.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baX -dod_dod5015.property.dod_imageSizeX.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baX -dod_dod5015.property.dod_imageSizeY.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baY -dod_dod5015.property.dod_imageSizeY.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baY -dod_dod5015.property.dod_imageSource.title=\u30a4\u30e1\u30fc\u30b8\u30bd\u30fc\u30b9 -dod_dod5015.property.dod_imageSource.description=\u30a4\u30e1\u30fc\u30b8\u30bd\u30fc\u30b9 -dod_dod5015.property.dod_compression.title=\u5727\u7e2e -dod_dod5015.property.dod_compression.description=\u5727\u7e2e -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb -dod_dod5015.property.dod_exifInformation.title=EXIF\u60c5\u5831 -dod_dod5015.property.dod_exifInformation.description=EXIF\u60c5\u5831 - -dod_dod5015.aspect.dod_webRecord.title=Web\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_webRecord.description=Web\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_webFileName.title=Web\u30d5\u30a1\u30a4\u30eb\u540d -dod_dod5015.property.dod_webFileName.description=Web\u30d5\u30a1\u30a4\u30eb\u540d -dod_dod5015.property.dod_webPlatform.title=Web\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 -dod_dod5015.property.dod_webPlatform.description=Web\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 -dod_dod5015.property.dod_webSiteName.title=Web\u30b5\u30a4\u30c8\u540d -dod_dod5015.property.dod_webSiteName.description=Web\u30b5\u30a4\u30c8\u540d -dod_dod5015.property.dod_webSiteURL.title=Web\u30b5\u30a4\u30c8URL -dod_dod5015.property.dod_webSiteURL.description=Web\u30b5\u30a4\u30c8URL -dod_dod5015.property.dod_captureMethod.title=\u30ad\u30e3\u30d7\u30c1\u30e3\u624b\u6cd5 -dod_dod5015.property.dod_captureMethod.description=\u30ad\u30e3\u30d7\u30c1\u30e3\u624b\u6cd5 -dod_dod5015.property.dod_captureDate.title=\u30ad\u30e3\u30d7\u30c1\u30e3\u65e5 -dod_dod5015.property.dod_captureDate.description=\u30ad\u30e3\u30d7\u30c1\u30e3\u65e5 -dod_dod5015.property.dod_contact.title=\u9023\u7d61\u5148 -dod_dod5015.property.dod_contact.description=\u9023\u7d61\u5148 -dod_dod5015.property.dod_contentManagementSystem.title=\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0 -dod_dod5015.property.dod_contentManagementSystem.description=\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0 - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties deleted file mode 100644 index 3157bdf8e1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties deleted file mode 100644 index f908d0dd87..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=DOD5015-contentmodel - -dod_dod5015.type.dod_site.title=DOD5015-site -dod_dod5015.type.dod_site.description=DOD5015-site - -dod_dod5015.type.dod_filePlan.title=DOD5015-ordeningsplan -dod_dod5015.type.dod_filePlan.description=DOD5015-ordeningsplan - -dod_dod5015.type.dod_recordSeries.title=Archiefstukreeks (afgekeurd) -dod_dod5015.type.dod_recordSeries.description=Archiefstukreeks (afgekeurd) - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015-archiefstuk -dod_dod5015.aspect.dod_dod5015record.description=DOD5015-archiefstuk -dod_dod5015.property.dod_publicationDate.title=Publicatiedatum -dod_dod5015.property.dod_publicationDate.decription=Publicatiedatum -dod_dod5015.property.dod_originator.title=Herkomst -dod_dod5015.property.dod_originator.decription=Herkomst -dod_dod5015.property.dod_originatingOrganization.title=Oorspronkelijke organisatie -dod_dod5015.property.dod_originatingOrganization.decription=Oorspronkelijke organisatie -dod_dod5015.property.dod_mediaType.title=Type medium -dod_dod5015.property.dod_mediaType.decription=Type medium -dod_dod5015.property.dod_format.title=Indeling -dod_dod5015.property.dod_format.decription=Indeling -dod_dod5015.property.dod_dateReceived.title=Datum ontvangen -dod_dod5015.property.dod_dateReceived.decription=Datum ontvangen -dod_dod5015.property.dod_address.title=Geadresseerde -dod_dod5015.property.dod_address.decription=Geadresseerde -dod_dod5015.property.dod_otherAddress.title=Andere geadresseerde -dod_dod5015.property.dod_otherAddress.decription=Andere geadresseerde - -dod_dod5015.aspect.dod_scannedRecord.title=Gescand archiefstuk -dod_dod5015.aspect.dod_scannedRecord.description=Gescand archiefstuk -dod_dod5015.property.dod_scannedFormat.title=Beeldindeling -dod_dod5015.property.dod_scannedFormat.description=Beeldindeling -dod_dod5015.property.dod_scannedFormatVersion.title=Beeldindeling en -versie -dod_dod5015.property.dod_scannedFormatVersion.description=Beeldindeling en -versie -dod_dod5015.property.dod_resolutionX.title=Beeldresolutie X -dod_dod5015.property.dod_resolutionX.description=Beeldresolutie X -dod_dod5015.property.dod_resolutionY.title=Beeldresolutie Y -dod_dod5015.property.dod_resolutionY.description=Beeldresolutie Y -dod_dod5015.property.dod_scannedBitDepth.title=Gescande bitdiepte -dod_dod5015.property.dod_scannedBitDepth.description=Gescande bitdiepte - -dod_dod5015.aspect.dod_pdfRecord.title=PDF-archiefstuk -dod_dod5015.aspect.dod_pdfRecord.description=PDF-archiefstuk -dod_dod5015.property.dod_producingApplication.title=Producerende applicatie -dod_dod5015.property.dod_producingApplication.description=Producerende applicatie -dod_dod5015.property.dod_producingApplicationVersion.title=Versie producerende applicatie -dod_dod5015.property.dod_producingApplicationVersion.description=Versie producerende applicatie -dod_dod5015.property.dod_pdfVersion.title=PDF-versie -dod_dod5015.property.dod_pdfVersion.description=PDF-versie -dod_dod5015.property.dod_creatingApplication.title=Producerende applicatie -dod_dod5015.property.dod_creatingApplication.description=Producerende applicatie -dod_dod5015.property.dod_documentSecuritySettings.title=Documentbeveiligingsinstellingen -dod_dod5015.property.dod_documentSecuritySettings.description=Documentbeveiligingsinstellingen - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digitaal fotoarchiefstuk -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digitaal fotoarchiefstuk -dod_dod5015.property.dod_caption.title=Bijschrift -dod_dod5015.property.dod_caption.description=Bijschrift -dod_dod5015.property.dod_photographer.title=Fotograaf -dod_dod5015.property.dod_photographer.description=Fotograaf -dod_dod5015.property.dod_copyright.title=Auteursrecht -dod_dod5015.property.dod_copyright.description=Auteursrecht -dod_dod5015.property.dod_bitDepth.title=Bitdiepte -dod_dod5015.property.dod_bitDepth.description=Bitdiepte -dod_dod5015.property.dod_imageSizeX.title=Beeldgrootte X -dod_dod5015.property.dod_imageSizeX.description=Beeldgrootte X -dod_dod5015.property.dod_imageSizeY.title=Beeldgrootte Y -dod_dod5015.property.dod_imageSizeY.description=Beeldgrootte Y -dod_dod5015.property.dod_imageSource.title=Beeldbron -dod_dod5015.property.dod_imageSource.description=Beeldbron -dod_dod5015.property.dod_compression.title=Compressie -dod_dod5015.property.dod_compression.description=Compressie -dod_dod5015.property.dod_iccIcmProfile.title=ICC-/ICM-profiel -dod_dod5015.property.dod_iccIcmProfile.description=ICC-/ICM-profiel -dod_dod5015.property.dod_exifInformation.title=EXIF-informatie -dod_dod5015.property.dod_exifInformation.description=EXIF-informatie - -dod_dod5015.aspect.dod_webRecord.title=Web-archiefstuk -dod_dod5015.aspect.dod_webRecord.description=Web-archiefstuk -dod_dod5015.property.dod_webFileName.title=Web-bestandsnaam -dod_dod5015.property.dod_webFileName.description=Web-bestandsnaam -dod_dod5015.property.dod_webPlatform.title=Web-platform -dod_dod5015.property.dod_webPlatform.description=Web-platform -dod_dod5015.property.dod_webSiteName.title=Websitenaam -dod_dod5015.property.dod_webSiteName.description=Websitenaam -dod_dod5015.property.dod_webSiteURL.title=Websiteadres -dod_dod5015.property.dod_webSiteURL.description=Websiteadres -dod_dod5015.property.dod_captureMethod.title=Methode van vastleggen -dod_dod5015.property.dod_captureMethod.description=Methode van vastleggen -dod_dod5015.property.dod_captureDate.title=Vastlegdatum -dod_dod5015.property.dod_captureDate.description=Vastlegdatum -dod_dod5015.property.dod_contact.title=Contact -dod_dod5015.property.dod_contact.description=Contact -dod_dod5015.property.dod_contentManagementSystem.title=Contentmanagementsysteem -dod_dod5015.property.dod_contentManagementSystem.description=Contentmanagementsysteem - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties deleted file mode 100644 index 869c444797..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=Modelo de conte\u00fado DOD5015 - -dod_dod5015.type.dod_site.title=Site DOD5015 -dod_dod5015.type.dod_site.description=Site DOD5015 - -dod_dod5015.type.dod_filePlan.title=Plano de arquivamento DOD5015 -dod_dod5015.type.dod_filePlan.description=Plano de arquivamento DOD5015 - -dod_dod5015.type.dod_recordSeries.title=S\u00e9rie de documento arquiv\u00edstico (obsoleta) -dod_dod5015.type.dod_recordSeries.description=S\u00e9rie de documento arquiv\u00edstico (obsoleta) - -dod_dod5015.aspect.dod_dod5015record.title=Documento arquiv\u00edstico DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Documento arquiv\u00edstico DOD5015 -dod_dod5015.property.dod_publicationDate.title=Data de publica\u00e7\u00e3o -dod_dod5015.property.dod_publicationDate.decription=Data de publica\u00e7\u00e3o -dod_dod5015.property.dod_originator.title=Originador -dod_dod5015.property.dod_originator.decription=Originador -dod_dod5015.property.dod_originatingOrganization.title=Organiza\u00e7\u00e3o de origem -dod_dod5015.property.dod_originatingOrganization.decription=Organiza\u00e7\u00e3o de origem -dod_dod5015.property.dod_mediaType.title=Tipo de m\u00eddia -dod_dod5015.property.dod_mediaType.decription=Tipo de m\u00eddia -dod_dod5015.property.dod_format.title=Formato -dod_dod5015.property.dod_format.decription=Formato -dod_dod5015.property.dod_dateReceived.title=Data de recebimento -dod_dod5015.property.dod_dateReceived.decription=Data de recebimento -dod_dod5015.property.dod_address.title=Destinat\u00e1rio -dod_dod5015.property.dod_address.decription=Destinat\u00e1rio -dod_dod5015.property.dod_otherAddress.title=Outro destinat\u00e1rio -dod_dod5015.property.dod_otherAddress.decription=Outro destinat\u00e1rio - -dod_dod5015.aspect.dod_scannedRecord.title=Documento arquiv\u00edstico escaneado -dod_dod5015.aspect.dod_scannedRecord.description=Documento arquiv\u00edstico escaneado -dod_dod5015.property.dod_scannedFormat.title=Formato da imagem -dod_dod5015.property.dod_scannedFormat.description=Formato da imagem -dod_dod5015.property.dod_scannedFormatVersion.title=Vers\u00e3o e formato da imagem -dod_dod5015.property.dod_scannedFormatVersion.description=Vers\u00e3o e formato da imagem -dod_dod5015.property.dod_resolutionX.title=Resolu\u00e7\u00e3o da imagem X -dod_dod5015.property.dod_resolutionX.description=Resolu\u00e7\u00e3o da imagem X -dod_dod5015.property.dod_resolutionY.title=Resolu\u00e7\u00e3o da imagem Y -dod_dod5015.property.dod_resolutionY.description=Resolu\u00e7\u00e3o da imagem Y -dod_dod5015.property.dod_scannedBitDepth.title=Intensidade de bits escaneada -dod_dod5015.property.dod_scannedBitDepth.description=Intensidade de bits escaneada - -dod_dod5015.aspect.dod_pdfRecord.title=Arquivo PDF -dod_dod5015.aspect.dod_pdfRecord.description=Arquivo PDF -dod_dod5015.property.dod_producingApplication.title=Aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_producingApplication.description=Aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_producingApplicationVersion.title=Vers\u00e3o do aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_producingApplicationVersion.description=Vers\u00e3o do aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_pdfVersion.title=Vers\u00e3o do PDF -dod_dod5015.property.dod_pdfVersion.description=Vers\u00e3o do PDF -dod_dod5015.property.dod_creatingApplication.title=Criando aplicativo -dod_dod5015.property.dod_creatingApplication.description=Criando aplicativo -dod_dod5015.property.dod_documentSecuritySettings.title=Configura\u00e7\u00f5es de seguran\u00e7a do documento -dod_dod5015.property.dod_documentSecuritySettings.description=Configura\u00e7\u00f5es de seguran\u00e7a do documento - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Documento arquiv\u00edstico fotogr\u00e1fico digital -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Documento arquiv\u00edstico fotogr\u00e1fico digital -dod_dod5015.property.dod_caption.title=Legenda -dod_dod5015.property.dod_caption.description=Legenda -dod_dod5015.property.dod_photographer.title=Fot\u00f3grafo -dod_dod5015.property.dod_photographer.description=Fot\u00f3grafo -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Intensidade de bit -dod_dod5015.property.dod_bitDepth.description=Intensidade de bit -dod_dod5015.property.dod_imageSizeX.title=Tamanho da imagem X -dod_dod5015.property.dod_imageSizeX.description=Tamanho da imagem X -dod_dod5015.property.dod_imageSizeY.title=Tamanho da imagem Y -dod_dod5015.property.dod_imageSizeY.description=Tamanho da imagem Y -dod_dod5015.property.dod_imageSource.title=Fonte da imagem -dod_dod5015.property.dod_imageSource.description=Fonte da imagem -dod_dod5015.property.dod_compression.title=Compress\u00e3o -dod_dod5015.property.dod_compression.description=Compress\u00e3o -dod_dod5015.property.dod_iccIcmProfile.title=Perfil ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Perfil ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informa\u00e7\u00f5es EXIF -dod_dod5015.property.dod_exifInformation.description=Informa\u00e7\u00f5es EXIF - -dod_dod5015.aspect.dod_webRecord.title=Documento arquiv\u00edstico da Web -dod_dod5015.aspect.dod_webRecord.description=Documento arquiv\u00edstico da Web -dod_dod5015.property.dod_webFileName.title=Nome do arquivo da Web -dod_dod5015.property.dod_webFileName.description=Nome do arquivo da Web -dod_dod5015.property.dod_webPlatform.title=Plataforma da Web -dod_dod5015.property.dod_webPlatform.description=Plataforma da Web -dod_dod5015.property.dod_webSiteName.title=Nome do site -dod_dod5015.property.dod_webSiteName.description=Nome do site -dod_dod5015.property.dod_webSiteURL.title=URL do site -dod_dod5015.property.dod_webSiteURL.description=URL do site -dod_dod5015.property.dod_captureMethod.title=M\u00e9todo de captura -dod_dod5015.property.dod_captureMethod.description=M\u00e9todo de captura -dod_dod5015.property.dod_captureDate.title=Data de captura -dod_dod5015.property.dod_captureDate.description=Data de captura -dod_dod5015.property.dod_contact.title=Contato -dod_dod5015.property.dod_contact.description=Contato -dod_dod5015.property.dod_contentManagementSystem.title=Sistema de gerenciamento de conte\u00fado -dod_dod5015.property.dod_contentManagementSystem.description=Sistema de gerenciamento de conte\u00fado - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties deleted file mode 100644 index dd8c5a192c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 DOD5015 - -dod_dod5015.type.dod_site.title=\u0421\u0430\u0439\u0442 DOD5015 -dod_dod5015.type.dod_site.description=\u0421\u0430\u0439\u0442 DOD5015 - -dod_dod5015.type.dod_filePlan.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 DOD5015 -dod_dod5015.type.dod_filePlan.description=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 DOD5015 - -dod_dod5015.type.dod_recordSeries.title=\u0421\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e) -dod_dod5015.type.dod_recordSeries.description=\u0421\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e) - -dod_dod5015.aspect.dod_dod5015record.title=\u0417\u0430\u043f\u0438\u0441\u044c DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=\u0417\u0430\u043f\u0438\u0441\u044c DOD5015 -dod_dod5015.property.dod_publicationDate.title=\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 -dod_dod5015.property.dod_publicationDate.decription=\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 -dod_dod5015.property.dod_originator.title=\u0418\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 -dod_dod5015.property.dod_originator.decription=\u0418\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 -dod_dod5015.property.dod_originatingOrganization.title=\u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f -dod_dod5015.property.dod_originatingOrganization.decription=\u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f -dod_dod5015.property.dod_mediaType.title=\u0422\u0438\u043f \u043c\u0435\u0434\u0438\u0430 -dod_dod5015.property.dod_mediaType.decription=\u0422\u0438\u043f \u043c\u0435\u0434\u0438\u0430 -dod_dod5015.property.dod_format.title=\u0424\u043e\u0440\u043c\u0430\u0442 -dod_dod5015.property.dod_format.decription=\u0424\u043e\u0440\u043c\u0430\u0442 -dod_dod5015.property.dod_dateReceived.title=\u0414\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_dateReceived.decription=\u0414\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_address.title=\u0410\u0434\u0440\u0435\u0441\u0430\u0442 -dod_dod5015.property.dod_address.decription=\u0410\u0434\u0440\u0435\u0441\u0430\u0442 -dod_dod5015.property.dod_otherAddress.title=\u0414\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0442 -dod_dod5015.property.dod_otherAddress.decription=\u0414\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0442 - -dod_dod5015.aspect.dod_scannedRecord.title=\u041e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.aspect.dod_scannedRecord.description=\u041e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.property.dod_scannedFormat.title=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedFormat.description=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedFormatVersion.title=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedFormatVersion.description=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_resolutionX.title=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_resolutionX.description=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_resolutionY.title=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_resolutionY.description=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_scannedBitDepth.title=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedBitDepth.description=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f - -dod_dod5015.aspect.dod_pdfRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c PDF -dod_dod5015.aspect.dod_pdfRecord.description=\u0417\u0430\u043f\u0438\u0441\u044c PDF -dod_dod5015.property.dod_producingApplication.title=\u0412\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_producingApplication.description=\u0412\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_producingApplicationVersion.title=\u0412\u0435\u0440\u0441\u0438\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_producingApplicationVersion.description=\u0412\u0435\u0440\u0441\u0438\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_pdfVersion.title=\u0412\u0435\u0440\u0441\u0438\u044f PDF -dod_dod5015.property.dod_pdfVersion.description=\u0412\u0435\u0440\u0441\u0438\u044f PDF -dod_dod5015.property.dod_creatingApplication.title=\u0421\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_creatingApplication.description=\u0421\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_documentSecuritySettings.title=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 -dod_dod5015.property.dod_documentSecuritySettings.description=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u0438\u0434\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u0438\u0434\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.property.dod_caption.title=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a -dod_dod5015.property.dod_caption.description=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a -dod_dod5015.property.dod_photographer.title=\u0410\u0432\u0442\u043e\u0440 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.property.dod_photographer.description=\u0410\u0432\u0442\u043e\u0440 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.property.dod_copyright.title=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 -dod_dod5015.property.dod_copyright.description=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 -dod_dod5015.property.dod_bitDepth.title=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 -dod_dod5015.property.dod_bitDepth.description=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 -dod_dod5015.property.dod_imageSizeX.title=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_imageSizeX.description=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_imageSizeY.title=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_imageSizeY.description=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_imageSource.title=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_imageSource.description=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_compression.title=\u0421\u0436\u0430\u0442\u0438\u0435 -dod_dod5015.property.dod_compression.description=\u0421\u0436\u0430\u0442\u0438\u0435 -dod_dod5015.property.dod_iccIcmProfile.title=\u041f\u0440\u043e\u0444\u0438\u043b\u044c ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=\u041f\u0440\u043e\u0444\u0438\u043b\u044c ICC/ICM -dod_dod5015.property.dod_exifInformation.title=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f EXIF -dod_dod5015.property.dod_exifInformation.description=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f EXIF - -dod_dod5015.aspect.dod_webRecord.title=\u0412\u0435\u0431-\u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.aspect.dod_webRecord.description=\u0412\u0435\u0431-\u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.property.dod_webFileName.title=\u0418\u043c\u044f \u0432\u0435\u0431-\u0444\u0430\u0439\u043b\u0430 -dod_dod5015.property.dod_webFileName.description=\u0418\u043c\u044f \u0432\u0435\u0431-\u0444\u0430\u0439\u043b\u0430 -dod_dod5015.property.dod_webPlatform.title=\u0412\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 -dod_dod5015.property.dod_webPlatform.description=\u0412\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 -dod_dod5015.property.dod_webSiteName.title=\u0418\u043c\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_webSiteName.description=\u0418\u043c\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_webSiteURL.title=URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_webSiteURL.description=URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_captureMethod.title=\u0421\u043f\u043e\u0441\u043e\u0431 \u0432\u0432\u043e\u0434\u0430 -dod_dod5015.property.dod_captureMethod.description=\u0421\u043f\u043e\u0441\u043e\u0431 \u0432\u0432\u043e\u0434\u0430 -dod_dod5015.property.dod_captureDate.title=\u0414\u0430\u0442\u0430 \u0441\u043d\u0438\u043c\u043a\u0430 -dod_dod5015.property.dod_captureDate.description=\u0414\u0430\u0442\u0430 \u0441\u043d\u0438\u043c\u043a\u0430 -dod_dod5015.property.dod_contact.title=\u041a\u043e\u043d\u0442\u0430\u043a\u0442 -dod_dod5015.property.dod_contact.description=\u041a\u043e\u043d\u0442\u0430\u043a\u0442 -dod_dod5015.property.dod_contentManagementSystem.title=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c -dod_dod5015.property.dod_contentManagementSystem.description=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties deleted file mode 100755 index 0e1b7a579b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=DOD5015 \u5185\u5bb9\u6a21\u578b - -dod_dod5015.type.dod_site.title=DOD5015 \u7ad9\u70b9 -dod_dod5015.type.dod_site.description=DOD5015 \u7ad9\u70b9 - -dod_dod5015.type.dod_filePlan.title=DOD5015 \u5f52\u7c7b\u65b9\u6848 -dod_dod5015.type.dod_filePlan.description=DOD5015 \u5f52\u7c7b\u65b9\u6848 - -dod_dod5015.type.dod_recordSeries.title=\u8bb0\u5f55\u7cfb\u5217\uff08\u5df2\u5f03\u7528\uff09 -dod_dod5015.type.dod_recordSeries.description=\u8bb0\u5f55\u7cfb\u5217\uff08\u5df2\u5f03\u7528\uff09 - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015 \u8bb0\u5f55 -dod_dod5015.aspect.dod_dod5015record.description=DOD5015 \u8bb0\u5f55 -dod_dod5015.property.dod_publicationDate.title=\u53d1\u5e03\u65e5\u671f -dod_dod5015.property.dod_publicationDate.decription=\u53d1\u5e03\u65e5\u671f -dod_dod5015.property.dod_originator.title=\u5efa\u7acb\u8005 -dod_dod5015.property.dod_originator.decription=\u5efa\u7acb\u8005 -dod_dod5015.property.dod_originatingOrganization.title=\u8d77\u59cb\u7ec4\u7ec7 -dod_dod5015.property.dod_originatingOrganization.decription=\u8d77\u59cb\u7ec4\u7ec7 -dod_dod5015.property.dod_mediaType.title=\u5a92\u4f53\u7c7b\u578b -dod_dod5015.property.dod_mediaType.decription=\u5a92\u4f53\u7c7b\u578b -dod_dod5015.property.dod_format.title=\u683c\u5f0f -dod_dod5015.property.dod_format.decription=\u683c\u5f0f -dod_dod5015.property.dod_dateReceived.title=\u63a5\u6536\u65e5\u671f -dod_dod5015.property.dod_dateReceived.decription=\u63a5\u6536\u65e5\u671f -dod_dod5015.property.dod_address.title=\u6536\u4ef6\u4eba -dod_dod5015.property.dod_address.decription=\u6536\u4ef6\u4eba -dod_dod5015.property.dod_otherAddress.title=\u5176\u4ed6\u6536\u4ef6\u4eba -dod_dod5015.property.dod_otherAddress.decription=\u5176\u4ed6\u6536\u4ef6\u4eba - -dod_dod5015.aspect.dod_scannedRecord.title=\u626b\u63cf\u7684\u8bb0\u5f55 -dod_dod5015.aspect.dod_scannedRecord.description=\u626b\u63cf\u7684\u8bb0\u5f55 -dod_dod5015.property.dod_scannedFormat.title=\u56fe\u50cf\u683c\u5f0f -dod_dod5015.property.dod_scannedFormat.description=\u56fe\u50cf\u683c\u5f0f -dod_dod5015.property.dod_scannedFormatVersion.title=\u56fe\u50cf\u683c\u5f0f\u548c\u7248\u672c -dod_dod5015.property.dod_scannedFormatVersion.description=\u56fe\u50cf\u683c\u5f0f\u548c\u7248\u672c -dod_dod5015.property.dod_resolutionX.title=\u56fe\u50cf\u5206\u8fa8\u7387 X -dod_dod5015.property.dod_resolutionX.description=\u56fe\u50cf\u5206\u8fa8\u7387 X -dod_dod5015.property.dod_resolutionY.title=\u56fe\u50cf\u5206\u8fa8\u7387 Y -dod_dod5015.property.dod_resolutionY.description=\u56fe\u50cf\u5206\u8fa8\u7387 Y -dod_dod5015.property.dod_scannedBitDepth.title=\u626b\u63cf\u7684\u4f4d\u6df1 -dod_dod5015.property.dod_scannedBitDepth.description=\u626b\u63cf\u7684\u4f4d\u6df1 - -dod_dod5015.aspect.dod_pdfRecord.title=PDF \u8bb0\u5f55 -dod_dod5015.aspect.dod_pdfRecord.description=PDF \u8bb0\u5f55 -dod_dod5015.property.dod_producingApplication.title=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_producingApplication.description=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_producingApplicationVersion.title=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f\u7248\u672c -dod_dod5015.property.dod_producingApplicationVersion.description=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f\u7248\u672c -dod_dod5015.property.dod_pdfVersion.title=PDF \u7248\u672c -dod_dod5015.property.dod_pdfVersion.description=PDF \u7248\u672c -dod_dod5015.property.dod_creatingApplication.title=\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_creatingApplication.description=\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_documentSecuritySettings.title=\u6587\u6863\u5b89\u5168\u8bbe\u7f6e -dod_dod5015.property.dod_documentSecuritySettings.description=\u6587\u6863\u5b89\u5168\u8bbe\u7f6e - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u6570\u7801\u7167\u7247\u8bb0\u5f55 -dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u6570\u7801\u7167\u7247\u8bb0\u5f55 -dod_dod5015.property.dod_caption.title=\u6807\u9898 -dod_dod5015.property.dod_caption.description=\u6807\u9898 -dod_dod5015.property.dod_photographer.title=\u6444\u5f71\u5e08 -dod_dod5015.property.dod_photographer.description=\u6444\u5f71\u5e08 -dod_dod5015.property.dod_copyright.title=\u7248\u6743 -dod_dod5015.property.dod_copyright.description=\u7248\u6743 -dod_dod5015.property.dod_bitDepth.title=\u4f4d\u6df1 -dod_dod5015.property.dod_bitDepth.description=\u4f4d\u6df1 -dod_dod5015.property.dod_imageSizeX.title=\u56fe\u50cf\u5c3a\u5bf8 X -dod_dod5015.property.dod_imageSizeX.description=\u56fe\u50cf\u5c3a\u5bf8 X -dod_dod5015.property.dod_imageSizeY.title=\u56fe\u50cf\u5c3a\u5bf8 Y -dod_dod5015.property.dod_imageSizeY.description=\u56fe\u50cf\u5c3a\u5bf8 Y -dod_dod5015.property.dod_imageSource.title=\u56fe\u50cf\u6e90 -dod_dod5015.property.dod_imageSource.description=\u56fe\u50cf\u6e90 -dod_dod5015.property.dod_compression.title=\u538b\u7f29 -dod_dod5015.property.dod_compression.description=\u538b\u7f29 -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM \u914d\u7f6e\u6587\u4ef6 -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM \u914d\u7f6e\u6587\u4ef6 -dod_dod5015.property.dod_exifInformation.title=EXIF \u4fe1\u606f -dod_dod5015.property.dod_exifInformation.description=EXIF \u4fe1\u606f - -dod_dod5015.aspect.dod_webRecord.title=Web \u8bb0\u5f55 -dod_dod5015.aspect.dod_webRecord.description=Web \u8bb0\u5f55 -dod_dod5015.property.dod_webFileName.title=Web \u6587\u4ef6\u540d -dod_dod5015.property.dod_webFileName.description=Web \u6587\u4ef6\u540d -dod_dod5015.property.dod_webPlatform.title=Web \u5e73\u53f0 -dod_dod5015.property.dod_webPlatform.description=Web \u5e73\u53f0 -dod_dod5015.property.dod_webSiteName.title=\u7f51\u7ad9\u540d\u79f0 -dod_dod5015.property.dod_webSiteName.description=\u7f51\u7ad9\u540d\u79f0 -dod_dod5015.property.dod_webSiteURL.title=\u7f51\u7ad9 URL -dod_dod5015.property.dod_webSiteURL.description=\u7f51\u7ad9 URL -dod_dod5015.property.dod_captureMethod.title=\u6355\u6349\u65b9\u6cd5 -dod_dod5015.property.dod_captureMethod.description=\u6355\u6349\u65b9\u6cd5 -dod_dod5015.property.dod_captureDate.title=\u6355\u6349\u65e5\u671f -dod_dod5015.property.dod_captureDate.description=\u6355\u6349\u65e5\u671f -dod_dod5015.property.dod_contact.title=\u8054\u7cfb\u4eba -dod_dod5015.property.dod_contact.description=\u8054\u7cfb\u4eba -dod_dod5015.property.dod_contentManagementSystem.title=\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf -dod_dod5015.property.dod_contentManagementSystem.description=\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties deleted file mode 100644 index 23d5952dfc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Classified Records -capability.UpdateClassificationDates.title=Update Classification Dates -capability.CreateModifyDestroyClassificationGuides.title=Create Modify Destroy Classification Guides -capability.UpgradeDowngradeAndDeclassifyRecords.title=Upgrade Downgrade and Declassify Records -capability.UpdateExemptionCategories.title=Update Exemption Categories -capability.MapClassificationGuideMetadata.title=Map Classification Guide Metadata -capability.CreateModifyDestroyTimeframes.title=Create Modify Destroy Time Frames \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties deleted file mode 100644 index 2616b791ff..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Klassifizierte Records -capability.UpdateClassificationDates.title=Klassifizierungsdaten aktualisieren -capability.CreateModifyDestroyClassificationGuides.title=Klassifizierungsleitfaden erstellen/\u00e4ndern/vernichten -capability.UpgradeDowngradeAndDeclassifyRecords.title=Records h\u00f6her-/herunterstufen und ihre Klassifizierung aufheben -capability.UpdateExemptionCategories.title=Ausnahmekategorien aktualisieren -capability.MapClassificationGuideMetadata.title=Metadaten f\u00fcr Klassifizierungsleitfaden zuordnen -capability.CreateModifyDestroyTimeframes.title=Zeitrahmen erstellen/\u00e4ndern/vernichten diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties deleted file mode 100644 index 3d506edd3c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Documentos de archivo clasificados -capability.UpdateClassificationDates.title=Actualizar fechas de clasificaci\u00f3n -capability.CreateModifyDestroyClassificationGuides.title=Crear Modificar Destruir gu\u00edas de clasificaci\u00f3n -capability.UpgradeDowngradeAndDeclassifyRecords.title=Actualizar, degradar y desclasificar documentos de archivo -capability.UpdateExemptionCategories.title=Actualizar categor\u00edas de exenci\u00f3n -capability.MapClassificationGuideMetadata.title=Asignar metadatos de gu\u00eda de clasificaci\u00f3n -capability.CreateModifyDestroyTimeframes.title=Crear Modificar Destruir plazos de tiempo diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties deleted file mode 100644 index e16db5953d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Document d'archives classifi\u00e9s -capability.UpdateClassificationDates.title=Mettre \u00e0 jour les dates de classification -capability.CreateModifyDestroyClassificationGuides.title=Cr\u00e9er Modifier D\u00e9truire les guides de classification -capability.UpgradeDowngradeAndDeclassifyRecords.title=Mettre \u00e0 jour R\u00e9trograder et D\u00e9classifier des documents d'archives -capability.UpdateExemptionCategories.title=Mettre \u00e0 jour les cat\u00e9gories d'exemption -capability.MapClassificationGuideMetadata.title=Mapper les m\u00e9tadonn\u00e9es de guides de classification -capability.CreateModifyDestroyTimeframes.title=Cr\u00e9er Modifier D\u00e9truire des d\u00e9lais diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties deleted file mode 100644 index c969fba7eb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Record classificati -capability.UpdateClassificationDates.title=Aggiorna date di classificazione -capability.CreateModifyDestroyClassificationGuides.title=Crea Modifica Elimina definitivamente guide di classificazione -capability.UpgradeDowngradeAndDeclassifyRecords.title=Upgrade Downgrade e Declassifica record -capability.UpdateExemptionCategories.title=Aggiorna categorie di esenzione -capability.MapClassificationGuideMetadata.title=Esegui il mapping dei metadati della guida di classificazione -capability.CreateModifyDestroyTimeframes.title=Crea Modifica Elimina definitivamente intervalli di tempo diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties deleted file mode 100644 index 4d6d84dd6b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=\u5206\u985e\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -capability.UpdateClassificationDates.title=\u5206\u985e\u65e5\u306e\u66f4\u65b0 -capability.CreateModifyDestroyClassificationGuides.title=\u5206\u985e\u30ac\u30a4\u30c9\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.UpgradeDowngradeAndDeclassifyRecords.title=\u30c0\u30a6\u30f3\u30b0\u30ec\u30fc\u30c9\u306e\u66f4\u65b0\u3068\u30ec\u30b3\u30fc\u30c9\u306e\u5206\u985e\u89e3\u9664 -capability.UpdateExemptionCategories.title=\u9664\u5916\u30ab\u30c6\u30b4\u30ea\u306e\u66f4\u65b0 -capability.MapClassificationGuideMetadata.title=\u5206\u985e\u30ac\u30a4\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0 -capability.CreateModifyDestroyTimeframes.title=\u671f\u9593\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties deleted file mode 100644 index e4f1fa4030..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties deleted file mode 100755 index 144f485fb3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Geclassificeerde archiefstukken -capability.UpdateClassificationDates.title=Classificatiedata bijwerken -capability.CreateModifyDestroyClassificationGuides.title=Classificatiegidsen maken aanpassen vernietigen -capability.UpgradeDowngradeAndDeclassifyRecords.title=Archiefstukken upgraden, downgraden en declassificeren -capability.UpdateExemptionCategories.title=Uitzonderingscategorie\u00ebn bijwerken -capability.MapClassificationGuideMetadata.title=Metagegevens classificatiegids toewijzen -capability.CreateModifyDestroyTimeframes.title=Tijdsperiodes maken aanpassen vernietigen diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties deleted file mode 100644 index b680fefaaa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Documentos arquiv\u00edsticos classificados -capability.UpdateClassificationDates.title=Atualizar datas de classifica\u00e7\u00e3o -capability.CreateModifyDestroyClassificationGuides.title=Criar Modificar Destruir guias de classifica\u00e7\u00e3o -capability.UpgradeDowngradeAndDeclassifyRecords.title=Atualizar Downgrade e Desclassificar documentos arquiv\u00edsticos -capability.UpdateExemptionCategories.title=Atualizar categorias de isen\u00e7\u00e3o -capability.MapClassificationGuideMetadata.title=Mapear metadados do guia de classifica\u00e7\u00e3o -capability.CreateModifyDestroyTimeframes.title=Criar Modificar Destruir per\u00edodos de tempo diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties deleted file mode 100644 index f2e703c148..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.UpdateClassificationDates.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 -capability.CreateModifyDestroyClassificationGuides.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 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 -capability.UpgradeDowngradeAndDeclassifyRecords.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043a \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u043c \u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.UpdateExemptionCategories.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 -capability.MapClassificationGuideMetadata.title=\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 -capability.CreateModifyDestroyTimeframes.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 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties deleted file mode 100755 index c4c6dae3bf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=\u5206\u7c7b\u7684\u8bb0\u5f55 -capability.UpdateClassificationDates.title=\u66f4\u65b0\u5206\u7c7b\u65e5\u671f -capability.CreateModifyDestroyClassificationGuides.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5206\u7c7b\u6307\u5357 -capability.UpgradeDowngradeAndDeclassifyRecords.title=\u8bb0\u5f55\u7684\u5347\u7ea7\u3001\u964d\u7ea7\u4ee5\u53ca\u53d6\u6d88\u5206\u7c7b -capability.UpdateExemptionCategories.title=\u66f4\u65b0\u8c41\u514d\u7c7b\u522b -capability.MapClassificationGuideMetadata.title=\u6620\u5c04\u5206\u7c7b\u6307\u5357\u5143\u6570\u636e -capability.CreateModifyDestroyTimeframes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u65f6\u95f4\u8303\u56f4 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml deleted file mode 100644 index ff74ae7b86..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.repo.security.permissions.impl.ExtendedPermissionService - - - - - - - - - - - - - - - - - - - - - - org.alfresco.service.cmr.security.PermissionService.getOwnerAuthority=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getAllAuthorities=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getAllPermission=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getPermissions=ACL_NODE.0.sys:base.ReadPermissions - org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions=ACL_NODE.0.sys:base.ReadPermissions - org.alfresco.service.cmr.security.PermissionService.getSettablePermissions=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.hasPermission=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getReaders=ACL_METHOD.ROLE_ADMINISTRATOR - org.alfresco.repo.security.permissions.impl.ExtendedPermissionService.getWriters=ACL_METHOD.ROLE_ADMINISTRATOR - org.alfresco.repo.security.permissions.impl.ExtendedPermissionService.getReadersAndWriters=ACL_METHOD.ROLE_ADMINISTRATOR - org.alfresco.service.cmr.security.PermissionService.deletePermissions=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.deletePermission=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.setPermission=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.setInheritParentPermissions=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.getInheritParentPermissions=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.clearPermission=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.*=ACL_DENY - - - - - - - - - - - - - - org.alfresco.writersTransactionalCache - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.haspermissionmap.read} - - - ${rm.haspermissionmap.write} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.autocompletesuggestion.maxsuggestions.node} - - - - - - - - - ${rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes} - - - - - - - ${rm.autocompletesuggestion.maxsuggestions.date} - - - - - - - - - - - - - - - - - - - - - - false - - - - - ${rm.rule.runasadmin} - - - - - - - - - - - org.alfresco.repo.forms.FormService.getForm=ACL_ALLOW - org.alfresco.repo.forms.FormService.saveForm=ACL_ALLOW - org.alfresco.repo.forms.FormService.*=ACL_DENY - - - - - - - search - - - - - - - - - - - - ${spaces.store} - - - - - - true - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties deleted file mode 100644 index f5ecef752f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties +++ /dev/null @@ -1,60 +0,0 @@ -# -# Warnings -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.caveat=warn -log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityPostProcessor=warn - -# -# Module patches -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info - -# -# Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be -# removed to enhance performance. -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=info - -# -# RM permission debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMEntryVoter=debug -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMAfterInvocationProvider=debug -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.declarative=debug - -# -# RM Audit service debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService=debug - -# -# Job debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug - -# -# Script logging level -# -log4j.logger.org.alfresco.repo.jscript.ScriptLogger=error - -# -# Behaviour debug -# -log4j.logger.org.alfresco.repo.policy.annotation.AnnotatedBehaviourPostProcessor=info -log4j.logger.org.alfresco.module.org_alfresco_module_rm.behaviour.BaseBehaviourBean=info - -# -# Patch debug -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info -# -# RM Audit service debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService=debug - -# -# Job debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug -log4j.logger.org.alfresco.repo.web.scripts.roles.DynamicAuthoritiesGet=info -log4j.logger.org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAOImpl=info \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties deleted file mode 100644 index eeac19f2e6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=The records management action {0} hasn't been defined. -rm.action.no-implicit-noderef=There was a system error so the action {0} might not be successful. -rm.action.record-not-declared=The retention action {0} couldn't be performed, because the record {1} isn't complete. -rm.action.expected-record-level=The retention action {0} couldn't be performed, because {1} isn't a record. -rm.action.not-all-records-declared=The retention action {0} couldn't be performed, because not all the records in the record folder are complete. (actionedUponNodeRef={1}) -rm.action.not-eligible=The record or record folder {1} isn't yet ready for retention action {0}. -rm.action.no-disposition-instructions=The retention action {0} couldn't be performed, because no retention instructions could be found. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=The retention action {0} couldn't be performed, because there's no available retention life-cycle set. (nodeRef={1}) -rm.action.next-disp-not-set=The retention action {0} couldn't be performed, because the next retention action isn't set. (nodeRef={1}) -rm.action.not-next-disp=The retention action {0} couldn't be performed, because this isn't the next retention action for this record or record folder. (nodeRef={1}) -rm.action.not-record-folder=The retention action {0} couldn't be performed, because {1} isn't a record folder. -rm.action.actioned-upon-not-record=The action {0} can't be performed because {1} isn't a record. -rm.action.custom-aspect-not-recognised=The custom type can't be applied because it's not recognised. (customAspect={0}) -rm.action.event-no-disp-lc=The event {0} can't be completed because it's not defined on the retention lifecycle. -rm.action.undeclared-only-records=Only records can be completed. (nodeRef={0}) -rm.action.no-declare-mand-prop=You need to set all the record's mandatory properties before you can complete the record. -rm.action.ghosted-prop-update=You can't update the properties of a previously destroyed record. -rm.action.valid-date-disp-asof=Enter a valid date for the retention action as of date. -rm.action.disp-asof-lifecycle-applied=You can't edit the retention as of date for a record or record folder which has a lifecycle applied. -rm.action.hold-edit-reason-none=You can't edit the hold reason because the hold was created without a reason. Try recreating the hold. -rm.action.hold-edit-type=You can't edit the hold reason for {1} because it isn't a hold. -rm.action.specify-avlid-date=Enter a valid date for the review as of date. -rm.action.review-details-only=You can only edit the review details of vital records. -rm.action.freeze-no-reason=You can't hold a record without a reason. Add a reason to the hold. -rm.action.freeze-only-records-folders=You can only hold records or record folders. -rm.action.no-open-record-folder=You can't reopen {0} because it's not a record folder. -rm.action.not-hold-type=You can't carry out the action on {1} because it isn't a hold. -rm.action.no-read-mime-message=The filetype message couldn't be read because {0}. -rm.action.email-declared=We couldn't split the email because the record is complete. (actionedUponNodeRef={0}) -rm.action.email-not-record=We couldn't split the email because the file, folder, or category isn't a record. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=We couldn't create a custom child association. -rm.action.node-already-transfer=The file, folder, or category is already being transferred. -rm.action.node-not-transfer=The file, folder, or category isn't a transfer object. -rm.action.undo-not-last=You can't undo the cut off because the last retention action wasn't cut off. -rm.action.records_only_undeclared=You can only complete records. -rm.action.event-not-undone=You can't undo the event {0} because it's not defined on the retention lifecycle. -rm.action.node-not-record-category=You can't create a retention schedule for ({0}) because it's not a record category. -rm.action.parameter-not-supplied=Add a ''{0}'' to continue. -rm.action.delete-not-hold-type=We couldn't delete the hold because {1} isn't of type {0}. -rm.action.cast-to-rm-type=You can't upload a custom folder type to the records management file plan. -rm.action.record-folder-create=You can't create a record folder in another record folder. -rm.action.unique.child.type-error-message=You can't create multiple items of this type here. -rm.action.multiple.children.type-error-message=You can't create {0} here. -rm.action.create.transfer.container.child-error-message=You can't create items in the Transfer container. -rm.action.create.transfer.child-error-message=You can't create items in Transfer Folders. -rm.action.create.record.folder.child-error-message=You can only create records in record folders and this was a {0}. -rm.action.transfer-non-editable=You can't edit transfer folder or container metadata. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties deleted file mode 100644 index 03b0890712..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=Die Records Management Aktion {0} wurde nicht definiert. -rm.action.no-implicit-noderef=Es ist ein Systemfehler aufgetreten, sodass die Aktion {0} m\u00f6glicherweise nicht erfolgreich sein wird. -rm.action.record-not-declared=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da der Record {1} unvollst\u00e4ndig ist. -rm.action.expected-record-level=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da {1} kein Record ist. -rm.action.not-all-records-declared=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da nicht alle Records im Record-Ordner abgeschlossen sind. (actionedUponNodeRef={1}) -rm.action.not-eligible=Record oder Record-Ordner {1} ist noch nicht bereit f\u00fcr die Aufbewahrungsaktion {0}. -rm.action.no-disposition-instructions=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da keine Aufbewahrungsanweisungen gefunden wurden. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da kein verf\u00fcgbarer Aufbewahrungszyklus festgelegt wurde. (nodeRef={1}) -rm.action.next-disp-not-set=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da keine n\u00e4chste Aufbewahrungsaktion festgelegt wurde. (nodeRef={1}) -rm.action.not-next-disp=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da es sich hierbei nicht um die n\u00e4chste Aufbewahrungsaktion f\u00fcr den Record bzw. den Record-Ordner handelt. (nodeRef={1}) -rm.action.not-record-folder=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da {1} kein Record-Ordner ist. -rm.action.actioned-upon-not-record=Die Aktion {0} kann nicht durchgef\u00fchrt werden, da {1} kein Record ist. -rm.action.custom-aspect-not-recognised=Der benutzerdefinierte Typ kann nicht angewendet werden, da er nicht erkannt wird. (customAspect={0}) -rm.action.event-no-disp-lc=Das Ereignis {0} kann nicht abgeschlossen werden, da es nicht im Aufbewahrungszyklus definiert ist. -rm.action.undeclared-only-records=Nur Records k\u00f6nnen abgeschlossen werden. (nodeRef={0}) -rm.action.no-declare-mand-prop=Um den Record abzuschlie\u00dfen, m\u00fcssen Sie alle erforderlichen Eigenschaften des Record festlegen. -rm.action.ghosted-prop-update=Die Eigenschaften eines zuvor vernichteten Record k\u00f6nnen nicht aktualisiert werden. -rm.action.valid-date-disp-asof=Geben Sie ein zul\u00e4ssiges Datum als Startdatum der Aufbewahrungsaktion ein. -rm.action.disp-asof-lifecycle-applied=Sie k\u00f6nnen das Startdatum der Aufbewahrung f\u00fcr einen Record oder Record-Ordner mit festgelegtem Aufbewahrungszyklus nicht bearbeiten. -rm.action.hold-edit-reason-none=Der Grund f\u00fcr den Legal Hold kann nicht bearbeitet werden, da er ohne Grund erstellt wurde. Versuchen Sie, den Legal Hold erneut zu erstellen. -rm.action.hold-edit-type=Sie k\u00f6nnen den Grund f\u00fcr den Legal Hold von {1} nicht bearbeiten, da es sich nicht um einen Legal Hold handelt. -rm.action.specify-avlid-date=Geben Sie ein zul\u00e4ssiges Datum als Startdatum der \u00dcberpr\u00fcfung ein. -rm.action.review-details-only=Sie k\u00f6nnen nur die \u00dcberpr\u00fcfungsdetails besonders relevanter Records bearbeiten. -rm.action.freeze-no-reason=Ein Record kann nicht ohne Grund mit einem Legal Hold belegt werden. F\u00fcgen Sie einen Grund f\u00fcr den Legal Hold hinzu. -rm.action.freeze-only-records-folders=Sie k\u00f6nnen nur Records oder Record-Ordner mit einem Legal Hold belegen. -rm.action.no-open-record-folder=Sie k\u00f6nnen {0} nicht erneut \u00f6ffnen, da es sich nicht um einen Record-Ordner handelt. -rm.action.not-hold-type=Die Aktion kann nicht f\u00fcr {1} durchgef\u00fchrt werden, weil es sich nicht um einen Legal Hold handelt. -rm.action.no-read-mime-message=Die Dateityp-Nachricht konnte nicht gelesen werden, da {0}. -rm.action.email-declared=Die E-Mail konnte nicht geteilt werden, da der Record abgeschlossen ist. (actionedUponNodeRef={0}) -rm.action.email-not-record=Die E-Mail konnte nicht geteilt werden, da die Datei, der Ordner bzw. die Kategorie kein Record ist. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Benutzerdefinierte Unterzuordnung konnte nicht erstellt werden. -rm.action.node-already-transfer=Datei, Ordner oder Kategorie wird bereits \u00fcbertragen. -rm.action.node-not-transfer=Datei, Ordner oder Kategorie ist kein \u00dcbertragungsobjekt. -rm.action.undo-not-last=Trennung kann nicht aufgehoben werden, da die letzte Aufbewahrungsaktion nicht getrennt wurde. -rm.action.records_only_undeclared=Es k\u00f6nnen nur Records abgeschlossen werden. -rm.action.event-not-undone=Sie k\u00f6nnen das Ereignis {0} nicht r\u00fcckg\u00e4ngig machen, da es nicht im Aufbewahrungszyklus definiert ist. -rm.action.node-not-record-category=Sie k\u00f6nnen keinen Aufbewahrungsplan f\u00fcr ({0}) erstellen, da es sich nicht um eine Record-Kategorie handelt. -rm.action.parameter-not-supplied=F\u00fcgen Sie ''{0}'' hinzu, um fortzufahren. -rm.action.delete-not-hold-type=Der Legal Hold konnte nicht gel\u00f6scht werden, da {1} nicht vom Typ {0} ist. -rm.action.cast-to-rm-type=Ein benutzerdefinierter Ordnertyp kann nicht in einen Records Management Ablageplan hochgeladen werden. -rm.action.record-folder-create=Ein Record-Ordner kann nicht in einem anderen Record-Ordner erstellt werden. -rm.action.unique.child.type-error-message=Sie k\u00f6nnen hier nicht mehrere Elemente dieser Art erstellen. -rm.action.multiple.children.type-error-message=Sie k\u00f6nnen {0} hier nicht erstellen. -rm.action.create.transfer.container.child-error-message=Sie k\u00f6nnen keine Elemente im \u00dcbertragungscontainer erstellen. -rm.action.create.transfer.child-error-message=Sie k\u00f6nnen keine Elemente in \u00dcbertragungsordnern erstellen. -rm.action.create.record.folder.child-error-message=In Record-Ordnern k\u00f6nnen Sie nur Records erstellen. Das war aber ein {0}. -rm.action.transfer-non-editable=Sie k\u00f6nnen Metadaten von \u00dcbertragungsordnern oder -containern nicht bearbeiten. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties deleted file mode 100644 index 5ea2ca053c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=No se ha definido la acci\u00f3n de Records Management {0}. -rm.action.no-implicit-noderef=Se produjo un error en el sistema por lo que la acci\u00f3n {0} puede no ser correcta. -rm.action.record-not-declared=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque el documento de archivo {1} no est\u00e1 completo. -rm.action.expected-record-level=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque {1} no es un documento de archivo. -rm.action.not-all-records-declared=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque no todos los documentos de archivo de la carpeta de documentos de archivo est\u00e1n completos. (actionedUponNodeRef={1}) -rm.action.not-eligible=El documento de archivo o carpeta de documentos de archivo {1} no est\u00e1 preparada todav\u00eda para la acci\u00f3n de retenci\u00f3n {0}. -rm.action.no-disposition-instructions=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque no se ha encontrado ninguna instrucci\u00f3n de retenci\u00f3n. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque no hay ning\u00fan ciclo de vida de retenci\u00f3n disponible. (nodeRef={1}) -rm.action.next-disp-not-set=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque la pr\u00f3xima acci\u00f3n de retenci\u00f3n no est\u00e1 definida. (nodeRef={1}) -rm.action.not-next-disp=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque no es la pr\u00f3xima acci\u00f3n de retenci\u00f3n para este documento de archivo o carpeta de documentos de archivo. (nodeRef={1}) -rm.action.not-record-folder=No se pudo realizar la acci\u00f3n de retenci\u00f3n {0} porque {1} no es una carpeta de documentos de archivo. -rm.action.actioned-upon-not-record=No se puede realizar la acci\u00f3n de retenci\u00f3n {0} porque {1} no es un documento de archivo. -rm.action.custom-aspect-not-recognised=El tipo personalizado no puede aplicarse porque no se reconoce. (customAspect={0}) -rm.action.event-no-disp-lc=No se puede completar el evento {0} porque no est\u00e1 definido en el ciclo de vida de la retenci\u00f3n. -rm.action.undeclared-only-records=Solo se pueden completar los documentos de archivo. (nodeRef={0}) -rm.action.no-declare-mand-prop=Debe definir todas las propiedades obligatorias del documento de archivo antes de poder completar el documento de archivo. -rm.action.ghosted-prop-update=No se puede actualizar las propiedades de un documento de archivo destruido anteriormente. -rm.action.valid-date-disp-asof=Introduzca una fecha v\u00e1lida para la fecha de inicio de acci\u00f3n de la retenci\u00f3n. -rm.action.disp-asof-lifecycle-applied=No se puede editar la fecha de inicio de la retenci\u00f3n para un documento de archivo o carpeta de documentos de archivo que tiene un ciclo de vida aplicado. -rm.action.hold-edit-reason-none=No se puede editar la raz\u00f3n de retenci\u00f3n legal porque se cre\u00f3 sin una raz\u00f3n. Trate de recrear la retenci\u00f3n legal. -rm.action.hold-edit-type=No se puede editar la raz\u00f3n de retenci\u00f3n legal para {1} porque no es una retenci\u00f3n legal. -rm.action.specify-avlid-date=Introduzca una fecha v\u00e1lida para la fecha de inicio de la revisi\u00f3n. -rm.action.review-details-only=Solo puede editar los detalles de revisi\u00f3n de documentos de archivo vitales. -rm.action.freeze-no-reason=No se puede hacer retenci\u00f3n legal de un documento de archivo sin una raz\u00f3n. A\u00f1ada una raz\u00f3n de retenci\u00f3n legal. -rm.action.freeze-only-records-folders=Solo puede hacer retenci\u00f3n legal de documentos de archivo o carpetas de documentos de archivo. -rm.action.no-open-record-folder=No se puede volver a abrir {0} porque no es una carpeta de documentos de archivo. -rm.action.not-hold-type=No se puede llevar a cabo la acci\u00f3n en {1} porque no es una retenci\u00f3n legal. -rm.action.no-read-mime-message=No se pudo leer el mensaje de tipo de fichero debido a {0}. -rm.action.email-declared=No se pudo separar el correo electr\u00f3nico porque el documento de archivo est\u00e1 completo. (actionedUponNodeRef={0}) -rm.action.email-not-record=No se pudo separar el correo electr\u00f3nico porque el fichero, ni la carpeta ni la categor\u00eda son un documento de archivo. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=No se puedo crear una asociaci\u00f3n secundaria personalizada. -rm.action.node-already-transfer=El fichero, carpeta o categor\u00eda ya se est\u00e1 trasfiriendo. -rm.action.node-not-transfer=El fichero, carpeta o categor\u00eda no es un objeto de transferencia. -rm.action.undo-not-last=No se puede deshacer la interrupci\u00f3n porque la \u00faltima acci\u00f3n de retenci\u00f3n no se interrumpi\u00f3. -rm.action.records_only_undeclared=Solo puede completar documentos de archivo. -rm.action.event-not-undone=No se puede deshacer el evento {0} porque no se ha definido en el ciclo de vida de retenci\u00f3n. -rm.action.node-not-record-category=No se puede crear una planificaci\u00f3n de retenci\u00f3n para ({0}) porque no es una categor\u00eda de documento de archivo. -rm.action.parameter-not-supplied=A\u00f1ada un ''{0}'' para continuar. -rm.action.delete-not-hold-type=No se pudo eliminar la retenci\u00f3n legal porque {1} no es del tipo {0}. -rm.action.cast-to-rm-type=No se puede cargar un tipo de carpeta personalizada al cuadro de clasificaci\u00f3n de Records Management. -rm.action.record-folder-create=No se puede crear una carpeta de documentos de archivo en otra carpeta de documentos de archivo. -rm.action.unique.child.type-error-message=No se pueden crear elementos m\u00faltiples de este tipo aqu\u00ed. -rm.action.multiple.children.type-error-message=No puede crear {0} aqu\u00ed. -rm.action.create.transfer.container.child-error-message=No se pueden crear elementos en el contenedor de transferencia. -rm.action.create.transfer.child-error-message=No se pueden crear elementos en las carpetas de transferencia. -rm.action.create.record.folder.child-error-message=Solo puede crear documentos de archivo en carpetas de documentos de archivo. {0} no se puede crear aqu\u00ed. -rm.action.transfer-non-editable=No se puede editar una carpeta de transferencia ni los metadatos de un contenedor. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties deleted file mode 100644 index d7d4a3ab52..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=L''action de gestion des archives {0} n''a pas \u00e9t\u00e9 d\u00e9finie. -rm.action.no-implicit-noderef=Suite \u00e0 une erreur syst\u00e8me, \u00e9chec de l''action {0} possible. -rm.action.record-not-declared=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car le document d''archives n''est pas complet. -rm.action.expected-record-level=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un document d''archives. -rm.action.not-all-records-declared=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car les documents d''archives dans le dossier d''archives ne sont pas tous complets. (actionedUponNodeRef={1}) -rm.action.not-eligible=Le document d''archives ou dossier d''archives {1} n''est pas encore pr\u00eat pour l''action de conservation {0}. -rm.action.no-disposition-instructions=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car aucune instruction de conservation n''a \u00e9t\u00e9 trouv\u00e9e. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car aucun ensemble de cycles de vie de conservation n''est disponible. (nodeRef={1}) -rm.action.next-disp-not-set=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car l''\u00e9tape suivante du d\u00e9lai de conservation n''est pas d\u00e9finie. (nodeRef={1}) -rm.action.not-next-disp=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car il ne s''agit pas de l''\u00e9tape suivante du d\u00e9lai de conservation pour ce document d''archives ou ce dossier d''archives. (nodeRef={1}) -rm.action.not-record-folder=L''action de conservation {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un dossier d''archives. -rm.action.actioned-upon-not-record=L''action {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un document d''archives. -rm.action.custom-aspect-not-recognised=Le type personnalis\u00e9 ne peut pas \u00eatre appliqu\u00e9, car il n''est pas reconnu. (customAspect={0}) -rm.action.event-no-disp-lc=L''\u00e9v\u00e9nement {0} ne peut pas \u00eatre compl\u00e9t\u00e9, car il n''est pas d\u00e9fini dans les \u00e9tapes du d\u00e9lai de conservation. -rm.action.undeclared-only-records=Seuls les documents d''archives peuvent \u00eatre compl\u00e9t\u00e9s. (nodeRef={0}) -rm.action.no-declare-mand-prop=Avant de compl\u00e9ter le document d'archives, vous devez d\u00e9finir toutes ses propri\u00e9t\u00e9s obligatoires. -rm.action.ghosted-prop-update=Impossible de mettre \u00e0 jour les propri\u00e9t\u00e9s d'un document d'archives d\u00e9truit pr\u00e9c\u00e9demment. -rm.action.valid-date-disp-asof=Entrez une date valide pour la date de d\u00e9but de l'action de conservation. -rm.action.disp-asof-lifecycle-applied=Vous ne pouvez pas modifier la date de d\u00e9but d'action de conservation d'un document d'archives ou dossier d'archives auquel est appliqu\u00e9 un cycle de vie. -rm.action.hold-edit-reason-none=Impossible de modifier le motif de suspension car la suspension a \u00e9t\u00e9 cr\u00e9\u00e9e sans motif. Essayez de recr\u00e9er la suspension. -rm.action.hold-edit-type=Impossible de modifier le motif de suspension pour {1}, car ce n''est pas une suspension. -rm.action.specify-avlid-date=Entrez une date valide pour la date de d\u00e9but de la r\u00e9vision. -rm.action.review-details-only=Seules les informations de v\u00e9rification des documents d'archives essentiels peuvent \u00eatre modifi\u00e9es. -rm.action.freeze-no-reason=Un document d'archives ne peut pas \u00eatre suspendu sans motif. Ajoutez un motif pour la suspension. -rm.action.freeze-only-records-folders=Seuls des documents d'archives ou dossiers d'archives peuvent \u00eatre suspendus. -rm.action.no-open-record-folder=Impossible de rouvrir {0}, car ce n''est pas un dossier d''archives. -rm.action.not-hold-type=Impossible d''effectuer l''action sur {1}, car ce n''est pas une suspension. -rm.action.no-read-mime-message=Le message filetype est illisible, car {0}. -rm.action.email-declared=Impossible de partager l''e-mail, car le document d''archives n''est pas complet. (actionedUponNodeRef={0}) -rm.action.email-not-record=Impossible de partager l''e-mail, car le fichier, le dossier ou la cat\u00e9gorie n''est pas un document d''archives. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Impossible de cr\u00e9er une sous-association personnalis\u00e9e. -rm.action.node-already-transfer=Le fichier, le dossier ou la cat\u00e9gorie est d\u00e9j\u00e0 en cours de transfert. -rm.action.node-not-transfer=Le fichier, le dossier ou la cat\u00e9gorie n'est pas un objet de transfert. -rm.action.undo-not-last=Impossible d'annuler le d\u00e9but de conservation car la derni\u00e8re action de conservation n'\u00e9tait pas un d\u00e9but de conservation. -rm.action.records_only_undeclared=Seuls les documents d'archives peuvent \u00eatre compl\u00e9t\u00e9s. -rm.action.event-not-undone=Impossible d''annuler l''\u00e9v\u00e9nement {0}, car il n''est pas d\u00e9fini dans les \u00e9tapes du d\u00e9lai de conservation. -rm.action.node-not-record-category=Impossible de cr\u00e9er une r\u00e8gle de conservation pour ({0}), car ce n''est pas une cat\u00e9gorie de document d''archives. -rm.action.parameter-not-supplied=Ajouter un(e) ''{0}'' pour continuer. -rm.action.delete-not-hold-type=Impossible de supprimer la suspension, car {1} n''est pas de type {0}. -rm.action.cast-to-rm-type=Impossible d'importer un type de dossier personnalis\u00e9 dans le plan de classement de gestion des archives. -rm.action.record-folder-create=Impossible de cr\u00e9er un dossier d'archives dans un autre dossier d'archives. -rm.action.unique.child.type-error-message=Impossible de cr\u00e9er plusieurs \u00e9l\u00e9ments de ce type ici. -rm.action.multiple.children.type-error-message=Impossible de cr\u00e9er {0} ici. -rm.action.create.transfer.container.child-error-message=Impossible de cr\u00e9er des \u00e9l\u00e9ments dans le contenant de transfert. -rm.action.create.transfer.child-error-message=Impossible de cr\u00e9er des \u00e9l\u00e9ments dans les dossiers de transfert. -rm.action.create.record.folder.child-error-message=Vous ne pouvez cr\u00e9er des documents d''archives que dans les dossiers d''archives, dans le cas pr\u00e9sent {0}. -rm.action.transfer-non-editable=Impossible de modifier les m\u00e9tadonn\u00e9es de dossier de transfert ou de contenant. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties deleted file mode 100644 index 81c2032be7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=L''azione di gestione dei record {0} non \u00e8 stata definita. -rm.action.no-implicit-noderef=Si \u00e8 verificato un errore di sistema per cui l''azione {0} potrebbe non riuscire. -rm.action.record-not-declared=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 il record {1} \u00e8 incompleto. -rm.action.expected-record-level=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 {1} non costituisce un record. -rm.action.not-all-records-declared=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non tutti i record nella cartella di record sono completi. (actionedUponNodeRef={1}) -rm.action.not-eligible=Il record o la cartella di record {1} non sono pronti per l''azione di conservazione {0}. -rm.action.no-disposition-instructions=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non sono state trovate le istruzioni di conservazione. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non \u00e8 disponibile alcun set di ciclo di vita di conservazione. (nodeRef={1}) -rm.action.next-disp-not-set=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 l''azione di conservazione successiva non \u00e8 stata impostata. (nodeRef={1}) -rm.action.not-next-disp=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 quest''ultima non costituisce l''azione di conservazione successiva per questo record o cartella di record. (nodeRef={1}) -rm.action.not-record-folder=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 {1} non costituisce una cartella di record. -rm.action.actioned-upon-not-record=Impossibile eseguire l''azione {0}, poich\u00e9 {1} non costituisce un record. -rm.action.custom-aspect-not-recognised=Impossibile applicare il tipo personalizzato poich\u00e9 non viene riconosciuto. (customAspect={0}) -rm.action.event-no-disp-lc=Impossibile completare l''evento {0}, poich\u00e9 non \u00e8 definito nel ciclo di vita di conservazione. -rm.action.undeclared-only-records=Solo i record possono essere completati. (nodeRef={0}) -rm.action.no-declare-mand-prop=\u00c8 necessario impostare tutte le propriet\u00e0 obbligatorie del record prima di completare il record. -rm.action.ghosted-prop-update=Impossibile aggiornare le propriet\u00e0 di un record precedentemente eliminato in maniera definitiva. -rm.action.valid-date-disp-asof=Inserire una data valida come data di inizio dell'azione di conservazione. -rm.action.disp-asof-lifecycle-applied=Impossibile modificare la data di inizio di conservazione per un record o cartella di record per cui \u00e8 stato impostato un ciclo di vita. -rm.action.hold-edit-reason-none=Impossibile modificare il motivo della sospensione poich\u00e9 la sospensione \u00e8 stata creata senza un motivo. Provare a ricreare la sospensione. -rm.action.hold-edit-type=Impossibile modificare il motivo della sospensione per {1} poich\u00e9 non \u00e8 una sospensione. -rm.action.specify-avlid-date=Inserire una data valida come data di inizio dell'esame. -rm.action.review-details-only=\u00c8 possibile modificare solo i dettagli dell'esame dei record fondamentali. -rm.action.freeze-no-reason=Impossibile sospendere un record senza un motivo. Aggiungere un motivo alla sospensione. -rm.action.freeze-only-records-folders=\u00c8 possibile sospendere solo record o cartelle di record. -rm.action.no-open-record-folder=Impossibile riaprire {0} poich\u00e9 non si tratta di una cartella di record. -rm.action.not-hold-type=Impossibile eseguire l''azione su {1} poich\u00e9 non \u00e8 una sospensione. -rm.action.no-read-mime-message=Impossibile leggere il messaggio di tipo file, poich\u00e9 {0}. -rm.action.email-declared=Impossibile dividere l''e-mail poich\u00e9 il record \u00e8 completo. (actionedUponNodeRef={0}) -rm.action.email-not-record=Impossibile dividere l''e-mail poich\u00e9 il file, la cartella o la categoria non sono un record. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Impossibile creare un'associazione secondaria personalizzata. -rm.action.node-already-transfer=Il file, la cartella o la categoria sono gi\u00e0 in fase di trasferimento. -rm.action.node-not-transfer=Il file, la cartella o la categoria non sono oggetti da trasferire. -rm.action.undo-not-last=Impossibile annullare il cut off poich\u00e9 l'ultima azione di conservazione non \u00e8 stata interrotta. -rm.action.records_only_undeclared=\u00c8 solo possibile completare i record. -rm.action.event-not-undone=Non \u00e8 possibile annullare l''evento {0} poich\u00e9 non \u00e8 definito sul ciclo di vita di conservazione. -rm.action.node-not-record-category=Impossibile creare un programma di conservazione per {0} poich\u00e9 non si tratta di una categoria record. -rm.action.parameter-not-supplied=Aggiungi un ''{0}'' per continuare. -rm.action.delete-not-hold-type=Impossibile eliminare la sospensione poich\u00e9 {1} non \u00e8 del tipo {0}. -rm.action.cast-to-rm-type=Impossibile caricare un tipo di cartella personalizzata sul piano di fascicolazione di Records Management. -rm.action.record-folder-create=Impossibile creare una cartella di record in un'altra cartella di record. -rm.action.unique.child.type-error-message=Impossibile creare pi\u00f9 elementi di questo tipo qui. -rm.action.multiple.children.type-error-message=Impossibile creare {0} qui. -rm.action.create.transfer.container.child-error-message=Impossibile creare elementi nel contenitore Trasferimento. -rm.action.create.transfer.child-error-message=Impossibile creare elementi nelle cartelle Trasferimento. -rm.action.create.record.folder.child-error-message=I record possono essere creati solo nelle cartelle dei record e questa era {0}. -rm.action.transfer-non-editable=Impossibile modificare la cartella di trasferimento o i metadati dei contenitori. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties deleted file mode 100644 index 8be3966fa5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u51e6\u7406 ''{0}'' \u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 -rm.action.no-implicit-noderef=\u30b7\u30b9\u30c6\u30e0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u3001\u51e6\u7406 ''{0}'' \u306f\u6b63\u5e38\u306b\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 -rm.action.record-not-declared=\u30ec\u30b3\u30fc\u30c9 ''{1}'' \u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.expected-record-level=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.not-all-records-declared=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u4e00\u90e8\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={1}) -rm.action.not-eligible=\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 ''{1}'' \u306f\u3001\u307e\u3060\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u306e\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u3002 -rm.action.no-disposition-instructions=\u4fdd\u7ba1\u6307\u793a\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=\u4f7f\u7528\u53ef\u80fd\u306a\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30bb\u30c3\u30c8\u304c\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.next-disp-not-set=\u6b21\u306e\u4fdd\u7ba1\u51e6\u7406\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.not-next-disp=\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u306f\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u7528\u306e\u6b21\u306e\u4fdd\u7ba1\u51e6\u7406\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.not-record-folder=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.actioned-upon-not-record=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.custom-aspect-not-recognised=\u30ab\u30b9\u30bf\u30e0\u30bf\u30a4\u30d7\u304c\u8a8d\u8b58\u3055\u308c\u306a\u3044\u305f\u3081\u3001\u9069\u7528\u3067\u304d\u307e\u305b\u3093\u3002 (customAspect={0}) -rm.action.event-no-disp-lc=\u30a4\u30d9\u30f3\u30c8 ''{0}'' \u306f\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5b8c\u4e86\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.undeclared-only-records=\u5b8c\u4e86\u3067\u304d\u308b\u306e\u306f\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3059\u3002 (nodeRef={0}) -rm.action.no-declare-mand-prop=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u3059\u3079\u3066\u306e\u5fc5\u9808\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -rm.action.ghosted-prop-update=\u4ee5\u524d\u306b\u7834\u68c4\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.valid-date-disp-asof=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u306b\u6709\u52b9\u306a\u65e5\u4ed8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.disp-asof-lifecycle-applied=\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u304c\u9069\u7528\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u4fdd\u7ba1\u51e6\u7406\u5b9f\u884c\u65e5\u306f\u3001\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.hold-edit-reason-none=\u3053\u306e\u30db\u30fc\u30eb\u30c9\u306f\u7406\u7531\u306a\u3057\u3067\u4f5c\u6210\u3055\u308c\u305f\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u7406\u7531\u3092\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 \u30db\u30fc\u30eb\u30c9\u3092\u4f5c\u6210\u3057\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.hold-edit-type=''{1}'' \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u7406\u7531\u3092\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.specify-avlid-date=\u30ec\u30d3\u30e5\u30fc\u306e\u5b9f\u884c\u65e5\u306b\u6709\u52b9\u306a\u65e5\u4ed8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.review-details-only=\u7de8\u96c6\u3067\u304d\u308b\u306e\u306f\u3001\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u306e\u8a73\u7d30\u306e\u307f\u3067\u3059\u3002 -rm.action.freeze-no-reason=\u7406\u7531\u304c\u306a\u3044\u3068\u3001\u30ec\u30b3\u30fc\u30c9\u3092\u30db\u30fc\u30eb\u30c9\u306b\u3067\u304d\u307e\u305b\u3093\u3002 \u30db\u30fc\u30eb\u30c9\u306b\u3059\u308b\u7406\u7531\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.freeze-only-records-folders=\u30db\u30fc\u30eb\u30c9\u306b\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u304b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3067\u3059\u3002 -rm.action.no-open-record-folder=''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u518d\u5ea6\u958b\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.not-hold-type=''{1}'' \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.no-read-mime-message={0} \u306e\u305f\u3081\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8aad\u307f\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.email-declared=\u30ec\u30b3\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u305f\u3081\u3001E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={0}) -rm.action.email-not-record=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u30ab\u30c6\u30b4\u30ea\u306e\u3044\u305a\u308c\u304b\u304c\u30ec\u30b3\u30fc\u30c9\u3067\u306a\u3044\u305f\u3081\u3001E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=\u30ab\u30b9\u30bf\u30e0\u306e\u5b50\u95a2\u9023\u4ed8\u3051\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.node-already-transfer=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u307e\u305f\u306f\u30ab\u30c6\u30b4\u30ea\u304c\u3059\u3067\u306b\u8ee2\u9001\u4e2d\u3067\u3059\u3002 -rm.action.node-not-transfer=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u307e\u305f\u306f\u30ab\u30c6\u30b4\u30ea\u304c\u8ee2\u9001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -rm.action.undo-not-last=\u76f4\u524d\u306e\u4fdd\u7ba1\u51e6\u7406\u306f\u30ab\u30c3\u30c8\u30aa\u30d5\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u5143\u306b\u623b\u3059\u64cd\u4f5c\u306f\u884c\u3048\u307e\u305b\u3093\u3002 -rm.action.records_only_undeclared=\u5b8c\u4e86\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3059\u3002 -rm.action.event-not-undone=\u30a4\u30d9\u30f3\u30c8 ''{0}'' \u306f\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5143\u306b\u623b\u3059\u64cd\u4f5c\u306f\u884c\u3048\u307e\u305b\u3093\u3002 -rm.action.node-not-record-category=''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.parameter-not-supplied=''{0}'' \u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.delete-not-hold-type=''{1}'' \u306f\u30bf\u30a4\u30d7 ''{0}'' \u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.cast-to-rm-type=\u30ab\u30b9\u30bf\u30e0\u306e\u30d5\u30a9\u30eb\u30c0\u30bf\u30a4\u30d7\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.record-folder-create=\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.unique.child.type-error-message=\u3053\u3053\u3067\u306f\u3001\u3053\u306e\u30bf\u30a4\u30d7\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u8907\u6570\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.multiple.children.type-error-message=\u3053\u3053\u3067\u306f {0} \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.create.transfer.container.child-error-message=\u8ee2\u9001\u30b3\u30f3\u30c6\u30ca\u5185\u3067\u306f\u30a2\u30a4\u30c6\u30e0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.create.transfer.child-error-message=\u8ee2\u9001\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u306f\u30a2\u30a4\u30c6\u30e0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.create.record.folder.child-error-message=\u30ec\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3067\u304d\u308b\u306e\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u307f\u3067\u3001\u3053\u308c\u306f {0} \u3067\u3059\u3002 -rm.action.transfer-non-editable=\u8ee2\u9001\u30d5\u30a9\u30eb\u30c0\u307e\u305f\u306f\u30b3\u30f3\u30c6\u30ca\u30e1\u30bf\u30c7\u30fc\u30bf\u306f\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties deleted file mode 100644 index 423c2f79c9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=Oppf\u00f8ringsh\u00e5ndteringshandlingen {0} er ikke definert. -rm.action.no-implicit-noderef=Det oppsto en systemfeil. derfor det mulig at handlingen {0} ikke var vellykket. -rm.action.record-not-declared=Retensjonshandlingen {0} kunne ikke utf\u00f8re fordi oppf\u00f8ringen {1} ikke er fullf\u00f8rt. -rm.action.expected-record-level=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi dette {1} ikke er en oppf\u00f8ring. -rm.action.not-all-records-declared=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi ikke alle oppf\u00f8ringene i oppf\u00f8ringsmappen var fullf\u00f8rt. (actionedUponNodeRef={1}) -rm.action.not-eligible=Oppf\u00f8ringen eller oppf\u00f8ringsmappen {1} er enn\u00e5 ikke klar for retensjonshandlingen {0}. -rm.action.no-disposition-instructions=Retensjonsh\u00e5ndlingen {0} kunne ikke utf\u00f8res fordi ingen retensjonsinstruksjoner ble funnet. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi det ikke fantes noe tilgjengelig livssyklussett ved retensjon. (nodeRef={1}) -rm.action.next-disp-not-set=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi neste retensjonshandling ikke er et sett. (nodeRef={1}) -rm.action.not-next-disp=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikke er den neste retensjonshandlingen til denne oppf\u00f8ringen eller oppf\u00f8ringsmappen. (nodeRef={1}) -rm.action.not-record-folder=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi {1} ikke er en oppf\u00f8ringsmappe. -rm.action.actioned-upon-not-record=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi {1} ikke er en oppf\u00f8ring. -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 retensjon. -rm.action.undeclared-only-records=Kun oppf\u00f8ringer kan fullf\u00f8res. (nodeRef={0}) -rm.action.no-declare-mand-prop=Alle de obligatoriske egenskapene til oppf\u00f8ringen m\u00e5 stilles inn f\u00f8r oppf\u00f8ringen kan fullf\u00f8res. -rm.action.ghosted-prop-update=Du kan ikke oppdatere egenskapene til en oppf\u00f8ring som er destruert tidligere. -rm.action.valid-date-disp-asof=Angi en gyldig dato for retensjonshandlingen per datoen. -rm.action.disp-asof-lifecycle-applied=Retensjonen 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 holdet ble opprettet uten grunn. Pr\u00f8v \u00e5 opprette holdet p\u00e5 nytt. -rm.action.hold-edit-type=Grunnen til holdet for {1} kan ikke redigeres fordi det ikke er et hold. -rm.action.specify-avlid-date=Angi en gyldig dato for gjennomgang per datoen. -rm.action.review-details-only=Kun Gjennomgangsdetaljene til de sv\u00e6rt viktige oppf\u00f8ringene kan redigeres. -rm.action.freeze-no-reason=En oppf\u00f8ring kan ikke holdes uten grunn. Legg til en grunn til holdet. -rm.action.freeze-only-records-folders=Du kan bare holde oppf\u00f8ringer eller oppf\u00f8ringsmapper. -rm.action.no-open-record-folder={0} kan ikke \u00e5pnes p\u00e5 nytt fordi den er ikke en oppf\u00f8ringsmappe. -rm.action.not-hold-type=Handlingen kan ikke utf\u00f8res p\u00e5 {1} fordi den ikke er p\u00e5 hold. -rm.action.no-read-mime-message=Filtypemeldingen kunne ikke leses fordi {0}. -rm.action.email-declared=E-posten kan ikke deles fordi oppf\u00f8ringen er fullf\u00f8rt. (actionedUponNodeRef={0}) -rm.action.email-not-record=E-posten kan ikke deles fordi filen, mappen eller kategorien ikke er en oppf\u00f8ring. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Kunne ikke opprette en egendefinert barnassosiasjon. -rm.action.node-already-transfer=Filen, mappen eller kategorien er overf\u00f8res allerede. -rm.action.node-not-transfer=Filen, mappen eller kategorien er ikke et overf\u00f8ringselement. -rm.action.undo-not-last=Cut off kan ikke angres fordi den siste retensjonshandlingen ikke ble cut off. -rm.action.records_only_undeclared=Du kan bare fullf\u00f8re oppf\u00f8ringer. -rm.action.event-not-undone=Hendelsen {0} kan ikke angres fordi den ikke p\u00e5 definert i livssyklusen ved retensjon. -rm.action.node-not-record-category=Retensjonsplanen til {0} kan ikke opprett fordi den er ikke en oppf\u00f8ringskategori. -rm.action.parameter-not-supplied=Legg til ''{0}'' for \u00e5 fortsette. -rm.action.delete-not-hold-type=Holdet kan ikke slettes fordi {1} ikke er en type {0}. -rm.action.cast-to-rm-type=En tilpasset mappetype kan ikke lastes opp p\u00e5 oppf\u00f8ringsh\u00e5ndteringsfilplanen. -rm.action.record-folder-create=En oppf\u00f8ringsmappen kan ikke opprettes i en annen oppf\u00f8ringsmappe. -rm.action.unique.child.type-error-message=Flere elementer av denne typen kan ikke opprettes her. -rm.action.multiple.children.type-error-message={0} kan ikke opprettes her. -rm.action.create.transfer.container.child-error-message=Elementer kan ikke opprettes i overf\u00f8ringsbeholderen. -rm.action.create.transfer.child-error-message=Elementer kan ikke opprettes i overf\u00f8ringsmapper. -rm.action.create.record.folder.child-error-message=Oppf\u00f8ringer kan bare opprettes i oppf\u00f8ringsmapper, og dette er en {0}. -rm.action.transfer-non-editable=Overf\u00f8ringsmapper eller beholdermetadata kan ikke redigeres. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties deleted file mode 100755 index 397f2ef9aa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=De Records Management-actie {0} is niet gedefinieerd. -rm.action.no-implicit-noderef=Er is een systeemfout opgetreden en de actie {0} is mogelijk niet geslaagd. -rm.action.record-not-declared=De retentieactie {0} kon niet worden uitgevoerd omdat het archiefstuk {1} niet afgerond is. -rm.action.expected-record-level=De retentieactie {0} kon niet worden uitgevoerd omdat {1} geen archiefstuk is. -rm.action.not-all-records-declared=De retentieactie {0} kon niet worden uitgevoerd omdat niet alle archiefstukken in de archiefmap afgerond zijn. (actionedUponNodeRef={1}) -rm.action.not-eligible=Het archiefstuk of de archiefmap {1} is nog niet gereed voor de retentieactie {0}. -rm.action.no-disposition-instructions=De retentieactie {0} kon niet worden uitgevoerd omdat er geen retentie-instructies zijn gevonden. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=De retentieactie {0} kon niet worden uitgevoerd omdat er geen retentiecyclus is ingesteld. (nodeRef={1}) -rm.action.next-disp-not-set=De retentiesactie {0} kon niet worden uitgevoerd omdat de volgende retentieactie niet is ingesteld. (nodeRef={1}) -rm.action.not-next-disp=De retentieactie {0} kon niet worden uitgevoerd omdat dit niet de volgende retentieactie voor dit archiefstuk of deze archiefmap is. (nodeRef={1}) -rm.action.not-record-folder=De retentieactie {0} kon niet worden uitgevoerd omdat {1} geen archiefmap is. -rm.action.actioned-upon-not-record=De actie {0} kan niet worden uitgevoerd omdat {1} geen archiefstuk is. -rm.action.custom-aspect-not-recognised=Het aangepaste type kan niet worden toegepast omdat het niet wordt herkend. (customAspect={0}) -rm.action.event-no-disp-lc=De gebeurtenis {0} kan niet worden afgerond omdat deze niet is gedefinieerd in de retentiecyclus. -rm.action.undeclared-only-records=Alleen archiefstukken kunnen worden afgerond. (nodeRef={0}) -rm.action.no-declare-mand-prop=U moet alle verplichte eigenschappen van het archiefstuk instellen voordat u het archiefstuk kunt afronden. -rm.action.ghosted-prop-update=U kunt de eigenschappen van een eerder vernietigd archiefstuk niet bijwerken. -rm.action.valid-date-disp-asof=Voer een geldige datum in voor de begindatum van de retentieactie. -rm.action.disp-asof-lifecycle-applied=U kunt de begindatum van de retentie van een archiefstuk of archiefmap waarvoor een levenscyclus is toegepast niet bewerken. -rm.action.hold-edit-reason-none=U kunt de reden van de bewaring niet bewerken omdat de bewaring is gemaakt zonder reden. Probeer de bewaring opnieuw te maken. -rm.action.hold-edit-type=U kunt de reden van de bewaring voor {1} niet bewerken omdat dit geen bewaring is. -rm.action.specify-avlid-date=Voer een geldige datum in voor de begindatum van de revisie. -rm.action.review-details-only=U kunt alleen de revisiegegevens van vitale archiefstukken bewerken. -rm.action.freeze-no-reason=U kunt een archiefstuk niet zonder reden in de bewaring plaatsen. Voeg een reden toe aan de bewaring. -rm.action.freeze-only-records-folders=U kunt alleen archiefstukken of archiefmappen in de bewaring plaatsen. -rm.action.no-open-record-folder=U kunt {0} niet heropenen omdat dit geen archiefmap is. -rm.action.not-hold-type=U kunt de actie niet uitvoeren voor {1} omdat dit geen bewaring is. -rm.action.no-read-mime-message=Het bestandstype kon niet worden gelezen omdat {0}. -rm.action.email-declared=De e-mail kan niet worden opgesplitst omdat het archiefstuk is afgerond. (actionedUponNodeRef={0}) -rm.action.email-not-record=De e-mail kan niet worden opgesplitst omdat het bestand, de map of de categorie geen archiefstuk is. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Er kan geen aangepaste onderliggende koppeling worden gemaakt. -rm.action.node-already-transfer=Het bestand, de map of de categorie wordt al overgezet. -rm.action.node-not-transfer=Het bestand, de map of de categorie is geen overzetobject. -rm.action.undo-not-last=U kunt het afsluiten niet ongedaan maken omdat de laatste retentieactie niet was afgesloten. -rm.action.records_only_undeclared=U kunt alleen archiefstukken afronden. -rm.action.event-not-undone=U kunt de gebeurtenis {0} niet ongedaan maken omdat deze niet in de retentiecyclus is gedefinieerd. -rm.action.node-not-record-category=U kunt geen retentieschema maken voor {0} omdat dit geen archiefstukcategorie is. -rm.action.parameter-not-supplied=Voeg een ''{0}'' toe om door te gaan. -rm.action.delete-not-hold-type=De bewaring kan niet worden verwijderd omdat {1} niet van het type {0} is. -rm.action.cast-to-rm-type=U kunt geen aangepast maptype uploaden naar het ordeningsplan van Records Management. -rm.action.record-folder-create=U kunt geen archiefmap in een andere archiefmap maken. -rm.action.unique.child.type-error-message=U kunt hier geen meerdere onderdelen van dit type maken. -rm.action.multiple.children.type-error-message=U kunt hier geen {0} maken. -rm.action.create.transfer.container.child-error-message=U kunt geen onderdelen maken in de overdrachtscontainer. -rm.action.create.transfer.child-error-message=U kunt geen onderdelen maken in overdrachtsmappen. -rm.action.create.record.folder.child-error-message=U kunt alleen archiefstukken maken in archiefmappen en dit was een {0}. -rm.action.transfer-non-editable=U kunt metagegevens in een overdrachtsmap of -container niet bewerken. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties deleted file mode 100644 index b02afa69cd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=A a\u00e7\u00e3o {0} do Records Management n\u00e3o foi definida. -rm.action.no-implicit-noderef=Houve um erro do sistema e a a\u00e7\u00e3o {0} pode n\u00e3o ter sucesso. -rm.action.record-not-declared=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois o documento arquiv\u00edstico {1} n\u00e3o est\u00e1 conclu\u00eddo. -rm.action.expected-record-level=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois {1} n\u00e3o \u00e9 um documento arquiv\u00edstico. -rm.action.not-all-records-declared=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois nem todos os documentos arquiv\u00edsticos na pasta de documentos arquiv\u00edsticos est\u00e3o conclu\u00eddos. (actionedUponNodeRef={1}) -rm.action.not-eligible=O documento arquiv\u00edstico ou pasta de documento arquiv\u00edstico {1} n\u00e3o est\u00e1 pronto para a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}. -rm.action.no-disposition-instructions=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois nenhuma instru\u00e7\u00e3o de reten\u00e7\u00e3o foi localizada. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois n\u00e3o h\u00e1 conjunto de ciclo de vida de reten\u00e7\u00e3o dispon\u00edvel. (nodeRef={1}) -rm.action.next-disp-not-set=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o n\u00e3o est\u00e1 definida. (nodeRef={1}) -rm.action.not-next-disp=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois esta n\u00e3o \u00e9 a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o para este documento arquiv\u00edstico ou esta pasta de documento arquiv\u00edstico. (nodeRef={1}) -rm.action.not-record-folder=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois {1} n\u00e3o \u00e9 uma pasta de documento arquiv\u00edstico. -rm.action.actioned-upon-not-record=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o {0} porque {1} n\u00e3o \u00e9 um documento arquiv\u00edstico. -rm.action.custom-aspect-not-recognised=N\u00e3o \u00e9 poss\u00edvel aplicar o tipo personalizado porque ele n\u00e3o \u00e9 reconhecido. (customAspect={0}) -rm.action.event-no-disp-lc=N\u00e3o \u00e9 poss\u00edvel concluir o evento {0}, pois ele n\u00e3o est\u00e1 definido no ciclo de vida da reten\u00e7\u00e3o. -rm.action.undeclared-only-records=Apenas documentos arquiv\u00edsticos podem ser conclu\u00eddos. (nodeRef={0}) -rm.action.no-declare-mand-prop=Voc\u00ea deve definir todas as propriedades obrigat\u00f3rias do documento arquiv\u00edstico antes de poder concluir o documento arquiv\u00edstico. -rm.action.ghosted-prop-update=N\u00e3o \u00e9 poss\u00edvel atualizar as propriedades de um documento arquiv\u00edstico destru\u00eddo anteriormente. -rm.action.valid-date-disp-asof=Insira uma data v\u00e1lida para a data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o. -rm.action.disp-asof-lifecycle-applied=N\u00e3o \u00e9 poss\u00edvel editar a data de in\u00edcio da reten\u00e7\u00e3o de um documento arquiv\u00edstico ou uma pasta de documento arquiv\u00edstico que tenha um ciclo de vida aplicado. -rm.action.hold-edit-reason-none=N\u00e3o \u00e9 poss\u00edvel editar o motivo da espera pois a espera foi criada sem um motivo. Tente recriar a espera. -rm.action.hold-edit-type=N\u00e3o \u00e9 poss\u00edvel editar o motivo da espera de {1}, pois isso n\u00e3o \u00e9 uma espera. -rm.action.specify-avlid-date=Insira uma data v\u00e1lida para a data de in\u00edcio da revis\u00e3o. -rm.action.review-details-only=Voc\u00ea somente pode editar os detalhes de revis\u00e3o de documentos arquiv\u00edsticos vitais. -rm.action.freeze-no-reason=N\u00e3o \u00e9 poss\u00edvel colocar em espera um documento arquiv\u00edstico sem um motivo. Adicione um motivo \u00e0 espera. -rm.action.freeze-only-records-folders=Voc\u00ea pode colocar em espera somente documentos arquiv\u00edsticos ou pastas de documentos arquiv\u00edsticos. -rm.action.no-open-record-folder=N\u00e3o \u00e9 poss\u00edvel reabrir {0}, pois isso n\u00e3o \u00e9 uma pasta de documento arquiv\u00edstico. -rm.action.not-hold-type=N\u00e3o \u00e9 poss\u00edvel realizar a a\u00e7\u00e3o em {1}, pois isso n\u00e3o \u00e9 uma espera. -rm.action.no-read-mime-message=N\u00e3o foi poss\u00edvel ler a mensagem de tipo de arquivo, pois {0}. -rm.action.email-declared=N\u00e3o foi poss\u00edvel dividir o e-mail, pois o documento arquiv\u00edstico est\u00e1 conclu\u00eddo. (actionedUponNodeRef={0}) -rm.action.email-not-record=N\u00e3o foi poss\u00edvel dividir o e-mail, pois o arquivo, pasta ou categoria n\u00e3o \u00e9 um documento arquiv\u00edstico. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=N\u00e3o foi poss\u00edvel criar uma associa\u00e7\u00e3o secund\u00e1ria personalizada. -rm.action.node-already-transfer=O arquivo, pasta ou categoria j\u00e1 est\u00e1 sendo transferido. -rm.action.node-not-transfer=O arquivo, pasta ou categoria n\u00e3o \u00e9 um objeto de transfer\u00eancia. -rm.action.undo-not-last=N\u00e3o \u00e9 poss\u00edvel desfazer o corte, pois a \u00faltima a\u00e7\u00e3o de reten\u00e7\u00e3o n\u00e3o foi cortada. -rm.action.records_only_undeclared=Voc\u00ea s\u00f3 pode concluir documentos arquiv\u00edsticos. -rm.action.event-not-undone=N\u00e3o \u00e9 poss\u00edvel desfazer o evento {0}, pois ele n\u00e3o est\u00e1 definido no ciclo de vida de reten\u00e7\u00e3o. -rm.action.node-not-record-category=N\u00e3o \u00e9 poss\u00edvel criar uma programa\u00e7\u00e3o de reten\u00e7\u00e3o para ({0}), pois n\u00e3o \u00e9 uma categoria de documento arquiv\u00edstico. -rm.action.parameter-not-supplied=Adicione um(a) ''{0}'' para continuar. -rm.action.delete-not-hold-type=N\u00e3o foi poss\u00edvel excluir a espera, pois {1} n\u00e3o \u00e9 do tipo {0}. -rm.action.cast-to-rm-type=N\u00e3o \u00e9 poss\u00edvel carregar um tipo de pasta personalizada para o plano de arquivamento do Records Management. -rm.action.record-folder-create=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico em outra pasta de documento arquiv\u00edstico. -rm.action.unique.child.type-error-message=N\u00e3o \u00e9 poss\u00edvel criar v\u00e1rios itens deste tipo aqui. -rm.action.multiple.children.type-error-message=N\u00e3o \u00e9 poss\u00edvel criar {0} aqui. -rm.action.create.transfer.container.child-error-message=N\u00e3o \u00e9 poss\u00edvel criar itens no cont\u00eainer de Transfer\u00eancia. -rm.action.create.transfer.child-error-message=N\u00e3o \u00e9 poss\u00edvel criar itens nas pastas de Transfer\u00eancia. -rm.action.create.record.folder.child-error-message=\u00c9 poss\u00edvel apenas criar documentos arquiv\u00edsticos em pastas de documentos arquiv\u00edsticos; esta foi {0}. -rm.action.transfer-non-editable=N\u00e3o \u00e9 poss\u00edvel editar os metadados das pastas de transfer\u00eancia ou cont\u00eainer. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties deleted file mode 100644 index 01174e4738..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 {0} \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e. -rm.action.no-implicit-noderef=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0} \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e. -rm.action.record-not-declared=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0437\u0430\u043f\u0438\u0441\u044c {1} \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u0439. -rm.action.expected-record-level=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. -rm.action.not-all-records-declared=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. (actionedUponNodeRef={1}) -rm.action.not-eligible=\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 {1} \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}. -rm.action.no-disposition-instructions=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. (nodeRef={1}) -rm.action.next-disp-not-set=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. (nodeRef={1}) -rm.action.not-next-disp=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. (nodeRef={1}) -rm.action.not-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.actioned-upon-not-record=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. -rm.action.custom-aspect-not-recognised=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f: \u0442\u0438\u043f \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d. (customAspect={0}) -rm.action.event-no-disp-lc=\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\u0435 \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 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. -rm.action.undeclared-only-records=\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. (nodeRef={0}) -rm.action.no-declare-mand-prop=\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.ghosted-prop-update=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.valid-date-disp-asof=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u0442\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443. -rm.action.disp-asof-lifecycle-applied=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0430\u0442\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. -rm.action.hold-edit-reason-none=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438: \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. -rm.action.hold-edit-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 {1}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. -rm.action.specify-avlid-date=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443. -rm.action.review-details-only=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.freeze-no-reason=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u044b. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. -rm.action.freeze-only-records-folders=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043b\u0438 \u043f\u0430\u043f\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.no-open-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.not-hold-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 {1}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. -rm.action.no-read-mime-message=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0442\u0438\u043f\u0435 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437-\u0437\u0430 {0}. -rm.action.email-declared=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0437\u0430\u043f\u0438\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0439. (actionedUponNodeRef={0}) -rm.action.email-not-record=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0444\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0434\u043e\u0447\u0435\u0440\u043d\u044e\u044e \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044e. -rm.action.node-already-transfer=\u0424\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f. -rm.action.node-not-transfer=\u0424\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. -rm.action.undo-not-last=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435: \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435\u043c. -rm.action.records_only_undeclared=\u041c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.event-not-undone=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 {0}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \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 \u0445\u0440\u0430\u043d\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 \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f ({0}): \u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.parameter-not-supplied=\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 ''{0}'', \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c. -rm.action.delete-not-hold-type=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443: {1} \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0438\u043f\u0443 {0}. -rm.action.cast-to-rm-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u043f\u0430\u043f\u043a\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. -rm.action.record-folder-create=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.unique.child.type-error-message=\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430. -rm.action.multiple.children.type-error-message=\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c {0}. -rm.action.create.transfer.container.child-error-message=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. -rm.action.create.transfer.child-error-message=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u0430\u043f\u043a\u0430\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. -rm.action.create.record.folder.child-error-message=\u0417\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0430\u043f\u043a\u0430\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0430 \u044d\u0442\u043e {0}. -rm.action.transfer-non-editable=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties deleted file mode 100644 index 4ff55da979..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties +++ /dev/null @@ -1,48 +0,0 @@ -rm.action.not-defined=\u5c1a\u672a\u5b9a\u4e49\u8bb0\u5f55\u7ba1\u7406\u64cd\u4f5c {0}\u3002 -rm.action.no-implicit-noderef=\u5b58\u5728\u7cfb\u7edf\u9519\u8bef\uff0c\u56e0\u6b64\u64cd\u4f5c {0} \u65e0\u6cd5\u6210\u529f\u5b8c\u6210\u3002 -rm.action.record-not-declared=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u8bb0\u5f55 {1} \u4e0d\u5b8c\u6574\u3002 -rm.action.expected-record-level=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u3002 -rm.action.not-all-records-declared=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u5e76\u975e\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u90fd\u5b8c\u6574\u3002 (actionedUponNodeRef={1}) -rm.action.not-eligible=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 {1} \u672a\u505a\u597d\u4fdd\u7559\u64cd\u4f5c {0} \u51c6\u5907\u3002 -rm.action.no-disposition-instructions=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u65e0\u6cd5\u627e\u5230\u4fdd\u7559\u8bf4\u660e\u3002 (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u6ca1\u6709\u53ef\u7528\u7684\u4fdd\u7559\u751f\u547d\u5468\u671f\u8bbe\u7f6e\u3002 (nodeRef={1}) -rm.action.next-disp-not-set=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u6ca1\u6709\u8bbe\u7f6e\u4e0b\u4e2a\u4fdd\u7559\u64cd\u4f5c\u3002 (nodeRef={1}) -rm.action.not-next-disp=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u8fd9\u5e76\u975e\u8be5\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u4e0b\u4e2a\u4fdd\u7559\u64cd\u4f5c\u3002 (nodeRef={1}) -rm.action.not-record-folder=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.actioned-upon-not-record=\u65e0\u6cd5\u6267\u884c\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u3002 -rm.action.custom-aspect-not-recognised=\u56e0\u4e3a\u672a\u8bc6\u522b\u81ea\u5b9a\u4e49\u7c7b\u578b\uff0c\u6240\u4ee5\u65e0\u6cd5\u5e94\u7528\u3002 (customAspect={0}) -rm.action.event-no-disp-lc=\u65e0\u6cd5\u5b8c\u6210\u4e8b\u4ef6 {0}\uff0c\u56e0\u4e3a\u5176\u672a\u5728\u4fdd\u7559\u751f\u547d\u5468\u671f\u4e0a\u5b9a\u4e49\u3002 -rm.action.undeclared-only-records=\u4ec5\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 (nodeRef={0}) -rm.action.no-declare-mand-prop=\u60a8\u9700\u8981\u8bbe\u7f6e\u6240\u6709\u8bb0\u5f55\u7684\u5fc5\u9009\u5c5e\u6027\uff0c\u7136\u540e\u624d\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 -rm.action.ghosted-prop-update=\u60a8\u65e0\u6cd5\u66f4\u65b0\u5148\u524d\u5df2\u9500\u6bc1\u8bb0\u5f55\u7684\u5c5e\u6027\u3002 -rm.action.valid-date-disp-asof=\u8f93\u5165\u6709\u6548\u65e5\u671f\u4f5c\u4e3a\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f\u3002 -rm.action.disp-asof-lifecycle-applied=\u60a8\u65e0\u6cd5\u7f16\u8f91\u5e94\u7528\u4e86\u751f\u547d\u5468\u671f\u7684\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u4fdd\u7559\u622a\u6b62\u65e5\u671f\u3002 -rm.action.hold-edit-reason-none=\u60a8\u65e0\u6cd5\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0\uff0c\u56e0\u4e3a\u4fdd\u5b58\u662f\u5728\u6ca1\u6709\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u521b\u5efa\u7684\u3002 \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u521b\u5efa\u4fdd\u5b58\u3002 -rm.action.hold-edit-type=\u60a8\u65e0\u6cd5\u7f16\u8f91 {1} \u7684\u4fdd\u5b58\u539f\u56e0\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u4fdd\u5b58\u3002 -rm.action.specify-avlid-date=\u8f93\u5165\u6709\u6548\u65e5\u671f\u4f5c\u4e3a\u590d\u67e5\u622a\u6b62\u65e5\u671f\u3002 -rm.action.review-details-only=\u60a8\u53ea\u80fd\u7f16\u8f91\u6709\u6548\u8bb0\u5f55\u7684\u590d\u67e5\u8be6\u7ec6\u4fe1\u606f\u3002 -rm.action.freeze-no-reason=\u60a8\u4e0d\u80fd\u5728\u6ca1\u6709\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u4fdd\u5b58\u8bb0\u5f55\u3002 \u6dfb\u52a0\u4fdd\u5b58\u7684\u539f\u56e0\u3002 -rm.action.freeze-only-records-folders=\u60a8\u53ea\u80fd\u4fdd\u5b58\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.no-open-record-folder=\u60a8\u65e0\u6cd5\u91cd\u65b0\u6253\u5f00 {0}\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.not-hold-type=\u60a8\u65e0\u6cd5\u5bf9 {1} \u6267\u884c\u64cd\u4f5c\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u4fdd\u5b58\u3002 -rm.action.no-read-mime-message=\u65e0\u6cd5\u8bfb\u53d6\u6587\u4ef6\u7c7b\u578b\u6d88\u606f\uff0c\u539f\u56e0\u4e3a {0}\u3002 -rm.action.email-declared=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206\u7535\u5b50\u90ae\u4ef6\uff0c\u56e0\u4e3a\u8bb0\u5f55\u5df2\u5b8c\u6210\u3002 (actionedUponNodeRef={0}) -rm.action.email-not-record=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206\u7535\u5b50\u90ae\u4ef6\uff0c\u56e0\u4e3a\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u4e0d\u662f\u8bb0\u5f55\u3002 (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u81ea\u5b9a\u4e49\u5b50\u5173\u8054\u3002 -rm.action.node-already-transfer=\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u5df2\u88ab\u4f20\u8f93\u3002 -rm.action.node-not-transfer=\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u4e0d\u662f\u4f20\u8f93\u5bf9\u8c61\u3002 -rm.action.undo-not-last=\u60a8\u65e0\u6cd5\u64a4\u9500\u4e2d\u65ad\uff0c\u56e0\u4e3a\u4e0a\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u6ca1\u6709\u4e2d\u65ad\u3002 -rm.action.records_only_undeclared=\u60a8\u53ea\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 -rm.action.event-not-undone=\u60a8\u65e0\u6cd5\u64a4\u9500\u4e8b\u4ef6 {0}\uff0c\u56e0\u4e3a\u5176\u672a\u5728\u4fdd\u7559\u751f\u547d\u5468\u671f\u4e0a\u5b9a\u4e49\u3002 -rm.action.node-not-record-category=\u60a8\u65e0\u6cd5\u4e3a ({0}) \u521b\u5efa\u4fdd\u7559\u8ba1\u5212\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u8bb0\u5f55\u7c7b\u522b\u3002 -rm.action.parameter-not-supplied=\u6dfb\u52a0\u4e00\u4e2a ''{0}'' \u4ee5\u7ee7\u7eed\u3002 -rm.action.delete-not-hold-type=\u6211\u4eec\u65e0\u6cd5\u5220\u9664\u4fdd\u5b58\uff0c\u56e0\u4e3a {1} \u5e76\u672a {0} \u7c7b\u578b\u3002 -rm.action.cast-to-rm-type=\u60a8\u65e0\u6cd5\u4e0a\u4f20\u81ea\u5b9a\u4e49\u6587\u4ef6\u5939\u7c7b\u578b\u5230\u8bb0\u5f55\u7ba1\u7406\u5f52\u7c7b\u65b9\u6848\u3002 -rm.action.record-folder-create=\u60a8\u65e0\u6cd5\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.unique.child.type-error-message=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u591a\u4e2a\u6b64\u7c7b\u9879\u76ee\u3002 -rm.action.multiple.children.type-error-message=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa {0}\u3002 -rm.action.create.transfer.container.child-error-message=\u60a8\u65e0\u6cd5\u5728 Transfer \u5bb9\u5668\u4e2d\u521b\u5efa\u9879\u76ee\u3002 -rm.action.create.transfer.child-error-message=\u60a8\u65e0\u6cd5\u5728 Transfer \u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u9879\u76ee\u3002 -rm.action.create.record.folder.child-error-message=\u60a8\u53ea\u80fd\u5728\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u8bb0\u5f55\uff0c\u4e14\u8fd9\u662f\u4e00\u4e2a {0}\u3002 -rm.action.transfer-non-editable=\u60a8\u65e0\u6cd5\u7f16\u8f91\u4f20\u8f93\u6587\u4ef6\u5939\u6216\u5bb9\u5668\u5143\u6570\u636e\u3002 - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties deleted file mode 100644 index ee2cf32e5f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classified by Retention Schedule -isClassified.description=Records or record folders been classified by a retention schedule - -# Are cutoff -isCutoff.title=Cut Off -isCutoff.description=Records or record folders are cut off - -# Are declared -isDeclared.title=Record Completed -isDeclared.description=Record is complete - -# Is on hold -isFrozen.title=On Hold -isFrozen.description=Record or record folder on hold - -# Are filed -isRecordFiled.title=Record Filed -isRecordFiled.description=Record is filed - -# Are closed record folders -isRecordFolderClosed.title=Record Folder Closed -isRecordFolderClosed.description=Record folder is closed - -# Are vital -isVital.title=Vital Record -isVital.description=Record or record folder is a vital record - -# Have Rentention Action -hasDispositionAction.title=Has Retention Action -hasDispositionAction.description=Records and folders have the specified associated retention action at the specified relative position - -# Are kind -isKind.title=Type of Records Management Item -isKind.description=Items are a file plan component kind -isKind.kind.display-label=Kind - -# Are Record Type -isRecordType.title=Has Record Type -isRecordType.description=Records have a specified record type - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=File as Record -create-record.description=Declares file as a record and optionally files it -create-record.file-plan.display-label=File Plan -create-record.hide-record.display-label=Hide Record -create-record.path.display-label=Record Folder Location - -# File Version Record -declare-as-version-record.title=File Version as Record -declare-as-version-record.description=Declares this version of the file as a record and optionally files it -declare-as-version-record.file-plan.display-label=File Plan -declare-as-version-record.path.display-label=Record Folder Location - -# Complete record -declareRecord.title=Complete Record -declareRecord.description=Completes a record -# Reopens record -undeclareRecord.title=Reopen Record -undeclareRecord.description=Reopens a record -# Open record folder -openRecordFolder.title=Open Record Folder -openRecordFolder.description=Opens a record folder -# Close record folder -closeRecordFolder.title=Close Record Folder -closeRecordFolder.description=Closes a Record Folder -# Complete event -completeEvent.title=Complete Event -completeEvent.description=Completes an event -completeEvent.eventName.display-label=Event -# Freeze -freeze.title=Freeze -freeze.description=Freezes a record -freeze.reason.display-label=Reason -# Unfreeze -unfreeze.title=Unfreeze -unfreeze.description=Unfreezes a record -# File to -fileTo.title=File to -fileTo.description=Files a record to the specified record folder -fileTo.path.display-label=Path to Record Folder -fileTo.createRecordPath.display-label=Create Record Path -# Copy to -copyTo.title=Copy to -copyTo.description=Copies a record to the specified record folder -copyTo.path.display-label=Path to Record Folder -copyTo.createRecordPath.display-label=Create Record Path -# Move to -moveTo.title=Move to -moveTo.description=Moves a record to the specified record folder -moveTo.path.display-label=Path to Record Folder -moveTo.createRecordPath.display-label=Create Record Path -# Link to -linkTo.title=Link to -linkTo.description=Links a record to the specified record folder -linkTo.path.display-label=Path to Record Folder -linkTo.createRecordPath.display-label=Create Record Path -# Reject -reject.title=Reject -reject.description=Rejects a record and moves the file to its original location -reject.reason.display-label=Reject Reason -# Request Information -requestInfo.title=Request Information -requestInfo.description=Starts a workflow for requesting more information for a record -# Execute script -executeScript.title=Execute Script -executeScript.description=Execute a script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Send Email -sendEmail.description=Send an email -# Set Property -setPropertyValue.title=Set Property Value -setPropertyValue.description=Set a property value - -# Edit Hold Reason -editHoldReason.title=Edit Hold Reason -editHoldReason.description=Edit the hold reason -# Relinquish Hold -relinquishHold.title=Relinquish Hold -relinquishHold.description=Relinquish the hold -# Edit Review As Of Date -editReviewAsOfDate.title=Edit Review As Of Date -editReviewAsOfDate.description=Edit review as of date -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Edit Retention Action As Of Date -editDispositionActionAsOfDate.description=Edit the retention action as of date -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Broadcast Vital Record Definition -broadcastVitalRecordDefinition.description=Broadcast the vital record definition -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Broadcast Retention Action Definition Update -broadcastDispositionActionDefinitionUpdate.description=Broadcast retention action definition update -# Undo Event -undoEvent.title=Undo Event -undoEvent.description=Undo event -# Transfer Complete -transferComplete.title=Transfer Complete -transferComplete.description=Transfer complete -# Accession Complete -accessionComplete.title=Accession Complete -accessionComplete.description=Accession complete -# Split Email -splitEmail.title=Split Email -splitEmail.description=Split email -# Create Rentention Schedule -createDispositionSchedule.title=Create Retention Schedule -createDispositionSchedule.description=Create retention schedule -# File Destruction Report -fileDestructionReport.title=File Destruction Report -fileDestructionReport.description=File destruction report -# Cut off -cutoff.title=Cut Off -cutoff.description=Cut off -# Destroy -destroy.title=Destroy -destroy.description=Destroy -# Reviewed -reviewed.title=Reviewed -reviewed.description=Reviewed -# Hide Record -hide-record.title=Hide Record -hide-record.description=Hide record -# Transfer -transfer.title=Transfer -transfer.description=Transfer -# Uncut off -unCutoff.title=Undo Cut Off -unCutoff.description=Undo cut off -# Accession -accession.title=Accession -accession.description=Accession -# Retain -retain.title=Retain -retain.description=Retain -# Add Record Types -addRecordTypes.title=Add Record Types -addRecordTypes.description=Adds the selected type(s) to the record -# File report -fileReport.title=File Report -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 -rm-ac-is-kind-kinds.record_folder=Record Folder -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties deleted file mode 100644 index 7f7de72ead..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Nach Aufbewahrungsplan klassifiziert -isClassified.description=Records oder Record-Ordner wurden nach einem Aufbewahrungsplan klassifiziert. - -# Are cutoff -isCutoff.title=Trennen -isCutoff.description=Records oder Record-Ordner sind getrennt. - -# Are declared -isDeclared.title=Record abgeschlossen -isDeclared.description=Record ist abgeschlossen. - -# Is on hold -isFrozen.title=Mit Legal Hold belegt -isFrozen.description=Record oder Record-Ordner mit Legal Hold belegt - -# Are filed -isRecordFiled.title=Record abgelegt -isRecordFiled.description=Record ist angelegt. - -# Are closed record folders -isRecordFolderClosed.title=Record-Ordner geschlossen -isRecordFolderClosed.description=Record-Ordner ist geschlossen. - -# Are vital -isVital.title=Besonders relevanter Record -isVital.description=Record oder Record-Ordner ist ein besonders relevanter Record. - -# Have Rentention Action -hasDispositionAction.title=Hat Aufbewahrungsaktion -hasDispositionAction.description=Records und Ordner verf\u00fcgen \u00fcber die angegebene zugeordnete Aufbewahrungsaktion an der angegebenen relativen Position. - -# Are kind -isKind.title=Typ des Records Management Elements -isKind.description=Elemente sind vom Typ Ablageplan-Komponente. -isKind.kind.display-label=Art - -# Are Record Type -isRecordType.title=Hat Record-Typ -isRecordType.description=Records verf\u00fcgen \u00fcber einen angegebenen Record-Typ. - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Als Record ablegen -create-record.description=Deklariert Datei als Record und legt sie auf Wunsch ab -create-record.file-plan.display-label=Ablageplan -create-record.hide-record.display-label=Record ausblenden -create-record.path.display-label=Ort f\u00fcr Record-Ordner - -# File Version Record -declare-as-version-record.title=Version als Record ablegen -declare-as-version-record.description=Deklariert diese Version der Datei als Record und legt sie auf Wunsch ab -declare-as-version-record.file-plan.display-label=Ablageplan -declare-as-version-record.path.display-label=Ort f\u00fcr Record-Ordner - -# Complete record -declareRecord.title=Record abschlie\u00dfen -declareRecord.description=Schlie\u00dft einen Record ab -# Reopens record -undeclareRecord.title=Record neu \u00f6ffnen -undeclareRecord.description=\u00d6ffnet einen Record neu -# Open record folder -openRecordFolder.title=Record-Ordner \u00f6ffnen -openRecordFolder.description=\u00d6ffnet einen Record-Ordner -# Close record folder -closeRecordFolder.title=Record-Ordner schlie\u00dfen -closeRecordFolder.description=Schlie\u00dft einen Record-Ordner -# Complete event -completeEvent.title=Ereignis abschlie\u00dfen -completeEvent.description=Schlie\u00dft ein Ereignis ab -completeEvent.eventName.display-label=Ereignis -# Freeze -freeze.title=Fixieren -freeze.description=Fixiert einen Record -freeze.reason.display-label=Grund -# Unfreeze -unfreeze.title=Fixierung aufheben -unfreeze.description=Hebt die Fixierung eines Record auf -# File to -fileTo.title=Ablegen unter -fileTo.description=Legt einen Record in einem bestimmten Record-Ordner ab -fileTo.path.display-label=Pfad zum Record-Ordner -fileTo.createRecordPath.display-label=Record-Pfad erstellen -# Copy to -copyTo.title=Kopieren nach -copyTo.description=Kopiert einen Record in einen bestimmten Record-Ordner -copyTo.path.display-label=Pfad zum Record-Ordner -copyTo.createRecordPath.display-label=Record-Pfad erstellen -# Move to -moveTo.title=Verschieben nach -moveTo.description=Verschiebt einen Record in einen bestimmten Record-Ordner -moveTo.path.display-label=Pfad zum Record-Ordner -moveTo.createRecordPath.display-label=Record-Pfad erstellen -# Link to -linkTo.title=Link zu -linkTo.description=Verkn\u00fcpft einen Record mit einem bestimmten Record-Ordner -linkTo.path.display-label=Pfad zum Record-Ordner -linkTo.createRecordPath.display-label=Record-Pfad erstellen -# Reject -reject.title=Ablehnen -reject.description=Lehnt einen Record ab und verschiebt die Datei an ihren urspr\u00fcnglichen Speicherort -reject.reason.display-label=Ablehnungsgrund -# Request Information -requestInfo.title=Informationen anfordern -requestInfo.description=Startet einen Workflow zur Anforderung weiterer Informationen zu einem Record. -# Execute script -executeScript.title=Skript ausf\u00fchren -executeScript.description=F\u00fchrt ein Skript aus -executeScript.script-ref.display-label=Skript -# Send Email -sendEmail.title=E-Mail senden -sendEmail.description=Sendet eine E-Mail -# Set Property -setPropertyValue.title=Wert einer Eigenschaft setzen -setPropertyValue.description=Setzt den Wert einer Eigenschaft - -# Edit Hold Reason -editHoldReason.title=Grund f\u00fcr Legal Hold bearbeiten -editHoldReason.description=Bearbeiten Sie den Grund f\u00fcr den Legal Hold -# Relinquish Hold -relinquishHold.title=Legal Hold aufheben -relinquishHold.description=Hebt einen Legal Hold auf -# Edit Review As Of Date -editReviewAsOfDate.title=Startdatum der \u00dcberpr\u00fcfung bearbeiten -editReviewAsOfDate.description=Bearbeitet das Startdatum der \u00dcberpr\u00fcfung -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Startdatum der Aufbewahrungsaktion bearbeiten -editDispositionActionAsOfDate.description=Bearbeitet das Startdatum der Aufbewahrungsaktion -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Definition f\u00fcr besonders relevanten Record senden -broadcastVitalRecordDefinition.description=Sendet die Definition f\u00fcr einen besonders relevanten Record -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Aktualisierung der Definition der Aufbewahrungsaktion senden -broadcastDispositionActionDefinitionUpdate.description=Sendet die Aktualisierung der Definition der Aufbewahrungsaktion -# Undo Event -undoEvent.title=Ereignis r\u00fcckg\u00e4ngig machen -undoEvent.description=Ereignis r\u00fcckg\u00e4ngig machen -# Transfer Complete -transferComplete.title=\u00dcbertragung abgeschlossen -transferComplete.description=\u00dcbertragung abgeschlossen -# Accession Complete -accessionComplete.title=Aufnahme abgeschlossen -accessionComplete.description=Aufnahme abgeschlossen -# Split Email -splitEmail.title=E-Mail teilen -splitEmail.description=E-Mail teilen -# Create Rentention Schedule -createDispositionSchedule.title=Aufbewahrungsplan erstellen -createDispositionSchedule.description=Erstellt einen Aufbewahrungsplan -# File Destruction Report -fileDestructionReport.title=Vernichtungsprotokoll ablegen -fileDestructionReport.description=Vernichtungsprotokoll ablegen -# Cut off -cutoff.title=Trennen -cutoff.description=Trennen -# Destroy -destroy.title=Vernichten -destroy.description=Vernichten -# Reviewed -reviewed.title=\u00dcberpr\u00fcft -reviewed.description=\u00dcberpr\u00fcft -# Hide Record -hide-record.title=Record ausblenden -hide-record.description=Record ausblenden -# Transfer -transfer.title=\u00dcbertragen -transfer.description=\u00dcbertragen -# Uncut off -unCutoff.title=Trennung aufheben -unCutoff.description=Trennung aufheben -# Accession -accession.title=Aufnahme -accession.description=Aufnahme -# Retain -retain.title=Aufbewahren -retain.description=Aufbewahren -# Add Record Types -addRecordTypes.title=Record-Typen hinzuf\u00fcgen -addRecordTypes.description=F\u00fcgt ausgew\u00e4hlte Typen zum Record hinzu -# File report -fileReport.title=Bericht ablegen -fileReport.description=Bericht ablegen -# Delete Hold -deleteHold.title=Legal Hold l\u00f6schen -deleteHold.description=Legal Hold 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 -rm-ac-is-kind-kinds.record_folder=Record-Ordner -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=Beliebig - -ac-versions.none=Nie -ac-versions.major_only=Nur f\u00fcr Hauptversionen -ac-versions.all=F\u00fcr alle Haupt- und Nebenversionen diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties deleted file mode 100644 index 43d529fe0a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Clasificado por planificaci\u00f3n de retenci\u00f3n -isClassified.description=Los documentos de archivo o las carpetas de documentos de archivo se han clasificado por una planificaci\u00f3n de retenci\u00f3n - -# Are cutoff -isCutoff.title=Interrumpir -isCutoff.description=Los documentos de archivo o las carpetas de documentos de archivo est\u00e1n interrumpidos - -# Are declared -isDeclared.title=Documento de archivo completado -isDeclared.description=Documento de archivo completo - -# Is on hold -isFrozen.title=En retenci\u00f3n legal -isFrozen.description=Documento de archivo o carpeta de documentos de archivo en retenci\u00f3n legal - -# Are filed -isRecordFiled.title=Documento de archivo archivado -isRecordFiled.description=El documento de archivo se ha archivado - -# Are closed record folders -isRecordFolderClosed.title=Carpeta de documentos de archivo cerrada -isRecordFolderClosed.description=La carpeta de documentos de archivo est\u00e1 cerrada - -# Are vital -isVital.title=Documento de archivo vital -isVital.description=El documento de archivo o la carpeta de documentos de archivo es un documento de archivo vital - -# Have Rentention Action -hasDispositionAction.title=Tiene acci\u00f3n de retenci\u00f3n -hasDispositionAction.description=Los documentos de archivo y las carpetas tienen la acci\u00f3n de retenci\u00f3n asociada especificada en la posici\u00f3n relativa especificada - -# Are kind -isKind.title=Tipo de elemento de Records Management -isKind.description=Los elementos son una clase de componente del cuadro de clasificaci\u00f3n -isKind.kind.display-label=Clase - -# Are Record Type -isRecordType.title=Tiene tipo de documento de archivo -isRecordType.description=Los documentos de archivo tienen un tipo de documento de archivo especificado - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Archivar como documento de archivo -create-record.description=Declara el fichero como un documento de archivo y lo archiva opcionalmente. -create-record.file-plan.display-label=Cuadro de clasificaci\u00f3n -create-record.hide-record.display-label=Ocultar documento de archivo -create-record.path.display-label=Ubicaci\u00f3n de la carpeta de documentos de archivo - -# File Version Record -declare-as-version-record.title=Archivar versi\u00f3n como documento de archivo -declare-as-version-record.description=Declara esta versi\u00f3n del fichero como un documento de archivo y opcionalmente lo archiva. -declare-as-version-record.file-plan.display-label=Cuadro de clasificaci\u00f3n -declare-as-version-record.path.display-label=Ubicaci\u00f3n de la carpeta de documentos de archivo - -# Complete record -declareRecord.title=Documento de archivo completo -declareRecord.description=Completa un documento de archivo -# Reopens record -undeclareRecord.title=Reabrir documento de archivo -undeclareRecord.description=Reabre un documento de archivo -# Open record folder -openRecordFolder.title=Abrir carpeta de documentos de archivo -openRecordFolder.description=Abre una carpeta de documentos de archivo -# Close record folder -closeRecordFolder.title=Cerrar carpeta de documentos de archivo -closeRecordFolder.description=Cierra una carpeta de documentos de archivo -# Complete event -completeEvent.title=Completar evento -completeEvent.description=Completa un evento -completeEvent.eventName.display-label=Evento -# Freeze -freeze.title=Congelar -freeze.description=Congela un documento de archivo -freeze.reason.display-label=Raz\u00f3n -# Unfreeze -unfreeze.title=Descongelar -unfreeze.description=Descongela un documento de archivo -# File to -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=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=Crear ruta de documentos de archivo -# Move to -moveTo.title=Mover a -moveTo.description=Mueve un documento de archivo a la carpeta de documentos de archivo especificada -moveTo.path.display-label=Ruta a la carpeta de 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=Crear ruta de documentos de archivo -# Reject -reject.title=Rechazar -reject.description=Rechaza un documento de archivo y mueve el fichero a su ubicaci\u00f3n original -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 -# Execute script -executeScript.title=Ejecutar script -executeScript.description=Ejecuta un script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Env\u00edar correo electr\u00f3nico -sendEmail.description=Env\u00eda un correo electr\u00f3nico -# Set Property -setPropertyValue.title=Establecer valor de la propiedad -setPropertyValue.description=Establece un valor de la propiedad - -# Edit Hold Reason -editHoldReason.title=Editar raz\u00f3n de retenci\u00f3n legal -editHoldReason.description=Edita la raz\u00f3n de retenci\u00f3n legal -# Relinquish Hold -relinquishHold.title=Eliminar retenci\u00f3n legal -relinquishHold.description=Elimina retenci\u00f3n legal -# Edit Review As Of Date -editReviewAsOfDate.title=Editar 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=Editar fecha de inicio de la acci\u00f3n de retenci\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 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Difundir actualizaci\u00f3n de definici\u00f3n de acciones de retenci\u00f3n -broadcastDispositionActionDefinitionUpdate.description=Difunde actualizaci\u00f3n de definici\u00f3n de acciones de retenci\u00f3n -# Undo Event -undoEvent.title=Deshacer evento -undoEvent.description=Deshace evento -# Transfer Complete -transferComplete.title=Transferencia completa -transferComplete.description=Transferencia completa -# Accession Complete -accessionComplete.title=Incorporaci\u00f3n completa -accessionComplete.description=Incorporaci\u00f3n completa -# Split Email -splitEmail.title=Separar correo electr\u00f3nico -splitEmail.description=Separa correo electr\u00f3nico -# Create Rentention Schedule -createDispositionSchedule.title=Crear planificaci\u00f3n de retenci\u00f3n -createDispositionSchedule.description=Crea planificaci\u00f3n de retenci\u00f3n -# File Destruction Report -fileDestructionReport.title=Archivar informe de destrucci\u00f3n -fileDestructionReport.description=Archiva informe de destrucci\u00f3n -# Cut off -cutoff.title=Interrumpir -cutoff.description=Interrumpe -# Destroy -destroy.title=Destruir -destroy.description=Destruye -# Reviewed -reviewed.title=Revisado -reviewed.description=Revisado -# Hide Record -hide-record.title=Ocultar documento de archivo -hide-record.description=Oculta documento de archivo -# Transfer -transfer.title=Transferencia -transfer.description=Transferencia -# Uncut off -unCutoff.title=Deshacer interrupci\u00f3n -unCutoff.description=Deshace interrupci\u00f3n -# Accession -accession.title=Incorporaci\u00f3n -accession.description=Incorporaci\u00f3n -# Retain -retain.title=Retener -retain.description=Retiene -# Add Record Types -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 informe -# Delete Hold -deleteHold.title=Eliminar retenci\u00f3n legal -deleteHold.description=Elimina retenci\u00f3n legal -# Move DM record -move-dm-record.title=Mover documento de archivo -move-dm-record.description=Mueve documento de archivo -# Unlink from -unlinkFrom.title=Desvincular de -unlinkFrom.description=Desvincula de - -# 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 - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Categor\u00eda de documentos de archivo -rm-ac-is-kind-kinds.record_folder=Carpeta de documentos de archivo -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties deleted file mode 100644 index c4e520414f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classifi\u00e9 par r\u00e8gle de conservation -isClassified.description=Les documents d'archives ou dossiers d'archives sont classifi\u00e9s selon une r\u00e8gle de conservation - -# Are cutoff -isCutoff.title=D\u00e9but de conservation -isCutoff.description=Les documents d'archives ou dossiers d'archives sont pour un d\u00e9but de conservation. - -# Are declared -isDeclared.title=Document d'archives termin\u00e9 -isDeclared.description=Le document d'archives est termin\u00e9 - -# Is on hold -isFrozen.title=Suspendu -isFrozen.description=Le document d'archives ou le dossier d'archives est suspendu - -# Are filed -isRecordFiled.title=Document d'archives archiv\u00e9 -isRecordFiled.description=Le document d'archives est archiv\u00e9 - -# Are closed record folders -isRecordFolderClosed.title=Dossier d'archives ferm\u00e9 -isRecordFolderClosed.description=Le dossier d'archives est ferm\u00e9 - -# Are vital -isVital.title=Document d'archives essentiel -isVital.description=Le document d'archives ou le dossier d'archives est essentiel - -# Have Rentention Action -hasDispositionAction.title=A une action de conservation -hasDispositionAction.description=Les documents d'archives et dossiers d'archives ont l'action de conservation associ\u00e9e d\u00e9finie \u00e0 la position relative d\u00e9finie - -# Are kind -isKind.title=Type d'\u00e9l\u00e9ment de gestion des archives -isKind.description=Les \u00e9l\u00e9ments sont un type de composant du plan de classement -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=A le type de document d'archives -isRecordType.description=Les documents d'archives ont un type de document d'archives d\u00e9fini - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Archiver comme document d'archives -create-record.description=D\u00e9clare le fichier comme document d'archives et le classe facultativement -create-record.file-plan.display-label=Plan de classement -create-record.hide-record.display-label=Masquer le document d'archives -create-record.path.display-label=Emplacement du dossier d'archives - -# File Version Record -declare-as-version-record.title=Classer la version comme document d'archives -declare-as-version-record.description=D\u00e9clare cette version du fichier comme document d'archives et le classe, le cas \u00e9ch\u00e9ant -declare-as-version-record.file-plan.display-label=Plan de classement -declare-as-version-record.path.display-label=Emplacement du dossier d'archives - -# Complete record -declareRecord.title=Compl\u00e9ter un document d'archives -declareRecord.description=Compl\u00e8te un document d'archives -# Reopens record -undeclareRecord.title=Rouvrir un document d'archives -undeclareRecord.description=Rouvre un document d'archives -# Open record folder -openRecordFolder.title=Ouvrir un dossier d'archives -openRecordFolder.description=Ouvre un dossier d'archives -# Close record folder -closeRecordFolder.title=Fermer un dossier d'archives -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 -# Freeze -freeze.title=Geler -freeze.description=G\u00e8le un document d'archives -freeze.reason.display-label=Motif -# Unfreeze -unfreeze.title=D\u00e9geler -unfreeze.description=D\u00e9g\u00e8le un document d'archives -# File to -fileTo.title=Archiver dans -fileTo.description=Archive un document d'archives dans le dossier d'archives d\u00e9fini -fileTo.path.display-label=Chemin de dossier d'archives -fileTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Copy to -copyTo.title=Copier vers -copyTo.description=Copie un document d'archives vers le dossier d'archives d\u00e9fini -copyTo.path.display-label=Chemin de dossier d'archives -copyTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Move to -moveTo.title=D\u00e9placer vers -moveTo.description=D\u00e9place un document d'archives vers le dossier d'archives d\u00e9fini -moveTo.path.display-label=Chemin de dossier d'archives -moveTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Link to -linkTo.title=Lier \u00e0 -linkTo.description=Lie un document d'archives vers le dossier d'archives d\u00e9fini -linkTo.path.display-label=Chemin de dossier d'archives -linkTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Reject -reject.title=Rejeter -reject.description=Rejette un document d'archives et place le fichier dans son emplacement d'origine -reject.reason.display-label=Motif du rejet -# Request Information -requestInfo.title=Demander des informations -requestInfo.description=D\u00e9marre un workflow pour demander plus d'informations sur un document d'archives -# Execute script -executeScript.title=Ex\u00e9cuter le script -executeScript.description=Ex\u00e9cuter un script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Envoyer un e-mail -sendEmail.description=Envoyer un e-mail -# Set Property -setPropertyValue.title=D\u00e9finir la valeur de la propri\u00e9t\u00e9 -setPropertyValue.description=D\u00e9finir une valeur de propri\u00e9t\u00e9 - -# Edit Hold Reason -editHoldReason.title=Modifier le motif de suspension -editHoldReason.description=Modifier le motif de suspension -# Relinquish Hold -relinquishHold.title=Lever la suspension -relinquishHold.description=Lever la suspension -# Edit Review As Of Date -editReviewAsOfDate.title=Modifier la date de d\u00e9but de la r\u00e9vision -editReviewAsOfDate.description=Modifier la date de d\u00e9but de la r\u00e9vision -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Modifier la date de d\u00e9but de l'action de conservation -editDispositionActionAsOfDate.description=Modifier la date de d\u00e9but de l'action de conservation -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=D\u00e9finition du document d'archives essentiel diffus\u00e9e -broadcastVitalRecordDefinition.description=D\u00e9finition du document d'archives essentiel diffus\u00e9e -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Mise \u00e0 jour de la d\u00e9finition de l'action de conservation diffus\u00e9e -broadcastDispositionActionDefinitionUpdate.description=Mise \u00e0 jour de la d\u00e9finition de l'action de conservation diffus\u00e9e -# Undo Event -undoEvent.title=Annuler l'\u00e9v\u00e9nement -undoEvent.description=Annuler l'\u00e9v\u00e9nement -# Transfer Complete -transferComplete.title=Transfert termin\u00e9 -transferComplete.description=Transfert termin\u00e9 -# Accession Complete -accessionComplete.title=Versement \u00e0 un autre organisme termin\u00e9 -accessionComplete.description=Versement \u00e0 un autre organisme termin\u00e9 -# Split Email -splitEmail.title=Partager l'e-mail -splitEmail.description=Partager l'e-mail -# Create Rentention Schedule -createDispositionSchedule.title=Cr\u00e9er une r\u00e8gle de conservation -createDispositionSchedule.description=Cr\u00e9er une r\u00e8gle de conservation -# File Destruction Report -fileDestructionReport.title=Rapport de destruction de fichier -fileDestructionReport.description=Rapport de destruction de fichier -# Cut off -cutoff.title=D\u00e9but de conservation -cutoff.description=D\u00e9but de conservation -# Destroy -destroy.title=D\u00e9truire -destroy.description=D\u00e9truire -# Reviewed -reviewed.title=V\u00e9rifi\u00e9 -reviewed.description=V\u00e9rifi\u00e9 -# Hide Record -hide-record.title=Masquer le document d'archives -hide-record.description=Masquer le document d'archives -# Transfer -transfer.title=Transf\u00e9rer -transfer.description=Transf\u00e9rer -# Uncut off -unCutoff.title=Annuler le d\u00e9but de conservation -unCutoff.description=Annuler le d\u00e9but de conservation -# Accession -accession.title=Versement \u00e0 un autre organisme -accession.description=Versement \u00e0 un autre organisme -# Retain -retain.title=Conserver -retain.description=Conserver -# Add Record Types -addRecordTypes.title=Ajouter des types de document d'archives -addRecordTypes.description=Ajoute le(s) type(s) s\u00e9lectionn\u00e9(s) au document d'archives -# File report -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 - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Cat\u00e9gorie de document d'archives -rm-ac-is-kind-kinds.record_folder=Dossier d'archives -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties deleted file mode 100644 index 34c985f4aa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classificato in base al programma di conservazione -isClassified.description=I record o le cartelle di record sono stati classificati in base al programma di conservazione - -# Are cutoff -isCutoff.title=Cut off -isCutoff.description=Record o cartelle di record separati - -# Are declared -isDeclared.title=Record completati -isDeclared.description=Il record \u00e8 completo - -# Is on hold -isFrozen.title=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 - -# Are closed record folders -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 record fondamentali - -# Have Rentention Action -hasDispositionAction.title=Con azione di conservazione -hasDispositionAction.description=I record e le cartelle hanno ottenuto la relativa azione di conservazione specificata alla relativa posizione specificata - -# Are kind -isKind.title=Tipo di elemento di Records Management -isKind.description=Gli elementi sono del tipo componente piano di fascicolazione -isKind.kind.display-label=Tipo - -# Are Record Type -isRecordType.title=Con tipo di record -isRecordType.description=I record hanno un tipo di record specificato - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Archivia come record -create-record.description=Dichiara il file come record e lo archivia facoltativamente -create-record.file-plan.display-label=Piano di fascicolazione -create-record.hide-record.display-label=Nascondi record -create-record.path.display-label=Posizione cartella di record - -# File Version Record -declare-as-version-record.title=Archivia versione come record -declare-as-version-record.description=Dichiara questa versione del file come record e opzionalmente lo archivia -declare-as-version-record.file-plan.display-label=Piano di fascicolazione -declare-as-version-record.path.display-label=Posizione cartella di record - -# Complete record -declareRecord.title=Completa record -declareRecord.description=Completa un record. -# Reopens record -undeclareRecord.title=Riapri record -undeclareRecord.description=Riapre un record -# Open record folder -openRecordFolder.title=Apri cartella di record -openRecordFolder.description=Apre una cartella di record -# Close record folder -closeRecordFolder.title=Chiudi cartella di record -closeRecordFolder.description=Chiude una cartella di record -# Complete event -completeEvent.title=Completa evento -completeEvent.description=Completa un evento -completeEvent.eventName.display-label=Evento -# Freeze -freeze.title=Blocca -freeze.description=Blocca un record -freeze.reason.display-label=Motivo -# Unfreeze -unfreeze.title=Sblocca -unfreeze.description=Sblocca un record -# File to -fileTo.title=Archivia in -fileTo.description=Archivia un record nella cartella di record specificata -fileTo.path.display-label=Indirizza nella cartella di record -fileTo.createRecordPath.display-label=Crea percorso del record -# Copy to -copyTo.title=Copia in -copyTo.description=Copia un record nella cartella di record specificata -copyTo.path.display-label=Indirizza nella cartella di record -copyTo.createRecordPath.display-label=Crea percorso del record -# Move to -moveTo.title=Sposta in -moveTo.description=Sposta un record nella cartella di record specificata -moveTo.path.display-label=Indirizza nella cartella di record -moveTo.createRecordPath.display-label=Crea percorso del record -# Link to -linkTo.title=Collega a -linkTo.description=Collega un record alla cartella di record specificata -linkTo.path.display-label=Indirizza nella cartella di record -linkTo.createRecordPath.display-label=Crea percorso del record -# Reject -reject.title=Respingi -reject.description=Respinge un record e sposta il file nella sua posizione originale -reject.reason.display-label=Respingi motivo -# Request Information -requestInfo.title=Richiedi informazioni -requestInfo.description=Avvia un workflow per richiedere pi\u00f9 informazioni per un record -# Execute script -executeScript.title=Esegui script -executeScript.description=Esegui uno script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Invia e-mail -sendEmail.description=Invia un'e-mail -# Set Property -setPropertyValue.title=Imposta valore di propriet\u00e0 -setPropertyValue.description=Imposta un valore di propriet\u00e0 - -# Edit Hold Reason -editHoldReason.title=Modifica motivo sospensione -editHoldReason.description=Modifica il motivo della sospensione -# Relinquish Hold -relinquishHold.title=Lascia sospensione -relinquishHold.description=Lascia la sospensione -# Edit Review As Of Date -editReviewAsOfDate.title=Modifica data di inizio esame -editReviewAsOfDate.description=Modifica data di inizio esame -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Modifica data di inizio azione di conservazione -editDispositionActionAsOfDate.description=Modifica la data di inizio azione di conservazione -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Trasmetti definizione di record fondamentale -broadcastVitalRecordDefinition.description=Trasmetti la definizione di record fondamentale -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Trasmetti aggiornamento definizione di azione di conservazione -broadcastDispositionActionDefinitionUpdate.description=Trasmetti aggiornamento definizione di azione di conservazione -# Undo Event -undoEvent.title=Annulla evento -undoEvent.description=Annulla evento -# Transfer Complete -transferComplete.title=Trasferimento completato -transferComplete.description=Trasferimento completato -# Accession Complete -accessionComplete.title=Trasferimento ad altri completato -accessionComplete.description=Trasferimento ad altri completato -# Split Email -splitEmail.title=Dividi e-mail -splitEmail.description=Dividi e-mail -# Create Rentention Schedule -createDispositionSchedule.title=Crea Programma di conservazione -createDispositionSchedule.description=Crea Programma di conservazione -# File Destruction Report -fileDestructionReport.title=Archivia rapporto di eliminazione definitiva -fileDestructionReport.description=Archivia rapporto di eliminazione definitiva -# Cut off -cutoff.title=Cut off -cutoff.description=Cut off -# Destroy -destroy.title=Elimina definitivamente -destroy.description=Elimina definitivamente -# Reviewed -reviewed.title=Esaminato -reviewed.description=Esaminato -# Hide Record -hide-record.title=Nascondi record -hide-record.description=Nascondi record -# Transfer -transfer.title=Trasferisci -transfer.description=Trasferisci -# Uncut off -unCutoff.title=Annulla cut off -unCutoff.description=Annulla cut off -# Accession -accession.title=Trasferimento ad altri -accession.description=Trasferimento ad altri -# Retain -retain.title=Conserva -retain.description=Conserva -# Add Record Types -addRecordTypes.title=Aggiungi tipi di record -addRecordTypes.description=Aggiunge i tipi selezionati al record -# File report -fileReport.title=Archivia rapporto -fileReport.description=Archivia rapporto -# 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 -rm-ac-is-kind-kinds.record_folder=Cartella di record -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties deleted file mode 100644 index b3b87b1ef4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u308a\u5206\u985e\u6e08\u307f -isClassified.description=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u3063\u3066\u5206\u985e\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Are cutoff -isCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -isCutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Are declared -isDeclared.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -isDeclared.description=\u30ec\u30b3\u30fc\u30c9\u306f\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059 - -# Is on hold -isFrozen.title=\u30db\u30fc\u30eb\u30c9\u4e2d -isFrozen.description=\u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Are filed -isRecordFiled.title=\u6574\u7406\u4fdd\u7ba1\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -isRecordFiled.description=\u30ec\u30b3\u30fc\u30c9\u306f\u6574\u7406\u4fdd\u7ba1\u3055\u308c\u3066\u3044\u307e\u3059 - -# Are closed record folders -isRecordFolderClosed.title=\u9589\u3058\u3089\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -isRecordFolderClosed.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u9589\u3058\u3089\u308c\u3066\u3044\u307e\u3059 - -# Are vital -isVital.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -isVital.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5206\u985e\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Have Rentention Action -hasDispositionAction.title=\u4fdd\u7ba1\u51e6\u7406\u3042\u308a -hasDispositionAction.description=\u7279\u5b9a\u306e\u76f8\u5bfe\u4f4d\u7f6e\u306b\u4fdd\u7ba1\u51e6\u7406\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u3068\u30d5\u30a9\u30eb\u30c0 - -# Are kind -isKind.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30a2\u30a4\u30c6\u30e0\u306e\u30bf\u30a4\u30d7 -isKind.description=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u4e00\u90e8\u3092\u306a\u3059\u30a2\u30a4\u30c6\u30e0 -isKind.kind.display-label=\u7a2e\u985e - -# Are Record Type -isRecordType.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u3042\u308a -isRecordType.description=\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u3092\u6301\u3064\u30ec\u30b3\u30fc\u30c9 - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u6574\u7406\u4fdd\u7ba1 -create-record.description=\u30d5\u30a1\u30a4\u30eb\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 -create-record.file-plan.display-label=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 -create-record.hide-record.display-label=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b -create-record.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u5834\u6240 - -# File Version Record -declare-as-version-record.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u6574\u7406\u4fdd\u7ba1 -declare-as-version-record.description=\u30d5\u30a1\u30a4\u30eb\u306e\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 -declare-as-version-record.file-plan.display-label=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 -declare-as-version-record.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u5834\u6240 - -# Complete record -declareRecord.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5b8c\u4e86 -declareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3057\u307e\u3059 -# Reopens record -undeclareRecord.title=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304f -undeclareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304d\u307e\u3059 -# Open record folder -openRecordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304f -openRecordFolder.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304d\u307e\u3059 -# Close record folder -closeRecordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b -closeRecordFolder.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u307e\u3059 -# Complete event -completeEvent.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86 -completeEvent.description=\u30a4\u30d9\u30f3\u30c8\u3092\u5b8c\u4e86\u3057\u307e\u3059 -completeEvent.eventName.display-label=\u30a4\u30d9\u30f3\u30c8 -# Freeze -freeze.title=\u51cd\u7d50 -freeze.description=\u30ec\u30b3\u30fc\u30c9\u3092\u51cd\u7d50\u3057\u307e\u3059 -freeze.reason.display-label=\u7406\u7531 -# Unfreeze -unfreeze.title=\u51cd\u7d50\u89e3\u9664 -unfreeze.description=\u30ec\u30b3\u30fc\u30c9\u306e\u51cd\u7d50\u3092\u89e3\u9664\u3057\u307e\u3059 -# File to -fileTo.title=\u6574\u7406\u4fdd\u7ba1\u5148 -fileTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 -fileTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -fileTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Copy to -copyTo.title=\u30b3\u30d4\u30fc\u5148 -copyTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059 -copyTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -copyTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Move to -moveTo.title=\u79fb\u52d5\u5148 -moveTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u307e\u3059 -moveTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -moveTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Link to -linkTo.title=\u30ea\u30f3\u30af\u5148 -linkTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u30ea\u30f3\u30af\u3057\u307e\u3059 -linkTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -linkTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Reject -reject.title=\u5374\u4e0b -reject.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5374\u4e0b\u3057\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u5143\u306e\u5834\u6240\u306b\u79fb\u52d5\u3057\u307e\u3059 -reject.reason.display-label=\u5374\u4e0b\u306e\u7406\u7531 -# Request Information -requestInfo.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8 -requestInfo.description=\u30ec\u30b3\u30fc\u30c9\u306e\u8a73\u7d30\u60c5\u5831\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u3092\u958b\u59cb\u3057\u307e\u3059 -# Execute script -executeScript.title=\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c -executeScript.description=\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059 -executeScript.script-ref.display-label=\u30b9\u30af\u30ea\u30d7\u30c8 -# Send Email -sendEmail.title=E \u30e1\u30fc\u30eb\u306e\u9001\u4fe1 -sendEmail.description=E \u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3059 -# Set Property -setPropertyValue.title=\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u306e\u8a2d\u5b9a -setPropertyValue.description=\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059 - -# Edit Hold Reason -editHoldReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531\u306e\u7de8\u96c6 -editHoldReason.description=\u30db\u30fc\u30eb\u30c9\u306e\u7406\u7531\u3092\u7de8\u96c6\u3057\u307e\u3059 -# Relinquish Hold -relinquishHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u89e3\u9664 -relinquishHold.description=\u30db\u30fc\u30eb\u30c9\u3092\u89e3\u9664\u3057\u307e\u3059 -# Edit Review As Of Date -editReviewAsOfDate.title=\u30ec\u30d3\u30e5\u30fc\u5b9f\u884c\u65e5\u306e\u7de8\u96c6 -editReviewAsOfDate.description=\u30ec\u30d3\u30e5\u30fc\u5b9f\u884c\u65e5\u3092\u7de8\u96c6\u3057\u307e\u3059 -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u3092\u7de8\u96c6 -editDispositionActionAsOfDate.description=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u3092\u7de8\u96c6\u3057\u307e\u3059 -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 -broadcastVitalRecordDefinition.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 -broadcastDispositionActionDefinitionUpdate.description=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059 -# Undo Event -undoEvent.title=\u30a4\u30d9\u30f3\u30c8\u3092\u5143\u306b\u623b\u3059 -undoEvent.description=\u30a4\u30d9\u30f3\u30c8\u3092\u5143\u306b\u623b\u3057\u307e\u3059 -# Transfer Complete -transferComplete.title=\u8ee2\u9001\u5b8c\u4e86 -transferComplete.description=\u8ee2\u9001\u5b8c\u4e86 -# Accession Complete -accessionComplete.title=\u53d7\u8afe\u5b8c\u4e86 -accessionComplete.description=\u53d7\u8afe\u5b8c\u4e86 -# Split Email -splitEmail.title=E \u30e1\u30fc\u30eb\u306e\u5206\u96e2 -splitEmail.description=E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3057\u307e\u3059 -# Create Rentention Schedule -createDispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u4f5c\u6210 -createDispositionSchedule.description=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059 -# File Destruction Report -fileDestructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -fileDestructionReport.description=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u3092\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 -# Cut off -cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -cutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5 -# Destroy -destroy.title=\u7834\u68c4 -destroy.description=\u7834\u68c4 -# Reviewed -reviewed.title=\u30ec\u30d3\u30e5\u30fc\u6e08\u307f -reviewed.description=\u30ec\u30d3\u30e5\u30fc\u6e08\u307f -# Hide Record -hide-record.title=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b -hide-record.description=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3057\u307e\u3059 -# Transfer -transfer.title=\u8ee2\u9001 -transfer.description=\u8ee2\u9001 -# Uncut off -unCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u53d6\u308a\u6d88\u3059 -unCutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u53d6\u308a\u6d88\u3057\u307e\u3059 -# Accession -accession.title=\u53d7\u8afe -accession.description=\u53d7\u8afe -# Retain -retain.title=\u4fdd\u7ba1 -retain.description=\u4fdd\u7ba1 -# Add Record Types -addRecordTypes.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306e\u8ffd\u52a0 -addRecordTypes.description=\u9078\u629e\u3057\u305f\u30bf\u30a4\u30d7\u3092\u30ec\u30b3\u30fc\u30c9\u306b\u8ffd\u52a0\u3057\u307e\u3059 -# 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 -rm-ac-is-kind-kinds.record_folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -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=\u8a2d\u5b9a\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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties deleted file mode 100644 index ead9bd5572..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Klassifisert etter retensjonsplanen -isClassified.description=Oppf\u00f8ringer og oppf\u00f8ringsmapper klassifisert etter en retensjonsplan - -# Are cutoff -isCutoff.title=Cut off -isCutoff.description=Cut off av oppf\u00f8ringer og oppf\u00f8ringsmapper. - -# Are declared -isDeclared.title=Oppf\u00f8ring fullf\u00f8rt -isDeclared.description=Oppf\u00f8ring er fullf\u00f8rt - -# Is on hold -isFrozen.title=P\u00e5 hold -isFrozen.description=Oppf\u00f8ring eller oppf\u00f8ringsmappe p\u00e5 hold. - -# Are filed -isRecordFiled.title=Oppf\u00f8ring registrert -isRecordFiled.description=Oppf\u00f8ring er registrert - -# Are closed record folders -isRecordFolderClosed.title=Oppf\u00f8ringsmappe lukket -isRecordFolderClosed.description=Oppf\u00f8ringsmappe er lukket - -# Are vital -isVital.title=Sv\u00e6rt viktig oppf\u00f8ring -isVital.description=Oppf\u00f8ring eller oppf\u00f8ringsmappe er en v\u00e6rt viktig oppf\u00f8ring - -# Have Rentention Action -hasDispositionAction.title=Har retensjonshandling -hasDispositionAction.description=Oppf\u00f8ringene og mappene har de spesifikke assosierte retensjonshandlingen p\u00e5 den spesifiserte relative posisjonen - -# Are kind -isKind.title=Type element ved oppf\u00f8ringsh\u00e5ndtering -isKind.description=Elementer er en type filplankomponent -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=Har oppf\u00f8ringstype -isRecordType.description=Oppf\u00f8ringer har en bestemt oppf\u00f8ringstype - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Registrer som oppf\u00f8ring -create-record.description=Erkl\u00e6rer filen som en oppf\u00f8ring og arkiverer den ved \u00f8nske -create-record.file-plan.display-label=Filplan -create-record.hide-record.display-label=Skjul oppf\u00f8ring -create-record.path.display-label=Plassering av oppf\u00f8ringsmappe - -# File Version Record -declare-as-version-record.title=Arkiver versjonen som en oppf\u00f8ring -declare-as-version-record.description=Erkl\u00e6rer filen som en oppf\u00f8ring og arkiverer den ved \u00f8nske -declare-as-version-record.file-plan.display-label=Filplan -declare-as-version-record.path.display-label=Plassering av oppf\u00f8ringsmappe - -# 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 filen 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 grunnen til holdet -# Relinquish Hold -relinquishHold.title=Avslutt hold -relinquishHold.description=Avslutt holdet -# 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 retensjonshandling per datoen -editDispositionActionAsOfDate.description=Rediger retensjonshandlingen per datoen -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Kringkast definisjonen til sv\u00e6rt viktig oppf\u00f8ring -broadcastVitalRecordDefinition.description=Kringkast definisjonen til den sv\u00e6rt viktige oppf\u00f8ringen -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Kringkast oppdatering av definisjonen til retensjonshandling -broadcastDispositionActionDefinitionUpdate.description=Kringkast oppdatering av definisjonen til retensjonshandling -# Undo Event -undoEvent.title=Angre hendelse -undoEvent.description=Angre hendelse -# Transfer Complete -transferComplete.title=Overf\u00f8ring fullf\u00f8rt -transferComplete.description=Overf\u00f8ring 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 Rentention Schedule -createDispositionSchedule.title=Opprett retensjonsplan -createDispositionSchedule.description=Opprett retensjonsplan -# 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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties deleted file mode 100755 index 254694c70d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Geclassificeerd op retentieschema -isClassified.description=Archiefstukken of archiefmappen zijn geclassificeerd op een retentieschema - -# Are cutoff -isCutoff.title=Afsluiten -isCutoff.description=Archiefstukken of archiefmappen zijn afgesloten - -# Are declared -isDeclared.title=Archiefstuk afgerond -isDeclared.description=Archiefstuk is afgerond - -# Is on hold -isFrozen.title=In bewaring -isFrozen.description=Archiefstuk of archiefmap in bewaring - -# Are filed -isRecordFiled.title=Archiefstuk gearchiveerd -isRecordFiled.description=Archiefstuk is gearchiveerd - -# Are closed record folders -isRecordFolderClosed.title=Archiefmap gesloten -isRecordFolderClosed.description=Archiefmap is gesloten - -# Are vital -isVital.title=Vitaal archiefstuk -isVital.description=Archiefstuk of archiefmap is een vitaal archiefstuk - -# Have Rentention Action -hasDispositionAction.title=Heeft retentieactie -hasDispositionAction.description=Archiefstukken en mappen hebben de opgegeven gekoppelde retentieactie op de opgegeven relatieve positie - -# Are kind -isKind.title=Type onderdeel Records Management -isKind.description=Onderdelen zijn van een type ordeningsplancomponent -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=Heeft archiefstuktype -isRecordType.description=Archiefstukken hebben een opgegeven archiefstuktype - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Archiveren als archiefstuk -create-record.description=Hiermee wordt het bestand gedeclareerd als een archiefstuk en optioneel gearchiveerd -create-record.file-plan.display-label=Ordeningsplan -create-record.hide-record.display-label=Archiefstuk verbergen -create-record.path.display-label=Locatie archiefmap - -# File Version Record -declare-as-version-record.title=Versie archiveren als archiefstuk -declare-as-version-record.description=Hiermee wordt deze versie van het bestand gedeclareerd als een archiefstuk en optioneel gearchiveerd -declare-as-version-record.file-plan.display-label=Ordeningsplan -declare-as-version-record.path.display-label=Locatie archiefmap - -# Complete record -declareRecord.title=Archiefstuk afronden -declareRecord.description=Hiermee wordt een archiefstuk afgerond -# Reopens record -undeclareRecord.title=Archiefstuk heropenen -undeclareRecord.description=Hiermee wordt een archiefstuk heropend -# Open record folder -openRecordFolder.title=Archiefmap openen -openRecordFolder.description=Hiermee wordt een archiefmap geopend -# Close record folder -closeRecordFolder.title=Archiefmap sluiten -closeRecordFolder.description=Hiermee wordt een archiefmap gesloten -# Complete event -completeEvent.title=Gebeurtenis afronden -completeEvent.description=Hiermee wordt een gebeurtenis afgerond -completeEvent.eventName.display-label=Gebeurtenis -# Freeze -freeze.title=Bevriezen -freeze.description=Hiermee wordt een archiefstuk bevroren -freeze.reason.display-label=Reden -# Unfreeze -unfreeze.title=Bevriezen opheffen -unfreeze.description=Hiermee wordt de bevriezing van een archiefstuk opgeheven -# File to -fileTo.title=Archiveren in -fileTo.description=Hiermee wordt een archiefstuk gearchiveerd in de opgegeven archiefmap -fileTo.path.display-label=Pad naar archiefmap -fileTo.createRecordPath.display-label=Archiefstukpad maken -# Copy to -copyTo.title=Kopi\u00ebren naar -copyTo.description=Hiermee wordt een archiefstuk gekopieerd naar de opgegeven archiefmap -copyTo.path.display-label=Pad naar archiefmap -copyTo.createRecordPath.display-label=Archiefstukpad maken -# Move to -moveTo.title=Verplaatsen naar -moveTo.description=Hiermee wordt een archiefstuk verplaatst naar de opgegeven archiefmap -moveTo.path.display-label=Pad naar archiefmap -moveTo.createRecordPath.display-label=Archiefstukpad maken -# Link to -linkTo.title=Koppelen naar -linkTo.description=Hiermee wordt een archiefstuk gekoppeld naar de opgegeven archiefmap -linkTo.path.display-label=Pad naar archiefmap -linkTo.createRecordPath.display-label=Archiefstukpad maken -# Reject -reject.title=Afwijzen -reject.description=Hiermee wordt een archiefstuk afgewezen en wordt het document naar de originele locatie verplaatst -reject.reason.display-label=Reden voor afwijzing -# Request Information -requestInfo.title=Informatie aanvragen -requestInfo.description=Hiermee wordt een workflow gestart voor het aanvragen van meer informatie over een archiefstuk. -# Execute script -executeScript.title=Script uitvoeren -executeScript.description=Een script uitvoeren -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=E-mail verzenden -sendEmail.description=Een e-mail verzenden -# Set Property -setPropertyValue.title=Eigenschapwaarde instellen -setPropertyValue.description=Een eigenschapwaarde instellen - -# Edit Hold Reason -editHoldReason.title=Reden van bewaring bewerken -editHoldReason.description=De reden van de bewaring bewerken -# Relinquish Hold -relinquishHold.title=Bewaring afwijzen -relinquishHold.description=De bewaring afwijzen -# Edit Review As Of Date -editReviewAsOfDate.title=Begindatum revisie bewerken -editReviewAsOfDate.description=Begindatum revisie bewerken -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Begindatum retentieactie bewerken -editDispositionActionAsOfDate.description=De begindatum van de retentieactie bewerken -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Definitie vitaal archiefstuk uitzenden -broadcastVitalRecordDefinition.description=Definitie van het vitale archiefstuk uitzenden -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Update van definitie retentieactie uitzenden -broadcastDispositionActionDefinitionUpdate.description=Update van definitie retentieactie uitzenden -# Undo Event -undoEvent.title=Gebeurtenis ongedaan maken -undoEvent.description=Gebeurtenis ongedaan maken -# Transfer Complete -transferComplete.title=Overzetten afgerond -transferComplete.description=Overzetten afgerond -# Accession Complete -accessionComplete.title=Overdracht afgerond -accessionComplete.description=Overdracht afgerond -# Split Email -splitEmail.title=E-mail opsplitsen -splitEmail.description=E-mail opsplitsen -# Create Rentention Schedule -createDispositionSchedule.title=Retentieschema maken -createDispositionSchedule.description=Retentieschema maken -# File Destruction Report -fileDestructionReport.title=Vernietigingsrapport archiveren -fileDestructionReport.description=Vernietigingsrapport archiveren -# Cut off -cutoff.title=Afsluiten -cutoff.description=Afsluiten -# Destroy -destroy.title=Vernietigen -destroy.description=Vernietigen -# Reviewed -reviewed.title=Gereviseerd -reviewed.description=Gereviseerd -# Hide Record -hide-record.title=Archiefstuk verbergen -hide-record.description=Archiefstuk verbergen -# Transfer -transfer.title=Overzetten -transfer.description=Overzetten -# Uncut off -unCutoff.title=Afsluiten ongedaan maken -unCutoff.description=Afsluiten ongedaan maken -# Accession -accession.title=Overdracht -accession.description=Overdracht -# Retain -retain.title=Behouden -retain.description=Behouden -# Add Record Types -addRecordTypes.title=Archiefstuktypes toevoegen -addRecordTypes.description=Hiermee worden de geselecteerde types aan het archiefstuk toegevoegd. -# File report -fileReport.title=Rapport archiveren -fileReport.description=Rapport archiveren -# Delete Hold -deleteHold.title=Bewaring verwijderen -deleteHold.description=Bewaring verwijderen -# Move DM record -move-dm-record.title=Archiefstuk verplaatsen -move-dm-record.description=Archiefstuk 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 archiefstukken - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Archiefstukcategorie -rm-ac-is-kind-kinds.record_folder=Archiefmap -rm-ac-is-kind-kinds.record=Archiefstuk - -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties deleted file mode 100644 index 4ca98e05c4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classificado por programa\u00e7\u00e3o de reten\u00e7\u00e3o -isClassified.description=Os documentos arquiv\u00edsticos ou as pastas de documentos arquiv\u00edsticos foram classificados por uma programa\u00e7\u00e3o de reten\u00e7\u00e3o - -# Are cutoff -isCutoff.title=Cortar -isCutoff.description=Os documentos arquiv\u00edsticos ou as pastas de documentos arquiv\u00edsticos s\u00e3o cortados - -# Are declared -isDeclared.title=Documento arquiv\u00edstico conclu\u00eddo -isDeclared.description=Documento arquiv\u00edstico foi conclu\u00eddo - -# Is on hold -isFrozen.title=Em espera -isFrozen.description=O documento arquiv\u00edstico ou a pasta de documento arquiv\u00edstico est\u00e1 em espera - -# Are filed -isRecordFiled.title=Documento arquiv\u00edstico arquivado -isRecordFiled.description=Documento arquiv\u00edstico est\u00e1 arquivado - -# Are closed record folders -isRecordFolderClosed.title=Pasta de documento arquiv\u00edstico fechada -isRecordFolderClosed.description=Pasta de documento arquiv\u00edstico est\u00e1 fechada - -# Are vital -isVital.title=Documento arquiv\u00edstico vital -isVital.description=O documento arquiv\u00edstico ou a pasta de documento arquiv\u00edstico \u00e9 um documento arquiv\u00edstico vital - -# Have Rentention Action -hasDispositionAction.title=Tem a\u00e7\u00e3o de reten\u00e7\u00e3o -hasDispositionAction.description=Os documentos arquiv\u00edsticos e pastas obtiveram a a\u00e7\u00e3o de reten\u00e7\u00e3o associada especificada na posi\u00e7\u00e3o relativa especificada - -# Are kind -isKind.title=Tipo de item do Records Management -isKind.description=Os itens s\u00e3o de um tipo de componente de plano de arquivamento -isKind.kind.display-label=Tipo - -# Are Record Type -isRecordType.title=Tem tipo de documento arquiv\u00edstico -isRecordType.description=Os documentos arquiv\u00edsticos t\u00eam um tipo de documento arquiv\u00edstico especificado - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=Arquivar como documento arquiv\u00edstico -create-record.description=Declara um arquivo como documento arquiv\u00edstico e opcionalmente o arquiva -create-record.file-plan.display-label=Plano de arquivamento -create-record.hide-record.display-label=Ocultar documento arquiv\u00edstico -create-record.path.display-label=Local da pasta de documento arquiv\u00edstico - -# File Version Record -declare-as-version-record.title=Arquivar vers\u00e3o como documento arquiv\u00edstico -declare-as-version-record.description=Declara esta vers\u00e3o do arquivo como um documento arquiv\u00edstico e opcionalmente a arquiva -declare-as-version-record.file-plan.display-label=Plano de arquivamento -declare-as-version-record.path.display-label=Local da pasta de documento arquiv\u00edstico - -# Complete record -declareRecord.title=Concluir documento arquiv\u00edstico -declareRecord.description=Conclui um documento arquiv\u00edstico -# Reopens record -undeclareRecord.title=Reabrir documento arquiv\u00edstico -undeclareRecord.description=Reabre um documento arquiv\u00edstico -# Open record folder -openRecordFolder.title=Abrir pasta de documento arquiv\u00edstico -openRecordFolder.description=Abre uma pasta de documento arquiv\u00edstico -# Close record folder -closeRecordFolder.title=Fechar pasta de documento arquiv\u00edstico -closeRecordFolder.description=Fecha uma pasta de documento arquiv\u00edstico -# Complete event -completeEvent.title=Concluir evento -completeEvent.description=Conclui um evento -completeEvent.eventName.display-label=Evento -# Freeze -freeze.title=Congelar -freeze.description=Congela um documento arquiv\u00edstico -freeze.reason.display-label=Motivo -# Unfreeze -unfreeze.title=Descongelar -unfreeze.description=Descongela um documento arquiv\u00edstico -# File to -fileTo.title=Arquivar em -fileTo.description=Arquiva um documento arquiv\u00edstico na pasta de documento arquiv\u00edstico especificada -fileTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -fileTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Copy to -copyTo.title=Copiar para -copyTo.description=Copia um documento arquiv\u00edstico para a pasta de documento arquiv\u00edstico especificada -copyTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -copyTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Move to -moveTo.title=Mover para -moveTo.description=Move um documento arquiv\u00edstico para a pasta de documento arquiv\u00edstico especificada -moveTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -moveTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Link to -linkTo.title=Vincular a -linkTo.description=Vincula um documento arquiv\u00edstico \u00e0 pasta de documento arquiv\u00edstico especificada -linkTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -linkTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Reject -reject.title=Rejeitar -reject.description=Rejeita um documento arquiv\u00edstico e move o arquivo para seu local original -reject.reason.display-label=Motivo da rejei\u00e7\u00e3o -# Request Information -requestInfo.title=Solicitar informa\u00e7\u00f5es -requestInfo.description=Inicia um fluxo de trabalho para solicitar mais informa\u00e7\u00f5es de um documento arquiv\u00edstico -# Execute script -executeScript.title=Executar script -executeScript.description=Executa um script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Enviar e-mail -sendEmail.description=Envia um e-mail -# Set Property -setPropertyValue.title=Definir valor da propriedade -setPropertyValue.description=Define um valor de propriedade - -# Edit Hold Reason -editHoldReason.title=Editar motivo para espera -editHoldReason.description=Edita o motivo para a espera -# Relinquish Hold -relinquishHold.title=Desistir da espera -relinquishHold.description=Desiste da espera -# Edit Review As Of Date -editReviewAsOfDate.title=Editar data inicial de revis\u00e3o -editReviewAsOfDate.description=Editar data inicial de revis\u00e3o -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Editar data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o -editDispositionActionAsOfDate.description=Editar a data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Transmitir defini\u00e7\u00e3o do documento arquiv\u00edstico vital -broadcastVitalRecordDefinition.description=Transmitir a defini\u00e7\u00e3o do documento arquiv\u00edstico vital -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Transmitir atualiza\u00e7\u00e3o da defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -broadcastDispositionActionDefinitionUpdate.description=Transmitir atualiza\u00e7\u00e3o da defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -# Undo Event -undoEvent.title=Desfazer evento -undoEvent.description=Desfazer evento -# Transfer Complete -transferComplete.title=Transfer\u00eancia conclu\u00edda -transferComplete.description=Transfer\u00eancia conclu\u00edda -# Accession Complete -accessionComplete.title=Ades\u00e3o conclu\u00edda -accessionComplete.description=Ades\u00e3o conclu\u00edda -# Split Email -splitEmail.title=Dividir e-mail -splitEmail.description=Dividir e-mail -# Create Rentention Schedule -createDispositionSchedule.title=Criar programa\u00e7\u00e3o de reten\u00e7\u00e3o -createDispositionSchedule.description=Criar programa\u00e7\u00e3o de reten\u00e7\u00e3o -# File Destruction Report -fileDestructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos -fileDestructionReport.description=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos -# Cut off -cutoff.title=Cortar -cutoff.description=Cortar -# Destroy -destroy.title=Destruir -destroy.description=Destruir -# Reviewed -reviewed.title=Revisado -reviewed.description=Revisado -# Hide Record -hide-record.title=Ocultar documento arquiv\u00edstico -hide-record.description=Ocultar documento arquiv\u00edstico -# Transfer -transfer.title=Transferir -transfer.description=Transferir -# Uncut off -unCutoff.title=Desfazer corte -unCutoff.description=Desfazer corte -# Accession -accession.title=Ades\u00e3o -accession.description=Ades\u00e3o -# Retain -retain.title=Manter -retain.description=Manter -# Add Record Types -addRecordTypes.title=Adicionar tipos de documento arquiv\u00edstico -addRecordTypes.description=Adiciona o(s) tipo(s) selecionado(s) ao documento arquiv\u00edstico -# File report -fileReport.title=Arquivar relat\u00f3rio -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 -rm-ac-is-kind-kinds.record_folder=Pasta de documento arquiv\u00edstico -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties deleted file mode 100644 index 896bd18108..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -isClassified.description=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -# Are cutoff -isCutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -isCutoff.description=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u044b - -# Are declared -isDeclared.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 -isDeclared.description=\u0417\u0430\u043f\u0438\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0439 - -# Is on hold -isFrozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -isFrozen.description=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \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=\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \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.description=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430 - -# Are vital -isVital.title=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -isVital.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e - -# Have Rentention Action -hasDispositionAction.title=\u0415\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -hasDispositionAction.description=\u0423 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u043f\u0430\u043f\u043e\u043a \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 - -# Are kind -isKind.title=\u0422\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -isKind.description=\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b -isKind.kind.display-label=\u0422\u0438\u043f - -# Are Record Type -isRecordType.title=\u0415\u0441\u0442\u044c \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -isRecordType.description=\u0412 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -create-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0435 \u0432 \u0444\u0430\u0439\u043b -create-record.file-plan.display-label=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 -create-record.hide-record.display-label=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -create-record.path.display-label=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - -# File Version Record -declare-as-version-record.title=\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u0444\u0430\u0439\u043b \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c -declare-as-version-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0438 (\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0435 \u0432 \u0444\u0430\u0439\u043b -declare-as-version-record.file-plan.display-label=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 -declare-as-version-record.path.display-label=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - -# 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 -# Reopens record -undeclareRecord.title=\u041f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -undeclareRecord.description=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -# Open record folder -openRecordFolder.title=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -openRecordFolder.description=\u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -# Close record folder -closeRecordFolder.title=\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -closeRecordFolder.description=\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -# Complete event -completeEvent.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -completeEvent.description=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -completeEvent.eventName.display-label=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 -# Freeze -freeze.title=\u0417\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c -freeze.description=\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -freeze.reason.display-label=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 -# Unfreeze -unfreeze.title=\u041e\u0442\u043a\u0440\u0435\u043f\u0438\u0442\u044c -unfreeze.description=\u041e\u0442\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -# File to -fileTo.title=\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432 -fileTo.description=\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -fileTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -fileTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Copy to -copyTo.title=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 -copyTo.description=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -copyTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -copyTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Move to -moveTo.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 -moveTo.description=\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -moveTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -moveTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Link to -linkTo.title=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441 -linkTo.description=\u0421\u0432\u044f\u0437\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -linkTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -linkTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Reject -reject.title=\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c -reject.description=\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -reject.reason.display-label=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f -# Request Information -requestInfo.title=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e -requestInfo.description=\u0417\u0430\u043f\u0443\u0441\u043a \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043f\u0438\u0441\u0438 -# Execute script -executeScript.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 -executeScript.description=\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 -executeScript.script-ref.display-label=\u0421\u043a\u0440\u0438\u043f\u0442 -# Send Email -sendEmail.title=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -sendEmail.description=\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f -# Set Property -setPropertyValue.title=\u0417\u0430\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -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\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -editHoldReason.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -# Relinquish Hold -relinquishHold.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -relinquishHold.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -# Edit Review As Of Date -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\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 -editDispositionActionAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -broadcastVitalRecordDefinition.description=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -broadcastDispositionActionDefinitionUpdate.description=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -# Undo Event -undoEvent.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -undoEvent.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -# Transfer Complete -transferComplete.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 -transferComplete.description=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 -# Accession Complete -accessionComplete.title=\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d -accessionComplete.description=\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d -# Split Email -splitEmail.title=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -splitEmail.description=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -# Create Rentention Schedule -createDispositionSchedule.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -createDispositionSchedule.description=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -# File Destruction Report -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\u0440\u0435\u0437\u0430\u0442\u044c -cutoff.description=\u041e\u0442\u043a\u043b\u044e\u0447\u0438\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 -# Reviewed -reviewed.title=\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e -reviewed.description=\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e -# Hide Record -hide-record.title=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -hide-record.description=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -# Transfer -transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -transfer.description=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -# Uncut off -unCutoff.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435 -unCutoff.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435 -# Accession -accession.title=\u0414\u043e\u0441\u0442\u0443\u043f -accession.description=\u0414\u043e\u0441\u0442\u0443\u043f -# Retain -retain.title=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -retain.description=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -# Add Record Types -addRecordTypes.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -addRecordTypes.description=\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# File report -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 - -# 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 -rm-ac-is-kind-kinds.record_folder=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties deleted file mode 100644 index cc5ecfa64b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties +++ /dev/null @@ -1,215 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=\u6309\u4fdd\u7559\u8ba1\u5212\u5206\u7c7b -isClassified.description=\u6309\u4fdd\u7559\u8ba1\u5212\u5c06\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u5206\u7c7b - -# Are cutoff -isCutoff.title=\u4e2d\u65ad -isCutoff.description=\u5df2\u4e2d\u65ad\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 - -# Are declared -isDeclared.title=\u8bb0\u5f55\u5df2\u5b8c\u6210 -isDeclared.description=\u8bb0\u5f55\u5df2\u5b8c\u6210 - -# Is on hold -isFrozen.title=\u4fdd\u5b58\u4e2d -isFrozen.description=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u5728\u4fdd\u5b58\u4e2d - -# Are filed -isRecordFiled.title=\u8bb0\u5f55\u5df2\u7acb\u5377 -isRecordFiled.description=\u8bb0\u5f55\u5df2\u7acb\u5377 - -# Are closed record folders -isRecordFolderClosed.title=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed -isRecordFolderClosed.description=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed - -# Are vital -isVital.title=\u6838\u5fc3\u8bb0\u5f55 -isVital.description=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u4e3a\u6838\u5fc3\u8bb0\u5f55 - -# Have Rentention Action -hasDispositionAction.title=\u5177\u6709\u4fdd\u7559\u64cd\u4f5c -hasDispositionAction.description=\u8bb0\u5f55\u548c\u6587\u4ef6\u5939\u5728\u6307\u5b9a\u7684\u76f8\u5173\u4f4d\u7f6e\u6267\u884c\u4e86\u6307\u5b9a\u7684\u76f8\u5173\u4fdd\u7559\u64cd\u4f5c - -# Are kind -isKind.title=\u8bb0\u5f55\u7ba1\u7406\u9879\u76ee\u7684\u7c7b\u578b -isKind.description=\u9879\u76ee\u4e3a\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6\u7c7b\u578b -isKind.kind.display-label=\u7c7b\u578b - -# Are Record Type -isRecordType.title=\u5177\u6709\u8bb0\u5f55\u7c7b\u578b -isRecordType.description=\u8bb0\u5f55\u5177\u6709\u6307\u5b9a\u7684\u8bb0\u5f55\u7c7b\u578b - - -# -# i18n for Records Management Actions -# -# File As Record -create-record.title=\u7acb\u5377\u4e3a\u8bb0\u5f55 -create-record.description=\u5c06\u6587\u4ef6\u58f0\u660e\u4e3a\u8bb0\u5f55\uff0c\u5e76\u5bf9\u5176\u8fdb\u884c\u9009\u62e9\u6027\u7acb\u5377 -create-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 -create-record.hide-record.display-label=\u9690\u85cf\u8bb0\u5f55 -create-record.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u4f4d\u7f6e - -# File Version Record -declare-as-version-record.title=\u6587\u4ef6\u7248\u672c\u4f5c\u4e3a\u8bb0\u5f55 -declare-as-version-record.description=\u5c06\u6b64\u6587\u4ef6\u7248\u672c\u58f0\u660e\u4e3a\u8bb0\u5f55\uff0c\u5e76\u53ef\u9009\u62e9\u5c06\u5176\u5f52\u6863 -declare-as-version-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 -declare-as-version-record.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u4f4d\u7f6e - -# Complete record -declareRecord.title=\u5b8c\u6210\u8bb0\u5f55 -declareRecord.description=\u5b8c\u6210\u8bb0\u5f55 -# Reopens record -undeclareRecord.title=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 -undeclareRecord.description=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 -# Open record folder -openRecordFolder.title=\u6253\u5f00\u8bb0\u5f55\u6587\u4ef6\u5939 -openRecordFolder.description=\u6253\u5f00\u8bb0\u5f55\u6587\u4ef6\u5939 -# Close record folder -closeRecordFolder.title=\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939 -closeRecordFolder.description=\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939 -# Complete event -completeEvent.title=\u5b8c\u6210\u4e8b\u4ef6 -completeEvent.description=\u5b8c\u6210\u4e8b\u4ef6 -completeEvent.eventName.display-label=\u4e8b\u4ef6 -# Freeze -freeze.title=\u4fdd\u5b58 -freeze.description=\u4fdd\u5b58\u8bb0\u5f55 -freeze.reason.display-label=\u539f\u56e0 -# Unfreeze -unfreeze.title=\u53d6\u6d88\u4fdd\u5b58 -unfreeze.description=\u53d6\u6d88\u4fdd\u5b58\u8bb0\u5f55 -# File to -fileTo.title=\u7acb\u5377\u81f3 -fileTo.description=\u5c06\u8bb0\u5f55\u7acb\u5377\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -fileTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -fileTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Copy to -copyTo.title=\u590d\u5236\u5230 -copyTo.description=\u5c06\u8bb0\u5f55\u590d\u5236\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -copyTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -copyTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Move to -moveTo.title=\u79fb\u52a8\u5230 -moveTo.description=\u5c06\u8bb0\u5f55\u79fb\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -moveTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -moveTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Link to -linkTo.title=\u94fe\u63a5\u5230 -linkTo.description=\u5c06\u8bb0\u5f55\u94fe\u63a5\u5230\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -linkTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -linkTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Reject -reject.title=\u62d2\u7edd -reject.description=\u62d2\u7edd\u8bb0\u5f55\u5e76\u5c06\u6587\u4ef6\u79fb\u52a8\u81f3\u5176\u539f\u59cb\u4f4d\u7f6e -reject.reason.display-label=\u62d2\u7edd\u539f\u56e0 -# Request Information -requestInfo.title=\u8bf7\u6c42\u4fe1\u606f -requestInfo.description=\u5f00\u59cb\u8bf7\u6c42\u8bb0\u5f55\u7684\u66f4\u591a\u4fe1\u606f\u7684\u5de5\u4f5c\u6d41\u7a0b -# Execute script -executeScript.title=\u6267\u884c\u811a\u672c -executeScript.description=\u6267\u884c\u811a\u672c -executeScript.script-ref.display-label=\u811a\u672c -# Send Email -sendEmail.title=\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 -sendEmail.description=\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 -# Set Property -setPropertyValue.title=\u8bbe\u7f6e\u5c5e\u6027\u503c -setPropertyValue.description=\u8bbe\u7f6e\u5c5e\u6027\u503c - -# Edit Hold Reason -editHoldReason.title=\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0 -editHoldReason.description=\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0 -# Relinquish Hold -relinquishHold.title=\u653e\u5f03\u4fdd\u5b58 -relinquishHold.description=\u653e\u5f03\u4fdd\u5b58 -# Edit Review As Of Date -editReviewAsOfDate.title=\u7f16\u8f91\u5ba1\u67e5\u622a\u6b62\u65e5\u671f -editReviewAsOfDate.description=\u7f16\u8f91\u5ba1\u67e5\u622a\u6b62\u65e5\u671f -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=\u7f16\u8f91\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f -editDispositionActionAsOfDate.description=\u7f16\u8f91\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=\u5e7f\u64ad\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 -broadcastVitalRecordDefinition.description=\u5e7f\u64ad\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=\u5e7f\u64ad\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\u66f4\u65b0 -broadcastDispositionActionDefinitionUpdate.description=\u5e7f\u64ad\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\u66f4\u65b0 -# Undo Event -undoEvent.title=\u64a4\u6d88\u4e8b\u4ef6 -undoEvent.description=\u64a4\u6d88\u4e8b\u4ef6 -# Transfer Complete -transferComplete.title=\u79fb\u4ea4\u5b8c\u6210 -transferComplete.description=\u79fb\u4ea4\u5b8c\u6210 -# Accession Complete -accessionComplete.title=\u5165\u7ba1\u5b8c\u6210 -accessionComplete.description=\u5165\u7ba1\u5b8c\u6210 -# Split Email -splitEmail.title=\u62c6\u5206\u7535\u5b50\u90ae\u4ef6 -splitEmail.description=\u62c6\u5206\u7535\u5b50\u90ae\u4ef6 -# Create Rentention Schedule -createDispositionSchedule.title=\u521b\u5efa\u4fdd\u7559\u8ba1\u5212 -createDispositionSchedule.description=\u521b\u5efa\u4fdd\u7559\u8ba1\u5212 -# File Destruction Report -fileDestructionReport.title=\u7acb\u5377\u9500\u6bc1\u62a5\u544a -fileDestructionReport.description=\u7acb\u5377\u9500\u6bc1\u62a5\u544a -# Cut off -cutoff.title=\u4e2d\u65ad -cutoff.description=\u4e2d\u65ad -# Destroy -destroy.title=\u9500\u6bc1 -destroy.description=\u9500\u6bc1 -# Reviewed -reviewed.title=\u5df2\u5ba1\u67e5 -reviewed.description=\u5df2\u5ba1\u67e5 -# Hide Record -hide-record.title=\u9690\u85cf\u8bb0\u5f55 -hide-record.description=\u9690\u85cf\u8bb0\u5f55 -# Transfer -transfer.title=\u79fb\u4ea4 -transfer.description=\u79fb\u4ea4 -# Uncut off -unCutoff.title=\u64a4\u6d88\u4e2d\u65ad -unCutoff.description=\u64a4\u6d88\u4e2d\u65ad -# Accession -accession.title=\u5165\u7ba1 -accession.description=\u5165\u7ba1 -# Retain -retain.title=\u4fdd\u7559 -retain.description=\u4fdd\u7559 -# Add Record Types -addRecordTypes.title=\u6dfb\u52a0\u8bb0\u5f55\u7c7b\u578b -addRecordTypes.description=\u5c06\u6240\u9009\u7c7b\u578b\u6dfb\u52a0\u81f3\u8bb0\u5f55 -# File report -fileReport.title=\u7acb\u5377\u62a5\u544a -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 -rm-ac-is-kind-kinds.record_folder=\u8bb0\u5f55\u6587\u4ef6\u5939 -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties deleted file mode 100644 index bccf2546cb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=The customization service hasn't been started. -rm.admin.not-customisable=The class {0} isn't customizable. -rm.admin.invalid-custom-aspect=We couldn't find custom aspect {0} for customisable class {1}. -rm.admin.property-already-exists=Property {0} already exists. -rm.admin.cannot-apply-constraint=You can't apply constraint {0} to property {1} with datatype {2}. (expected: dataType = TEXT) -rm.admin.prop-exist=We couldn't find custom property {0}. -rm.admin.custom-prop-exist=The custom model doesn't contain the property {0}. -rm.admin.unknown-aspect=Unknown aspect {0}. -rm.admin.constraint-exists=The constraint {0} already exists. -rm.admin.contraint-cannot-find=We couldn't find the definition for constraint {0}. -rm.admin.unexpected_type_constraint=Unexpected type {0} for constraint {1}. The expected is {2}. -rm.admin.custom-model-not-found=We couldn't find custom model {0}. -rm.admin.custom-model-no-content=The custom model has no content. (nodeRef={0}) -rm.admin.error-write-custom-model=We hit a problem writing custom model content. (nodeRef={0}). -rm.admin.error-client-id=We couldn't generate the client ID because it's already in use. (clientid={0}) -rm.admin.error-split-id=We couldn't split ID {0}. because separator {1} isn't present. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties deleted file mode 100644 index a02758b739..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=Der Anpassungsservice wurde nicht gestartet. -rm.admin.not-customisable=Die Klasse {0} kann nicht angepasst werden. -rm.admin.invalid-custom-aspect=Der benutzerdefinierte Aspekt {0} f\u00fcr die anpassbare Klasse {1} wurde nicht gefunden. -rm.admin.property-already-exists=Eigenschaft {0} bereits vorhanden. -rm.admin.cannot-apply-constraint=Randbedingung {0} kann nicht auf Eigenschaft {1} mit Datentyp {2} angewendet werden. (erwartet: Datentyp = TEXT) -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.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}. -rm.admin.custom-model-not-found=Benutzerdefiniertes Modell {0} wurde nicht gefunden. -rm.admin.custom-model-no-content=Benutzerdefiniertes Modell hat keinen Inhalt. (nodeRef={0}) -rm.admin.error-write-custom-model=Beim Schreiben von benutzerdefiniertem Modellinhalt ist ein Problem aufgetreten. (nodeRef={0}). -rm.admin.error-client-id=Client-ID konnte nicht generiert werden, da diese bereits verwendet wird. (clientid={0}) -rm.admin.error-split-id=ID {0} kann nicht getrennt werden, da das Trennzeichen {1} nicht vorhanden ist. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties deleted file mode 100644 index cdaad4a9b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=El servicio de personalizaci\u00f3n no se ha iniciado. -rm.admin.not-customisable=La clase {0} no es personalizable. -rm.admin.invalid-custom-aspect=No se pudo encontrar el aspecto personalizado {0} para la clase personalizable {1}. -rm.admin.property-already-exists=La propiedad {0} ya existe. -rm.admin.cannot-apply-constraint=No se puede aplicar la restricci\u00f3n {0} a la propiedad {1} con el tipo de datos {2}. (previsto: tipo de datos = TEXT) -rm.admin.prop-exist=No se pudo 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.constraint-exists=La restricci\u00f3n {0} ya existe. -rm.admin.contraint-cannot-find=No se pudo encontrar la definici\u00f3n para la restricci\u00f3n {0}. -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 pudo encontrar el modelo personalizado {0}. -rm.admin.custom-model-no-content=El modelo personalizado no tiene contenido. (nodeRef={0}) -rm.admin.error-write-custom-model=Se produjo un problema al escribir el contenido del modelo personalizado. (nodeRef={0}) -rm.admin.error-client-id=No se pudo generar el ID de cliente porque ya est\u00e1 en uso. (clientid={0}) -rm.admin.error-split-id=No se pudo separar el ID {0}. porque el separador {1} no est\u00e1 presente. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties deleted file mode 100644 index 542abfcc0a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=Le service de personnalisation n'a pas \u00e9t\u00e9 d\u00e9marr\u00e9. -rm.admin.not-customisable=La classe {0} n''est pas personnalisable. -rm.admin.invalid-custom-aspect=L''aspect personnalis\u00e9 {0} pour la classe personnalisable {1} est introuvable. -rm.admin.property-already-exists=La propri\u00e9t\u00e9 {0} existe d\u00e9j\u00e0. -rm.admin.cannot-apply-constraint=Impossible d''appliquer la contrainte {0} \u00e0 la propri\u00e9t\u00e9 {1} avec le datatype {2}. (attendu\u00a0: dataType = TEXT) -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.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} -rm.admin.custom-model-not-found=Le mod\u00e8le personnalis\u00e9 {0} est introuvable. -rm.admin.custom-model-no-content=Le mod\u00e8le personnalis\u00e9 n''a pas de contenu. (nodeRef={0}) -rm.admin.error-write-custom-model=Un probl\u00e8me est survenu pendant l''\u00e9criture du contenu du mod\u00e8le personnalis\u00e9. (nodeRef={0}). -rm.admin.error-client-id=Impossible de g\u00e9n\u00e9rer l''ID client car il est d\u00e9j\u00e0 en cours d''utilisation. (clientid={0}) -rm.admin.error-split-id=Impossible de fractionner l''ID {0}. Le s\u00e9parateur {1} n''est pas pr\u00e9sent. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties deleted file mode 100644 index 0444f33c07..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=Il servizio di personalizzazione non \u00e8 stato avviato. -rm.admin.not-customisable=Non \u00e8 possibile personalizzare la classe {0}. -rm.admin.invalid-custom-aspect=Impossibile trovare un aspetto personalizzato {0} per la classe personalizzabile {1}. -rm.admin.property-already-exists=La propriet\u00e0 {0} \u00e8 gi\u00e0 esistente. -rm.admin.cannot-apply-constraint=Impossibile applicare il vincolo {0} alla propriet\u00e0 {1} con il tipo di dati {2}. (expected: dataType = TEXT) -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.constraint-exists=Il vincolo {0} \u00e8 gi\u00e0 esistente. -rm.admin.contraint-cannot-find=Impossibile trovare la definizione per il vincolo {0}. -rm.admin.unexpected_type_constraint=Tipo {0} inaspettato per vincolo {1}. Ci\u00f2 che si aspetta \u00e8 {2}. -rm.admin.custom-model-not-found=Impossibile trovare il modello personalizzato {0}. -rm.admin.custom-model-no-content=Il modello personalizzato non ha contenuti. (nodeRef={0}) -rm.admin.error-write-custom-model=Si \u00e8 verificato un problema durante la scrittura del contenuto del modello personalizzato. (nodeRef={0}) -rm.admin.error-client-id=Impossibile generare l''ID client, poich\u00e9 gi\u00e0 in uso. (clientid={0}) -rm.admin.error-split-id=Impossibile dividere l''ID {0} poich\u00e9 non \u00e8 presente il separatore {1}. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties deleted file mode 100644 index efd6b5fb11..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u30b5\u30fc\u30d3\u30b9\u304c\u958b\u59cb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 -rm.admin.not-customisable=\u30af\u30e9\u30b9 ''{0}'' \u306f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u305b\u3093\u3002 -rm.admin.invalid-custom-aspect=\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u53ef\u80fd\u306a\u30af\u30e9\u30b9 ''{1}'' \u306e\u30ab\u30b9\u30bf\u30e0\u30a2\u30b9\u30da\u30af\u30c8 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.admin.property-already-exists=\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 -rm.admin.cannot-apply-constraint=\u5236\u7d04 ''{0}'' \u306f\u3001\u30c7\u30fc\u30bf\u578b\u304c ''{2}'' \u306e\u30d7\u30ed\u30d1\u30c6\u30a3 ''{1}'' \u306b\u306f\u9069\u7528\u3067\u304d\u307e\u305b\u3093\u3002 (expected: dataType = TEXT) -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=\u3053\u306e\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.constraint-exists=\u5236\u7d04 ''{0}'' \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 -rm.admin.contraint-cannot-find=\u5236\u7d04 ''{0}'' \u306e\u5b9a\u7fa9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 -rm.admin.unexpected_type_constraint=\u30bf\u30a4\u30d7 ''{0}'' \u306f\u5236\u7d04 ''{1}'' \u306b\u9069\u3057\u307e\u305b\u3093\u3002 \u6709\u52b9\u306a\u30bf\u30a4\u30d7\u306f ''{2}'' \u3067\u3059\u3002 -rm.admin.custom-model-not-found=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 -rm.admin.custom-model-no-content=\u3053\u306e\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306b\u306f\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u3042\u308a\u307e\u305b\u3093\u3002 (nodeRef={0}) -rm.admin.error-write-custom-model=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u66f8\u304d\u8fbc\u307f\u4e2d\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 (nodeRef={0}). -rm.admin.error-client-id=\u3053\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID \u306f\u3059\u3067\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 (clientid={0}) -rm.admin.error-split-id=\u533a\u5207\u308a\u6587\u5b57 ({1}) \u304c\u306a\u3044\u305f\u3081\u3001ID ''{0}'' \u3092\u5206\u5272\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties deleted file mode 100644 index 03401c1125..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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 startet. -rm.admin.not-customisable=Klassen {0} er ikke tilpasset. -rm.admin.invalid-custom-aspect=Finner ikke det tilpassede aspektet {0} for 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=Kunne ikke finne den tilpassede egenskapen {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=Kunne ikke finne definisjonen til restriksjonen {0}. -rm.admin.unexpected_type_constraint=Uventet type {0} ved restriksjonen {1}. {2} var forventet... -rm.admin.custom-model-not-found=Kunne ikke finne den tilpassede modellen {0}. -rm.admin.custom-model-no-content=Den tilpassede modellen har ikke innhold. (nodeRef={0}) -rm.admin.error-write-custom-model=Det oppsto et problem med \u00e5 skrive innholdet til den tilpassede modellen. (nodeRef={0}). -rm.admin.error-client-id=Kunne ikke generere klient-ID for den er allerede i bruk. (clientid={0}) -rm.admin.error-split-id=Kunne ikke dele ID-en {0}. fordi grensetegnet {1} ikke fantes. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties deleted file mode 100755 index 71e5a944d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=De aanpassingsservice is niet gestart. -rm.admin.not-customisable=De klasse {0} kan niet worden aangepast. -rm.admin.invalid-custom-aspect=Kan het aangepaste aspect {0} voor aanpasbare klasse {1} niet vinden. -rm.admin.property-already-exists=Eigenschap {0} bestaat al. -rm.admin.cannot-apply-constraint=U kunt beperking {0} niet toepassen op eigenschap {1} met gegevenstype {2}. (verwacht: dataType = TEXT) -rm.admin.prop-exist=Kan aangepaste eigenschap {0} niet vinden. -rm.admin.custom-prop-exist=Het aangepaste model bevat de eigenschap {0} niet. -rm.admin.unknown-aspect=Onbekend aspect {0}. -rm.admin.constraint-exists=De beperking {0} bestaat al. -rm.admin.contraint-cannot-find=Kan de definitie voor beperking {0} niet vinden. -rm.admin.unexpected_type_constraint=Onverwacht type {0} voor beperking {1}. Het verwachte type is {2}. -rm.admin.custom-model-not-found=Kan aangepast model {0} niet vinden. -rm.admin.custom-model-no-content=Het aangepaste model heeft geen content. (nodeRef={0}) -rm.admin.error-write-custom-model=Er is een probleem opgetreden bij het schrijven van aangepaste-modelcontent. (nodeRef={0}). -rm.admin.error-client-id=Kan de client-id niet genereren omdat deze al in gebruik is. (clientid={0}) -rm.admin.error-split-id=Kan id {0} niet opsplitsen omdat scheiding {1} niet aanwezig is. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties deleted file mode 100644 index ba6c68d645..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=O servi\u00e7o de personaliza\u00e7\u00e3o n\u00e3o foi iniciado. -rm.admin.not-customisable=A classe {0} n\u00e3o \u00e9 personaliz\u00e1vel. -rm.admin.invalid-custom-aspect=N\u00e3o foi poss\u00edvel encontrar aspecto personalizado {0} para a classe personaliz\u00e1vel {1}. -rm.admin.property-already-exists=A propriedade {0} j\u00e1 existe. -rm.admin.cannot-apply-constraint=N\u00e3o \u00e9 poss\u00edvel aplicar a reserva {0} \u00e0 propriedade {1} com o tipo de dados {2}. (esperado: dataType = TEXT) -rm.admin.prop-exist=N\u00e3o foi poss\u00edvel encontrar 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.constraint-exists=A reserva {0} j\u00e1 existe. -rm.admin.contraint-cannot-find=N\u00e3o foi poss\u00edvel encontrar a defini\u00e7\u00e3o para a reserva {0}. -rm.admin.unexpected_type_constraint=Tipo inesperado {0} para a reserva {1}. O tipo esperado \u00e9 {2}. -rm.admin.custom-model-not-found=N\u00e3o foi poss\u00edvel encontrar o modelo personalizado {0}. -rm.admin.custom-model-no-content=O modelo personalizado n\u00e3o tem conte\u00fado. (nodeRef={0}) -rm.admin.error-write-custom-model=Encontramos um problema ao gravar o conte\u00fado do modelo personalizado. (nodeRef={0}). -rm.admin.error-client-id=N\u00e3o foi poss\u00edvel gerar o ID do cliente, pois ele j\u00e1 est\u00e1 em uso. (clientid={0}) -rm.admin.error-split-id=N\u00e3o foi poss\u00edvel dividir o ID {0}. pois o separador {1} n\u00e3o est\u00e1 presente. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties deleted file mode 100644 index b105207d0b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=\u0421\u043b\u0443\u0436\u0431\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430. -rm.admin.not-customisable=\u041a\u043b\u0430\u0441\u0441 {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c. -rm.admin.invalid-custom-aspect=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0} \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 {1}. -rm.admin.property-already-exists=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. -rm.admin.cannot-apply-constraint=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 {0} \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 {1} \u0441 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 {2}. (\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f: dataType = TEXT) -rm.admin.prop-exist=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. -rm.admin.custom-prop-exist=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\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.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 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \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}. -rm.admin.custom-model-not-found=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c {0}. -rm.admin.custom-model-no-content=\u041d\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. (nodeRef={0}) -rm.admin.error-write-custom-model=\u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. (nodeRef={0}). -rm.admin.error-client-id=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430: \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. (clientid={0}) -rm.admin.error-split-id=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 {0}: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b-\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c {1}. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties deleted file mode 100644 index b9b03ed143..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=\u5c1a\u672a\u542f\u52a8\u81ea\u5b9a\u4e49\u670d\u52a1\u3002 -rm.admin.not-customisable=\u7c7b\u522b {0} \u4e0d\u53ef\u81ea\u5b9a\u4e49\u3002 -rm.admin.invalid-custom-aspect=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u53ef\u81ea\u5b9a\u4e49\u7c7b\u522b {1} \u7684\u81ea\u5b9a\u4e49\u5207\u9762 {0}\u3002 -rm.admin.property-already-exists=\u5c5e\u6027 {0} \u5df2\u5b58\u5728\u3002 -rm.admin.cannot-apply-constraint=\u60a8\u65e0\u6cd5\u5c06\u7ea6\u675f {0} \u5e94\u7528\u4e8e\u6570\u636e\u7c7b\u578b\u4e3a {2} \u7684\u5c5e\u6027 {1}\u3002 \uff08\u9884\u671f\uff1adataType = TEXT\uff09 -rm.admin.prop-exist=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u81ea\u5b9a\u4e49\u5c5e\u6027\uff1a{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.constraint-exists=\u7ea6\u675f {0} \u5df2\u5b58\u5728\u3002 -rm.admin.contraint-cannot-find=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\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 -rm.admin.custom-model-not-found=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u81ea\u5b9a\u4e49\u6a21\u578b\uff1a{0}\u3002 -rm.admin.custom-model-no-content=\u81ea\u5b9a\u4e49\u6a21\u578b\u6ca1\u6709\u5185\u5bb9\u3002 (nodeRef={0}) -rm.admin.error-write-custom-model=\u6211\u4eec\u5728\u7f16\u5199\u81ea\u5b9a\u4e49\u6a21\u578b\u5185\u5bb9\u65f6\u9047\u5230\u95ee\u9898\u3002 (nodeRef={0})\u3002 -rm.admin.error-client-id=\u6211\u4eec\u65e0\u6cd5\u751f\u6210\u5ba2\u6237\u7aef ID\uff0c\u56e0\u4e3a\u5b83\u5df2\u88ab\u4f7f\u7528\u3002 (clientid={0}) -rm.admin.error-split-id=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206 ID {0}\uff0c \u56e0\u4e3a\u5206\u9694\u7b26 {1} \u4e0d\u5b58\u5728\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties deleted file mode 100644 index acafc32979..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=Updated Metadata -rm.audit.created-object=Created Object -rm.audit.delete-object=Delete Object -rm.audit.login-succeeded=Login Successful -rm.audit.login-failed=Login Unsuccessful -rm.audit.create-person=Create User -rm.audit.delete-person=Delete User -rm.audit.create-userGroup=Create User Group -rm.audit.delete-userGroup=Delete User Group -rm.audit.addMember=Add To User Group -rm.audit.removeMember=Remove From User Group -rm.audit.linkTo=Link to -rm.audit.moveTo=Move to -rm.audit.copyTo=Copy to -rm.audit.fileTo=File to -rm.audit.createHold=Create Hold -rm.audit.deleteHold=Delete Hold -rm.audit.addToHold=Add To Hold -rm.audit.removeFromHold=Remove From Hold -rm.audit.holdPermission-Error=You don't have permission to view this hold. -rm.audit.audit-start=Audit Start -rm.audit.audit-stop=Audit Stop -rm.audit.audit-clear=Audit Clear -rm.audit.audit-view=Audit View -rm.audit.trail-file-fail=We couldn't generate an audit report. Check the audit details and try again, or speak with your I.T. Dept. -rm.audit.audit-report=Audit Report -rm.audit.set-permission=Set Permission -rm.audit.enable-inherit-permission=Inherited Permissions Switched On -rm.audit.disable-inherit-permission=Inherited Permissions Switched Off -recordable-version-config=Auto-Declare Options \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties deleted file mode 100644 index 9b9686ce24..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=Metadaten aktualisiert -rm.audit.created-object=Objekt erstellt -rm.audit.delete-object=Objekt gel\u00f6scht -rm.audit.login-succeeded=Anmeldung erfolgreich -rm.audit.login-failed=Anmeldung fehlgeschlagen -rm.audit.create-person=Benutzer anlegen -rm.audit.delete-person=Benutzer l\u00f6schen -rm.audit.create-userGroup=Benutzergruppe erstellen -rm.audit.delete-userGroup=Benutzergruppe l\u00f6schen -rm.audit.addMember=Zu Benutzergruppe hinzuf\u00fcgen -rm.audit.removeMember=Von Benutzergruppe entfernen -rm.audit.linkTo=Link zu -rm.audit.moveTo=Verschieben nach -rm.audit.copyTo=Kopieren nach -rm.audit.fileTo=Ablegen unter -rm.audit.createHold=Legal Hold erstellen -rm.audit.deleteHold=Legal Hold l\u00f6schen -rm.audit.addToHold=Zu Legal Hold hinzuf\u00fcgen -rm.audit.removeFromHold=Aus Legal Hold entfernen -rm.audit.holdPermission-Error=Sie haben nicht die n\u00f6tigen Berechtigungen zum Anzeigen dieses Legal Holds. -rm.audit.audit-start=Audit starten -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 konnte nicht generiert werden. \u00dcberpr\u00fcfen Sie die Audit-Details und versuchen Sie es erneut. Sie k\u00f6nnen sich auch an Ihre IT-Abteilung wenden. -rm.audit.audit-report=Audit-Bericht -rm.audit.set-permission=Berechtigung setzen -rm.audit.enable-inherit-permission=Vererbte Berechtigungen aktiv -rm.audit.disable-inherit-permission=Vererbte Berechtigungen inaktiv -recordable-version-config=Optionen f\u00fcr automatische Deklaration diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties deleted file mode 100644 index 8b74c9f76f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=Metadatos actualizados -rm.audit.created-object=Objeto creado -rm.audit.delete-object=Eliminar objeto -rm.audit.login-succeeded=Inicio de sesi\u00f3n correcto -rm.audit.login-failed=Error de inicio de sesi\u00f3n -rm.audit.create-person=Crear usuario -rm.audit.delete-person=Eliminar usuario -rm.audit.create-userGroup=Crear grupo de usuarios -rm.audit.delete-userGroup=Eliminar grupo de usuarios -rm.audit.addMember=A\u00f1adir a grupo de usuarios -rm.audit.removeMember=Eliminar de grupo de usuarios -rm.audit.linkTo=Enlace a -rm.audit.moveTo=Mover a -rm.audit.copyTo=Copiar a -rm.audit.fileTo=Archivar en -rm.audit.createHold=Crear retenci\u00f3n legal -rm.audit.deleteHold=Eliminar retenci\u00f3n legal -rm.audit.addToHold=A\u00f1adir a retenci\u00f3n legal -rm.audit.removeFromHold=Eliminar de retenci\u00f3n legal -rm.audit.holdPermission-Error=No tiene permiso para ver esta retenci\u00f3n legal. -rm.audit.audit-start=Iniciar auditor\u00eda -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 pudo generar un informe de auditor\u00eda. Compruebe los detalles de auditor\u00eda y vuelva a intentarlo, o hable con el dep. de TI. -rm.audit.audit-report=Informe de auditor\u00eda -rm.audit.set-permission=Establecer permisos -rm.audit.enable-inherit-permission=Permisos heredados activados -rm.audit.disable-inherit-permission=Permisos heredados desactivados -recordable-version-config=Opciones de declaraci\u00f3n autom\u00e1tica diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties deleted file mode 100644 index e21a076622..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=M\u00e9tadonn\u00e9es mises \u00e0 jour -rm.audit.created-object=Objet cr\u00e9\u00e9 -rm.audit.delete-object=Supprimer l'objet -rm.audit.login-succeeded=La connexion a abouti -rm.audit.login-failed=La connexion a \u00e9chou\u00e9 -rm.audit.create-person=Cr\u00e9er un utilisateur -rm.audit.delete-person=Supprimer un utilisateur -rm.audit.create-userGroup=Cr\u00e9er un groupe d'utilisateur -rm.audit.delete-userGroup=Supprimer le groupe d'utilisateur -rm.audit.addMember=Ajouter au groupe d'utilisateur -rm.audit.removeMember=Supprimer du groupe d'utilisateur -rm.audit.linkTo=Lier \u00e0 -rm.audit.moveTo=D\u00e9placer vers... -rm.audit.copyTo=Copier vers... -rm.audit.fileTo=Archiver dans -rm.audit.createHold=Cr\u00e9er une suspension -rm.audit.deleteHold=Supprimer la suspension -rm.audit.addToHold=Ajouter \u00e0 la suspension -rm.audit.removeFromHold=Supprimer de la suspension -rm.audit.holdPermission-Error=Vous n'avez pas les droits requis pour afficher cette suspension. -rm.audit.audit-start=Audit d\u00e9marr\u00e9 -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. V\u00e9rifiez les informations d'audit et r\u00e9essayez ou contactez votre DSI. -rm.audit.audit-report=Rapport d'audit -rm.audit.set-permission=D\u00e9finir les permissions -rm.audit.enable-inherit-permission=Permissions h\u00e9rit\u00e9es activ\u00e9es -rm.audit.disable-inherit-permission=Permissions h\u00e9rit\u00e9es d\u00e9sactiv\u00e9es -recordable-version-config=Options de d\u00e9claration automatique diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties deleted file mode 100644 index 4fa3b05841..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=Metadati aggiornati -rm.audit.created-object=Oggetto creato -rm.audit.delete-object=Elimina oggetto -rm.audit.login-succeeded=Login riuscito -rm.audit.login-failed=Login non riuscito -rm.audit.create-person=Crea utente -rm.audit.delete-person=Elimina utente -rm.audit.create-userGroup=Crea gruppo utenti -rm.audit.delete-userGroup=Elimina gruppo utenti -rm.audit.addMember=Aggiungi al gruppo utenti -rm.audit.removeMember=Rimuovi dal gruppo utenti -rm.audit.linkTo=Collega a -rm.audit.moveTo=Sposta in -rm.audit.copyTo=Copia in -rm.audit.fileTo=Archivia in -rm.audit.createHold=Crea sospensione -rm.audit.deleteHold=Annulla sospensione -rm.audit.addToHold=Aggiungi a sospensione -rm.audit.removeFromHold=Rimuovi dalla sospensione -rm.audit.holdPermission-Error=Non si dispone del permesso di visualizzare questa sospensione. -rm.audit.audit-start=Avvio audit -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 rapporto di audit. Verificare i dettagli dell'audit e riprovare o contattare il proprio dipartimento I.T. -rm.audit.audit-report=Rapporto audit -rm.audit.set-permission=Imposta autorizzazione -rm.audit.enable-inherit-permission=Autorizzazioni ereditate attivate -rm.audit.disable-inherit-permission=Autorizzazioni ereditate disattivate -recordable-version-config=Opzioni di dichiarazione automatica diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties deleted file mode 100644 index 1d0722295a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=\u66f4\u65b0\u6e08\u307f\u30e1\u30bf\u30c7\u30fc\u30bf -rm.audit.created-object=\u4f5c\u6210\u6e08\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 -rm.audit.delete-object=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u524a\u9664 -rm.audit.login-succeeded=\u30ed\u30b0\u30a4\u30f3\u6210\u529f -rm.audit.login-failed=\u30ed\u30b0\u30a4\u30f3\u5931\u6557 -rm.audit.create-person=\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210 -rm.audit.delete-person=\u30e6\u30fc\u30b6\u30fc\u306e\u524a\u9664 -rm.audit.create-userGroup=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u306e\u4f5c\u6210 -rm.audit.delete-userGroup=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u306e\u524a\u9664 -rm.audit.addMember=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u306b\u8ffd\u52a0 -rm.audit.removeMember=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u304b\u3089\u524a\u9664 -rm.audit.linkTo=\u30ea\u30f3\u30af\u5148 -rm.audit.moveTo=\u79fb\u52d5\u5148 -rm.audit.copyTo=\u30b3\u30d4\u30fc\u5148 -rm.audit.fileTo=\u6574\u7406\u4fdd\u7ba1\u5148 -rm.audit.createHold=\u30db\u30fc\u30eb\u30c9\u306e\u4f5c\u6210 -rm.audit.deleteHold=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -rm.audit.addToHold=\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0 -rm.audit.removeFromHold=\u30db\u30fc\u30eb\u30c9\u304b\u3089\u524a\u9664 -rm.audit.holdPermission-Error=\u3053\u306e\u30db\u30fc\u30eb\u30c9\u306e\u8868\u793a\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002 -rm.audit.audit-start=\u76e3\u67fb\u306e\u958b\u59cb -rm.audit.audit-stop=\u76e3\u67fb\u306e\u505c\u6b62 -rm.audit.audit-clear=\u76e3\u67fb\u306e\u6d88\u53bb -rm.audit.audit-view=\u76e3\u67fb\u306e\u8868\u793a -rm.audit.trail-file-fail=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 \u76e3\u67fb\u306e\u8a73\u7d30\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3059\u304b\u3001IT \u62c5\u5f53\u8005\u306b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.audit.audit-report=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8 -rm.audit.set-permission=\u6a29\u9650\u306e\u8a2d\u5b9a -rm.audit.enable-inherit-permission=\u6a29\u9650\u306e\u8a2d\u5b9a -rm.audit.disable-inherit-permission=\u6a29\u9650\u306e\u8a2d\u5b9a -recordable-version-config=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties deleted file mode 100644 index eb3292a987..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties +++ /dev/null @@ -1,30 +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 bruker -rm.audit.delete-person=Slett bruker -rm.audit.create-userGroup=Opprett brukergruppe -rm.audit.delete-userGroup=Slett brukergruppe -rm.audit.addMember=Legg til i brukergruppe -rm.audit.removeMember=Fjern fra brukergruppe -rm.audit.linkTo=Koble til -rm.audit.moveTo=Flytt til -rm.audit.copyTo=Kopier til -rm.audit.fileTo=Arkiver i -rm.audit.createHold=Opprett hold -rm.audit.deleteHold=Slett hold -rm.audit.addToHold=Legg til i hold -rm.audit.removeFromHold=Fjern fra hold -rm.audit.holdPermission-Error=Du har ikke tillatelse til \u00e5 vise dette holdet. -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=Kunne ikke generere en revisjonsrapport. Kontroller revisjonsdetaljene, og pr\u00f8v igjen eller snakk med din IT- avdeling. -rm.audit.audit-report=Revisjonsrapport -rm.audit.set-permission=Still inn tillatelsen -rm.audit.enable-inherit-permission=Arvede tillatelser sl\u00e5tt p\u00e5 -rm.audit.disable-inherit-permission=Arvede tillatelser sl\u00e5tt av -recordable-version-config=Alternativer med automatiske erkl\u00e6ringer diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties deleted file mode 100755 index 344c240b7e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=Bijgewerkte metagegevens -rm.audit.created-object=Object gemaakt -rm.audit.delete-object=Object verwijderen -rm.audit.login-succeeded=Aanmelden geslaagd -rm.audit.login-failed=Aanmelden niet geslaagd -rm.audit.create-person=Gebruiker maken -rm.audit.delete-person=Gebruiker verwijderen -rm.audit.create-userGroup=Gebruikersgroep maken -rm.audit.delete-userGroup=Gebruikersgroep verwijderen -rm.audit.addMember=Toevoegen aan gebruikersgroep -rm.audit.removeMember=Verwijderen uit gebruikersgroep -rm.audit.linkTo=Koppelen naar -rm.audit.moveTo=Verplaatsen naar -rm.audit.copyTo=Kopi\u00ebren naar -rm.audit.fileTo=Archiveren in -rm.audit.createHold=Bewaring maken -rm.audit.deleteHold=Bewaring verwijderen -rm.audit.addToHold=Toevoegen aan bewaring -rm.audit.removeFromHold=Verwijderen uit bewaring -rm.audit.holdPermission-Error=U hebt geen rechten voor het weergeven van deze bewaring. -rm.audit.audit-start=Audit starten -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. Controleer de auditgegevens en probeer het opnieuw of neem contact op met uw IT- afdeling -rm.audit.audit-report=Auditrapport -rm.audit.set-permission=Recht instellen -rm.audit.enable-inherit-permission=Overgenomen rechten ingeschakeld -rm.audit.disable-inherit-permission=Overgenomen rechten uitgeschakeld -recordable-version-config=Opties voor automatisch declareren diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties deleted file mode 100644 index 6e5a9d0010..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=Metadados atualizados -rm.audit.created-object=Objeto criado -rm.audit.delete-object=Excluir objeto -rm.audit.login-succeeded=Login bem-sucedido -rm.audit.login-failed=Login malsucedido -rm.audit.create-person=Criar usu\u00e1rio -rm.audit.delete-person=Excluir usu\u00e1rio -rm.audit.create-userGroup=Criar grupo de usu\u00e1rios -rm.audit.delete-userGroup=Excluir grupo de usu\u00e1rios -rm.audit.addMember=Adicionar ao grupo de usu\u00e1rios -rm.audit.removeMember=Remover do grupo de usu\u00e1rios -rm.audit.linkTo=Vincular a -rm.audit.moveTo=Mover para -rm.audit.copyTo=Copiar para -rm.audit.fileTo=Arquivar em -rm.audit.createHold=Criar espera -rm.audit.deleteHold=Excluir espera -rm.audit.addToHold=Adicionar \u00e0 espera -rm.audit.removeFromHold=Remover da espera -rm.audit.holdPermission-Error=Voc\u00ea n\u00e3o tem permiss\u00e3o para visualizar esta espera. -rm.audit.audit-start=In\u00edcio da auditoria -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 um relat\u00f3rio de auditoria. Verifique os detalhes de auditoria e tente novamente, ou entre em contato com o Dept. de TI. -rm.audit.audit-report=Relat\u00f3rio de auditoria -rm.audit.set-permission=Definir Permiss\u00e3o -rm.audit.enable-inherit-permission=Permiss\u00f5es herdadas ativadas -rm.audit.disable-inherit-permission=Permiss\u00f5es herdadas desativadas -recordable-version-config=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties deleted file mode 100644 index 32cd1a3509..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 -rm.audit.created-object=\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 -rm.audit.delete-object=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 -rm.audit.login-succeeded=\u0412\u0445\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d -rm.audit.login-failed=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 -rm.audit.create-person=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f -rm.audit.delete-person=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f -rm.audit.create-userGroup=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 -rm.audit.delete-userGroup=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 -rm.audit.addMember=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 -rm.audit.removeMember=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 -rm.audit.linkTo=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441 -rm.audit.moveTo=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 -rm.audit.copyTo=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 -rm.audit.fileTo=\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432 -rm.audit.createHold=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -rm.audit.deleteHold=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -rm.audit.addToHold=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c -rm.audit.removeFromHold=\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c -rm.audit.holdPermission-Error=\u0423 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. -rm.audit.audit-start=\u0417\u0430\u043f\u0443\u0441\u043a \u0430\u0443\u0434\u0438\u0442\u0430 -rm.audit.audit-stop=\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 -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 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 IT- \u043e\u0442\u0434\u0435\u043b. -rm.audit.audit-report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435 -rm.audit.set-permission=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 -rm.audit.enable-inherit-permission=\u0423\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b -rm.audit.disable-inherit-permission=\u0423\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties deleted file mode 100644 index 0d1dfade4b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties +++ /dev/null @@ -1,30 +0,0 @@ -rm.audit.updated-metadata=\u66f4\u65b0\u7684\u5143\u6570\u636e -rm.audit.created-object=\u521b\u5efa\u7684\u5bf9\u8c61 -rm.audit.delete-object=\u5220\u9664\u5bf9\u8c61 -rm.audit.login-succeeded=\u767b\u5f55\u6210\u529f -rm.audit.login-failed=\u767b\u5f55\u5931\u8d25 -rm.audit.create-person=\u521b\u5efa\u7528\u6237 -rm.audit.delete-person=\u5220\u9664\u7528\u6237 -rm.audit.create-userGroup=\u521b\u5efa\u7528\u6237\u7ec4 -rm.audit.delete-userGroup=\u5220\u9664\u7528\u6237\u7ec4 -rm.audit.addMember=\u52a0\u5230\u7528\u6237\u7ec4 -rm.audit.removeMember=\u4ece\u7528\u6237\u7ec4\u79fb\u9664 -rm.audit.linkTo=\u94fe\u63a5\u5230 -rm.audit.moveTo=\u79fb\u52a8\u5230 -rm.audit.copyTo=\u590d\u5236\u5230 -rm.audit.fileTo=\u7acb\u5377\u81f3 -rm.audit.createHold=\u521b\u5efa\u4fdd\u5b58 -rm.audit.deleteHold=\u5220\u9664\u4fdd\u5b58 -rm.audit.addToHold=\u6dfb\u52a0\u81f3\u4fdd\u5b58 -rm.audit.removeFromHold=\u89e3\u9664\u4fdd\u5b58 -rm.audit.holdPermission-Error=\u60a8\u6ca1\u6709\u6743\u9650\u67e5\u770b\u6b64\u4fdd\u5b58\u3002 -rm.audit.audit-start=\u5f00\u59cb\u5ba1\u8ba1 -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=\u6211\u4eec\u65e0\u6cd5\u751f\u6210\u5ba1\u8ba1\u62a5\u544a\u3002 \u68c0\u67e5\u5ba1\u8ba1\u8be6\u7ec6\u4fe1\u606f\u5e76\u91cd\u8bd5\uff0c\u6216\u8005\u54a8\u8be2\u60a8\u7684 IT \u90e8\u95e8\u3002 -rm.audit.audit-report=\u5ba1\u8ba1\u62a5\u544a -rm.audit.set-permission=\u8bbe\u7f6e\u6743\u9650 -rm.audit.enable-inherit-permission=\u7ee7\u627f\u7684\u6743\u9650\u5df2\u6253\u5f00 -rm.audit.disable-inherit-permission=\u7ee7\u627f\u7684\u6743\u9650\u5df2\u5173\u95ed -recordable-version-config=\u81ea\u52a8\u58f0\u660e\u9009\u9879 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties deleted file mode 100644 index a19b8ec389..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Records -capability.DeclareRecords.title=Complete Records -capability.ViewRecords.title=View Records -capability.UndeclareRecords.title=Reopen Records -capability.CreateRecords.title=Create Records -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 -capability.EditRecordMetadata.title=Edit Record Metadata -capability.EditDeclaredRecordMetadata.title=Edit Completed Record Metadata -capability.EditNonRecordMetadata.title=Edit Non-Record Metadata -capability.MoveRecords.title=Move Records - -# Folder Control -capability.group.folderControl.title=Folder Control -capability.CreateModifyDestroyFolders.title=Create Modify Destroy Folders -capability.CloseFolders.title=Close Folders -capability.ReOpenFolders.title=Re-Open Folders -capability.DeclareRecordsInClosedFolders.title=Complete Records in Closed Folders -capability.FileVersionRecords.title=File Version Records - -# Vital Records -capability.group.vitalRecords.title=Vital Records -capability.UpdateVitalRecordCycleInformation.title=Update Vital Record Cycle Information -capability.CycleVitalRecords.title=Cycle Vital Records -capability.PlanningReviewCycles.title=Planning Review Cycles - -# References and Links -capability.group.references.title=References -capability.ChangeOrDeleteReferences.title=Change or Delete References - -# Events -capability.group.events.title=Events -capability.CreateModifyDestroyEvents.title=Create Modify Destroy Events -capability.AddModifyEventDates.title=Add Modify Event Dates - -# Cutoff -capability.group.cutoff.title=Cut Off -capability.ApproveRecordsScheduledForCutoff.title=Approve Records Scheduled for Cut Off -capability.CreateModifyRecordsInCutoffFolders.title=Create Modify Records in Cut Off Folders - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Retention and Transfers -capability.UpdateTriggerDates.title=Update Trigger Dates -capability.ManuallyChangeDispositionDates.title=Manually Change Retention Dates -capability.AuthorizeNominatedTransfers.title=Authorize Nominated Transfers -capability.AuthorizeAllTransfers.title=Authorize All Transfers -capability.DestroyRecordsScheduledForDestruction.title=Destroy Record or Record Folder Scheduled for Destruction -capability.DestroyRecords.title=Destroy Records -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 -capability.ExtendRetentionPeriodOrFreeze.title=Extend Retention Period or Freeze -capability.Unfreeze.title=Unfreeze -capability.ViewUpdateReasonsForFreeze.title=View Update Reasons for Freeze -capability.CreateHold.title=Create Hold -capability.AddToHold.title=Add to Hold -capability.RemoveFromHold.title=Remove from Hold -capability.FileHoldReport.title=File Hold Report -capability.DeleteHold.title=Delete Hold -capability.EditHold.title=Edit Hold - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Declare Audit as Record -capability.EnableDisableAuditByTypes.title=Enable Disable Audit by Types -capability.DeleteAudit.title=Delete Audit -capability.SelectAuditMetadata.title=Select Audit Metadata -capability.AccessAudit.title=Access Audit -capability.ExportAudit.title=Export Audit - -# Security -capability.group.security.title=Security -capability.CreateModifyDestroyRoles.title=Create Modify Destroy Roles -capability.CreateModifyDestroyUsersAndGroups.title=Create Modify Destroy Users and Groups -capability.PasswordControl.title=Password Control -capability.DisplayRightsReport.title=Display Rights Report -capability.ManageAccessControls.title=Group and User Role Assignment -capability.ManageAccessRights.title=Manage Permissions - -# Configuration -capability.group.config.title=Configuration -capability.CreateModifyDestroyFileplanMetadata.title=Create Modify Destroy File Plan Metadata -capability.CreateModifyDestroyFileplanTypes.title=Create Modify Destroy File Plan Types -capability.CreateModifyDestroyRecordTypes.title=Create Modify Destroy Record Types -capability.CreateAndAssociateSelectionLists.title=Create and Associate Selection Lists -capability.EditSelectionLists.title=Edit Selection Lists -capability.CreateModifyDestroyReferenceTypes.title=Create Modify Destroy Reference Types -capability.AttachRulesToMetadataProperties.title=Attach Rules to Metadata Properties -capability.MakeOptionalParametersMandatory.title=Make Optional Parameters Mandatory -capability.MapEmailMetadata.title=Map Email Metadata - -# Rules -capability.group.rules.title=Rules -capability.ManageRules.title=Manage Rules \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties deleted file mode 100644 index e84005ef42..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Records -capability.DeclareRecords.title=Records abschlie\u00dfen -capability.ViewRecords.title=Records anzeigen -capability.UndeclareRecords.title=Records erneut \u00f6ffnen -capability.CreateRecords.title=Records erstellen -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 -capability.EditRecordMetadata.title=Record-Metadaten bearbeiten -capability.EditDeclaredRecordMetadata.title=Metadaten von abgeschlossenem Record bearbeiten -capability.EditNonRecordMetadata.title=Record-fremde Metadaten bearbeiten -capability.MoveRecords.title=Records verschieben - -# Folder Control -capability.group.folderControl.title=Ordnersteuerung -capability.CreateModifyDestroyFolders.title=Ordner erstellen/\u00e4ndern/vernichten -capability.CloseFolders.title=Ordner schlie\u00dfen -capability.ReOpenFolders.title=Ordner erneut \u00f6ffnen -capability.DeclareRecordsInClosedFolders.title=Records in geschlossenen Ordnern abschlie\u00dfen -capability.FileVersionRecords.title=Records-Version ablegen - -# Vital Records -capability.group.vitalRecords.title=Besonders relevante Records -capability.UpdateVitalRecordCycleInformation.title=Zyklusinformationen besonders relevanter Records aktualisieren -capability.CycleVitalRecords.title=Zyklus besonders relevanter Records -capability.PlanningReviewCycles.title=\u00dcberpr\u00fcfungszyklen planen - -# References and Links -capability.group.references.title=Referenzen -capability.ChangeOrDeleteReferences.title=Referenzen \u00e4ndern oder l\u00f6schen - -# Events -capability.group.events.title=Ereignisse -capability.CreateModifyDestroyEvents.title=Ereignisse erstellen/\u00e4ndern/vernichten -capability.AddModifyEventDates.title=Ereignisdaten hinzuf\u00fcgen/\u00e4ndern - -# Cutoff -capability.group.cutoff.title=Trennen -capability.ApproveRecordsScheduledForCutoff.title=F\u00fcr Trennung geplante Records genehmigen -capability.CreateModifyRecordsInCutoffFolders.title=Records in getrennten Ordnern erstellen/\u00e4ndern - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Aufbewahrung und \u00dcbertragungen -capability.UpdateTriggerDates.title=Triggerdaten aktualisieren -capability.ManuallyChangeDispositionDates.title=Aufbewahrungsdaten manuell \u00e4ndern -capability.AuthorizeNominatedTransfers.title=Nominierte \u00dcbertragungen autorisieren -capability.AuthorizeAllTransfers.title=Alle \u00dcbertragungen autorisieren -capability.DestroyRecordsScheduledForDestruction.title=Zur Vernichtung vorgesehenen Record oder Record-Ordner vernichten -capability.DestroyRecords.title=Records vernichten -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=Legal-Hold-Steuerung -capability.ExtendRetentionPeriodOrFreeze.title=Aufbewahrungsfrist verl\u00e4ngern oder fixieren -capability.Unfreeze.title=Fixierung aufheben -capability.ViewUpdateReasonsForFreeze.title=Aktualisierungsgrund f\u00fcr Fixierung anzeigen -capability.CreateHold.title=Legal Hold erstellen -capability.AddToHold.title=Zum Legal Hold hinzuf\u00fcgen -capability.RemoveFromHold.title=Vom Legal Hold entfernen -capability.FileHoldReport.title=Legal-Hold-Bericht ablegen -capability.DeleteHold.title=Legal Hold l\u00f6schen -capability.EditHold.title=Legal Hold bearbeiten - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Audit als Record deklarieren -capability.EnableDisableAuditByTypes.title=Audit nach Typen aktivieren/deaktivieren -capability.DeleteAudit.title=Audit l\u00f6schen -capability.SelectAuditMetadata.title=Audit-Metadaten ausw\u00e4hlen -capability.AccessAudit.title=Auf Audit zugreifen -capability.ExportAudit.title=Audit exportieren - -# Security -capability.group.security.title=Sicherheit -capability.CreateModifyDestroyRoles.title=Rollen erstellen/\u00e4ndern/vernichten -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 - -# Configuration -capability.group.config.title=Konfiguration -capability.CreateModifyDestroyFileplanMetadata.title=Ablageplan-Metadaten erstellen/\u00e4ndern/vernichten -capability.CreateModifyDestroyFileplanTypes.title=Ablageplan-Typen erstellen/\u00e4ndern/vernichten -capability.CreateModifyDestroyRecordTypes.title=Record-Typen erstellen/\u00e4ndern/vernichten -capability.CreateAndAssociateSelectionLists.title=Auswahllisten erstellen und zuordnen -capability.EditSelectionLists.title=Auswahllisten bearbeiten -capability.CreateModifyDestroyReferenceTypes.title=Referenztypen erstellen/\u00e4ndern/vernichten -capability.AttachRulesToMetadataProperties.title=Regeln an Metadaten-Eigenschaften anh\u00e4ngen -capability.MakeOptionalParametersMandatory.title=Optionale Parameter als erforderlich festlegen -capability.MapEmailMetadata.title=E-Mail-Metadaten zuordnen - -# Rules -capability.group.rules.title=Regeln -capability.ManageRules.title=Regeln verwalten diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties deleted file mode 100644 index 240bf7fe35..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Documentos de archivo -capability.DeclareRecords.title=Documentos de archivo completo -capability.ViewRecords.title=Ver documentos de archivo -capability.UndeclareRecords.title=Reabrir documentos de archivo -capability.CreateRecords.title=Crear documentos de archivo -capability.RequestRecordInformation.title=Solicitar informaci\u00f3n sobre documento de archivo -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 -capability.EditRecordMetadata.title=Editar metadatos de documento de archivo -capability.EditDeclaredRecordMetadata.title=Editar metadatos de documento de archivo completados -capability.EditNonRecordMetadata.title=Editar metadatos que no son de documentos de archivo -capability.MoveRecords.title=Mover documentos de archivo - -# Folder Control -capability.group.folderControl.title=Control de carpetas -capability.CreateModifyDestroyFolders.title=Crear Modificar Destruir carpetas -capability.CloseFolders.title=Cerrar carpetas -capability.ReOpenFolders.title=Reabrir carpetas -capability.DeclareRecordsInClosedFolders.title=Completar documentos de archivo en carpetas cerradas -capability.FileVersionRecords.title=Archivar documentos de archivo de versi\u00f3n - -# Vital Records -capability.group.vitalRecords.title=Documentos de archivo vitales -capability.UpdateVitalRecordCycleInformation.title=Actualizar informaci\u00f3n de ciclo de documentos de archivo vitales -capability.CycleVitalRecords.title=Documentos de archivo vitales de ciclo -capability.PlanningReviewCycles.title=Planificaci\u00f3n de ciclos de revisi\u00f3n - -# References and Links -capability.group.references.title=Referencias -capability.ChangeOrDeleteReferences.title=Cambiar o eliminar referencias - -# Events -capability.group.events.title=Eventos -capability.CreateModifyDestroyEvents.title=Crear Modificar Destruir eventos -capability.AddModifyEventDates.title=Agregar o modificar fechas de eventos - -# Cutoff -capability.group.cutoff.title=Interrumpir -capability.ApproveRecordsScheduledForCutoff.title=Aprobar documentos de archivo planificados para interrupci\u00f3n -capability.CreateModifyRecordsInCutoffFolders.title=Crear o modificar documentos de archivo en carpetas de interrupci\u00f3n - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Retenci\u00f3n y transferencias -capability.UpdateTriggerDates.title=Actualizar fechas de ejecuci\u00f3n -capability.ManuallyChangeDispositionDates.title=Cambiar las fechas de retenci\u00f3n manualmente -capability.AuthorizeNominatedTransfers.title=Autorizar transferencias nominadas -capability.AuthorizeAllTransfers.title=Autorizar todas las transferencias -capability.DestroyRecordsScheduledForDestruction.title=Destruir documento de archivo o carpeta de documentos de archivo planificada para destrucci\u00f3n -capability.DestroyRecords.title=Destruir documentos de archivo -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=Controles de retenci\u00f3n legal -capability.ExtendRetentionPeriodOrFreeze.title=Extender periodo de retenci\u00f3n o congelar -capability.Unfreeze.title=Descongelar -capability.ViewUpdateReasonsForFreeze.title=Ver razones actualizadas de congelaci\u00f3n -capability.CreateHold.title=Crear retenci\u00f3n legal -capability.AddToHold.title=A\u00f1adir a retenci\u00f3n legal -capability.RemoveFromHold.title=Eliminar de retenci\u00f3n legal -capability.FileHoldReport.title=Archivar informe de retenci\u00f3n legal -capability.DeleteHold.title=Eliminar retenci\u00f3n legal -capability.EditHold.title=Editar retenci\u00f3n legal - -# Audit -capability.group.audit.title=Auditor\u00eda -capability.DeclareAuditAsRecord.title=Declarar auditor\u00eda como documento de archivo -capability.EnableDisableAuditByTypes.title=Activar o desactivar auditor\u00eda por tipos -capability.DeleteAudit.title=Eliminar auditor\u00eda -capability.SelectAuditMetadata.title=Seleccionar metadatos de auditor\u00eda -capability.AccessAudit.title=Acceder a auditor\u00eda -capability.ExportAudit.title=Exportar auditor\u00eda - -# Security -capability.group.security.title=Seguridad -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 - -# Configuration -capability.group.config.title=Configuraci\u00f3n -capability.CreateModifyDestroyFileplanMetadata.title=Crear Modificar Destruir metadatos del cuadro de clasificaci\u00f3n -capability.CreateModifyDestroyFileplanTypes.title=Crear Modificar Destruir tipos del cuadro de clasificaci\u00f3n -capability.CreateModifyDestroyRecordTypes.title=Crear Modificar Destruir tipos de documento de archivo -capability.CreateAndAssociateSelectionLists.title=Crear y asociar listas de selecci\u00f3n -capability.EditSelectionLists.title=Editar listas de selecci\u00f3n -capability.CreateModifyDestroyReferenceTypes.title=Crear Modificar Destruir tipos de referencia -capability.AttachRulesToMetadataProperties.title=Vincular reglas a las propiedades de metadatos -capability.MakeOptionalParametersMandatory.title=Establecer como obligatorios los par\u00e1metros opcionales -capability.MapEmailMetadata.title=Asignar metadatos de correo electr\u00f3nico - -# Rules -capability.group.rules.title=Reglas -capability.ManageRules.title=Gestionar reglas diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties deleted file mode 100644 index b7641f69b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Documents d'archives -capability.DeclareRecords.title=Compl\u00e9ter des documents d'archives -capability.ViewRecords.title=Afficher des documents d'archives -capability.UndeclareRecords.title=Rouvrir des documents d'archives -capability.CreateRecords.title=Cr\u00e9er des documents d'archives -capability.RequestRecordInformation.title=Demander des informations sur un document d'archives -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 -capability.EditRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document d'archives -capability.EditDeclaredRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document d'archives compl\u00e9t\u00e9 -capability.EditNonRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document qui n'est pas un document d'archives -capability.MoveRecords.title=D\u00e9placer des documents d'archives - -# Folder Control -capability.group.folderControl.title=Contr\u00f4le de dossiers -capability.CreateModifyDestroyFolders.title=Cr\u00e9er Modifier D\u00e9truire Dossiers -capability.CloseFolders.title=Fermer des dossiers -capability.ReOpenFolders.title=Rouvrir des dossiers -capability.DeclareRecordsInClosedFolders.title=Compl\u00e9ter des documents d'archives dans des dossiers ferm\u00e9s -capability.FileVersionRecords.title=Classer la version des documents d'archives - -# Vital Records -capability.group.vitalRecords.title=Documents d'archives essentiels -capability.UpdateVitalRecordCycleInformation.title=Actualiser les informations concernant le cycle des documents d'archives essentiels -capability.CycleVitalRecords.title=Cycle des documents d'archives essentiels -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 - -# Events -capability.group.events.title=Ev\u00e9nements -capability.CreateModifyDestroyEvents.title=Cr\u00e9er Modifier D\u00e9truire Ev\u00e9nements -capability.AddModifyEventDates.title=Ajouter Modifier Dates d'\u00e9v\u00e9nements - -# Cutoff -capability.group.cutoff.title=D\u00e9but de conservation -capability.ApproveRecordsScheduledForCutoff.title=Approuver les documents d'archives planifi\u00e9s pour un d\u00e9but de conservation -capability.CreateModifyRecordsInCutoffFolders.title=Cr\u00e9er Modifier des documents d'archives dans des dossiers de d\u00e9but de conservation - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Conservation et transferts -capability.UpdateTriggerDates.title=Actualiser les dates de d\u00e9clenchement -capability.ManuallyChangeDispositionDates.title=Modifier manuellement les dates de conservation -capability.AuthorizeNominatedTransfers.title=Autoriser les transferts nominatifs -capability.AuthorizeAllTransfers.title=Autoriser tous les transferts -capability.DestroyRecordsScheduledForDestruction.title=D\u00e9truire un document ou un dossier d'archives dont la destruction est planifi\u00e9e -capability.DestroyRecords.title=D\u00e9truire des documents d'archives -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 conservation - -# Hold Controls -capability.group.holdControls.title=Suspendre les contr\u00f4les -capability.ExtendRetentionPeriodOrFreeze.title=Prolonger la p\u00e9riode de conservation ou le gel -capability.Unfreeze.title=D\u00e9geler -capability.ViewUpdateReasonsForFreeze.title=Voir les motifs d'actualisation d'un gel -capability.CreateHold.title=Cr\u00e9er une suspension -capability.AddToHold.title=Ajouter \u00e0 la suspension -capability.RemoveFromHold.title=Supprimer de la suspension -capability.FileHoldReport.title=Archiver le rapport de suspension -capability.DeleteHold.title=Supprimer la suspension -capability.EditHold.title=Modifier la suspension - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=D\u00e9clarer l'audit en tant que document d'archives -capability.EnableDisableAuditByTypes.title=Activer D\u00e9sactiver l'audit par types -capability.DeleteAudit.title=Supprimer un audit -capability.SelectAuditMetadata.title=S\u00e9lectionner les m\u00e9tadonn\u00e9es d'un audit -capability.AccessAudit.title=Acc\u00e9der \u00e0 un audit -capability.ExportAudit.title=Exporter l'audit - -# Security -capability.group.security.title=S\u00e9curit\u00e9 -capability.CreateModifyDestroyRoles.title=Cr\u00e9er Modifier D\u00e9truire des r\u00f4les -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 - -# Configuration -capability.group.config.title=Configuration -capability.CreateModifyDestroyFileplanMetadata.title=Cr\u00e9er Modifier D\u00e9truire des m\u00e9tadonn\u00e9es de plan de classement -capability.CreateModifyDestroyFileplanTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de plan de classement -capability.CreateModifyDestroyRecordTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de document d'archives -capability.CreateAndAssociateSelectionLists.title=Cr\u00e9er et associer des listes de s\u00e9lections -capability.EditSelectionLists.title=Modifier des listes de s\u00e9lections -capability.CreateModifyDestroyReferenceTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de r\u00e9f\u00e9rence -capability.AttachRulesToMetadataProperties.title=Attacher des r\u00e8gles aux propri\u00e9t\u00e9s des m\u00e9tadonn\u00e9es -capability.MakeOptionalParametersMandatory.title=Rendre obligatoires des param\u00e8tres facultatifs -capability.MapEmailMetadata.title=Mapper des m\u00e9tadonn\u00e9es d'e-mail - -# Rules -capability.group.rules.title=R\u00e8gles -capability.ManageRules.title=G\u00e9rer les r\u00e8gles diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties deleted file mode 100644 index e5e9070c83..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Record -capability.DeclareRecords.title=Completa record -capability.ViewRecords.title=Visualizza record -capability.UndeclareRecords.title=Riapri record -capability.CreateRecords.title=Crea record -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 -capability.EditRecordMetadata.title=Modifica metadati del record -capability.EditDeclaredRecordMetadata.title=Modifica metadati del record completati -capability.EditNonRecordMetadata.title=Modifica metadati del non record -capability.MoveRecords.title=Sposta record - -# Folder Control -capability.group.folderControl.title=Controllo cartelle -capability.CreateModifyDestroyFolders.title=Crea Modifica Elimina definitivamente cartelle -capability.CloseFolders.title=Chiudi cartelle -capability.ReOpenFolders.title=Riapri cartelle -capability.DeclareRecordsInClosedFolders.title=Completa record nelle cartelle chiuse -capability.FileVersionRecords.title=Archivia versione dei record - -# Vital Records -capability.group.vitalRecords.title=Record fondamentali -capability.UpdateVitalRecordCycleInformation.title=Aggiorna informazioni ciclo di record fondamentale -capability.CycleVitalRecords.title=Record fondamentali del ciclo -capability.PlanningReviewCycles.title=Programma cicli di esame - -# References and Links -capability.group.references.title=Riferimenti -capability.ChangeOrDeleteReferences.title=Cambia o elimina riferimenti - -# Events -capability.group.events.title=Eventi -capability.CreateModifyDestroyEvents.title=Crea Modifica Elimina definitivamente eventi -capability.AddModifyEventDates.title=Aggiungi Modifica date eventi - -# Cutoff -capability.group.cutoff.title=Cut off -capability.ApproveRecordsScheduledForCutoff.title=Approva record programmati per il cut off -capability.CreateModifyRecordsInCutoffFolders.title=Crea Modifica record nelle cartelle di cut off - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Conservazione e trasferimenti -capability.UpdateTriggerDates.title=Aggiorna date di attivazione -capability.ManuallyChangeDispositionDates.title=Cambia manualmente le date di conservazione -capability.AuthorizeNominatedTransfers.title=Autorizza trasferimenti nominati -capability.AuthorizeAllTransfers.title=Autorizza tutti i trasferimenti -capability.DestroyRecordsScheduledForDestruction.title=Elimina definitivamente record o cartella di record programmati per l'eliminazione definitiva -capability.DestroyRecords.title=Elimina definitivamente record -capability.DeleteRecords.title=Elimina record -capability.TriggerAnEvent.title=Attiva un evento -capability.FileDestructionReport.title=Archivia rapporto di eliminazione definitiva -capability.FileTransferReport.title=Archivia rapporto di trasferimento -capability.EndRetention.title=Termina conservazione - -# Hold Controls -capability.group.holdControls.title=Sospendi controlli -capability.ExtendRetentionPeriodOrFreeze.title=Estendi periodo di conservazione o blocca -capability.Unfreeze.title=Sblocca -capability.ViewUpdateReasonsForFreeze.title=Visualizza Aggiorna motivi blocco -capability.CreateHold.title=Crea sospensione -capability.AddToHold.title=Aggiungi a sospesi -capability.RemoveFromHold.title=Rimuovi da sospesi -capability.FileHoldReport.title=Archivia rapporto di sospensione -capability.DeleteHold.title=Annulla sospensione -capability.EditHold.title=Modifica sospensione - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Dichiara audit come record -capability.EnableDisableAuditByTypes.title=Abilita Disabilita audit per tipo -capability.DeleteAudit.title=Elimina audit -capability.SelectAuditMetadata.title=Seleziona metadati di audit -capability.AccessAudit.title=Accedi audit -capability.ExportAudit.title=Esporta audit - -# Security -capability.group.security.title=Sicurezza -capability.CreateModifyDestroyRoles.title=Crea Modifica Elimina definitivamente ruoli -capability.CreateModifyDestroyUsersAndGroups.title=Crea Modifica Elimina definitivamente utenti e gruppi -capability.PasswordControl.title=Controllo password -capability.DisplayRightsReport.title=Mostra rapporto diritti -capability.ManageAccessControls.title=Assegnazione gruppo e ruolo utente -capability.ManageAccessRights.title=Gestisci permessi - -# Configuration -capability.group.config.title=Configurazione -capability.CreateModifyDestroyFileplanMetadata.title=Crea Modifica Elimina definitivamente metadati di Piano di fascicolazione -capability.CreateModifyDestroyFileplanTypes.title=Crea Modifica Elimina definitivamente tipi di Piano di fascicolazione -capability.CreateModifyDestroyRecordTypes.title=Crea Modifica Elimina definitivamente tipi di record -capability.CreateAndAssociateSelectionLists.title=Crea e associa elenchi di selezione -capability.EditSelectionLists.title=Modifica elenchi di selezione -capability.CreateModifyDestroyReferenceTypes.title=Crea Modifica Elimina definitivamente tipi di riferimento -capability.AttachRulesToMetadataProperties.title=Allega regole a propriet\u00e0 di metadati -capability.MakeOptionalParametersMandatory.title=Rendi obbligatori i parametri opzionali -capability.MapEmailMetadata.title=Esegui il mapping dei metadati di e-mail - -# Rules -capability.group.rules.title=Regole -capability.ManageRules.title=Gestisci regole diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties deleted file mode 100644 index 782bfd56fa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=\u30ec\u30b3\u30fc\u30c9 -capability.DeclareRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5b8c\u4e86 -capability.ViewRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u8868\u793a -capability.UndeclareRecords.title=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304f -capability.CreateRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210 -capability.RequestRecordInformation.title=\u30ec\u30b3\u30fc\u30c9\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8 -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\u89e3\u9664 - -# Metadata Control -capability.group.metadataControl.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7ba1\u7406 -capability.EditRecordMetadata.title=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 -capability.EditDeclaredRecordMetadata.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 -capability.EditNonRecordMetadata.title=\u975e\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 -capability.MoveRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 - -# Folder Control -capability.group.folderControl.title=\u30d5\u30a9\u30eb\u30c0\u306e\u7ba1\u7406 -capability.CreateModifyDestroyFolders.title=\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CloseFolders.title=\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b -capability.ReOpenFolders.title=\u30d5\u30a9\u30eb\u30c0\u3092\u518d\u5ea6\u958b\u304f -capability.DeclareRecordsInClosedFolders.title=\u9589\u3058\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 -capability.FileVersionRecords.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1 - -# Vital Records -capability.group.vitalRecords.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -capability.UpdateVitalRecordCycleInformation.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30b5\u30a4\u30af\u30eb\u60c5\u5831\u306e\u66f4\u65b0 -capability.CycleVitalRecords.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30b5\u30a4\u30af\u30eb -capability.PlanningReviewCycles.title=\u30ec\u30d3\u30e5\u30fc\u30b5\u30a4\u30af\u30eb\u306e\u30d7\u30e9\u30f3\u30cb\u30f3\u30b0 - -# References and Links -capability.group.references.title=\u53c2\u7167 -capability.ChangeOrDeleteReferences.title=\u53c2\u7167\u306e\u5909\u66f4\u307e\u305f\u306f\u524a\u9664 - -# Events -capability.group.events.title=\u30a4\u30d9\u30f3\u30c8 -capability.CreateModifyDestroyEvents.title=\u30a4\u30d9\u30f3\u30c8\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.AddModifyEventDates.title=\u30a4\u30d9\u30f3\u30c8\u306e\u65e5\u4ed8\u306e\u8ffd\u52a0/\u5909\u66f4 - -# Cutoff -capability.group.cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -capability.ApproveRecordsScheduledForCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u306e\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f\u30ec\u30b3\u30fc\u30c9\u306e\u627f\u8a8d -capability.CreateModifyRecordsInCutoffFolders.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u4fee\u6b63\u30ec\u30b3\u30fc\u30c9\u3092\u4f5c\u6210 - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=\u4fdd\u7ba1\u3068\u8ee2\u9001 -capability.UpdateTriggerDates.title=\u30c8\u30ea\u30ac\u30fc\u65e5\u306e\u66f4\u65b0 -capability.ManuallyChangeDispositionDates.title=\u4fdd\u7ba1\u65e5\u3092\u624b\u52d5\u3067\u5909\u66f4\u3059\u308b -capability.AuthorizeNominatedTransfers.title=\u7533\u8acb\u3055\u308c\u305f\u8ee2\u9001\u3092\u627f\u8a8d\u3059\u308b -capability.AuthorizeAllTransfers.title=\u3059\u3079\u3066\u306e\u8ee2\u9001\u3092\u627f\u8a8d\u3059\u308b -capability.DestroyRecordsScheduledForDestruction.title=\u7834\u68c4\u304c\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u7834\u68c4\u3059\u308b -capability.DestroyRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u7834\u68c4 -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\u7ba1\u306e\u7d42\u4e86 - -# Hold Controls -capability.group.holdControls.title=\u30db\u30fc\u30eb\u30c9\u306e\u7ba1\u7406 -capability.ExtendRetentionPeriodOrFreeze.title=\u4fdd\u7ba1\u671f\u9593\u306e\u5ef6\u9577\u307e\u305f\u306f\u51cd\u7d50 -capability.Unfreeze.title=\u51cd\u7d50\u89e3\u9664 -capability.ViewUpdateReasonsForFreeze.title=\u51cd\u7d50\u306e\u66f4\u65b0\u7406\u7531\u3092\u8868\u793a -capability.CreateHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u4f5c\u6210 -capability.AddToHold.title=\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0 -capability.RemoveFromHold.title=\u30db\u30fc\u30eb\u30c9\u304b\u3089\u524a\u9664 -capability.FileHoldReport.title=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -capability.DeleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -capability.EditHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u7de8\u96c6 - -# Audit -capability.group.audit.title=\u76e3\u67fb -capability.DeclareAuditAsRecord.title=\u76e3\u67fb\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b -capability.EnableDisableAuditByTypes.title=\u76e3\u67fb\u3092\u30bf\u30a4\u30d7\u5225\u306b\u6709\u52b9\u5316/\u7121\u52b9\u5316\u3059\u308b -capability.DeleteAudit.title=\u76e3\u67fb\u306e\u524a\u9664 -capability.SelectAuditMetadata.title=\u76e3\u67fb\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u9078\u629e -capability.AccessAudit.title=\u76e3\u67fb\u306b\u30a2\u30af\u30bb\u30b9 -capability.ExportAudit.title=\u76e3\u67fb\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8 - -# Security -capability.group.security.title=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 -capability.CreateModifyDestroyRoles.title=\u5f79\u5272\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -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\u7ba1\u7406 -capability.DisplayRightsReport.title=\u6a29\u9650\u30ec\u30dd\u30fc\u30c8\u306e\u8868\u793a -capability.ManageAccessControls.title=\u30b0\u30eb\u30fc\u30d7\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u5f79\u5272\u306e\u5272\u308a\u5f53\u3066 -capability.ManageAccessRights.title=\u6a29\u9650\u306e\u7ba1\u7406 - -# Configuration -capability.group.config.title=\u8a2d\u5b9a -capability.CreateModifyDestroyFileplanMetadata.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateModifyDestroyFileplanTypes.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateModifyDestroyRecordTypes.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateAndAssociateSelectionLists.title=\u9078\u629e\u30ea\u30b9\u30c8\u306e\u4f5c\u6210\u3068\u95a2\u9023\u4ed8\u3051 -capability.EditSelectionLists.title=\u9078\u629e\u30ea\u30b9\u30c8\u306e\u7de8\u96c6 -capability.CreateModifyDestroyReferenceTypes.title=\u53c2\u7167\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.AttachRulesToMetadataProperties.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30eb\u30fc\u30eb\u3092\u9069\u7528 -capability.MakeOptionalParametersMandatory.title=\u30aa\u30d7\u30b7\u30e7\u30f3\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5fc5\u9808\u306b\u3059\u308b -capability.MapEmailMetadata.title=E \u30e1\u30fc\u30eb\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0 - -# Rules -capability.group.rules.title=\u30eb\u30fc\u30eb -capability.ManageRules.title=\u30eb\u30fc\u30eb\u306e\u7ba1\u7406 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties deleted file mode 100644 index 87228f33a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties +++ /dev/null @@ -1,106 +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 -capability.FileVersionRecords.title=Arkiver versjonsoppf\u00f8ringer - -# 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=Forfall og overf\u00f8ringer -capability.UpdateTriggerDates.title=Oppdater utl\u00f8serdatoer -capability.ManuallyChangeDispositionDates.title=Endre forfallsdatoer 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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties deleted file mode 100755 index d5b1efd3a1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Archiefstukken -capability.DeclareRecords.title=Archiefstukken afronden -capability.ViewRecords.title=Archiefstukken bekijken -capability.UndeclareRecords.title=Archiefstukken heropenen -capability.CreateRecords.title=Archiefstukken maken -capability.RequestRecordInformation.title=Archiefstukgegevens opvragen -capability.RejectRecords.title=Archiefstukken afwijzen -capability.FileUnfiledRecords.title=Niet gearchiveerde archiefstukken archiveren -capability.LinkToRecords.title=Archiefstukken koppelen -capability.DeleteLinks.title=Archiefstukkoppeling opheffen - -# Metadata Control -capability.group.metadataControl.title=Metagegevensbeheer -capability.EditRecordMetadata.title=Metagegevens van archiefstuk bewerken -capability.EditDeclaredRecordMetadata.title=Metagegevens van afgerond archiefstukbewerken -capability.EditNonRecordMetadata.title=Metagegevens zonder archiefstuk bewerken -capability.MoveRecords.title=Archiefstukken verplaatsen - -# Folder Control -capability.group.folderControl.title=Mapbeheer -capability.CreateModifyDestroyFolders.title=Mappen maken aanpassen vernietigen -capability.CloseFolders.title=Mappen sluiten -capability.ReOpenFolders.title=Mappen heropenen -capability.DeclareRecordsInClosedFolders.title=Archiefstukken in gesloten mappen afronden -capability.FileVersionRecords.title=Archiefstukkenversie archiveren - -# Vital Records -capability.group.vitalRecords.title=Vitale archiefstukken -capability.UpdateVitalRecordCycleInformation.title=Cyclusgegevens van vitaal archiefstuk bijwerken -capability.CycleVitalRecords.title=Cyclus vitale archiefstukken -capability.PlanningReviewCycles.title=Planning revisiecycli - -# References and Links -capability.group.references.title=Verwijzingen -capability.ChangeOrDeleteReferences.title=Verwijzingen veranderen of verwijderen - -# Events -capability.group.events.title=Gebeurtenissen -capability.CreateModifyDestroyEvents.title=Gebeurtenissen maken aanpassen vernietigen -capability.AddModifyEventDates.title=Datums van gebeurtenis wijzigen toevoegen - -# Cutoff -capability.group.cutoff.title=Afsluiten -capability.ApproveRecordsScheduledForCutoff.title=Archiefstukken goedkeuren die zijn ingepland voor afsluiten -capability.CreateModifyRecordsInCutoffFolders.title=Veranderingsarchiefstukken in afsluitmappen maken - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Retentie en overzettingen -capability.UpdateTriggerDates.title=Triggerdatums bijwerken -capability.ManuallyChangeDispositionDates.title=Retentiedatums handmatig wijzigen -capability.AuthorizeNominatedTransfers.title=Genomineerde overzettingen autoriseren -capability.AuthorizeAllTransfers.title=Alle overzettingen autoriseren -capability.DestroyRecordsScheduledForDestruction.title=Archiefstuk of archiefmap vernietigen dat/die is ingepland voor vernietiging -capability.DestroyRecords.title=Archiefstukken vernietigen -capability.DeleteRecords.title=Archiefstukken 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=Bewaringsfuncties -capability.ExtendRetentionPeriodOrFreeze.title=Retentieperiode of bevriezen verlengen -capability.Unfreeze.title=Bevriezen opheffen -capability.ViewUpdateReasonsForFreeze.title=Redenen voor bevriezen bijwerken bekijken -capability.CreateHold.title=Bewaring maken -capability.AddToHold.title=Toevoegen aan bewaring -capability.RemoveFromHold.title=Verwijderen uit bewaring -capability.FileHoldReport.title=Bewaringsrapport archiveren -capability.DeleteHold.title=Bewaring verwijderen -capability.EditHold.title=Bewaring bewerken - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Audit declareren als archiefstuk -capability.EnableDisableAuditByTypes.title=Audit op type uitschakelen inschakelen -capability.DeleteAudit.title=Audit verwijderen -capability.SelectAuditMetadata.title=Metagegevens van audit selecteren -capability.AccessAudit.title=Audit openen -capability.ExportAudit.title=Audit exporteren - -# Security -capability.group.security.title=Beveiliging -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 - -# Configuration -capability.group.config.title=Configuratie -capability.CreateModifyDestroyFileplanMetadata.title=Metagegevens voor ordeningsplan maken aanpassen vernietigen -capability.CreateModifyDestroyFileplanTypes.title=Ordeningsplantypes maken aanpassen vernietigen -capability.CreateModifyDestroyRecordTypes.title=Archiefstuktypes maken aanpassen vernietigen -capability.CreateAndAssociateSelectionLists.title=Selectielijsten maken en toewijzen -capability.EditSelectionLists.title=Selectielijsten bewerken -capability.CreateModifyDestroyReferenceTypes.title=Verwijzingstypes maken aanpassen vernietigen -capability.AttachRulesToMetadataProperties.title=Regels aan metagegevenseigenschappen koppelen -capability.MakeOptionalParametersMandatory.title=Optionele parameters verplicht maken -capability.MapEmailMetadata.title=Metagegevens e-mail toewijzen - -# Rules -capability.group.rules.title=Regels -capability.ManageRules.title=Regels beheren diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties deleted file mode 100644 index b3b2bae02b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=Documentos arquiv\u00edsticos -capability.DeclareRecords.title=Concluir documentos arquiv\u00edsticos -capability.ViewRecords.title=Visualizar documentos arquiv\u00edsticos -capability.UndeclareRecords.title=Reabrir documentos arquiv\u00edsticos -capability.CreateRecords.title=Criar documentos arquiv\u00edsticos -capability.RequestRecordInformation.title=Solicitar informa\u00e7\u00f5es de documentos arquiv\u00edsticos -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 -capability.EditRecordMetadata.title=Editar metadados de documentos arquiv\u00edsticos -capability.EditDeclaredRecordMetadata.title=Editar metadados de documentos arquiv\u00edsticos conclu\u00eddos -capability.EditNonRecordMetadata.title=Editar metadados n\u00e3o de documento arquiv\u00edstico -capability.MoveRecords.title=Mover documentos arquiv\u00edsticos - -# Folder Control -capability.group.folderControl.title=Controle de pasta -capability.CreateModifyDestroyFolders.title=Criar Modificar Destruir pastas -capability.CloseFolders.title=Fechar pastas -capability.ReOpenFolders.title=Reabrir pastas -capability.DeclareRecordsInClosedFolders.title=Concluir documentos arquiv\u00edsticos em pastas fechadas -capability.FileVersionRecords.title=Arquivar vers\u00e3o de documento arquiv\u00edstico - -# Vital Records -capability.group.vitalRecords.title=Documentos arquiv\u00edsticos vitais -capability.UpdateVitalRecordCycleInformation.title=Atualizar informa\u00e7\u00f5es do ciclo de documentos arquiv\u00edsticos vitais -capability.CycleVitalRecords.title=Executar ciclo de documentos arquiv\u00edsticos vitais -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 - -# Events -capability.group.events.title=Eventos -capability.CreateModifyDestroyEvents.title=Criar Modificar Destruir eventos -capability.AddModifyEventDates.title=Adicionar Modificar datas de eventos - -# Cutoff -capability.group.cutoff.title=Cortar -capability.ApproveRecordsScheduledForCutoff.title=Aprovar documentos arquiv\u00edsticos programados para corte -capability.CreateModifyRecordsInCutoffFolders.title=Criar Modificar documentos arquiv\u00edsticos em pastas de corte - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Reten\u00e7\u00e3o e transfer\u00eancias -capability.UpdateTriggerDates.title=Atualizar datas de disparo -capability.ManuallyChangeDispositionDates.title=Alterar datas de reten\u00e7\u00e3o manualmente -capability.AuthorizeNominatedTransfers.title=Autorizar transfer\u00eancias nomeadas -capability.AuthorizeAllTransfers.title=Autorizar todas as transfer\u00eancias -capability.DestroyRecordsScheduledForDestruction.title=Destruir documento arquiv\u00edstico ou pasta de documento arquiv\u00edstico programado para destrui\u00e7\u00e3o -capability.DestroyRecords.title=Destruir documentos arquiv\u00edsticos -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 da espera -capability.ExtendRetentionPeriodOrFreeze.title=Estender per\u00edodo de reten\u00e7\u00e3o ou congelar -capability.Unfreeze.title=Descongelar -capability.ViewUpdateReasonsForFreeze.title=Visualizar motivos de atualiza\u00e7\u00e3o para congelar -capability.CreateHold.title=Criar espera -capability.AddToHold.title=Adicionar \u00e0 espera -capability.RemoveFromHold.title=Remover da espera -capability.FileHoldReport.title=Arquivar relat\u00f3rio de espera -capability.DeleteHold.title=Excluir espera -capability.EditHold.title=Editar espera - -# Audit -capability.group.audit.title=Auditoria -capability.DeclareAuditAsRecord.title=Declarar auditoria como documento arquiv\u00edstico -capability.EnableDisableAuditByTypes.title=Ativar Desativar auditoria por tipos -capability.DeleteAudit.title=Excluir auditoria -capability.SelectAuditMetadata.title=Selecionar metadados de auditoria -capability.AccessAudit.title=Acessar auditoria -capability.ExportAudit.title=Exportar auditoria - -# Security -capability.group.security.title=Seguran\u00e7a -capability.CreateModifyDestroyRoles.title=Criar Modificar Destruir fun\u00e7\u00f5es -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 - -# Configuration -capability.group.config.title=Configura\u00e7\u00e3o -capability.CreateModifyDestroyFileplanMetadata.title=Criar Modificar Destruir metadados de planos de arquivamento -capability.CreateModifyDestroyFileplanTypes.title=Criar Modificar Destruir tipos de planos de arquivamento -capability.CreateModifyDestroyRecordTypes.title=Criar Modificar Destruir tipos de documentos arquiv\u00edsticos -capability.CreateAndAssociateSelectionLists.title=Criar e Associar listas de sele\u00e7\u00e3o -capability.EditSelectionLists.title=Editar listas de sele\u00e7\u00e3o -capability.CreateModifyDestroyReferenceTypes.title=Criar Modificar Destruir tipos de refer\u00eancia -capability.AttachRulesToMetadataProperties.title=Anexar regras a propriedades de metadados -capability.MakeOptionalParametersMandatory.title=Tornar par\u00e2metros opcionais obrigat\u00f3rios -capability.MapEmailMetadata.title=Mapear metadados de e-mail - -# Rules -capability.group.rules.title=Regras -capability.ManageRules.title=Gerenciar regras diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties deleted file mode 100644 index e5f5356df9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=\u0417\u0430\u043f\u0438\u0441\u0438 -capability.DeclareRecords.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.ViewRecords.title=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.UndeclareRecords.title=\u041f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 -capability.CreateRecords.title=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.RequestRecordInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043f\u0438\u0441\u0438 -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 -capability.EditRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.EditDeclaredRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.EditNonRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -capability.MoveRecords.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 - -# Folder Control -capability.group.folderControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u043e\u0439 -capability.CreateModifyDestroyFolders.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\u0430\u043f\u043a\u0438 -capability.CloseFolders.title=\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0438 -capability.ReOpenFolders.title=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0438 -capability.DeclareRecordsInClosedFolders.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 -capability.FileVersionRecords.title=\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - -# Vital Records -capability.group.vitalRecords.title=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.UpdateVitalRecordCycleInformation.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0446\u0438\u043a\u043b\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.CycleVitalRecords.title=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 -capability.PlanningReviewCycles.title=\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 - -# 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 - -# Events -capability.group.events.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f -capability.CreateModifyDestroyEvents.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 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -capability.AddModifyEventDates.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 - -# 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 - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 -capability.UpdateTriggerDates.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 -capability.ManuallyChangeDispositionDates.title=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e -capability.AuthorizeNominatedTransfers.title=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b -capability.AuthorizeAllTransfers.title=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -capability.DestroyRecordsScheduledForDestruction.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0434 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 -capability.DestroyRecords.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 -capability.DeleteRecords.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0417\u0430\u043f\u0438\u0441\u044c -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 -capability.ExtendRetentionPeriodOrFreeze.title=\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c -capability.Unfreeze.title=\u041e\u0442\u043a\u0440\u0435\u043f\u0438\u0442\u044c -capability.ViewUpdateReasonsForFreeze.title=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0447\u0438\u043d \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f -capability.CreateHold.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 -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 - -# Audit -capability.group.audit.title=\u0410\u0443\u0434\u0438\u0442 -capability.DeclareAuditAsRecord.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c -capability.EnableDisableAuditByTypes.title=\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c/\u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 \u043f\u043e \u0442\u0438\u043f\u0430\u043c -capability.DeleteAudit.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 -capability.SelectAuditMetadata.title=\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 -capability.AccessAudit.title=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0443\u0434\u0438\u0442 -capability.ExportAudit.title=\u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0430\u0443\u0434\u0438\u0442\u0430 - -# Security -capability.group.security.title=\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c -capability.CreateModifyDestroyRoles.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 \u0440\u043e\u043b\u0438 -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 - -# Configuration -capability.group.config.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f -capability.CreateModifyDestroyFileplanMetadata.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 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 -capability.CreateModifyDestroyFileplanTypes.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 \u0442\u0438\u043f\u044b \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 -capability.CreateModifyDestroyRecordTypes.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 \u0442\u0438\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.CreateAndAssociateSelectionLists.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 -capability.EditSelectionLists.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 -capability.CreateModifyDestroyReferenceTypes.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 \u0442\u0438\u043f\u044b \u0441\u0441\u044b\u043b\u043e\u043a -capability.AttachRulesToMetadataProperties.title=\u041f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 -capability.MakeOptionalParametersMandatory.title=\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 -capability.MapEmailMetadata.title=\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b - -# Rules -capability.group.rules.title=\u041f\u0440\u0430\u0432\u0438\u043b\u0430 -capability.ManageRules.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties deleted file mode 100644 index 2100d81769..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties +++ /dev/null @@ -1,106 +0,0 @@ -# Records -capability.group.records.title=\u8bb0\u5f55 -capability.DeclareRecords.title=\u5b8c\u6210\u8bb0\u5f55 -capability.ViewRecords.title=\u67e5\u770b\u8bb0\u5f55 -capability.UndeclareRecords.title=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 -capability.CreateRecords.title=\u521b\u5efa\u8bb0\u5f55 -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 -capability.EditRecordMetadata.title=\u7f16\u8f91\u8bb0\u5f55\u5143\u6570\u636e -capability.EditDeclaredRecordMetadata.title=\u7f16\u8f91\u5b8c\u6210\u7684\u8bb0\u5f55\u5143\u6570\u636e -capability.EditNonRecordMetadata.title=\u7f16\u8f91\u975e\u8bb0\u5f55\u5143\u6570\u636e -capability.MoveRecords.title=\u79fb\u52a8\u8bb0\u5f55 - -# Folder Control -capability.group.folderControl.title=\u6587\u4ef6\u5939\u63a7\u5236 -capability.CreateModifyDestroyFolders.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u6587\u4ef6\u5939 -capability.CloseFolders.title=\u5173\u95ed\u6587\u4ef6\u5939 -capability.ReOpenFolders.title=\u91cd\u65b0\u6253\u5f00\u6587\u4ef6\u5939 -capability.DeclareRecordsInClosedFolders.title=\u5b8c\u6210\u5df2\u5173\u95ed\u6587\u4ef6\u5939\u4e2d\u7684\u8bb0\u5f55 -capability.FileVersionRecords.title=\u6587\u4ef6\u7248\u672c\u8bb0\u5f55 - -# Vital Records -capability.group.vitalRecords.title=\u6838\u5fc3\u8bb0\u5f55 -capability.UpdateVitalRecordCycleInformation.title=\u66f4\u65b0\u6838\u5fc3\u8bb0\u5f55\u5468\u671f\u4fe1\u606f -capability.CycleVitalRecords.title=\u5468\u671f\u6838\u5fc3\u8bb0\u5f55 -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 - -# Events -capability.group.events.title=\u4e8b\u4ef6 -capability.CreateModifyDestroyEvents.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u4e8b\u4ef6 -capability.AddModifyEventDates.title=\u6dfb\u52a0\u4fee\u6539\u4e8b\u4ef6\u65e5\u671f - -# Cutoff -capability.group.cutoff.title=\u4e2d\u65ad -capability.ApproveRecordsScheduledForCutoff.title=\u6279\u51c6\u8ba1\u5212\u8981\u4e2d\u65ad\u7684\u8bb0\u5f55 -capability.CreateModifyRecordsInCutoffFolders.title=\u5728\u4e2d\u65ad\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4fee\u6539\u8bb0\u5f55 - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=\u4fdd\u7559\u548c\u4f20\u8f93 -capability.UpdateTriggerDates.title=\u66f4\u65b0\u89e6\u53d1\u65e5\u671f -capability.ManuallyChangeDispositionDates.title=\u624b\u52a8\u66f4\u6539\u4fdd\u7559\u65e5\u671f -capability.AuthorizeNominatedTransfers.title=\u6388\u6743\u6307\u5b9a\u79fb\u4ea4 -capability.AuthorizeAllTransfers.title=\u6388\u6743\u6240\u6709\u79fb\u4ea4 -capability.DestroyRecordsScheduledForDestruction.title=\u9500\u6bc1\u8ba1\u5212\u8981\u9500\u6bc1\u7684\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 -capability.DestroyRecords.title=\u9500\u6bc1\u8bb0\u5f55 -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 -capability.ExtendRetentionPeriodOrFreeze.title=\u5ef6\u957f\u4fdd\u7559\u671f\u95f4\u6216\u4fdd\u5b58 -capability.Unfreeze.title=\u53d6\u6d88\u4fdd\u5b58 -capability.ViewUpdateReasonsForFreeze.title=\u67e5\u770b\u4fdd\u5b58\u7684\u66f4\u65b0\u539f\u56e0 -capability.CreateHold.title=\u521b\u5efa\u4fdd\u5b58 -capability.AddToHold.title=\u52a0\u5165\u4fdd\u5b58 -capability.RemoveFromHold.title=\u89e3\u9664\u4fdd\u5b58 -capability.FileHoldReport.title=\u7acb\u5377\u4fdd\u5b58\u62a5\u544a -capability.DeleteHold.title=\u5220\u9664\u4fdd\u5b58 -capability.EditHold.title=\u7f16\u8f91\u4fdd\u5b58 - -# Audit -capability.group.audit.title=\u5ba1\u8ba1 -capability.DeclareAuditAsRecord.title=\u5c06\u5ba1\u8ba1\u58f0\u660e\u4e3a\u8bb0\u5f55 -capability.EnableDisableAuditByTypes.title=\u6309\u7c7b\u578b\u542f\u7528\u3001\u7981\u7528\u5ba1\u8ba1 -capability.DeleteAudit.title=\u5220\u9664\u5ba1\u8ba1 -capability.SelectAuditMetadata.title=\u9009\u62e9\u5ba1\u8ba1\u5143\u6570\u636e -capability.AccessAudit.title=\u8bbf\u95ee\u5ba1\u8ba1 -capability.ExportAudit.title=\u5bfc\u51fa\u5ba1\u8ba1 - -# Security -capability.group.security.title=\u5b89\u5168\u6027 -capability.CreateModifyDestroyRoles.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u89d2\u8272 -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 - -# Configuration -capability.group.config.title=\u914d\u7f6e -capability.CreateModifyDestroyFileplanMetadata.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5f52\u7c7b\u65b9\u6848\u5143\u6570\u636e -capability.CreateModifyDestroyFileplanTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5f52\u7c7b\u65b9\u6848\u7c7b\u578b -capability.CreateModifyDestroyRecordTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u8bb0\u5f55\u7c7b\u578b -capability.CreateAndAssociateSelectionLists.title=\u521b\u5efa\u548c\u5173\u8054\u9009\u62e9\u5217\u8868 -capability.EditSelectionLists.title=\u7f16\u8f91\u9009\u62e9\u5217\u8868 -capability.CreateModifyDestroyReferenceTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u53c2\u8003\u7c7b\u578b -capability.AttachRulesToMetadataProperties.title=\u5c06\u89c4\u5219\u9644\u52a0\u81f3\u5143\u6570\u636e\u5c5e\u6027 -capability.MakeOptionalParametersMandatory.title=\u5c06\u53ef\u9009\u53c2\u6570\u53d8\u4e3a\u5fc5\u8981\u53c2\u6570 -capability.MapEmailMetadata.title=\u6620\u5c04\u7535\u5b50\u90ae\u4ef6\u5143\u6570\u636e - -# Rules -capability.group.rules.title=\u89c4\u5219 -capability.ManageRules.title=\u7ba1\u7406\u89c4\u5219 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service.properties deleted file mode 100644 index c0aac38e01..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=DOD 5015 Example Data \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_de.properties deleted file mode 100644 index f99603c665..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_de.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=DOD 5015 Beispieldaten diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_es.properties deleted file mode 100644 index 60e7165d64..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_es.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=Datos de ejemplo de DOD 5015 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_fr.properties deleted file mode 100644 index b2aece7538..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_fr.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=Exemple de donn\u00e9es DOD 5015 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_it.properties deleted file mode 100644 index 6d4e33635e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_it.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=Dati di esempio DOD 5015 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_ja.properties deleted file mode 100644 index a8ca256494..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_ja.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=DOD 5015 \u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nb.properties deleted file mode 100644 index b3c287fe07..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nl.properties deleted file mode 100755 index 626680e107..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nl.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=DOD 5015-voorbeeldgegevens diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_pt_BR.properties deleted file mode 100644 index eaa0279655..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_pt_BR.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=Exemplo de dados do DOD 5015 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_ru.properties deleted file mode 100644 index 8e4d107f36..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_ru.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 DOD 5015 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_zh_CN.properties deleted file mode 100644 index c0a60e1a1e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=DOD 5015 \u793a\u4f8b\u6570\u636e diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service.properties deleted file mode 100644 index 0c8921f747..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} is not a hold. -rm.hold.add-to-hold-invalid-type={0} isn't a record, a record folder or content. Only records, record folders or content can be added to a hold. -rm.hold.add-to-hold-archived-node=Archived content can't be added to a hold. -rm.hold.add-to-hold-locked-node=Locked content can't be added to a hold. -rm.hold.delete-frozen-node=Frozen content can't be deleted. -rm.hold.delete-node-frozen-children=Can't delete folder because it contains frozen content. -rm.hold.move-frozen-node=Frozen content can't be moved. -rm.hold.update-frozen-node=Frozen content can't be updated. -rm.hold.generic-permission-error=Can't delete hold, because you don't have the correct permissions for all the items within the hold. -rm.hold.detailed-permission-error=Can't delete hold, because filing permissions for at least the following items are needed: \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_de.properties deleted file mode 100644 index 234239759f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_de.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} ist kein Legal Hold. -rm.hold.add-to-hold-invalid-type={0} ist kein Record, Record-Ordner oder Inhalt. Nur Records, Record-Ordner und Inhalte k\u00f6nnen zu Legal Holds hinzugef\u00fcgt werden. -rm.hold.add-to-hold-archived-node=Archivierte Inhalte k\u00f6nnen nicht zu einem Legal Hold hinzugef\u00fcgt werden. -rm.hold.add-to-hold-locked-node=Gesperrte Inhalte k\u00f6nnen nicht zu einem Legal Hold hinzugef\u00fcgt werden. -rm.hold.delete-frozen-node=Fixierte Inhalte k\u00f6nnen nicht gel\u00f6scht werden. -rm.hold.delete-node-frozen-children=Der Ordner kann nicht gel\u00f6scht werden, weil er fixierte Inhalte enth\u00e4lt. -rm.hold.move-frozen-node=Fixierte Inhalte k\u00f6nnen nicht verschoben werden. -rm.hold.update-frozen-node=Fixierte Inhalte k\u00f6nnen nicht aktualisiert werden. -rm.hold.generic-permission-error=Legal Hold kann nicht gel\u00f6scht werden, weil Sie nicht die n\u00f6tigen Berechtigungen f\u00fcr alle Elemente im Legal Hold haben. -rm.hold.detailed-permission-error=Legal Hold kann nicht gel\u00f6scht werden, weil Sie dazu Ablageberechtigungen f\u00fcr mindestens die folgenden Elemente brauchen: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_es.properties deleted file mode 100644 index 89bae703e9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_es.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} no es una retenci\u00f3n legal. -rm.hold.add-to-hold-invalid-type={0} no es un documento de archivo, una carpeta de documentos de archivo ni un elemento de contenido. Solo los documentos de archivo, las carpetas de documentos de archivo y los elementos de contenido pueden a\u00f1adirse a una retenci\u00f3n legal. -rm.hold.add-to-hold-archived-node=El contenido archivado no puede a\u00f1adirse a una retenci\u00f3n legal. -rm.hold.add-to-hold-locked-node=El contenido bloqueado no puede a\u00f1adirse a una retenci\u00f3n legal. -rm.hold.delete-frozen-node=El contenido congelado no puede eliminarse. -rm.hold.delete-node-frozen-children=La carpeta no puede eliminarse porque contiene contenido congelado. -rm.hold.move-frozen-node=El contenido congelado no puede moverse. -rm.hold.update-frozen-node=El contenido congelado no puede actualizarse. -rm.hold.generic-permission-error=No puede eliminar la retenci\u00f3n legal porque no dispone de los permisos adecuados para todos los elementos en retenci\u00f3n legal. -rm.hold.detailed-permission-error=No puede eliminar la retenci\u00f3n legal porque es necesario disponer de permisos de archivado para al menos los siguientes elementos: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_fr.properties deleted file mode 100644 index 899249203a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_fr.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} n''est pas une suspension. -rm.hold.add-to-hold-invalid-type={0} n''est pas un document d''archive, un dossier de documents d''archives ou un contenu. Seuls les documents d''archives, dossiers de documents d''archives ou contenus peuvent \u00eatre ajout\u00e9s \u00e0 une suspension. -rm.hold.add-to-hold-archived-node=Impossible d'ajouter du contenu archiv\u00e9 \u00e0 une suspension. -rm.hold.add-to-hold-locked-node=Impossible d'ajouter du contenu verrouill\u00e9 \u00e0 une suspension. -rm.hold.delete-frozen-node=Impossible de supprimer du contenu gel\u00e9. -rm.hold.delete-node-frozen-children=Impossible de supprimer le dossier car il contient du contenu gel\u00e9. -rm.hold.move-frozen-node=Impossible de d\u00e9placer du contenu gel\u00e9. -rm.hold.update-frozen-node=Impossible de mettre \u00e0 jour du contenu gel\u00e9. -rm.hold.generic-permission-error=Impossible de supprimer la suspension car vous n'avez pas les droits requis pour tous les \u00e9l\u00e9ments qu'elle contient. -rm.hold.detailed-permission-error=Impossible de supprimer la suspension car les droits d'archivage pour les \u00e9l\u00e9ments suivants au moins sont requis\u00a0: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_it.properties deleted file mode 100644 index 8592ce1755..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_it.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} non \u00e8 una sospensione. -rm.hold.add-to-hold-invalid-type={0} non \u00e8 un record, una cartella di record o un contenuto. Solo i record, le cartelle dei record o i contenuti possono essere aggiunti a una sospensione. -rm.hold.add-to-hold-archived-node=I contenuti archiviati non possono essere aggiunti ad una sospensione. -rm.hold.add-to-hold-locked-node=I contenuti bloccati non possono essere aggiunti ad una sospensione. -rm.hold.delete-frozen-node=I contenuti congelati non possono essere eliminati. -rm.hold.delete-node-frozen-children=Impossibile eliminare la cartella poich\u00e9 contiene contenuti congelati. -rm.hold.move-frozen-node=I contenuti congelati non possono essere spostati. -rm.hold.update-frozen-node=I contenuti congelati non possono essere aggiornati. -rm.hold.generic-permission-error=Impossibile eliminare la sospensione. Non si possiedono i permessi corretti per tutti gli elementi contenuti nella sospensione. -rm.hold.detailed-permission-error=Impossibile eliminare la sospensione. Sono necessari i permessi di archiviazione per almeno i seguenti elementi: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_ja.properties deleted file mode 100644 index 0bd60704cb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_ja.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -rm.hold.add-to-hold-invalid-type={0} \u306f\u30ec\u30b3\u30fc\u30c9\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u3044\u305a\u308c\u3067\u3082\u3042\u308a\u307e\u305b\u3093\u3002\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0\u3067\u304d\u308b\u306e\u306f\u30ec\u30b3\u30fc\u30c9\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u307f\u3067\u3059\u3002 -rm.hold.add-to-hold-archived-node=\u30a2\u30fc\u30ab\u30a4\u30d6\u6e08\u307f\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.add-to-hold-locked-node=\u30ed\u30c3\u30af\u3055\u308c\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.delete-frozen-node=\u51cd\u7d50\u3055\u308c\u305f\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.delete-node-frozen-children=\u30d5\u30a9\u30eb\u30c0\u306b\u51cd\u7d50\u3055\u308c\u305f\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.move-frozen-node=\u51cd\u7d50\u3055\u308c\u305f\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u79fb\u52d5\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.update-frozen-node=\u51cd\u7d50\u3055\u308c\u305f\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.generic-permission-error=\u30db\u30fc\u30eb\u30c9\u5185\u306e\u3059\u3079\u3066\u306e\u30a2\u30a4\u30c6\u30e0\u306b\u5bfe\u3059\u308b\u9069\u5207\u306a\u6a29\u9650\u304c\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002 -rm.hold.detailed-permission-error=\u30db\u30fc\u30eb\u30c9\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002\u5c11\u306a\u304f\u3068\u3082\u6b21\u306e\u30a2\u30a4\u30c6\u30e0\u306e\u6574\u7406\u4fdd\u7ba1\u6a29\u9650\u304c\u5fc5\u8981\u3067\u3059: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_nb.properties deleted file mode 100644 index f6e7f49603..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_nb.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} er ikke et hold. -rm.hold.add-to-hold-invalid-type={0} er ikke en oppf\u00f8ring, en oppf\u00f8ringsmappe eller innhold. Kun oppf\u00f8ringer, oppf\u00f8ringsmapper eller innhold kan legges til i et hold. -rm.hold.add-to-hold-archived-node=Arkivert innhold kan ikke legges til et hold. -rm.hold.add-to-hold-locked-node=L\u00e5st innhold kan ikke legges til et hold. -rm.hold.delete-frozen-node=Frosset innhold kan ikke slettes. -rm.hold.delete-node-frozen-children=Kan ikke slette mappen fordi den inneholder frosset innhold. -rm.hold.move-frozen-node=Frosset innhold kan ikke flyttes. -rm.hold.update-frozen-node=Frosset innhold kan ikke oppdateres. -rm.hold.generic-permission-error=Kan ikke slette holdet, da du ikke har de riktige tillatelsene for alle elementene i holdet. -rm.hold.detailed-permission-error=Kan ikke slette holdet, fordi arkiveringstillatelser for minst f\u00f8lgende elementer er n\u00f8dvendig: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_nl.properties deleted file mode 100644 index 4c48f23a21..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_nl.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} is geen bewaring. -rm.hold.add-to-hold-invalid-type={0} is geen archiefstuk, archiefmap of content. Alleen archiefstukken, archiefmappen of content kunnen worden toegevoegd aan een bewaring. -rm.hold.add-to-hold-archived-node=Gearchiveerde content kan niet worden toegevoegd aan een bewaring. -rm.hold.add-to-hold-locked-node=Vergrendelde content kan niet worden toegevoegd aan een bewaring. -rm.hold.delete-frozen-node=Geblokkeerde content kan niet worden verwijderd. -rm.hold.delete-node-frozen-children=De map kan niet worden verwijderd omdat deze geblokkeerde content bevat. -rm.hold.move-frozen-node=Geblokkeerde content kan niet worden verplaatst. -rm.hold.update-frozen-node=Geblokkeerde content kan niet worden bijgewerkt. -rm.hold.generic-permission-error=Kan bewaring niet verwijderen, omdat u niet beschikt over de juiste rechten voor alle onderdelen in de bewaring. -rm.hold.detailed-permission-error=Kan bewaring niet verwijderen, omdat er alleen al voor de volgende onderdelen archiveringsrechten nodig zijn: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_pt_BR.properties deleted file mode 100644 index ec430f1af7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_pt_BR.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} n\u00e3o \u00e9 uma espera. -rm.hold.add-to-hold-invalid-type={0} n\u00e3o \u00e9 um documento arquiv\u00edstico, uma pasta de documento arquiv\u00edstico ou conte\u00fado. Somente documentos arquiv\u00edsticos, pastas de documentos arquiv\u00edsticos ou conte\u00fados podem ser adicionados a uma espera. -rm.hold.add-to-hold-archived-node=Conte\u00fado arquivado n\u00e3o pode ser adicionado a uma espera. -rm.hold.add-to-hold-locked-node=Conte\u00fado bloqueado n\u00e3o pode ser adicionado a uma espera. -rm.hold.delete-frozen-node=Conte\u00fado congelado n\u00e3o pode ser exclu\u00eddo. -rm.hold.delete-node-frozen-children=N\u00e3o \u00e9 poss\u00edvel excluir a pasta pois ela cont\u00e9m conte\u00fado congelado. -rm.hold.move-frozen-node=Conte\u00fado congelado n\u00e3o pode ser movido. -rm.hold.update-frozen-node=Conte\u00fado congelado n\u00e3o pode ser atualizado. -rm.hold.generic-permission-error=N\u00e3o \u00e9 poss\u00edvel excluir a espera porque voc\u00ea n\u00e3o tem as permiss\u00f5es corretas para todos os itens na espera. -rm.hold.detailed-permission-error=N\u00e3o \u00e9 poss\u00edvel excluir a espera porque s\u00e3o necess\u00e1rias permiss\u00f5es de arquivamento para os itens a seguir, no m\u00ednimo: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_ru.properties deleted file mode 100644 index 70d261aeaa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_ru.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. -rm.hold.add-to-hold-invalid-type={0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e, \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043b\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c. \u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043b\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u044b. -rm.hold.add-to-hold-archived-node=\u0410\u0440\u0445\u0438\u0432\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. -rm.hold.add-to-hold-locked-node=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. -rm.hold.delete-frozen-node=\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043e. -rm.hold.delete-node-frozen-children=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0443, \u0442. \u043a. \u0432 \u043d\u0435\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. -rm.hold.move-frozen-node=\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u043e. -rm.hold.update-frozen-node=\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e. -rm.hold.generic-permission-error=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. -rm.hold.detailed-permission-error=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f: diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_zh_CN.properties deleted file mode 100644 index 7a337e0cb7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/hold-service_zh_CN.properties +++ /dev/null @@ -1,10 +0,0 @@ -rm.hold.not-hold={0} \u4e0d\u662f\u4fdd\u5b58\u3002 -rm.hold.add-to-hold-invalid-type={0} \u4e0d\u662f\u8bb0\u5f55\u3001\u8bb0\u5f55\u6587\u4ef6\u5939\u6216\u5185\u5bb9\u3002\u53ea\u6709\u8bb0\u5f55\u3001\u8bb0\u5f55\u6587\u4ef6\u5939\u6216\u5185\u5bb9\u53ef\u4ee5\u6dfb\u52a0\u5230\u4fdd\u5b58\u4e2d\u3002 -rm.hold.add-to-hold-archived-node=\u5df2\u5b58\u6863\u5185\u5bb9\u65e0\u6cd5\u6dfb\u52a0\u5230\u4fdd\u5b58\u4e2d\u3002 -rm.hold.add-to-hold-locked-node=\u9501\u5b9a\u5185\u5bb9\u65e0\u6cd5\u6dfb\u52a0\u5230\u4fdd\u5b58\u4e2d\u3002 -rm.hold.delete-frozen-node=\u65e0\u6cd5\u5220\u9664\u5df2\u5173\u95ed\u5185\u5bb9\u3002 -rm.hold.delete-node-frozen-children=\u65e0\u6cd5\u5220\u9664\u6587\u4ef6\u5939\uff0c\u56e0\u4e3a\u5176\u5305\u542b\u5df2\u5173\u95ed\u5185\u5bb9\u3002 -rm.hold.move-frozen-node=\u65e0\u6cd5\u79fb\u52a8\u5df2\u5173\u95ed\u5185\u5bb9\u3002 -rm.hold.update-frozen-node=\u65e0\u6cd5\u66f4\u65b0\u5df2\u5173\u95ed\u5185\u5bb9\u3002 -rm.hold.generic-permission-error=\u65e0\u6cd5\u5220\u9664\u4fdd\u5b58\uff0c\u56e0\u4e3a\u60a8\u5bf9\u4fdd\u5b58\u4e2d\u7684\u6240\u6709\u9879\u76ee\u6ca1\u6709\u9002\u5f53\u6743\u9650\u3002 -rm.hold.detailed-permission-error=\u65e0\u6cd5\u5220\u9664\u4fdd\u5b58\uff0c\u56e0\u4e3a\u81f3\u5c11\u9700\u8981\u4ee5\u4e0b\u9879\u76ee\u7684\u5f52\u6863\u6743\u9650\uff1a diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties deleted file mode 100644 index 5ba8e758ce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Records due for Review Notification -notification.superseded.subject=Record Superseded Notification -notification.rejected.subject=Record Rejected Notification \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties deleted file mode 100644 index c8cb23326f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Benachrichtigung bei Records mit f\u00e4lliger \u00dcberpr\u00fcfung -notification.superseded.subject=Benachrichtigung bei abgel\u00f6stem Record -notification.rejected.subject=Benachrichtigung bei abgelehntem Record diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties deleted file mode 100644 index 4c3b63ccf5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Documentos de archivo pendientes de notificaci\u00f3n de revisi\u00f3n -notification.superseded.subject=Notificaci\u00f3n de documento de archivo reemplazada -notification.rejected.subject=Notificaci\u00f3n de documento de archivo rechazada diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties deleted file mode 100644 index 4a1ce78a26..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Documents d'archives arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification -notification.superseded.subject=Le document d'archives a remplac\u00e9 la notification -notification.rejected.subject=Le document d'archives a rejet\u00e9 la notification diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties deleted file mode 100644 index 0564d2183b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Notifica record da esaminare -notification.superseded.subject=Notifica record sostituito -notification.rejected.subject=Notifica record respinto diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties deleted file mode 100644 index e61c89274e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u30ec\u30b3\u30fc\u30c9\u306e\u901a\u77e5 -notification.superseded.subject=\u30ec\u30b3\u30fc\u30c9\u306e\u5dee\u3057\u66ff\u3048\u901a\u77e5 -notification.rejected.subject=\u30ec\u30b3\u30fc\u30c9\u306e\u5374\u4e0b\u901a\u77e5 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties deleted file mode 100644 index 8717c04858..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties deleted file mode 100755 index a1ac55a266..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Melding Archiefstukken gereed voor revisie -notification.superseded.subject=Melding Archiefstuk vervangen -notification.rejected.subject=Melding Archiefstuk geweigerd diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties deleted file mode 100644 index 3e4e0ac2cf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Notifica\u00e7\u00e3o de prazo para revis\u00e3o de documentos arquiv\u00edsticos -notification.superseded.subject=Notifica\u00e7\u00e3o de documento arquiv\u00edstico substitu\u00eddo -notification.rejected.subject=Notifica\u00e7\u00e3o de documento arquiv\u00edstico rejeitado diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties deleted file mode 100644 index e3df4c625d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 -notification.superseded.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043c\u0435\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -notification.rejected.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties deleted file mode 100644 index e4284b9ed9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=\u8bb0\u5f55\u5ba1\u67e5\u5230\u671f\u901a\u77e5 -notification.superseded.subject=\u8bb0\u5f55\u88ab\u53d6\u4ee3\u901a\u77e5 -notification.rejected.subject=\u8bb0\u5f55\u88ab\u62d2\u7edd\u901a\u77e5 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties deleted file mode 100644 index 8eee213054..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=You can only file records to a record folder. -rm.service.update-disposition-action-def=You can't update the retention action definition because changes made to the retention schedule are being saved. Try again in a few minutes. -rm.service.set-id=You can't change the ID of {0} because it's read-only. -rm.service.path-node=We couldn't find {0}. Try refreshing your browser or contact your I.T. Dept. -rm.service.invalid-rm-node=The records management node isn't valid because the aspect {0} isn't present. -rm.service.no-root=We couldn't find the records management root. Try filing the record again. -rm.service.dup-root=You can't create a file plan here as there's already one created in this folder hierarchy. -rm.service.root-type=We can't create the file plan because type {0} isn't a sub-type of rma:filePlan. Try again using a different type. -rm.service.container-parent-type=You can only create a record category at the top level of the file plan or in another record category (rma:recordCategory). -rm.service.container-type=You can only create a record category at the top level of the file plan or in another record category (rma:recordsManagementContainer or sub-type). -rm.service.container-expected=You can only find record category contents in a record category (rma:recordCategory or sub-type). -rm.service.record-folder-expected=The action can only be completed using a record folder of type rma:recordFolder. -rm.service.parent-record-folder-root=You can't create a record folder here. Try creating it in a record category. -rm.service.parent-record-folder-type=You can't create a record folder here. Try creating it in a record category. -rm.service.record-folder-type=We can't create record folder unless you use the type rma:recordFolder or a sub-type. -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 record type {1} is already showing for record {0}. -rm.service.final-version=Final -rm.service.final-version-description=The final archived record version -rm.service.enable-autoversion-on-record-creation=Auto Version on Record Creation -rm.service.add-children-to-closed-record-folder=You can't add new items to a closed record folder. -rm.service.add-children-to-frozen-record-folder=You can't add new items to a frozen record folder. -rm.service.update-record-content=You can't update a record's content property. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties deleted file mode 100644 index a9b7889e6b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=Records k\u00f6nnen nur in einem Record-Ordner abgelegt werden. -rm.service.update-disposition-action-def=Sie k\u00f6nnen die Definition der Aufbewahrungsaktion nicht aktualisieren, da \u00c4nderungen am Aufbewahrungsplan gespeichert werden. Versuchen Sie es in ein paar Minuten erneut. -rm.service.set-id=Sie k\u00f6nnen die ID von {0} nicht \u00e4ndern (schreibgesch\u00fctzt). -rm.service.path-node=''{0}'' wurde nicht gefunden. Aktualisieren Sie Ihren Browser, um es noch einmal zu versuchen, oder kontakten Sie Ihre IT-Abteilung. -rm.service.invalid-rm-node=Der Records-Management-Node ist ung\u00fcltig, da der Aspekt {0} nicht vorhanden ist. -rm.service.no-root=Records Management Root wurde nicht gefunden. Versuchen Sie, den Record erneut abzulegen. -rm.service.dup-root=Sie k\u00f6nnen hier keinen Ablageplan erstellen, da bereits einer in dieser Ordnerhierarchie erstellt wurde. -rm.service.root-type=Ablageplan kann nicht erstellt werden, da Typ {0} ein Subtyp von rma:filePlan ist. Versuchen Sie es mit einem anderen Typ. -rm.service.container-parent-type=Eine Record-Kategorie kann nur auf oberster Ebene des Ablageplans oder in einer anderen Record-Kategorie (rma:recordCategory) erstellt werden. -rm.service.container-type=Eine Record-Kategorie kann nur auf oberster Ebene des Ablageplans oder in einer anderen Record-Kategorie (rma:recordsManagementContainer oder Subtyp) erstellt werden. -rm.service.container-expected=Inhalte einer Record-Kategorie k\u00f6nnen nur in einer Record-Kategorie (rma:recordCategory oder Subtyp) gefunden werden. -rm.service.record-folder-expected=Die Aktion kann nur \u00fcber einen Record-Ordner vom Typ rma:recordFolder abgeschlossen werden. -rm.service.parent-record-folder-root=Sie k\u00f6nnen hier keinen Record-Ordner erstellen. Versuchen Sie, diesen in einer Record-Kategorie zu erstellen. -rm.service.parent-record-folder-type=Sie k\u00f6nnen hier keinen Record-Ordner erstellen. Versuchen Sie, diesen in einer Record-Kategorie zu erstellen. -rm.service.record-folder-type=Record-Ordner kann erst erstellt werden, wenn Sie den Typ rma:recordFolder oder einen Subtyp verwenden. -rm.service.not-record=Node {0} ist kein Record. -rm.service.vital-def-missing=Definitionsaspekt von besonders relevantem Record ist auf dem Node 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=Record-Typ {1} wird bereits f\u00fcr Record {0} angezeigt. -rm.service.final-version=Endg\u00fcltig -rm.service.final-version-description=Die endg\u00fcltige archivierte Version des Records -rm.service.enable-autoversion-on-record-creation=Automatische Versionsnummer bei Record-Erstellung -rm.service.add-children-to-closed-record-folder=Sie k\u00f6nnen keine neuen Elemente zu einem geschlossenen Record-Ordner hinzuf\u00fcgen. -rm.service.add-children-to-frozen-record-folder=Sie k\u00f6nnen keine neuen Elemente zu einem fixierten Record-Ordner hinzuf\u00fcgen. -rm.service.update-record-content=Sie k\u00f6nnen die Inhaltseigenschaft eines Records nicht aktualisieren. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties deleted file mode 100644 index 37afe57ce0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=Solo puede archivar documentos de archivo en una carpeta de documentos de archivo. -rm.service.update-disposition-action-def=No se puede actualizar la definici\u00f3n de acci\u00f3n de retenci\u00f3n porque los cambios hechos en la planificaci\u00f3n de retenci\u00f3n se est\u00e1n guardando. Vuelva a intentarlo despu\u00e9s de unos minutos. -rm.service.set-id=No se puede cambiar el ID de {0} porque es de solo lectura. -rm.service.path-node=No se pudo encontrar {0}. Trate de actualizar el navegador o p\u00f3ngase en contacto con el dep. de TI. -rm.service.invalid-rm-node=El nodo de Records Management no es v\u00e1lido porque el aspecto {0} no est\u00e1 presente. -rm.service.no-root=No se pudo encontrar la ra\u00edz de Records Management. Trate de archivar el documento de archivo de nuevo. -rm.service.dup-root=No se puede crear un cuadro de clasificaci\u00f3n aqu\u00ed porque ya hay uno creado en esta jerarqu\u00eda de carpetas. -rm.service.root-type=No se puede crear el cuadro de clasificaci\u00f3n porque el tipo {0} no es un subtipo de rma:filePlan. Vuelva a intentarlo usando un tipo diferente. -rm.service.container-parent-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del cuadro de clasificaci\u00f3n o en otra categor\u00eda de documentos de archivo (rma:recordCategory). -rm.service.container-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del cuadro de clasificaci\u00f3n o en otra categor\u00eda de documentos de archivo (rma:recordsManagementContainer o subtipo). -rm.service.container-expected=Solo puede encontrar contenidos de categor\u00eda de documentos de archivo en una categor\u00eda de documentos de archivo (rma:recordCategory o subtipo). -rm.service.record-folder-expected=La acci\u00f3n solo puede completarse usando una carpeta de documentos de archivo del tipo rma:recordFolder. -rm.service.parent-record-folder-root=No se puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo. -rm.service.parent-record-folder-type=No se puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo. -rm.service.record-folder-type=No se puede crear una carpeta de documentos de archivo a menos que use el tipo rma:recordFolder o un subtipo. -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 tipo de documento de archivo {1} ya se est\u00e1 mostrando para el documento de archivo {0}. -rm.service.final-version=Final -rm.service.final-version-description=La versi\u00f3n final del documento de archivo archivado -rm.service.enable-autoversion-on-record-creation=Versi\u00f3n autom\u00e1tica al crear documento de archivo -rm.service.add-children-to-closed-record-folder=No se pueden a\u00f1adir elementos nuevos a una carpeta de documentos de archivo cerrada. -rm.service.add-children-to-frozen-record-folder=No se pueden a\u00f1adir elementos nuevos a una carpeta de documentos de archivo congelada. -rm.service.update-record-content=No se puede actualizar una propiedad de contenido de un documento de archivo. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties deleted file mode 100644 index 71bca56af1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=Les documents d'archives peuvent \u00eatre class\u00e9s uniquement dans un dossier d'archives. -rm.service.update-disposition-action-def=Impossible de mettre \u00e0 jour la d\u00e9finition de l'action de conservation, car des modifications de la r\u00e8gle de conservation sont en cours d'enregistrement. R\u00e9essayez dans quelques minutes. -rm.service.set-id=Impossible de modifier l''ID de {0}, car cet \u00e9l\u00e9ment est en lecture seule. -rm.service.path-node={0} est introuvable. Essayez d''actualiser votre navigateur ou contactez votre DSI. -rm.service.invalid-rm-node=Le n\u0153ud de gestion des archives n''est pas valide, car l''aspect {0} n''est pas pr\u00e9sent. -rm.service.no-root=La racine du site de gestion des archives est introuvable. Essayez d'archiver \u00e0 nouveau le document d'archives. -rm.service.dup-root=Impossible de cr\u00e9er un plan de classement ici, car il en existe d\u00e9j\u00e0 un dans cette hi\u00e9rarchie de dossiers. -rm.service.root-type=Impossible de cr\u00e9er le plan de classement, car le type {0} n''est pas un sous-type de rma:filePlan. R\u00e9essayez avec un type diff\u00e9rent. -rm.service.container-parent-type=Une cat\u00e9gorie de document d'archives peut \u00eatre cr\u00e9\u00e9e uniquement au niveau sup\u00e9rieur du plan de classement ou dans une autre cat\u00e9gorie de document d'archives (rma:recordCategory). -rm.service.container-type=Une cat\u00e9gorie de document d'archives peut \u00eatre cr\u00e9\u00e9e uniquement au niveau sup\u00e9rieur du plan de classement ou dans une autre cat\u00e9gorie de document d'archives (rma:recordsManagementContainer ou sous-type). -rm.service.container-expected=Vous trouverez des contenus de cat\u00e9gorie de document d'archives uniquement dans une cat\u00e9gorie de document d'archives (rma:recordCategory ou sous-type). -rm.service.record-folder-expected=L'action peut \u00eatre effectu\u00e9e uniquement avec un dossier d'archives de type rma:recordFolder. -rm.service.parent-record-folder-root=Impossible de cr\u00e9er un dossier d'archives ici. Essayez de le cr\u00e9er dans une cat\u00e9gorie de document d'archives. -rm.service.parent-record-folder-type=Impossible de cr\u00e9er un dossier d'archives ici. Essayez de le cr\u00e9er dans une cat\u00e9gorie de document d'archives. -rm.service.record-folder-type=Impossible de cr\u00e9er un dossier d'archives \u00e0 moins d'utiliser le type rma:recordFolder ou un sous-type. -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 type de document d''archives {1} est d\u00e9j\u00e0 affich\u00e9 pour le document d''archives {0}. -rm.service.final-version=Finale -rm.service.final-version-description=Version finale du document archiv\u00e9 -rm.service.enable-autoversion-on-record-creation=Version automatique lors de la cr\u00e9ation du document d'archives -rm.service.add-children-to-closed-record-folder=Impossible d'ajouter de nouveaux \u00e9l\u00e9ments \u00e0 un dossier d'archives ferm\u00e9. -rm.service.add-children-to-frozen-record-folder=Impossible d'ajouter de nouveaux \u00e9l\u00e9ments \u00e0 un dossier de documents d'archives gel\u00e9. -rm.service.update-record-content=Impossible de mettre \u00e0 jour la propri\u00e9t\u00e9 de contenu d'un document d'archives. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties deleted file mode 100644 index 8a309cde89..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=\u00c8 possibile archiviare i record solo in cartelle di record. -rm.service.update-disposition-action-def=Impossibile aggiornare la definizione dell'azione di conservazione poich\u00e9 le modifiche effettuate al programma di conservazione vengono salvate. Riprovare tra alcuni minuti. -rm.service.set-id=Impossibile modificare l''ID di {0} poich\u00e9 \u00e8 di sola lettura. -rm.service.path-node=Impossibile trovare {0}. Provare ad aggiornare il browser o contattare il proprio dipartimento I.T. -rm.service.invalid-rm-node=Il nodo di gestione dei record non \u00e8 valido poich\u00e9 l''aspetto {0} non \u00e8 presente. -rm.service.no-root=Impossibile trovare la radice di Records Management. Provare ad archiviare nuovamente il record. -rm.service.dup-root=Impossibile creare un piano di fascicolazione qui poich\u00e9 nella gerarchia di questa cartella ne \u00e8 gi\u00e0 stato creato uno. -rm.service.root-type=Impossibile creare il piano di fascicolazione poich\u00e9 il tipo {0} non \u00e8 un sottotipo di rma:filePlan. Prova ancora usando un dipo differente. -rm.service.container-parent-type=\u00c8 possibile solo creare una categoria record nel livello superiore del piano di fascicolazione o in un'altra categoria record (rma:recordCategory). -rm.service.container-type=\u00c8 possibile solo creare una categoria record nel livello superiore del piano di fascicolazione o in un'altra categoria record (rma:recordsManagementContainer o sottotipo). -rm.service.container-expected=\u00c8 possibile trovare i contenuti di una categoria record solo in una categoria record (rma:recordCategory o sottotipo). -rm.service.record-folder-expected=L'azione pu\u00f2 essere completata solo utilizzando una cartella di record del tipo rma:recordFolder. -rm.service.parent-record-folder-root=Impossibile creare una cartella di record qui. Provare a crearla in un'altra categoria record. -rm.service.parent-record-folder-type=Impossibile creare una cartella di record qui. Provare a crearla in un'altra categoria record. -rm.service.record-folder-type=Impossibile creare una cartella di record a meno che si utilizzi il tipo rma:recordFolder o un sottotipo. -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 tipo di record {1} sta gi\u00e0 visualizzando per il record {0}. -rm.service.final-version=Finale -rm.service.final-version-description=Versione del record archiviata finale -rm.service.enable-autoversion-on-record-creation=Versione automatica sulla creazione del record -rm.service.add-children-to-closed-record-folder=Impossibile aggiungere nuovi elementi a una cartella di record chiusa. -rm.service.add-children-to-frozen-record-folder=Impossibile aggiungere nuovi elementi a una cartella di record congelata. -rm.service.update-record-content=Impossibile aggiornare la propriet\u00e0 del contenuto di un record. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties deleted file mode 100644 index b9c8204bfa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1\u5148\u306b\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3067\u3059\u3002 -rm.service.update-disposition-action-def=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u5909\u66f4\u3092\u4fdd\u5b58\u4e2d\u306e\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u3092\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 \u6570\u5206\u5f8c\u306b\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.set-id=''{0}'' \u306f\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u305f\u3081\u3001ID \u3092\u5909\u66f4\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.path-node=''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 \u30d6\u30e9\u30a6\u30b6\u3092\u518d\u8aad\u307f\u8fbc\u307f\u3059\u308b\u304b\u3001IT \u62c5\u5f53\u8005\u306b\u9023\u7d61\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.invalid-rm-node=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30ce\u30fc\u30c9\u306b\u306f\u30a2\u30b9\u30da\u30af\u30c8 ''{0}'' \u304c\u306a\u3044\u305f\u3081\u3001\u7121\u52b9\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 \u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.dup-root=\u3053\u306e\u30d5\u30a9\u30eb\u30c0\u968e\u5c64\u306b\u306f\u3059\u3067\u306b\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u304c 1 \u3064\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.root-type=\u30bf\u30a4\u30d7 ''{0}'' \u306f rma:filePlan \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 \u5225\u306e\u30bf\u30a4\u30d7\u3092\u4f7f\u3063\u3066\u3001\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.container-parent-type=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u6700\u4e0a\u4f4d\u304b\u3001\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordCategory) \u5185\u306b\u3057\u304b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.container-type=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u6700\u4e0a\u4f4d\u304b\u3001\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordsManagementContainer or sub-type) \u5185\u306b\u3057\u304b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.container-expected=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordCategory or sub-type) \u5185\u3067\u3057\u304b\u691c\u7d22\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.record-folder-expected=\u3053\u306e\u51e6\u7406\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u3001rma:recordFolder \u30bf\u30a4\u30d7\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -rm.service.parent-record-folder-root=\u3053\u3053\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u5185\u3067\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.parent-record-folder-type=\u3053\u3053\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u5185\u3067\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.record-folder-type=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001rma:recordFolder \u30bf\u30a4\u30d7\u307e\u305f\u306f\u30b5\u30d6\u30bf\u30a4\u30d7\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -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.close-record-folder-not-folder=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u3057\u3066\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u9589\u3058\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={0}) -rm.service.node-has-aspect=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7 ''{1}'' \u306f\u3059\u3067\u306b\u30ec\u30b3\u30fc\u30c9 ''{0}'' \u306e\u3082\u306e\u3068\u3057\u3066\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002 -rm.service.final-version=\u6700\u7d42\u7248 -rm.service.final-version-description=\u30ec\u30b3\u30fc\u30c9\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u6e08\u307f\u6700\u7d42\u30d0\u30fc\u30b8\u30e7\u30f3 -rm.service.enable-autoversion-on-record-creation=\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210\u6642\u306b\u81ea\u52d5\u30d0\u30fc\u30b8\u30e7\u30cb\u30f3\u30b0\u3092\u884c\u3046 -rm.service.add-children-to-closed-record-folder=\u9589\u3058\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u65b0\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u306f\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.add-children-to-frozen-record-folder=\u51cd\u7d50\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u65b0\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.update-record-content=\u30ec\u30b3\u30fc\u30c9\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties deleted file mode 100644 index c1f30730b2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=Du kan bare arkivere oppf\u00f8ringer i en oppf\u00f8ringsmappe. -rm.service.update-disposition-action-def=Definisjonen av retensjonshandlingen kan ikke oppdateres fordi endringene som ble gjort i retensjonsplanen lagres. Pr\u00f8v igjen om noen f\u00e5 minutter. -rm.service.set-id=ID-en til {0} kan ikke endres fordi den er skrivebeskyttet. -rm.service.path-node=Kunne ikke finne {0}. Pr\u00f8v \u00e5 oppdatere nettleseren, eller kontakt din IT- avdeling. -rm.service.invalid-rm-node=Oppf\u00f8ringsh\u00e5ndteringsnoden er ikke gyldig fordi aspektet {0} ikke finnes. -rm.service.no-root=Kunne ikke finne oppf\u00f8ringsh\u00e5ndteringsroten. Fors\u00f8k \u00e5 registrere oppf\u00f8ringen p\u00e5 nytt. -rm.service.dup-root=En filplan kan ikke opprettes her fordi det finnes allerede en filplan i dette mappehierarkiet. -rm.service.root-type=Kunne ikke opprette en filplan fordi typen {0} er ikke en undertype av rma:filePlan. Pr\u00f8v igjen med en annen type. -rm.service.container-parent-type=Du kan bare opprette en oppf\u00f8ringskategori p\u00e5 filplanens toppniv\u00e5 eller i en annen oppf\u00f8ringskategori (rma:recordCategory). -rm.service.container-type=Du kan bare opprette en oppf\u00f8ringskategori p\u00e5 filplanens toppniv\u00e5 eller i en annen oppf\u00f8ringskategori (rma:recordsManagementContainer eller undertype). -rm.service.container-expected=Du finner bare innholdet til overf\u00f8ringskategorien i en oppf\u00f8ringskategori (rma:recordCategory eller undertype). -rm.service.record-folder-expected=Handlingen kan bare fullf\u00f8resmed en oppf\u00f8ringsmappe av typen rma:recordFolder. -rm.service.parent-record-folder-root=En oppf\u00f8ringsmappen kan ikke opprettes her. Pr\u00f8v \u00e5 opprette den i en oppf\u00f8ringskategori. -rm.service.parent-record-folder-type=En oppf\u00f8ringsmappen kan ikke opprettes her. Pr\u00f8v \u00e5 opprette den i en oppf\u00f8ringskategori. -rm.service.record-folder-type=Det kan ikke opprettes en oppf\u00f8ringsmappe med mindre du bruker typen rma:recordFolder eller en undertype. -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=Oppf\u00f8ringstypen {1} vises allerede i oppf\u00f8ringen {0}. -rm.service.final-version=Endelig -rm.service.final-version-description=Den endelig arkiverte oppf\u00f8ringsversjonen -rm.service.enable-autoversion-on-record-creation=Automatisk versjon om opprettelse av oppf\u00f8ringer -rm.service.add-children-to-closed-record-folder=Nye elementer kan ikke legges til en lukket oppf\u00f8ringsmappe. -rm.service.add-children-to-frozen-record-folder=Nye elementer kan ikke legges til en frosset oppf\u00f8ringsmappe. -rm.service.update-record-content=Innholdsegenskapen til en oppf\u00f8ring kan ikke oppdateres. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties deleted file mode 100755 index 44a763e38a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=U kunt archiefstukken alleen archiveren in een archiefmap. -rm.service.update-disposition-action-def=U kunt de definitie van de retentieactie niet bijwerken omdat er wijzigingen in het retentieschema worden opgeslagen. Probeer het over een paar minuten opnieuw. -rm.service.set-id=U kunt de id van {0} niet wijzigen omdat dit de eigenschap Alleen-lezen heeft. -rm.service.path-node=Kan {0} niet vinden. Vernieuw de browser of neem contact op met uw IT- afdeling -rm.service.invalid-rm-node=De node voor Records Management is niet geldig omdat het aspect {0} niet aanwezig is. -rm.service.no-root=Kan de Records Management-oorsprong niet vinden. Probeer het archiefstuk opnieuw te archiveren. -rm.service.dup-root=U kunt hier geen ordeningsplan maken omdat er al een is gemaakt in deze maphi\u00ebrarchie. -rm.service.root-type=Kan het ordeningsplan niet maken omdat type {0} geen subtype is van rma:filePlan. Probeer het opnieuw met een ander type. -rm.service.container-parent-type=U kunt alleen een archiefstukcategorie maken op het hoogste niveau van het ordeningsplan of in een andere archiefstukcategorie (rma:recordCategory). -rm.service.container-type=U kunt alleen een archiefstukcategorie maken op het hoogste niveau van het ordeningsplan of in een andere archiefstukcategorie (rma:recordsManagementContainer of subtype). -rm.service.container-expected=U kunt alleen archiefstukcategoriecontent vinden in een archiefstukcategorie (rma:recordCategory of subtype). -rm.service.record-folder-expected=De actie kan alleen worden afgerond met behulp van een archiefmap van het type rma:recordFolder. -rm.service.parent-record-folder-root=U kunt hier geen archiefmap maken. Probeer de map te maken in een archiefstukcategorie. -rm.service.parent-record-folder-type=U kunt hier geen archiefmap maken. Probeer de map te maken in een archiefstukcategorie. -rm.service.record-folder-type=Kan geen archiefmap maken tenzij u het type rma:recordFolder of een subtype gebruikt. -rm.service.not-record=De node {0} is geen archiefstuk. -rm.service.vital-def-missing=Definitie-aspect van vitaal archiefstuk 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=Het archiefstuktype {1} wordt al weergegeven voor archiefstuk {0}. -rm.service.final-version=Definitief -rm.service.final-version-description=De definitieve gearchiveerde archiefstukversie -rm.service.enable-autoversion-on-record-creation=Automatische versie bij maken van archiefstuk -rm.service.add-children-to-closed-record-folder=U kunt geen nieuwe onderdelen toevoegen aan een gesloten archiefmap. -rm.service.add-children-to-frozen-record-folder=U kunt geen nieuwe onderdelen toevoegen aan een geblokkeerde archiefmap. -rm.service.update-record-content=U kunt de contenteigenschap van een archiefstuk niet bijwerken. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties deleted file mode 100644 index 5e4e515693..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=\u00c9 poss\u00edvel arquivar somente documentos arquiv\u00edsticos em uma pasta de documentos arquiv\u00edsticos. -rm.service.update-disposition-action-def=N\u00e3o \u00e9 poss\u00edvel atualizar a defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o, pois as altera\u00e7\u00f5es feitas na programa\u00e7\u00e3o de reten\u00e7\u00e3o est\u00e3o sendo salvas. Tente novamente em alguns minutos. -rm.service.set-id=N\u00e3o \u00e9 poss\u00edvel alterar o ID de {0}, pois \u00e9 somente leitura. -rm.service.path-node=N\u00e3o foi poss\u00edvel localizar {0}. Tente atualizar seu navegador ou entre em contato com o Dept. de TI. -rm.service.invalid-rm-node=O n\u00f3 do Records Management n\u00e3o \u00e9 v\u00e1lido, pois o aspecto {0} n\u00e3o est\u00e1 presente. -rm.service.no-root=N\u00e3o foi poss\u00edvel localizar a raiz do Records Management. Tente arquivar o documento arquiv\u00edstico novamente. -rm.service.dup-root=N\u00e3o \u00e9 poss\u00edvel criar um plano de arquivamento aqui, pois j\u00e1 h\u00e1 um criado nessa hierarquia de pastas. -rm.service.root-type=N\u00e3o \u00e9 poss\u00edvel criar o plano de arquivamento, pois o tipo {0} n\u00e3o \u00e9 um subtipo de rma:filePlan. Tente novamente usando um tipo diferente. -rm.service.container-parent-type=Voc\u00ea s\u00f3 pode criar uma categoria de documento arquiv\u00edstico no n\u00edvel superior do plano de arquivamento ou em outra categoria de documento arquiv\u00edstico (rma:recordCategory). -rm.service.container-type=Voc\u00ea s\u00f3 pode criar uma categoria de documento arquiv\u00edstico no n\u00edvel superior do plano de arquivamento ou em outra categoria de documento arquiv\u00edstico (rma:recordsManagementContainer ou subtipo). -rm.service.container-expected=Voc\u00ea s\u00f3 pode encontrar conte\u00fado de categoria de documento arquiv\u00edstico em uma categoria de documento arquiv\u00edstico (rma:recordCategory ou subtipo). -rm.service.record-folder-expected=A a\u00e7\u00e3o somente pode ser conclu\u00edda usando uma pasta de documento arquiv\u00edstico do tipo rma:recordFolder. -rm.service.parent-record-folder-root=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico aqui. Tente cri\u00e1-la em uma categoria de documento arquiv\u00edstico. -rm.service.parent-record-folder-type=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico aqui. Tente cri\u00e1-la em uma categoria de documento arquiv\u00edstico. -rm.service.record-folder-type=N\u00e3o podemos criar uma pasta de documento arquiv\u00edstico, a menos que voc\u00ea use o tipo rma:recordFolder ou um subtipo. -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 tipo de documento arquiv\u00edstico {1} j\u00e1 est\u00e1 sendo mostrado para o documento arquiv\u00edstico {0}. -rm.service.final-version=Final -rm.service.final-version-description=A vers\u00e3o do documento arquiv\u00edstico arquivado final -rm.service.enable-autoversion-on-record-creation=Vers\u00e3o autom\u00e1tica na cria\u00e7\u00e3o de documento arquiv\u00edstico -rm.service.add-children-to-closed-record-folder=N\u00e3o \u00e9 poss\u00edvel adicionar novos itens a uma pasta fechada de documento arquiv\u00edstico. -rm.service.add-children-to-frozen-record-folder=N\u00e3o \u00e9 poss\u00edvel adicionar novos itens a uma pasta congelada de documentos arquiv\u00edsticos. -rm.service.update-record-content=N\u00e3o \u00e9 poss\u00edvel atualizar a propriedade do conte\u00fado de um documento arquiv\u00edstico. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties deleted file mode 100644 index cff7378bf6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.update-disposition-action-def=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e: \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442. -rm.service.set-id=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 {0}: \u043e\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. -rm.service.path-node=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 {0}. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 IT- \u043e\u0442\u0434\u0435\u043b. -rm.service.invalid-rm-node=\u0423\u0437\u0435\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043d\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. -rm.service.no-root=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e. -rm.service.dup-root=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043f\u0430\u043f\u043e\u043a \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0432. -rm.service.root-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443: \u0442\u0438\u043f {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c rma:filePlan. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f. -rm.service.container-parent-type=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u044b\u0441\u0448\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordCategory). -rm.service.container-type=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u044b\u0441\u0448\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordsManagementContainer \u0438\u043b\u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0438\u043f). -rm.service.container-expected=\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordCategory \u0438\u043b\u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0438\u043f). -rm.service.record-folder-expected=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0438\u043f\u0430 rma:recordFolder. -rm.service.parent-record-folder-root=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.parent-record-folder-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.record-folder-type=\u041f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 rma:recordFolder \u0438\u043b\u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u0442\u0438\u043f\u0430. -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=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u0438\u043f\u0430 {1} \u0443\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 {0}. -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 -rm.service.enable-autoversion-on-record-creation=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rm.service.add-children-to-closed-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.add-children-to-frozen-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.update-record-content=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u0438. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties deleted file mode 100644 index 82562b9fe7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.service.error-add-content-container=\u60a8\u667a\u80fd\u5c06\u8bb0\u5f55\u7acb\u5377\u5230\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.service.update-disposition-action-def=\u60a8\u65e0\u6cd5\u66f4\u65b0\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\uff0c\u56e0\u4e3a\u4fdd\u7559\u8ba1\u5212\u7684\u66f4\u6539\u6b63\u5728\u4fdd\u5b58\u4e2d\u3002 \u8bf7\u5728\u51e0\u5206\u949f\u540e\u91cd\u8bd5\u3002 -rm.service.set-id=\u60a8\u65e0\u6cd5\u66f4\u6539 {0} \u7684 ID\uff0c\u56e0\u4e3a\u5b83\u4e3a\u53ea\u8bfb\u3002 -rm.service.path-node=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e {0}\u3002 \u8bf7\u5c1d\u8bd5\u5237\u65b0\u60a8\u7684\u6d4f\u89c8\u5668\u6216\u8054\u7cfb\u60a8\u7684 IT \u90e8\u95e8\u3002 -rm.service.invalid-rm-node=\u8bb0\u5f55\u7ba1\u7406\u8282\u70b9\u65e0\u6548\uff0c\u56e0\u4e3a\u5207\u9762 {0} \u4e0d\u5b58\u5728\u3002 -rm.service.no-root=\u6211\u4eec\u627e\u4e0d\u5230\u8bb0\u5f55\u7ba1\u7406\u5de5\u5177\u3002 \u8bf7\u91cd\u65b0\u5bf9\u8bb0\u5f55\u7acb\u5377\u3002 -rm.service.dup-root=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u5f52\u7c7b\u65b9\u6848\uff0c\u56e0\u4e3a\u6b64\u6587\u4ef6\u5939\u5c42\u6b21\u7ed3\u6784\u4e2d\u5df2\u5b58\u5728\u521b\u5efa\u7684\u5f52\u7c7b\u65b9\u6848\u3002 -rm.service.root-type=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u5f52\u7c7b\u65b9\u6848\uff0c\u56e0\u4e3a\u7c7b\u578b {0} \u4e0d\u662f rma:filePlan \u7684\u5b50\u7c7b\u578b\u3002 \u4f7f\u7528\u4e0d\u540c\u7684\u7c7b\u578b\u91cd\u8bd5\u3002 -rm.service.container-parent-type=\u60a8\u53ea\u80fd\u5728\u5f52\u7c7b\u65b9\u6848\u7684\u9876\u5c42\u6216\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u8bb0\u5f55\u7c7b\u522b (rma:recordCategory)\u3002 -rm.service.container-type=\u60a8\u53ea\u80fd\u5728\u5f52\u7c7b\u65b9\u6848\u7684\u9876\u5c42\u6216\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u8bb0\u5f55\u7c7b\u522b\uff08rma:recordsManagementContainer \u6216\u5b50\u7c7b\u578b\uff09\u3002 -rm.service.container-expected=\u60a8\u53ea\u80fd\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u67e5\u627e\u8bb0\u5f55\u7c7b\u522b\u5185\u5bb9\uff08rma:recordCategory \u6216\u5b50\u7c7b\u578b\uff09\u3002 -rm.service.record-folder-expected=\u8be5\u64cd\u4f5c\u53ea\u80fd\u4f7f\u7528 rma:recordFolder \u7c7b\u578b\u7684\u8bb0\u5f55\u6587\u4ef6\u5939\u5b8c\u6210\u3002 -rm.service.parent-record-folder-root=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \u8bf7\u5c1d\u8bd5\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u3002 -rm.service.parent-record-folder-type=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \u8bf7\u5c1d\u8bd5\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u3002 -rm.service.record-folder-type=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\uff0c\u9664\u975e\u60a8\u4f7f\u7528\u7c7b\u578b rma:recordFolder \u6216\u5b50\u7c7b\u578b\u3002 -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=\u8bb0\u5f55\u7c7b\u578b {1} \u5df2\u4e3a\u8bb0\u5f55 {0} \u663e\u793a\u3002 -rm.service.final-version=\u6700\u7ec8 -rm.service.final-version-description=\u6700\u7ec8\u5b58\u6863\u7684\u8bb0\u5f55\u7248\u672c -rm.service.enable-autoversion-on-record-creation=\u521b\u5efa\u8bb0\u5f55\u7684\u81ea\u52a8\u7248\u672c -rm.service.add-children-to-closed-record-folder=\u60a8\u65e0\u6cd5\u65b0\u589e\u9879\u76ee\u81f3\u5df2\u5173\u95ed\u7684\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.service.add-children-to-frozen-record-folder=\u60a8\u65e0\u6cd5\u65b0\u589e\u9879\u76ee\u81f3\u5df2\u5173\u95ed\u7684\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.service.update-record-content=\u60a8\u65e0\u6cd5\u66f4\u65b0\u8bb0\u5f55\u7684\u5185\u5bb9\u5c5e\u6027\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties deleted file mode 100644 index a55d29cf8d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Records Management Content Model - -rma_recordsmanagement.type.rma_rmsite.title=Records Management Site -rma_recordsmanagement.type.rma_rmsite.description=Specialized Site for Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Security Controls Configuration -rma_recordsmanagement.type.rma_caveatConfig.decription=Security Controls Configuration - -rma_recordsmanagement.type.rma_emailConfig.title=Email Configuration -rma_recordsmanagement.type.rma_emailConfig.decription=Email Configuration - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Records Management Container -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Records Management Container - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Records Management Root Container -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Records Management Root Container - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Retention Schedule -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retention Schedule - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Retention Authority -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retention Authority - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Retention Instructions -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retention Instructions - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Record Level Retention -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Record Level Retention - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retention Actions -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retention Actions - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Retention Action Definition -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Retention Action Definition -rma_recordsmanagement.property.rma_dispositionActionName.title=Retention Action Name -rma_recordsmanagement.property.rma_dispositionActionName.decription=Retention Action Name -rma_recordsmanagement.property.rma_dispositionDescription.title=Retention Description -rma_recordsmanagement.property.rma_dispositionDescription.decription=Retention Description -rma_recordsmanagement.property.rma_dispositionLocation.title=Retention Location -rma_recordsmanagement.property.rma_dispositionLocation.decription=Retention Location -rma_recordsmanagement.property.rma_dispositionPeriod.title=Retention Period -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retention Period -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Retention Period Property -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Retention Period Property -rma_recordsmanagement.property.rma_dispositionEvent.title=Retention Event -rma_recordsmanagement.property.rma_dispositionEvent.decription=Retention Event -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Retention Event Combination -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Retention Event Combination - -rma_recordsmanagement.type.rma_recordFolder.title=Record Folder -rma_recordsmanagement.type.rma_recordFolder.decription=Record Folder -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Record Category -rma_recordsmanagement.type.rma_recordCategory.decription=Record Category - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Non-Electronic Document -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Non-Electronic Document -rma_recordsmanagement.property.rma_physicalSize.title=Physical Size -rma_recordsmanagement.property.rma_physicalSize.decription=The size of the document measured in linear meters. -rma_recordsmanagement.property.rma_numberOfCopies.title=Number of Copies -rma_recordsmanagement.property.rma_numberOfCopies.description=The number of copies of the document. -rma_recordsmanagement.property.rma_storageLocation.title=Storage Location -rma_recordsmanagement.property.rma_storageLocation.decription=The physical storage location of the record. -rma_recordsmanagement.property.rma_shelf.title=Shelf -rma_recordsmanagement.property.rma_shelf.decription=The shelf the record is stored on. -rma_recordsmanagement.property.rma_box.title=Box -rma_recordsmanagement.property.rma_box.description=The box the record is stored in. -rma_recordsmanagement.property.rma_file.title=File -rma_recordsmanagement.property.rma_file.decription=The file the record is stored in. - -rma_recordsmanagement.type.rma_dispositionAction.title=Retention Action -rma_recordsmanagement.type.rma_dispositionAction.decription=Retention Action -rma_recordsmanagement.property.rma_dispositionActionId.title=Retention Action ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=Retention Action ID -rma_recordsmanagement.property.rma_dispositionAction.title=Retention Action -rma_recordsmanagement.property.rma_dispositionAction.decription=Retention Action -rma_recordsmanagement.property.rma_dispositionAsOf.title=Retention Action -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retention Action -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Retention Events Eligible -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Retention Events Eligible -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retention Action Started At -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retention Action Started At -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retention Action Started By -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retention Action Started By -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retention Action Completed At -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retention Action Completed At -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retention Action Completed By -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retention Action Completed By -rma_recordsmanagement.association.rma_eventExecutions.title=Event executions -rma_recordsmanagement.association.rma_eventExecutions.decription=Event executions - -rma_recordsmanagement.type.rma_eventExecution.title=Event Execution -rma_recordsmanagement.type.rma_eventExecution.decription=Event Execution -rma_recordsmanagement.property.rma_eventExecutionName.title=Event Name -rma_recordsmanagement.property.rma_eventExecutionName.decription=Event Name -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Event automatic -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Event automatic -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Event complete -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Event complete -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Event completed by -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Event completed by -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Event completed at -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Event completed at - -rma_recordsmanagement.type.rma_hold.title=Hold -rma_recordsmanagement.type.rma_hold.decription=Hold -rma_recordsmanagement.property.rma_holdReason.title=Hold Reason -rma_recordsmanagement.property.rma_holdReason.decription=Hold Reason -rma_recordsmanagement.association.rma_frozenRecords.title=Held Records -rma_recordsmanagement.association.rma_frozenRecords.decription=Held Records - -rma_recordsmanagement.type.rma_transfer.title=Transfer -rma_recordsmanagement.type.rma_transfer.decription=Transfer -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transfer Accession Indicator -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transfer Accession Indicator -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transfer PDF Indicator -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transfer PDF Indicator -rma_recordsmanagement.property.rma_transferLocation.title=Transfer PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transfer PDF -rma_recordsmanagement.association.rma_transferred.title=Transferred -rma_recordsmanagement.association.rma_transferred.decription=Transferred - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=File Plan Component -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=File Plan Component -rma_recordsmanagement.property.rma_rootNodeRef.title=Root node -rma_recordsmanagement.property.rma_rootNodeRef.decription=Root node - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Records Management Root -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Records Management Root -rma_recordsmanagement.association.rma_holds.title=Holds -rma_recordsmanagement.association.rma_holds.decription=Holds -rma_recordsmanagement.association.rma_transfers.title=Transfers -rma_recordsmanagement.association.rma_transfers.decription=Transfers - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Completed Record -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Completed Record -rma_recordsmanagement.property.rma_declaredAt.title=Date Completed -rma_recordsmanagement.property.rma_declaredAt.decription=Date Completed -rma_recordsmanagement.property.rma_declaredBy.title=Completed By -rma_recordsmanagement.property.rma_declaredBy.decription=Completed By - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Record component identifier -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Record component identifier -rma_recordsmanagement.property.rma_identifier.title=Record ID -rma_recordsmanagement.property.rma_identifier.decription=Unique record identifier -rma_recordsmanagement.property.rma_dbUniquenessId.title=Database uniqueness -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Database uniqueness - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Vital Record Definition -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Vital Record Definition - -rma_recordsmanagement.property.rma_reviewPeriod.title=Review Period -rma_recordsmanagement.property.rma_reviewPeriod.decription=Review Period -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Vital Record Indicator -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Vital Record Indicator - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Date Filed -rma_recordsmanagement.property.rma_dateFiled.decription=Date Filed -rma_recordsmanagement.property.rma_origionalName=Original Name - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Record Metadata -rma_recordsmanagement.aspect.rma_recordMetaData.description=Marker aspect for record metadata - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Common Records Details -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadata common to all record types -rma_recordsmanagement.property.rma_location.title=Location -rma_recordsmanagement.property.rma_location.decription=Location - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Vital Record -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vital Record -rma_recordsmanagement.property.rma_reviewAsOf.title=Next Review -rma_recordsmanagement.property.rma_reviewAsOf.decription=Next Review - -rma_recordsmanagement.aspect.rma_scheduled.title=Scheduled -rma_recordsmanagement.aspect.rma_scheduled.decription=Scheduled -rma_recordsmanagement.association.rma_dispositionSchedule.title=Retention Schedule -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retention Schedule - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Retention Lifecycle -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Retention Lifecycle -rma_recordsmanagement.association.rma_nextDispositionAction.title=Next retention action -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Next retention action -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Retention Action History -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Retention Action History - -rma_recordsmanagement.aspect.rma_cutOff.title=Cut Off -rma_recordsmanagement.aspect.rma_cutOff.decription=Cut Off -rma_recordsmanagement.property.rma_cutOffDate.title=Cut Off Date -rma_recordsmanagement.property.rma_cutOffDate.decription=Cut Off Date - -rma_recordsmanagement.aspect.rma_transferred.title=Transferred -rma_recordsmanagement.aspect.rma_transferred.decription=Transferred - -rma_recordsmanagement.aspect.rma_ascended.title=Ascended -rma_recordsmanagement.aspect.rma_ascended.decription=Ascended - -rma_recordsmanagement.aspect.rma_frozen.title=On Hold -rma_recordsmanagement.aspect.rma_frozen.decription=On Hold -rma_recordsmanagement.property.rma_frozenAt.title=Held At -rma_recordsmanagement.property.rma_frozenAt.decription=Held At -rma_recordsmanagement.property.rma_frozenBy.title=Held By -rma_recordsmanagement.property.rma_frozenBy.decription=Held By - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Caveat Configuration Root -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Caveat Configuration Root -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat Configuration -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat Configuration - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Email Configuration Root -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Email Configuration Root -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Email Configuration -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Email Configuration - -rma_recordsmanagement.aspect.rma_recordSearch.title=Record Search -rma_recordsmanagement.aspect.rma_recordSearch.decription=Information to support Records Management search -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Has Retention Schedule -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indicates whether the item has an associated retention schedule -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Retention Action Name -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=The name of the next retention action -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retention Action of -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=The date at which the next retention action becomes eligible -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retention Period -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retention Period -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Retention Period Expression -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Retention Period Expression -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Retention Events Eligible -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Retention Events Eligible -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retention Events -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retention Events -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retention Authority -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retention Authority -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retention Instructions -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retention Instructions -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Hold Reason -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Hold Reason -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Vital Record Review Period -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Vital Record Review Period -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Review Period Expression -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Review Period Expression - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Versioned Record -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Versioned Record - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Unpublished Update -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Unpublished Update -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Unpublished Update -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indicates whether there is an unpublished update -rma_recordsmanagement.property.rma_updateTo.title=Update To -rma_recordsmanagement.property.rma_updateTo.description=Destination of the update -rma_recordsmanagement.property.rma_updatedProperties.title=Updated Properties -rma_recordsmanagement.property.rma_updatedProperties.description=The updated properties -rma_recordsmanagement.property.rma_publishInProgress.title=Publish In Progress -rma_recordsmanagement.property.rma_publishInProgress.description=Indicates whether a publish is currently in progress - -rma_recordsmanagement.aspect.dod_ghosted.title=Metadata Only Record -rma_recordsmanagement.aspect.dod_ghosted.description=Metadata only record - -listconstraint.rmc_tlList.title=Transfer Locations -listconstraint.rmc_smList.title=Supplemental Markings \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties deleted file mode 100644 index 131e2941dd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Content Model f\u00fcr Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Records Management Site -rma_recordsmanagement.type.rma_rmsite.description=Spezielle Site f\u00fcr Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Sicherheitskontrollen-Konfiguration -rma_recordsmanagement.type.rma_caveatConfig.decription=Sicherheitskontrollen-Konfiguration - -rma_recordsmanagement.type.rma_emailConfig.title=E-Mail-Konfiguration -rma_recordsmanagement.type.rma_emailConfig.decription=E-Mail-Konfiguration - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Records Management Container -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Records Management Container - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Records Management Root-Container -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Records Management Root-Container - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Aufbewahrungsplan -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Aufbewahrungsplan - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Aufbewahrungs-Authority -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Aufbewahrungs-Authority - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Aufbewahrungsanweisungen -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Aufbewahrungsanweisungen - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Aufbewahrung auf Record-Ebene -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Aufbewahrung auf Record-Ebene - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Aufbewahrungsaktionen -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Aufbewahrungsaktionen - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definition der Aufbewahrungsaktion -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definition der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionName.title=Name der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionName.decription=Name der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionDescription.title=Aufbewahrungsbeschreibung -rma_recordsmanagement.property.rma_dispositionDescription.decription=Aufbewahrungsbeschreibung -rma_recordsmanagement.property.rma_dispositionLocation.title=Aufbewahrungsort -rma_recordsmanagement.property.rma_dispositionLocation.decription=Aufbewahrungsort -rma_recordsmanagement.property.rma_dispositionPeriod.title=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Eigenschaft des Aufbewahrungszeitraums -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Eigenschaft des Aufbewahrungszeitraums -rma_recordsmanagement.property.rma_dispositionEvent.title=Aufbewahrungsereignis -rma_recordsmanagement.property.rma_dispositionEvent.decription=Aufbewahrungsereignis -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Aufbewahrungsereigniskombination -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Aufbewahrungsereigniskombination - -rma_recordsmanagement.type.rma_recordFolder.title=Record-Ordner -rma_recordsmanagement.type.rma_recordFolder.decription=Record-Ordner -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Record-Kategorie -rma_recordsmanagement.type.rma_recordCategory.decription=Record-Kategorie - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Nicht elektronisches Dokument -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Nicht elektronisches Dokument -rma_recordsmanagement.property.rma_physicalSize.title=Physikalische Gr\u00f6\u00dfe -rma_recordsmanagement.property.rma_physicalSize.decription=Die Gr\u00f6\u00dfe des Dokuments wird in laufenden Metern gemessen. -rma_recordsmanagement.property.rma_numberOfCopies.title=Anzahl der Kopien -rma_recordsmanagement.property.rma_numberOfCopies.description=Die Anzahl der Kopien des Dokuments. -rma_recordsmanagement.property.rma_storageLocation.title=Speicherort -rma_recordsmanagement.property.rma_storageLocation.decription=Der physische Speicherort des Record. -rma_recordsmanagement.property.rma_shelf.title=Regal -rma_recordsmanagement.property.rma_shelf.decription=Das Regal, in dem der Record abgelegt ist. -rma_recordsmanagement.property.rma_box.title=Box -rma_recordsmanagement.property.rma_box.description=Die Box, in der der Record abgelegt ist. -rma_recordsmanagement.property.rma_file.title=Datei -rma_recordsmanagement.property.rma_file.decription=Die Datei, in der der Record gespeichert ist. - -rma_recordsmanagement.type.rma_dispositionAction.title=Aufbewahrungsaktion -rma_recordsmanagement.type.rma_dispositionAction.decription=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionId.title=ID der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAction.title=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAction.decription=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAsOf.title=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Aufbewahrungsaktion gestartet um -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Aufbewahrungsaktion gestartet um -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Aufbewahrungsaktion gestartet von -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Aufbewahrungsaktion gestartet von -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Aufbewahrungsaktion abgeschlossen um -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Aufbewahrungsaktion abgeschlossen um -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Aufbewahrungsaktion abgeschlossen von -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Aufbewahrungsaktion abgeschlossen von -rma_recordsmanagement.association.rma_eventExecutions.title=Ereignisausf\u00fchrungen -rma_recordsmanagement.association.rma_eventExecutions.decription=Ereignisausf\u00fchrungen - -rma_recordsmanagement.type.rma_eventExecution.title=Ereignisausf\u00fchrung -rma_recordsmanagement.type.rma_eventExecution.decription=Ereignisausf\u00fchrung -rma_recordsmanagement.property.rma_eventExecutionName.title=Ereignisname -rma_recordsmanagement.property.rma_eventExecutionName.decription=Ereignisname -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Automatisches Ereignis -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Automatisches Ereignis -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Abgeschlossenes Ereignis -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Abgeschlossenes Ereignis -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Ereignis abgeschlossen von -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Ereignis abgeschlossen von -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Ereignis abgeschlossen um -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Ereignis abgeschlossen um - -rma_recordsmanagement.type.rma_hold.title=Legal Hold -rma_recordsmanagement.type.rma_hold.decription=Legal Hold -rma_recordsmanagement.property.rma_holdReason.title=Grund f\u00fcr Legal Hold -rma_recordsmanagement.property.rma_holdReason.decription=Grund f\u00fcr Legal Hold -rma_recordsmanagement.association.rma_frozenRecords.title=Records mit Legal Hold -rma_recordsmanagement.association.rma_frozenRecords.decription=Records mit Legal Hold - -rma_recordsmanagement.type.rma_transfer.title=\u00dcbertragen -rma_recordsmanagement.type.rma_transfer.decription=\u00dcbertragen -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Anzeige bei \u00dcbertragung zur Aufnahme -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Anzeige bei \u00dcbertragung zur Aufnahme -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Anzeige bei PDF-\u00dcbertragung -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Anzeige bei PDF-\u00dcbertragung -rma_recordsmanagement.property.rma_transferLocation.title=PDF \u00fcbertragen -rma_recordsmanagement.property.rma_transferLocation.decription=PDF \u00fcbertragen -rma_recordsmanagement.association.rma_transferred.title=\u00dcbertragen -rma_recordsmanagement.association.rma_transferred.decription=\u00dcbertragen - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Ablageplan-Komponente -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Ablageplan-Komponente -rma_recordsmanagement.property.rma_rootNodeRef.title=Root-Node -rma_recordsmanagement.property.rma_rootNodeRef.decription=Root-Node - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Records Management Root -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Records Management Root -rma_recordsmanagement.association.rma_holds.title=Legal Holds -rma_recordsmanagement.association.rma_holds.decription=Legal Holds -rma_recordsmanagement.association.rma_transfers.title=\u00dcbertragungen -rma_recordsmanagement.association.rma_transfers.decription=\u00dcbertragungen - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Abgeschlossener Record -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Abgeschlossener Record -rma_recordsmanagement.property.rma_declaredAt.title=Abschlussdatum -rma_recordsmanagement.property.rma_declaredAt.decription=Abschlussdatum -rma_recordsmanagement.property.rma_declaredBy.title=Abgeschlossen von -rma_recordsmanagement.property.rma_declaredBy.decription=Abgeschlossen von - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=ID der Record-Komponente -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=ID der Record-Komponente -rma_recordsmanagement.property.rma_identifier.title=Record-ID -rma_recordsmanagement.property.rma_identifier.decription=Eindeutige Record-ID -rma_recordsmanagement.property.rma_dbUniquenessId.title=Eindeutigkeit der Datenbank -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Eindeutigkeit der Datenbank - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definition f\u00fcr besonders relevanten Record -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definition f\u00fcr besonders relevanten Record - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u00dcberpr\u00fcfungszeitraum -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u00dcberpr\u00fcfungszeitraum -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Kennzeichen f\u00fcr besonders relevante Records -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Kennzeichen f\u00fcr besonders relevante Records - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Ablagedatum -rma_recordsmanagement.property.rma_dateFiled.decription=Ablagedatum -rma_recordsmanagement.property.rma_origionalName=Originalname - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Record-Metadaten -rma_recordsmanagement.aspect.rma_recordMetaData.description=Markeraspekt f\u00fcr Record-Metadaten - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Gemeinsame Record-Details -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Gemeinsame Metadaten aller Record-Typen -rma_recordsmanagement.property.rma_location.title=Ort -rma_recordsmanagement.property.rma_location.decription=Ort - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Besonders relevanter Record -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Besonders relevanter Record -rma_recordsmanagement.property.rma_reviewAsOf.title=N\u00e4chste \u00dcberpr\u00fcfung -rma_recordsmanagement.property.rma_reviewAsOf.decription=N\u00e4chste \u00dcberpr\u00fcfung - -rma_recordsmanagement.aspect.rma_scheduled.title=Geplant -rma_recordsmanagement.aspect.rma_scheduled.decription=Geplant -rma_recordsmanagement.association.rma_dispositionSchedule.title=Aufbewahrungsplan -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Aufbewahrungsplan - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Aufbewahrungszyklus -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Aufbewahrungszyklus -rma_recordsmanagement.association.rma_nextDispositionAction.title=N\u00e4chste Aufbewahrungsaktion -rma_recordsmanagement.association.rma_nextDispositionAction.decription=N\u00e4chste Aufbewahrungsaktion -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Aufbewahrungsaktionsverlauf -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Aufbewahrungsaktionsverlauf - -rma_recordsmanagement.aspect.rma_cutOff.title=Trennen -rma_recordsmanagement.aspect.rma_cutOff.decription=Trennen -rma_recordsmanagement.property.rma_cutOffDate.title=Trenndatum -rma_recordsmanagement.property.rma_cutOffDate.decription=Trenndatum - -rma_recordsmanagement.aspect.rma_transferred.title=\u00dcbertragen -rma_recordsmanagement.aspect.rma_transferred.decription=\u00dcbertragen - -rma_recordsmanagement.aspect.rma_ascended.title=In Archiv aufgenommen -rma_recordsmanagement.aspect.rma_ascended.decription=In Archiv aufgenommen - -rma_recordsmanagement.aspect.rma_frozen.title=Mit Legal Hold belegt -rma_recordsmanagement.aspect.rma_frozen.decription=Mit Legal Hold belegt -rma_recordsmanagement.property.rma_frozenAt.title=Legal Hold in -rma_recordsmanagement.property.rma_frozenAt.decription=Legal Hold in -rma_recordsmanagement.property.rma_frozenBy.title=Legal Hold von -rma_recordsmanagement.property.rma_frozenBy.decription=Legal Hold von - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Root von Caveat-Konfiguration -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Root von Caveat-Konfiguration -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat-Konfiguration -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat-Konfiguration - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Root von E-Mail-Konfiguration -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Root von E-Mail-Konfiguration -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-Mail-Konfiguration -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-Mail-Konfiguration - -rma_recordsmanagement.aspect.rma_recordSearch.title=Record-Suche -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informationen zur Unterst\u00fctzung der Records Management Suche -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Mit Aufbewahrungsplan -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Gibt an, ob das Element \u00fcber einen zugeordneten Aufbewahrungsplan verf\u00fcgt -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Name der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Der Name der n\u00e4chsten Aufbewahrungsaktion -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Start der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Das Datum, ab dem die n\u00e4chste Aufbewahrungsaktion erlaubt ist -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Ausdruck f\u00fcr Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Ausdruck f\u00fcr Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Aufbewahrungs-Authority -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Aufbewahrungs-Authority -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Aufbewahrungsanweisungen -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Aufbewahrungsanweisungen -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Grund f\u00fcr Legal Hold -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Grund f\u00fcr Legal Hold -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u00dcberpr\u00fcfungszeitraum f\u00fcr besonders relevante Records -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u00dcberpr\u00fcfungszeitraum f\u00fcr besonders relevante Records -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Ausdruck f\u00fcr \u00dcberpr\u00fcfungszeitraum -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Ausdruck f\u00fcr \u00dcberpr\u00fcfungszeitraum - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Versionierter Record -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Versionierter Record - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Nicht ver\u00f6ffentlichte Aktualisierung -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Nicht ver\u00f6ffentlichte Aktualisierung -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Nicht ver\u00f6ffentlichte Aktualisierung -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Gibt an, ob eine nicht ver\u00f6ffentlichte Aktualisierung vorhanden ist. -rma_recordsmanagement.property.rma_updateTo.title=Aktualisieren auf -rma_recordsmanagement.property.rma_updateTo.description=Das Ziel der Aktualisierung. -rma_recordsmanagement.property.rma_updatedProperties.title=Aktualisierte Eigenschaften -rma_recordsmanagement.property.rma_updatedProperties.description=Die aktualisierten Eigenschaften. -rma_recordsmanagement.property.rma_publishInProgress.title=Laufende Ver\u00f6ffentlichung -rma_recordsmanagement.property.rma_publishInProgress.description=Gibt an, ob derzeit eine Ver\u00f6ffentlichung durchgef\u00fchrt wird. - -rma_recordsmanagement.aspect.dod_ghosted.title=Nur Metadaten enthaltender Record -rma_recordsmanagement.aspect.dod_ghosted.description=Nur Metadaten enthaltender Record - -listconstraint.rmc_tlList.title=Speicherorte \u00fcbertragen -listconstraint.rmc_smList.title=Zus\u00e4tzliche Markierungen diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties deleted file mode 100644 index 59e0cab602..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Modelo de contenido de gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_rmsite.title=Sitio de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.type.rma_rmsite.description=Sitio especializado para gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_caveatConfig.title=Configuraci\u00f3n de los controles de seguridad -rma_recordsmanagement.type.rma_caveatConfig.decription=Configuraci\u00f3n de los controles de seguridad - -rma_recordsmanagement.type.rma_emailConfig.title=Configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.type.rma_emailConfig.decription=Configuraci\u00f3n de correo electr\u00f3nico - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Contenedor de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Contenedor de gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Contenedor ra\u00edz de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Contenedor ra\u00edz de gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Planificaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Planificaci\u00f3n de retenci\u00f3n - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Autoridad de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autoridad de retenci\u00f3n - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Instrucciones de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instrucciones de retenci\u00f3n - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Retenci\u00f3n de nivel de documento de archivo -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Retenci\u00f3n de nivel de documento de archivo - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Acciones de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Acciones de retenci\u00f3n - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definici\u00f3n de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definici\u00f3n de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionName.title=Nombre de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nombre de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionDescription.title=Descripci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionDescription.decription=Descripci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionLocation.title=Ubicaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionLocation.decription=Ubicaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriod.title=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propiedad del periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propiedad del periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEvent.title=Evento de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinaci\u00f3n de evento de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinaci\u00f3n de evento de retenci\u00f3n - -rma_recordsmanagement.type.rma_recordFolder.title=Carpeta de documentos de archivo -rma_recordsmanagement.type.rma_recordFolder.decription=Carpeta de documentos de archivo -rma_recordsmanagement.property.rma_isClosed.title=Documento de archivo -rma_recordsmanagement.property.rma_isClosed.decription=Documento de archivo - -rma_recordsmanagement.type.rma_recordCategory.title=Categor\u00eda de documentos de archivo -rma_recordsmanagement.type.rma_recordCategory.decription=Categor\u00eda de documentos de archivo - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento no electr\u00f3nico -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento no electr\u00f3nico -rma_recordsmanagement.property.rma_physicalSize.title=Tama\u00f1o f\u00edsico -rma_recordsmanagement.property.rma_physicalSize.decription=El tama\u00f1o del documento en metros lineales. -rma_recordsmanagement.property.rma_numberOfCopies.title=N\u00famero de copias -rma_recordsmanagement.property.rma_numberOfCopies.description=El n\u00famero de copias del documento. -rma_recordsmanagement.property.rma_storageLocation.title=Ubicaci\u00f3n de almacenamiento -rma_recordsmanagement.property.rma_storageLocation.decription=La ubicaci\u00f3n f\u00edsica de almacenamiento del documento de archivo. -rma_recordsmanagement.property.rma_shelf.title=Estanter\u00eda -rma_recordsmanagement.property.rma_shelf.decription=La estanter\u00eda en la que est\u00e1 guardado el documento de archivo. -rma_recordsmanagement.property.rma_box.title=Caja -rma_recordsmanagement.property.rma_box.description=La caja en la que est\u00e1 guardado el documento de archivo. -rma_recordsmanagement.property.rma_file.title=Fichero -rma_recordsmanagement.property.rma_file.decription=El fichero en el que est\u00e1 guardado el documento de archivo. - -rma_recordsmanagement.type.rma_dispositionAction.title=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.type.rma_dispositionAction.decription=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionId.title=ID de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAction.title=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAction.decription=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAsOf.title=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Acci\u00f3n de retenci\u00f3n iniciada en -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Acci\u00f3n de retenci\u00f3n iniciada en -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Acci\u00f3n de retenci\u00f3n iniciada por -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Acci\u00f3n de retenci\u00f3n iniciada por -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Acci\u00f3n de retenci\u00f3n completada en -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Acci\u00f3n de retenci\u00f3n completada en -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Acci\u00f3n de retenci\u00f3n completada por -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Acci\u00f3n de retenci\u00f3n completada por -rma_recordsmanagement.association.rma_eventExecutions.title=Ejecuciones de evento -rma_recordsmanagement.association.rma_eventExecutions.decription=Ejecuciones de evento - -rma_recordsmanagement.type.rma_eventExecution.title=Ejecuci\u00f3n de evento -rma_recordsmanagement.type.rma_eventExecution.decription=Ejecuci\u00f3n de evento -rma_recordsmanagement.property.rma_eventExecutionName.title=Nombre de evento -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nombre de evento -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento completo -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento completo -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento completado por -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento completado por -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento completado en -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento completado en - -rma_recordsmanagement.type.rma_hold.title=Retenci\u00f3n legal -rma_recordsmanagement.type.rma_hold.decription=Retenci\u00f3n legal -rma_recordsmanagement.property.rma_holdReason.title=Raz\u00f3n de retenci\u00f3n legal -rma_recordsmanagement.property.rma_holdReason.decription=Raz\u00f3n de retenci\u00f3n legal -rma_recordsmanagement.association.rma_frozenRecords.title=Documentos de archivo bloqueados -rma_recordsmanagement.association.rma_frozenRecords.decription=Documentos de archivo bloqueados - -rma_recordsmanagement.type.rma_transfer.title=Transferencia -rma_recordsmanagement.type.rma_transfer.decription=Transferencia -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicador de incorporaci\u00f3n y transferencia -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicador de incorporaci\u00f3n y transferencia -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicador de transferencia de PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicador de transferencia de PDF -rma_recordsmanagement.property.rma_transferLocation.title=Transferencia de PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transferencia de PDF -rma_recordsmanagement.association.rma_transferred.title=Transferido -rma_recordsmanagement.association.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente del cuadro de clasificaci\u00f3n -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente del cuadro de clasificaci\u00f3n -rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo ra\u00edz -rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo ra\u00edz - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Ra\u00edz de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Ra\u00edz de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.association.rma_holds.title=Retenciones legales -rma_recordsmanagement.association.rma_holds.decription=Retenciones legales -rma_recordsmanagement.association.rma_transfers.title=Transferencias -rma_recordsmanagement.association.rma_transfers.decription=Transferencias - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Documento de archivo completado -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Documento de archivo completado -rma_recordsmanagement.property.rma_declaredAt.title=Fecha de finalizaci\u00f3n -rma_recordsmanagement.property.rma_declaredAt.decription=Fecha de finalizaci\u00f3n -rma_recordsmanagement.property.rma_declaredBy.title=Completado por -rma_recordsmanagement.property.rma_declaredBy.decription=Completado por - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificador de componente de documento de archivo -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificador de componente de documento de archivo -rma_recordsmanagement.property.rma_identifier.title=ID de documento de archivo -rma_recordsmanagement.property.rma_identifier.decription=Identificador \u00fanico de documento de archivo -rma_recordsmanagement.property.rma_dbUniquenessId.title=Singularidad de la base de datos -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Singularidad de la base de datos - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definici\u00f3n de documento de archivo vital -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definici\u00f3n de documento de archivo vital - -rma_recordsmanagement.property.rma_reviewPeriod.title=Periodo de revisi\u00f3n -rma_recordsmanagement.property.rma_reviewPeriod.decription=Periodo de revisi\u00f3n -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicador de documento de archivo vital -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicador de documento de archivo vital - -rma_recordsmanagement.aspect.rma_record.title=Documento de archivo -rma_recordsmanagement.aspect.rma_record.decription=Documento de archivo -rma_recordsmanagement.property.rma_dateFiled.title=Fecha de archivado -rma_recordsmanagement.property.rma_dateFiled.decription=Fecha de archivado -rma_recordsmanagement.property.rma_origionalName=Nombre original - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadatos de documento de archivo -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspecto de marcador para metadatos del documento de archivo - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Detalles de documento de archivo com\u00fan -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadatos comunes para todos los tipos de documento de archivo -rma_recordsmanagement.property.rma_location.title=Ubicaci\u00f3n -rma_recordsmanagement.property.rma_location.decription=Ubicaci\u00f3n - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento de archivo vital -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento de archivo vital -rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revisi\u00f3n -rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revisi\u00f3n - -rma_recordsmanagement.aspect.rma_scheduled.title=Planificado -rma_recordsmanagement.aspect.rma_scheduled.decription=Planificado -rma_recordsmanagement.association.rma_dispositionSchedule.title=Planificaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Planificaci\u00f3n de retenci\u00f3n - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo de vida de retenci\u00f3n -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo de vida de retenci\u00f3n -rma_recordsmanagement.association.rma_nextDispositionAction.title=Pr\u00f3xima acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Pr\u00f3xima acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historial de acciones de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historial de acciones de retenci\u00f3n - -rma_recordsmanagement.aspect.rma_cutOff.title=Interrumpir -rma_recordsmanagement.aspect.rma_cutOff.decription=Interrumpir -rma_recordsmanagement.property.rma_cutOffDate.title=Fecha de interrupci\u00f3n -rma_recordsmanagement.property.rma_cutOffDate.decription=Fecha de interrupci\u00f3n - -rma_recordsmanagement.aspect.rma_transferred.title=Transferido -rma_recordsmanagement.aspect.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_ascended.title=Ascendido -rma_recordsmanagement.aspect.rma_ascended.decription=Ascendido - -rma_recordsmanagement.aspect.rma_frozen.title=En retenci\u00f3n legal -rma_recordsmanagement.aspect.rma_frozen.decription=En retenci\u00f3n legal -rma_recordsmanagement.property.rma_frozenAt.title=Bloqueado en -rma_recordsmanagement.property.rma_frozenAt.decription=Bloqueado en -rma_recordsmanagement.property.rma_frozenBy.title=Bloqueado por -rma_recordsmanagement.property.rma_frozenBy.decription=Bloqueado por - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Ra\u00edz de configuraci\u00f3n de advertencia -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Ra\u00edz de configuraci\u00f3n de advertencia -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configuraci\u00f3n de advertencia -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configuraci\u00f3n de advertencia - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Ra\u00edz de configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Ra\u00edz de configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configuraci\u00f3n de correo electr\u00f3nico - -rma_recordsmanagement.aspect.rma_recordSearch.title=B\u00fasqueda de documentos de archivo -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informaci\u00f3n para b\u00fasqueda de Records Management -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Tiene planificaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica si el elemento tiene planificaci\u00f3n de retenci\u00f3n asociada -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nombre de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=El nombre de la pr\u00f3xima acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Acci\u00f3n de retenci\u00f3n de -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La fecha en la cual la pr\u00f3xima acci\u00f3n de retenci\u00f3n reunir\u00e1 los requisitos -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Expresi\u00f3n de periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Expresi\u00f3n de periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventos de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventos de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autoridad de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autoridad de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instrucciones de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instrucciones de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Raz\u00f3n de retenci\u00f3n legal -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Raz\u00f3n de retenci\u00f3n legal -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Periodo de revisi\u00f3n de documento de archivo vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Periodo de revisi\u00f3n de documento de archivo vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Expresi\u00f3n de periodo de revisi\u00f3n -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Expresi\u00f3n de periodo de revisi\u00f3n - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Documento de archivo versionado -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Documento de archivo versionado - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Actualizaci\u00f3n sin publicar -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Actualizaci\u00f3n sin publicar -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Actualizaci\u00f3n sin publicar -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica si existe una actualizaci\u00f3n sin publicar -rma_recordsmanagement.property.rma_updateTo.title=Actualizar a -rma_recordsmanagement.property.rma_updateTo.description=Destino de la actualizaci\u00f3n -rma_recordsmanagement.property.rma_updatedProperties.title=Propiedades actualizadas -rma_recordsmanagement.property.rma_updatedProperties.description=Las propiedades actualizadas -rma_recordsmanagement.property.rma_publishInProgress.title=Publicaci\u00f3n en curso -rma_recordsmanagement.property.rma_publishInProgress.description=Indica si una publicaci\u00f3n se encuentra en curso - -rma_recordsmanagement.aspect.dod_ghosted.title=Documento de archivo solo de metadatos -rma_recordsmanagement.aspect.dod_ghosted.description=Documento de archivo solo de metadatos - -listconstraint.rmc_tlList.title=Ubicaciones de la transferencia -listconstraint.rmc_smList.title=Marcas complementarias diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties deleted file mode 100644 index a092acd19e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Mod\u00e8le de contenu de gestion des archives - -rma_recordsmanagement.type.rma_rmsite.title=Site de gestion des archives -rma_recordsmanagement.type.rma_rmsite.description=Site sp\u00e9cialis\u00e9 pour la gestion des archives - -rma_recordsmanagement.type.rma_caveatConfig.title=Configuration des contr\u00f4les de s\u00e9curit\u00e9 -rma_recordsmanagement.type.rma_caveatConfig.decription=Configuration des contr\u00f4les de s\u00e9curit\u00e9 - -rma_recordsmanagement.type.rma_emailConfig.title=Configuration d'e-mail -rma_recordsmanagement.type.rma_emailConfig.decription=Configuration d'e-mail - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Conteneur de gestion des archives -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Conteneur de gestion des archives - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Conteneur de la racine du site de gestion des archives -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Conteneur de la racine du site de gestion des archives - -rma_recordsmanagement.type.rma_dispositionSchedule.title=R\u00e8gle de conservation -rma_recordsmanagement.type.rma_dispositionSchedule.decription=R\u00e8gle de conservation - -rma_recordsmanagement.property.rma_dispositionAuthority.title=D\u00e9tenteur principal -rma_recordsmanagement.property.rma_dispositionAuthority.decription=D\u00e9tenteur principal - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Instructions de conservation -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instructions de conservation - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Conservation au niveau du document d'archives -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Conservation au niveau du document d'archives - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Actions de conservation -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Actions de conservation - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=D\u00e9finition de l'action de conservation -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=D\u00e9finition de l'action de conservation -rma_recordsmanagement.property.rma_dispositionActionName.title=Nom de l'action de conservation -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nom de l'action de conservation -rma_recordsmanagement.property.rma_dispositionDescription.title=Description de la conservation -rma_recordsmanagement.property.rma_dispositionDescription.decription=Description de la conservation -rma_recordsmanagement.property.rma_dispositionLocation.title=Emplacement de la conservation -rma_recordsmanagement.property.rma_dispositionLocation.decription=Emplacement de la conservation -rma_recordsmanagement.property.rma_dispositionPeriod.title=P\u00e9riode de conservation -rma_recordsmanagement.property.rma_dispositionPeriod.decription=P\u00e9riode de conservation -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propri\u00e9t\u00e9 de la p\u00e9riode de conservation -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propri\u00e9t\u00e9 de la p\u00e9riode de conservation -rma_recordsmanagement.property.rma_dispositionEvent.title=Ev\u00e9nement de conservation -rma_recordsmanagement.property.rma_dispositionEvent.decription=Ev\u00e9nement de conservation -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinaison d'\u00e9v\u00e9nements de conservation -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinaison d'\u00e9v\u00e9nements de conservation - -rma_recordsmanagement.type.rma_recordFolder.title=Dossier d'archives -rma_recordsmanagement.type.rma_recordFolder.decription=Dossier d'archives -rma_recordsmanagement.property.rma_isClosed.title=Document d'archives -rma_recordsmanagement.property.rma_isClosed.decription=Document d'archives - -rma_recordsmanagement.type.rma_recordCategory.title=Cat\u00e9gorie de document d'archives -rma_recordsmanagement.type.rma_recordCategory.decription=Cat\u00e9gorie de document d'archives - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Document non \u00e9lectronique -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Document non \u00e9lectronique -rma_recordsmanagement.property.rma_physicalSize.title=Taille physique -rma_recordsmanagement.property.rma_physicalSize.decription=Taille du document mesur\u00e9e en m\u00e8tres lin\u00e9aires. -rma_recordsmanagement.property.rma_numberOfCopies.title=Nombre de copies -rma_recordsmanagement.property.rma_numberOfCopies.description=Nombre de copies du document. -rma_recordsmanagement.property.rma_storageLocation.title=Emplacement de stockage -rma_recordsmanagement.property.rma_storageLocation.decription=Emplacement de stockage physique du document d'archives. -rma_recordsmanagement.property.rma_shelf.title=Etag\u00e8re -rma_recordsmanagement.property.rma_shelf.decription=Etag\u00e8re o\u00f9 se trouve le document d'archives. -rma_recordsmanagement.property.rma_box.title=Bo\u00eete -rma_recordsmanagement.property.rma_box.description=Bo\u00eete o\u00f9 se trouve le document d'archives. -rma_recordsmanagement.property.rma_file.title=Fichier -rma_recordsmanagement.property.rma_file.decription=Fichier du document d'archives. - -rma_recordsmanagement.type.rma_dispositionAction.title=Action de conservation -rma_recordsmanagement.type.rma_dispositionAction.decription=Action de conservation -rma_recordsmanagement.property.rma_dispositionActionId.title=Identifiant de l'action de conservation -rma_recordsmanagement.property.rma_dispositionActionId.decription=Identifiant de l'action de conservation -rma_recordsmanagement.property.rma_dispositionAction.title=Action de conservation -rma_recordsmanagement.property.rma_dispositionAction.decription=Action de conservation -rma_recordsmanagement.property.rma_dispositionAsOf.title=Action de conservation -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Action de conservation -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Ev\u00e9nements de conservation \u00e9ligibles -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Ev\u00e9nements de conservation \u00e9ligibles -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Action de conservation d\u00e9marr\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Action de conservation d\u00e9marr\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Action de conservation d\u00e9marr\u00e9e par -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Action de conservation d\u00e9marr\u00e9e par -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Action de conservation termin\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Action de conservation termin\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Action de conservation termin\u00e9e par -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Action de conservation termin\u00e9e par -rma_recordsmanagement.association.rma_eventExecutions.title=Ex\u00e9cutions de l'\u00e9v\u00e9nement -rma_recordsmanagement.association.rma_eventExecutions.decription=Ex\u00e9cutions de l'\u00e9v\u00e9nement - -rma_recordsmanagement.type.rma_eventExecution.title=Ex\u00e9cution de l'\u00e9v\u00e9nement -rma_recordsmanagement.type.rma_eventExecution.decription=Ex\u00e9cution de l'\u00e9v\u00e9nement -rma_recordsmanagement.property.rma_eventExecutionName.title=Nom d'\u00e9v\u00e9nement -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nom d'\u00e9v\u00e9nement -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Ev\u00e9nement automatique -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Ev\u00e9nement automatique -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Ev\u00e9nement termin\u00e9 -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Ev\u00e9nement termin\u00e9 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Ev\u00e9nement termin\u00e9 par -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Ev\u00e9nement termin\u00e9 par -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Ev\u00e9nement termin\u00e9 \u00e0 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Ev\u00e9nement termin\u00e9 \u00e0 - -rma_recordsmanagement.type.rma_hold.title=Suspendre -rma_recordsmanagement.type.rma_hold.decription=Suspendre -rma_recordsmanagement.property.rma_holdReason.title=Motif de suspension -rma_recordsmanagement.property.rma_holdReason.decription=Motif de suspension -rma_recordsmanagement.association.rma_frozenRecords.title=Documents d'archives suspendus -rma_recordsmanagement.association.rma_frozenRecords.decription=Documents d'archives suspendus - -rma_recordsmanagement.type.rma_transfer.title=Transf\u00e9rer -rma_recordsmanagement.type.rma_transfer.decription=Transf\u00e9rer -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transf\u00e9rer l'indicateur de versement \u00e0 un autre organisme -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transf\u00e9rer l'indicateur de versement \u00e0 un autre organisme -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transf\u00e9rer l'indicateur PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transf\u00e9rer l'indicateur PDF -rma_recordsmanagement.property.rma_transferLocation.title=Transf\u00e9rer le PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transf\u00e9rer le PDF -rma_recordsmanagement.association.rma_transferred.title=Transf\u00e9r\u00e9 -rma_recordsmanagement.association.rma_transferred.decription=Transf\u00e9r\u00e9 - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Composant du plan de classement -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Composant du plan de classement -rma_recordsmanagement.property.rma_rootNodeRef.title=N\u0153ud racine -rma_recordsmanagement.property.rma_rootNodeRef.decription=N\u0153ud racine - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Racine du site de gestion des archives -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Racine du site de gestion des archives -rma_recordsmanagement.association.rma_holds.title=Suspensions -rma_recordsmanagement.association.rma_holds.decription=Suspensions -rma_recordsmanagement.association.rma_transfers.title=Transferts -rma_recordsmanagement.association.rma_transfers.decription=Transferts - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Document d'archives complet -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Document d'archives complet -rma_recordsmanagement.property.rma_declaredAt.title=Date d'ach\u00e8vement -rma_recordsmanagement.property.rma_declaredAt.decription=Date d'ach\u00e8vement -rma_recordsmanagement.property.rma_declaredBy.title=Compl\u00e9t\u00e9 par -rma_recordsmanagement.property.rma_declaredBy.decription=Compl\u00e9t\u00e9 par - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identifiant de composant de document d'archives -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identifiant de composant de document d'archives -rma_recordsmanagement.property.rma_identifier.title=ID du document d'archives -rma_recordsmanagement.property.rma_identifier.decription=Identifiant unique de document d'archives -rma_recordsmanagement.property.rma_dbUniquenessId.title=Unicit\u00e9 de base de donn\u00e9es -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unicit\u00e9 de base de donn\u00e9es - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=D\u00e9finition du document d'archives essentiel -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=D\u00e9finition du document d'archives essentiel - -rma_recordsmanagement.property.rma_reviewPeriod.title=P\u00e9riode de r\u00e9vision -rma_recordsmanagement.property.rma_reviewPeriod.decription=P\u00e9riode de r\u00e9vision -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Identifiant de document d'archives essentiel -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Identifiant de document d'archives essentiel - -rma_recordsmanagement.aspect.rma_record.title=Document d'archives -rma_recordsmanagement.aspect.rma_record.decription=Document d'archives -rma_recordsmanagement.property.rma_dateFiled.title=Date de versement au site des archives -rma_recordsmanagement.property.rma_dateFiled.decription=Date de versement au site des archives -rma_recordsmanagement.property.rma_origionalName=Nom d'origine - -rma_recordsmanagement.aspect.rma_recordMetaData.title=M\u00e9tadonn\u00e9es de document d'archives -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspect du marqueur de m\u00e9tadonn\u00e9es de document d'archives - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=D\u00e9tails des documents d'archives communs -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=M\u00e9tadonn\u00e9es communes \u00e0 tous les types de document d'archives -rma_recordsmanagement.property.rma_location.title=Emplacement -rma_recordsmanagement.property.rma_location.decription=Emplacement - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Document d'archives essentiel -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Document d'archives essentiel -rma_recordsmanagement.property.rma_reviewAsOf.title=V\u00e9rification suivante -rma_recordsmanagement.property.rma_reviewAsOf.decription=V\u00e9rification suivante - -rma_recordsmanagement.aspect.rma_scheduled.title=Planifi\u00e9 -rma_recordsmanagement.aspect.rma_scheduled.decription=Planifi\u00e9 -rma_recordsmanagement.association.rma_dispositionSchedule.title=R\u00e8gle de conservation -rma_recordsmanagement.association.rma_dispositionSchedule.decription=R\u00e8gle de conservation - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Etapes du d\u00e9lai de conservation -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Etapes du d\u00e9lai de conservation -rma_recordsmanagement.association.rma_nextDispositionAction.title=Etape suivante du d\u00e9lai de conservation -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Etape suivante du d\u00e9lai de conservation -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historique des actions de conservation -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historique des actions de conservation - -rma_recordsmanagement.aspect.rma_cutOff.title=D\u00e9but de conservation -rma_recordsmanagement.aspect.rma_cutOff.decription=D\u00e9but de conservation -rma_recordsmanagement.property.rma_cutOffDate.title=Date de d\u00e9but de conservation -rma_recordsmanagement.property.rma_cutOffDate.decription=Date de d\u00e9but de conservation - -rma_recordsmanagement.aspect.rma_transferred.title=Transf\u00e9r\u00e9 -rma_recordsmanagement.aspect.rma_transferred.decription=Transf\u00e9r\u00e9 - -rma_recordsmanagement.aspect.rma_ascended.title=Mont\u00e9 -rma_recordsmanagement.aspect.rma_ascended.decription=Mont\u00e9 - -rma_recordsmanagement.aspect.rma_frozen.title=Suspendu -rma_recordsmanagement.aspect.rma_frozen.decription=Suspendu -rma_recordsmanagement.property.rma_frozenAt.title=Suspendu \u00e0 -rma_recordsmanagement.property.rma_frozenAt.decription=Suspendu \u00e0 -rma_recordsmanagement.property.rma_frozenBy.title=Suspendu par -rma_recordsmanagement.property.rma_frozenBy.decription=Suspendu par - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Racine de configuration des avertissements -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Racine de configuration des avertissements -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configuration des avertissements -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configuration des avertissements - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Racine de configuration d'e-mail -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Racine de configuration d'e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configuration d'e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configuration d'e-mail - -rma_recordsmanagement.aspect.rma_recordSearch.title=Recherche de document d'archives -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informations pour prendre en charge la recherche dans la gestion des archives -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=A une r\u00e8gle de conservation -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indique si une r\u00e8gle de conservation est associ\u00e9e \u00e0 l'\u00e9l\u00e9ment -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nom de l'action de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Le nom de l'\u00e9tape suivante du d\u00e9lai de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Action de conservation de -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La date \u00e0 laquelle l'\u00e9tape suivante du d\u00e9lai de conservation devient \u00e9ligible -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=P\u00e9riode de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=P\u00e9riode de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Expression de la p\u00e9riode de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Expression de la p\u00e9riode de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Ev\u00e9nements de conservation \u00e9ligibles -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Ev\u00e9nements de conservation \u00e9ligibles -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Ev\u00e9nements de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Ev\u00e9nements de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=D\u00e9tenteur principal -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=D\u00e9tenteur principal -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instructions de conservation -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instructions de conservation -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motif de suspension -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motif de suspension -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=P\u00e9riode de v\u00e9rification du document d'archives essentiel -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=P\u00e9riode de v\u00e9rification du document d'archives essentiel -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Expression de p\u00e9riode de r\u00e9vision -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Expression de p\u00e9riode de r\u00e9vision - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Document d'archives versionn\u00e9 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Document d'archives versionn\u00e9 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indique s'il existe une mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.property.rma_updateTo.title=Mettre \u00e0 jour vers -rma_recordsmanagement.property.rma_updateTo.description=Destination de la mise \u00e0 jour -rma_recordsmanagement.property.rma_updatedProperties.title=Propri\u00e9t\u00e9s mises \u00e0 jour -rma_recordsmanagement.property.rma_updatedProperties.description=Les propri\u00e9t\u00e9s mises \u00e0 jour -rma_recordsmanagement.property.rma_publishInProgress.title=Publication en cours -rma_recordsmanagement.property.rma_publishInProgress.description=Indique si une publication est en cours - -rma_recordsmanagement.aspect.dod_ghosted.title=M\u00e9tadonn\u00e9es d'archives seulement -rma_recordsmanagement.aspect.dod_ghosted.description=M\u00e9tadonn\u00e9es d'archives seulement - -listconstraint.rmc_tlList.title=Transf\u00e9rer les emplacements -listconstraint.rmc_smList.title=Marquages compl\u00e9mentaires diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties deleted file mode 100644 index 3f4e28d117..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Modello di contenuto di Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Sito di Records Management -rma_recordsmanagement.type.rma_rmsite.description=Sito specializzato di Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Configurazione controlli di sicurezza -rma_recordsmanagement.type.rma_caveatConfig.decription=Configurazione controlli di sicurezza - -rma_recordsmanagement.type.rma_emailConfig.title=Configurazione e-mail -rma_recordsmanagement.type.rma_emailConfig.decription=Configurazione e-mail - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Contenitore di Records Management -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Contenitore di Records Management - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Contenitore radice di Records Management -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Contenitore radice di Records Management - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Programma di conservazione -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Programma di conservazione - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Autorit\u00e0 di conservazione -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autorit\u00e0 di conservazione - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Istruzioni per la conservazione -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Istruzioni per la conservazione - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Conservazione livello record -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Conservazione livello record - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Azioni di conservazione -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Azioni di conservazione - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definizione azione di conservazione -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definizione azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionName.title=Nome dell'azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nome dell'azione di conservazione -rma_recordsmanagement.property.rma_dispositionDescription.title=Descrizione conservazione -rma_recordsmanagement.property.rma_dispositionDescription.decription=Descrizione conservazione -rma_recordsmanagement.property.rma_dispositionLocation.title=Posizione di conservazione -rma_recordsmanagement.property.rma_dispositionLocation.decription=Posizione di conservazione -rma_recordsmanagement.property.rma_dispositionPeriod.title=Periodo di conservazione -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Periodo di conservazione -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propriet\u00e0 del periodo di conservazione -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propriet\u00e0 del periodo di conservazione -rma_recordsmanagement.property.rma_dispositionEvent.title=Evento di conservazione -rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento di conservazione -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinazione eventi di conservazione -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinazione eventi di conservazione - -rma_recordsmanagement.type.rma_recordFolder.title=Cartella di record -rma_recordsmanagement.type.rma_recordFolder.decription=Cartella di record -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Categoria record -rma_recordsmanagement.type.rma_recordCategory.decription=Categoria record - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento non elettronico -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento non elettronico -rma_recordsmanagement.property.rma_physicalSize.title=Dimensioni fisiche -rma_recordsmanagement.property.rma_physicalSize.decription=Le dimensioni del documento misurate in metri lineari. -rma_recordsmanagement.property.rma_numberOfCopies.title=Numero di copie -rma_recordsmanagement.property.rma_numberOfCopies.description=Il numero di copie del documento. -rma_recordsmanagement.property.rma_storageLocation.title=Posizione di archiviazione -rma_recordsmanagement.property.rma_storageLocation.decription=La posizione fisica di archiviazione del record. -rma_recordsmanagement.property.rma_shelf.title=Ripiano -rma_recordsmanagement.property.rma_shelf.decription=Il ripiano nel quale \u00e8 conservato il record. -rma_recordsmanagement.property.rma_box.title=Casella -rma_recordsmanagement.property.rma_box.description=La casella dove \u00e8 conservato il record. -rma_recordsmanagement.property.rma_file.title=File -rma_recordsmanagement.property.rma_file.decription=Il file dove \u00e8 conservato il record. - -rma_recordsmanagement.type.rma_dispositionAction.title=Azione di conservazione -rma_recordsmanagement.type.rma_dispositionAction.decription=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionId.title=ID azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID azione di conservazione -rma_recordsmanagement.property.rma_dispositionAction.title=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionAction.decription=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionAsOf.title=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Azione di conservazione iniziata alle ore -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Azione di conservazione iniziata alle ore -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Azione di conservazione iniziata da -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Azione di conservazione iniziata da -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Azione di conservazione completata alle ore -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Azione di conservazione completata alle ore -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Azione di conservazione completata da -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Azione di conservazione completata da -rma_recordsmanagement.association.rma_eventExecutions.title=Esecuzioni evento -rma_recordsmanagement.association.rma_eventExecutions.decription=Esecuzioni evento - -rma_recordsmanagement.type.rma_eventExecution.title=Esecuzione evento -rma_recordsmanagement.type.rma_eventExecution.decription=Esecuzione evento -rma_recordsmanagement.property.rma_eventExecutionName.title=Nome evento -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nome evento -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento automatico -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento automatico -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento completato -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento completato -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento completato da -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento completato da -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento completato alle ore -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento completato alle ore - -rma_recordsmanagement.type.rma_hold.title=Sospensione -rma_recordsmanagement.type.rma_hold.decription=Sospensione -rma_recordsmanagement.property.rma_holdReason.title=Motivo sospensione -rma_recordsmanagement.property.rma_holdReason.decription=Motivo sospensione -rma_recordsmanagement.association.rma_frozenRecords.title=Record sospesi -rma_recordsmanagement.association.rma_frozenRecords.decription=Record sospesi - -rma_recordsmanagement.type.rma_transfer.title=Trasferisci -rma_recordsmanagement.type.rma_transfer.decription=Trasferisci -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicatore di trasferimento/trasferimento ad altri -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicatore di trasferimento/trasferimento ad altri -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicatore di trasferimento PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicatore di trasferimento PDF -rma_recordsmanagement.property.rma_transferLocation.title=Trasferisci PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Trasferisci PDF -rma_recordsmanagement.association.rma_transferred.title=Trasferito -rma_recordsmanagement.association.rma_transferred.decription=Trasferito - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente Piano di fascicolazione -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente Piano di fascicolazione -rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo radice -rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo radice - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Radice di Records Management -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Radice di Records Management -rma_recordsmanagement.association.rma_holds.title=Sospensioni -rma_recordsmanagement.association.rma_holds.decription=Sospensioni -rma_recordsmanagement.association.rma_transfers.title=Trasferimenti -rma_recordsmanagement.association.rma_transfers.decription=Trasferimenti - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Record completato -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Record completato -rma_recordsmanagement.property.rma_declaredAt.title=Data completamento -rma_recordsmanagement.property.rma_declaredAt.decription=Data completamento -rma_recordsmanagement.property.rma_declaredBy.title=Completato da -rma_recordsmanagement.property.rma_declaredBy.decription=Completato da - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificatore componente record -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificatore componente record -rma_recordsmanagement.property.rma_identifier.title=ID Record -rma_recordsmanagement.property.rma_identifier.decription=Identificatore record univoco -rma_recordsmanagement.property.rma_dbUniquenessId.title=Unicit\u00e0 database -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unicit\u00e0 database - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definizione di record fondamentale -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definizione di record fondamentale - -rma_recordsmanagement.property.rma_reviewPeriod.title=Periodo di esame -rma_recordsmanagement.property.rma_reviewPeriod.decription=Periodo di esame -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicatore record fondamentale -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicatore record fondamentale - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Data di archiviazione -rma_recordsmanagement.property.rma_dateFiled.decription=Data di archiviazione -rma_recordsmanagement.property.rma_origionalName=Nome originale - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadati del record -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspetto indicatore per metadati del record - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Dettagli record comuni -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadati comuni a tutti i tipi di record -rma_recordsmanagement.property.rma_location.title=Posizione -rma_recordsmanagement.property.rma_location.decription=Posizione - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Record fondamentale -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Record fondamentale -rma_recordsmanagement.property.rma_reviewAsOf.title=Prossimo esame -rma_recordsmanagement.property.rma_reviewAsOf.decription=Prossimo esame - -rma_recordsmanagement.aspect.rma_scheduled.title=Programmato -rma_recordsmanagement.aspect.rma_scheduled.decription=Programmato -rma_recordsmanagement.association.rma_dispositionSchedule.title=Programma di conservazione -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Programma di conservazione - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo di vita di conservazione -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo di vita di conservazione -rma_recordsmanagement.association.rma_nextDispositionAction.title=Prossima azione di conservazione -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Prossima azione di conservazione -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Cronologia azione di conservazione -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Cronologia azione di conservazione - -rma_recordsmanagement.aspect.rma_cutOff.title=Cut off -rma_recordsmanagement.aspect.rma_cutOff.decription=Cut off -rma_recordsmanagement.property.rma_cutOffDate.title=Data cut off -rma_recordsmanagement.property.rma_cutOffDate.decription=Data cut off - -rma_recordsmanagement.aspect.rma_transferred.title=Trasferito -rma_recordsmanagement.aspect.rma_transferred.decription=Trasferito - -rma_recordsmanagement.aspect.rma_ascended.title=Asceso -rma_recordsmanagement.aspect.rma_ascended.decription=Asceso - -rma_recordsmanagement.aspect.rma_frozen.title=Sospeso -rma_recordsmanagement.aspect.rma_frozen.decription=Sospeso -rma_recordsmanagement.property.rma_frozenAt.title=Sospeso presso -rma_recordsmanagement.property.rma_frozenAt.decription=Sospeso presso -rma_recordsmanagement.property.rma_frozenBy.title=Sospeso da -rma_recordsmanagement.property.rma_frozenBy.decription=Sospeso da - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Radice di configurazione avvertenza -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Radice di configurazione avvertenza -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configurazione avvertenza -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configurazione avvertenza - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Radice Config E-mail -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Radice Config E-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configurazione e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configurazione e-mail - -rma_recordsmanagement.aspect.rma_recordSearch.title=Ricerca record -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informazioni per supportare la ricerca di Records Management -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Con Programma di conservazione -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica se un programma di conservazione \u00e8 stato associato a un certo elemento -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nome dell'azione di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Il nome della prossima azione di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Azione di conservazione del -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La data in cui la prossima azione di conservazione diventa idonea -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Espressione del periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Espressione del periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventi di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventi di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autorit\u00e0 di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autorit\u00e0 di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Istruzioni per la conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Istruzioni per la conservazione -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motivo sospensione -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motivo sospensione -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Periodo di esame record fondamentale -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Periodo di esame record fondamentale -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Espressione periodo di esame -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Espressione periodo di esame - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Record con versione -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Record con versione - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Aggiornamento non pubblicato -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Aggiornamento non pubblicato -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Aggiornamento non pubblicato -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica se \u00e8 presente un aggiornamento non pubblicato -rma_recordsmanagement.property.rma_updateTo.title=Aggiornamento a -rma_recordsmanagement.property.rma_updateTo.description=Destinazione dell'aggiornamento -rma_recordsmanagement.property.rma_updatedProperties.title=Propriet\u00e0 aggiornate -rma_recordsmanagement.property.rma_updatedProperties.description=Le propriet\u00e0 aggiornate -rma_recordsmanagement.property.rma_publishInProgress.title=Pubblicazione in corso -rma_recordsmanagement.property.rma_publishInProgress.description=Indica se \u00e8 in corso una pubblicazione - -rma_recordsmanagement.aspect.dod_ghosted.title=Record di soli metadati -rma_recordsmanagement.aspect.dod_ghosted.description=Record di soli metadati - -listconstraint.rmc_tlList.title=Posizioni di trasferimento -listconstraint.rmc_smList.title=Contrassegni supplementari diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties deleted file mode 100644 index 2a6c27af1a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb - -rma_recordsmanagement.type.rma_rmsite.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b5\u30a4\u30c8 -rma_recordsmanagement.type.rma_rmsite.description=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u7528\u306e\u5c02\u9580\u30b5\u30a4\u30c8 - -rma_recordsmanagement.type.rma_caveatConfig.title=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a -rma_recordsmanagement.type.rma_caveatConfig.decription=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a - -rma_recordsmanagement.type.rma_emailConfig.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a -rma_recordsmanagement.type.rma_emailConfig.decription=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u30b3\u30f3\u30c6\u30ca\u30fc -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u30b3\u30f3\u30c6\u30ca\u30fc - -rma_recordsmanagement.type.rma_dispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb -rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb - -rma_recordsmanagement.property.rma_dispositionAuthority.title=\u4fdd\u7ba1\u6a29\u9650 -rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u4fdd\u7ba1\u6a29\u9650 - -rma_recordsmanagement.property.rma_dispositionInstructions.title=\u4fdd\u7ba1\u6307\u793a -rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u4fdd\u7ba1\u6307\u793a - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u30ec\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u306e\u4fdd\u7ba1 -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u30ec\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u306e\u4fdd\u7ba1 - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u4fdd\u7ba1\u51e6\u7406 - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9 -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9 -rma_recordsmanagement.property.rma_dispositionActionName.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_dispositionActionName.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_dispositionDescription.title=\u4fdd\u7ba1\u306e\u8aac\u660e -rma_recordsmanagement.property.rma_dispositionDescription.decription=\u4fdd\u7ba1\u306e\u8aac\u660e -rma_recordsmanagement.property.rma_dispositionLocation.title=\u4fdd\u7ba1\u5834\u6240 -rma_recordsmanagement.property.rma_dispositionLocation.decription=\u4fdd\u7ba1\u5834\u6240 -rma_recordsmanagement.property.rma_dispositionPeriod.title=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u4fdd\u7ba1\u671f\u9593\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u4fdd\u7ba1\u671f\u9593\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_dispositionEvent.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionEvent.decription=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8\u306e\u7d44\u307f\u5408\u308f\u305b -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8\u306e\u7d44\u307f\u5408\u308f\u305b - -rma_recordsmanagement.type.rma_recordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rma_recordsmanagement.type.rma_recordFolder.decription=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rma_recordsmanagement.property.rma_isClosed.title=\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_isClosed.decription=\u30ec\u30b3\u30fc\u30c9 - -rma_recordsmanagement.type.rma_recordCategory.title=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea -rma_recordsmanagement.type.rma_recordCategory.decription=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u975e\u96fb\u5b50\u6587\u66f8 -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u975e\u96fb\u5b50\u6587\u66f8 -rma_recordsmanagement.property.rma_physicalSize.title=\u7269\u7406\u7684\u306a\u30b5\u30a4\u30ba -rma_recordsmanagement.property.rma_physicalSize.decription=\u6587\u66f8\u306e\u30b5\u30a4\u30ba\u306f\u30ea\u30cb\u30a2\u30e1\u30fc\u30bf\u30fc\u3067\u8a08\u6e2c\u3055\u308c\u307e\u3059\u3002 -rma_recordsmanagement.property.rma_numberOfCopies.title=\u30b3\u30d4\u30fc\u6570 -rma_recordsmanagement.property.rma_numberOfCopies.description=\u6587\u66f8\u306e\u30b3\u30d4\u30fc\u6570\u3002 -rma_recordsmanagement.property.rma_storageLocation.title=\u4fdd\u7ba1\u5834\u6240 -rma_recordsmanagement.property.rma_storageLocation.decription=\u30ec\u30b3\u30fc\u30c9\u306e\u7269\u7406\u7684\u306a\u4fdd\u7ba1\u5834\u6240\u3002 -rma_recordsmanagement.property.rma_shelf.title=\u68da -rma_recordsmanagement.property.rma_shelf.decription=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u68da\u3002 -rma_recordsmanagement.property.rma_box.title=\u7bb1 -rma_recordsmanagement.property.rma_box.description=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u7bb1\u3002 -rma_recordsmanagement.property.rma_file.title=\u30d5\u30a1\u30a4\u30eb -rma_recordsmanagement.property.rma_file.decription=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u30d5\u30a1\u30a4\u30eb\u3002 - -rma_recordsmanagement.type.rma_dispositionAction.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.type.rma_dispositionAction.decription=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionActionId.title=\u4fdd\u7ba1\u51e6\u7406 ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=\u4fdd\u7ba1\u51e6\u7406 ID -rma_recordsmanagement.property.rma_dispositionAction.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionAction.decription=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionAsOf.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u8005 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.association.rma_eventExecutions.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c -rma_recordsmanagement.association.rma_eventExecutions.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c - -rma_recordsmanagement.type.rma_eventExecution.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c -rma_recordsmanagement.type.rma_eventExecution.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c -rma_recordsmanagement.property.rma_eventExecutionName.title=\u30a4\u30d9\u30f3\u30c8\u540d -rma_recordsmanagement.property.rma_eventExecutionName.decription=\u30a4\u30d9\u30f3\u30c8\u540d -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u30a4\u30d9\u30f3\u30c8\u306e\u81ea\u52d5\u5316 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u81ea\u52d5\u5316 -rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u30a4\u30d9\u30f3\u30c8\u5b8c\u4e86 -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u30a4\u30d9\u30f3\u30c8\u5b8c\u4e86 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u65e5\u6642 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u65e5\u6642 - -rma_recordsmanagement.type.rma_hold.title=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.type.rma_hold.decription=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.property.rma_holdReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.property.rma_holdReason.decription=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.association.rma_frozenRecords.title=\u30db\u30fc\u30eb\u30c9\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.association.rma_frozenRecords.decription=\u30db\u30fc\u30eb\u30c9\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9 - -rma_recordsmanagement.type.rma_transfer.title=\u8ee2\u9001 -rma_recordsmanagement.type.rma_transfer.decription=\u8ee2\u9001 -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u8ee2\u9001\u53d7\u8afe\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u8ee2\u9001\u53d7\u8afe\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferPDFIndicator.title=PDF\u306e\u8ee2\u9001\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=PDF\u306e\u8ee2\u9001\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferLocation.title=PDF\u306e\u8ee2\u9001 -rma_recordsmanagement.property.rma_transferLocation.decription=PDF\u306e\u8ee2\u9001 -rma_recordsmanagement.association.rma_transferred.title=\u8ee2\u9001\u6e08\u307f -rma_recordsmanagement.association.rma_transferred.decription=\u8ee2\u9001\u6e08\u307f - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 -rma_recordsmanagement.property.rma_rootNodeRef.title=\u30eb\u30fc\u30c8\u30ce\u30fc\u30c9 -rma_recordsmanagement.property.rma_rootNodeRef.decription=\u30eb\u30fc\u30c8\u30ce\u30fc\u30c9 - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8 -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8 -rma_recordsmanagement.association.rma_holds.title=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.association.rma_holds.decription=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.association.rma_transfers.title=\u8ee2\u9001 -rma_recordsmanagement.association.rma_transfers.decription=\u8ee2\u9001 - -rma_recordsmanagement.aspect.rma_declaredRecord.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_declaredAt.title=\u5b8c\u4e86\u65e5 -rma_recordsmanagement.property.rma_declaredAt.decription=\u5b8c\u4e86\u65e5 -rma_recordsmanagement.property.rma_declaredBy.title=\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_declaredBy.decription=\u5b8c\u4e86\u8005 - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 ID -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 ID -rma_recordsmanagement.property.rma_identifier.title=\u30ec\u30b3\u30fc\u30c9 ID -rma_recordsmanagement.property.rma_identifier.decription=\u4e00\u610f\u306e\u30ec\u30b3\u30fc\u30c9 ID -rma_recordsmanagement.property.rma_dbUniquenessId.title=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u610f\u6027 -rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u610f\u6027 - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9 -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9 - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc - -rma_recordsmanagement.aspect.rma_record.title=\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_record.decription=\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_dateFiled.title=\u6574\u7406\u4fdd\u7ba1\u65e5 -rma_recordsmanagement.property.rma_dateFiled.decription=\u6574\u7406\u4fdd\u7ba1\u65e5 -rma_recordsmanagement.property.rma_origionalName=\u5143\u306e\u540d\u524d - -rma_recordsmanagement.aspect.rma_recordMetaData.title=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf -rma_recordsmanagement.aspect.rma_recordMetaData.description=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30fc\u30ab\u30fc\u30a2\u30b9\u30da\u30af\u30c8 - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u5171\u901a\u3059\u308b\u30ec\u30b3\u30fc\u30c9\u60c5\u5831 -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306b\u5171\u901a\u3059\u308b\u30e1\u30bf\u30c7\u30fc\u30bf -rma_recordsmanagement.property.rma_location.title=\u5834\u6240 -rma_recordsmanagement.property.rma_location.decription=\u5834\u6240 - -rma_recordsmanagement.aspect.rma_vitalRecord.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_reviewAsOf.title=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc -rma_recordsmanagement.property.rma_reviewAsOf.decription=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc - -rma_recordsmanagement.aspect.rma_scheduled.title=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f -rma_recordsmanagement.aspect.rma_scheduled.decription=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f -rma_recordsmanagement.association.rma_dispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb -rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb -rma_recordsmanagement.association.rma_nextDispositionAction.title=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5c65\u6b74 -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5c65\u6b74 - -rma_recordsmanagement.aspect.rma_cutOff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -rma_recordsmanagement.aspect.rma_cutOff.decription=\u30ab\u30c3\u30c8\u30aa\u30d5 -rma_recordsmanagement.property.rma_cutOffDate.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u65e5 -rma_recordsmanagement.property.rma_cutOffDate.decription=\u30ab\u30c3\u30c8\u30aa\u30d5\u65e5 - -rma_recordsmanagement.aspect.rma_transferred.title=\u8ee2\u9001\u6e08\u307f -rma_recordsmanagement.aspect.rma_transferred.decription=\u8ee2\u9001\u6e08\u307f - -rma_recordsmanagement.aspect.rma_ascended.title=\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u6e08\u307f -rma_recordsmanagement.aspect.rma_ascended.decription=\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u6e08\u307f - -rma_recordsmanagement.aspect.rma_frozen.title=\u30db\u30fc\u30eb\u30c9\u4e2d -rma_recordsmanagement.aspect.rma_frozen.decription=\u30db\u30fc\u30eb\u30c9\u4e2d -rma_recordsmanagement.property.rma_frozenAt.title=\u30db\u30fc\u30eb\u30c9\u65e5\u6642 -rma_recordsmanagement.property.rma_frozenAt.decription=\u30db\u30fc\u30eb\u30c9\u65e5\u6642 -rma_recordsmanagement.property.rma_frozenBy.title=\u30db\u30fc\u30eb\u30c9\u5b9f\u884c\u8005 -rma_recordsmanagement.property.rma_frozenBy.decription=\u30db\u30fc\u30eb\u30c9\u5b9f\u884c\u8005 - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u8b66\u544a\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u8b66\u544a\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u8b66\u544a\u306e\u8a2d\u5b9a -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u8b66\u544a\u306e\u8a2d\u5b9a - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a - -rma_recordsmanagement.aspect.rma_recordSearch.title=\u30ec\u30b3\u30fc\u30c9\u306e\u691c\u7d22 -rma_recordsmanagement.aspect.rma_recordSearch.decription=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u3067\u306e\u691c\u7d22\u306b\u95a2\u3059\u308b\u60c5\u5831 -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3042\u308a -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u30a2\u30a4\u30c6\u30e0\u306b\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002 -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u53ef\u80fd\u65e5 -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406\u304c\u5b9f\u884c\u53ef\u80fd\u306b\u306a\u308b\u65e5 -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u4fdd\u7ba1\u671f\u9593\u306e\u8a08\u7b97\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u4fdd\u7ba1\u671f\u9593\u306e\u8a08\u7b97\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u4fdd\u7ba1\u6a29\u9650 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u4fdd\u7ba1\u6a29\u9650 -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u4fdd\u7ba1\u6307\u793a -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u4fdd\u7ba1\u6307\u793a -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u30ec\u30d3\u30e5\u30fc\u671f\u9593\u306e\u8a08\u7b97\u5f0f -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u30ec\u30d3\u30e5\u30fc\u671f\u9593\u306e\u8a08\u7b97\u5f0f - -rma_recordsmanagement.aspect.rma_versionedRecord.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 -rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 -rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059 -rma_recordsmanagement.property.rma_updateTo.title=\u66f4\u65b0\u5148 -rma_recordsmanagement.property.rma_updateTo.description=\u66f4\u65b0\u306e\u9069\u7528\u5148 -rma_recordsmanagement.property.rma_updatedProperties.title=\u66f4\u65b0\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_updatedProperties.description=\u66f4\u65b0\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_publishInProgress.title=\u516c\u958b\u4e2d -rma_recordsmanagement.property.rma_publishInProgress.description=\u73fe\u5728\u516c\u958b\u4e2d\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059 - -rma_recordsmanagement.aspect.dod_ghosted.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u307f\u306e\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.dod_ghosted.description=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u307f\u306e\u30ec\u30b3\u30fc\u30c9 - -listconstraint.rmc_tlList.title=\u8ee2\u9001\u5834\u6240 -listconstraint.rmc_smList.title=\u88dc\u8db3\u30de\u30fc\u30ad\u30f3\u30b0 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties deleted file mode 100644 index 5fcdf8d9d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties +++ /dev/null @@ -1,263 +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=Konfigurasjon av sikkerhetskontroller -rma_recordsmanagement.type.rma_caveatConfig.decription=Konfigurasjon av sikkerhetskontroller - -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=Retensjonsplan -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retensjonsplan - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Retensjonsrett -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retensjonsrett - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Retensjonsinstruksjoner -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retensjonsinstruksjoner - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Oppf\u00f8ringsniv\u00e5 ved retensjon -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Oppf\u00f8ringsniv\u00e5 ved retensjon - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retensjonshandlinger -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retensjonshandlinger - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definisjon av retensjonshandling -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definisjon av retensjonshandling -rma_recordsmanagement.property.rma_dispositionActionName.title=Navn p\u00e5 retensjonshandling -rma_recordsmanagement.property.rma_dispositionActionName.decription=Navn p\u00e5 retensjonshandling -rma_recordsmanagement.property.rma_dispositionDescription.title=Retensjonsbeskrivelse -rma_recordsmanagement.property.rma_dispositionDescription.decription=Retensjonsbeskrivelse -rma_recordsmanagement.property.rma_dispositionLocation.title=Retensjonssted -rma_recordsmanagement.property.rma_dispositionLocation.decription=Retensjonssted -rma_recordsmanagement.property.rma_dispositionPeriod.title=Retensjonsperiode -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retensjonsperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Egenskap ved retensjonsperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Egenskap ved retensjonsperiode -rma_recordsmanagement.property.rma_dispositionEvent.title=Retensjonshendelse -rma_recordsmanagement.property.rma_dispositionEvent.decription=Retensjonshendelse -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Kombinert retensjonshendelse -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Kombinert retensjonshendelse - -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 oppbevares p\u00e5. -rma_recordsmanagement.property.rma_box.title=Eske -rma_recordsmanagement.property.rma_box.description=Esken som oppf\u00f8ringen oppbevares i. -rma_recordsmanagement.property.rma_file.title=Fil -rma_recordsmanagement.property.rma_file.decription=Filen som oppf\u00f8ringen oppbevares i. - -rma_recordsmanagement.type.rma_dispositionAction.title=Retensjonshandling -rma_recordsmanagement.type.rma_dispositionAction.decription=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionActionId.title=Retensjonshandling-ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=Retensjonshandling-ID -rma_recordsmanagement.property.rma_dispositionAction.title=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionAction.decription=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionAsOf.title=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retensjonshandling som starter p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retensjonshandling som starter p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retensjonshandling som startes av -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retensjonshandling som startes av -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retensjonshandling som fullf\u00f8res p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retensjonshandling som fullf\u00f8res p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retensjonshandling som fullf\u00f8res av -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retensjonshandling som fullf\u00f8res 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=Oppf\u00f8rings-ID -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=Oppf\u00f8ringsmetadata -rma_recordsmanagement.aspect.rma_recordMetaData.description=Mark\u00f8raspekt for oppf\u00f8ringsmetadata - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Felles oppf\u00f8ringsinformasjon -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Felles metadata for alle oppf\u00f8ringstyper -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.aspect.rma_scheduled.title=Planlagt -rma_recordsmanagement.aspect.rma_scheduled.decription=Planlagt -rma_recordsmanagement.association.rma_dispositionSchedule.title=Retensjonsplan -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retensjonsplan - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Livssyklus ved retensjon -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Livssyklus ved retensjon -rma_recordsmanagement.association.rma_nextDispositionAction.title=Neste retensjonshandling -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Neste retensjonshandling -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historikk ved retensjonshandling -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historikk ved retensjonshandling - -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=Roten ved e-postkonfigurasjon -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Roten ved e-postkonfigurasjon -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=Informasjon som st\u00f8tter s\u00f8k i oppf\u00f8ringsh\u00e5ndtering -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Har retensjonsplan -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indikerer om elementet er forbundet med retensjonsplanen -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Navn p\u00e5 retensjonshandling -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Navnet p\u00e5 neste retensjonshandling -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retensjonshandling av -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Datoen n\u00e5r neste retensjonshandling blir kvalifisert -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uttrykk ved retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uttrykk ved retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retensjonsrett -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retensjonsrett -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retensjonsinstruksjoner -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retensjonsinstruksjoner -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties deleted file mode 100755 index f1e3438ed7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Contentmodel Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Site Records Management -rma_recordsmanagement.type.rma_rmsite.description=Gespecialiseerde site voor Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Configuratie beveiligingsfuncties -rma_recordsmanagement.type.rma_caveatConfig.decription=Configuratie beveiligingsfuncties - -rma_recordsmanagement.type.rma_emailConfig.title=E-mailconfiguratie -rma_recordsmanagement.type.rma_emailConfig.decription=E-mailconfiguratie - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Container Records Management -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Container Records Management - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Oorsprongcontainer Records Management -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Oorsprongcontainer Records Management - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Retentieschema -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retentieschema - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Retentieautoriteit -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retentieautoriteit - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Retentie-instructies -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retentie-instructies - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Retentie op archiefstukniveau -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Retentie op archiefstukniveau - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retentieacties -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retentieacties - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definitie retentieactie -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definitie retentieactie -rma_recordsmanagement.property.rma_dispositionActionName.title=Naam retentieactie -rma_recordsmanagement.property.rma_dispositionActionName.decription=Naam retentieactie -rma_recordsmanagement.property.rma_dispositionDescription.title=Retentiebeschrijving -rma_recordsmanagement.property.rma_dispositionDescription.decription=Retentiebeschrijving -rma_recordsmanagement.property.rma_dispositionLocation.title=Retentielocatie -rma_recordsmanagement.property.rma_dispositionLocation.decription=Retentielocatie -rma_recordsmanagement.property.rma_dispositionPeriod.title=Retentieperiode -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retentieperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Eigenschap retentieperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Eigenschap retentieperiode -rma_recordsmanagement.property.rma_dispositionEvent.title=Retentiegebeurtenis -rma_recordsmanagement.property.rma_dispositionEvent.decription=Retentiegebeurtenis -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinatie retentiegebeurtenis -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinatie retentiegebeurtenis - -rma_recordsmanagement.type.rma_recordFolder.title=Archiefmap -rma_recordsmanagement.type.rma_recordFolder.decription=Archiefmap -rma_recordsmanagement.property.rma_isClosed.title=Archiefstuk -rma_recordsmanagement.property.rma_isClosed.decription=Archiefstuk - -rma_recordsmanagement.type.rma_recordCategory.title=Archiefstukcategorie -rma_recordsmanagement.type.rma_recordCategory.decription=Archiefstukcategorie - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Niet-elektronisch document -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Niet-elektronisch document -rma_recordsmanagement.property.rma_physicalSize.title=Fysieke grootte -rma_recordsmanagement.property.rma_physicalSize.decription=De grootte van het document gemeten in lineaire meters. -rma_recordsmanagement.property.rma_numberOfCopies.title=Aantal exemplaren -rma_recordsmanagement.property.rma_numberOfCopies.description=Het aantal exemplaren van het document. -rma_recordsmanagement.property.rma_storageLocation.title=Opslaglocatie -rma_recordsmanagement.property.rma_storageLocation.decription=De fysieke opslaglocatie van het archiefstuk. -rma_recordsmanagement.property.rma_shelf.title=Plank -rma_recordsmanagement.property.rma_shelf.decription=De plank waarop het archiefstuk wordt bewaard. -rma_recordsmanagement.property.rma_box.title=Doos -rma_recordsmanagement.property.rma_box.description=De doos waarin het archiefstuk wordt bewaard. -rma_recordsmanagement.property.rma_file.title=Archiveren -rma_recordsmanagement.property.rma_file.decription=Het archief waarin het archiefstuk wordt bewaard. - -rma_recordsmanagement.type.rma_dispositionAction.title=Retentieactie -rma_recordsmanagement.type.rma_dispositionAction.decription=Retentieactie -rma_recordsmanagement.property.rma_dispositionActionId.title=Id retentieactie -rma_recordsmanagement.property.rma_dispositionActionId.decription=Id retentieactie -rma_recordsmanagement.property.rma_dispositionAction.title=Retentieactie -rma_recordsmanagement.property.rma_dispositionAction.decription=Retentieactie -rma_recordsmanagement.property.rma_dispositionAsOf.title=Retentieactie -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retentieactie -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retentieactie gestart op -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retentieactie gestart op -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retentieactie gestart door -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retentieactie gestart door -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retentieactie afgerond op -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retentieactie afgerond op -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retentieactie afgerond door -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retentieactie afgerond door -rma_recordsmanagement.association.rma_eventExecutions.title=Gebeurtenisuitvoeringen -rma_recordsmanagement.association.rma_eventExecutions.decription=Gebeurtenisuitvoeringen - -rma_recordsmanagement.type.rma_eventExecution.title=Gebeurtenisuitvoering -rma_recordsmanagement.type.rma_eventExecution.decription=Gebeurtenisuitvoering -rma_recordsmanagement.property.rma_eventExecutionName.title=Gebeurtenisnaam -rma_recordsmanagement.property.rma_eventExecutionName.decription=Gebeurtenisnaam -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Gebeurtenis automatisch -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Gebeurtenis automatisch -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Gebeurtenis afgerond -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Gebeurtenis afgerond -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Gebeurtenis afgerond door -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Gebeurtenis afgerond door -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Gebeurtenis afgerond op -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Gebeurtenis afgerond op - -rma_recordsmanagement.type.rma_hold.title=Bewaring -rma_recordsmanagement.type.rma_hold.decription=Bewaring -rma_recordsmanagement.property.rma_holdReason.title=Reden van bewaring -rma_recordsmanagement.property.rma_holdReason.decription=Reden van bewaring -rma_recordsmanagement.association.rma_frozenRecords.title=Archiefstukken in bewaring -rma_recordsmanagement.association.rma_frozenRecords.decription=Archiefstukken in bewaring - -rma_recordsmanagement.type.rma_transfer.title=Overzetten -rma_recordsmanagement.type.rma_transfer.decription=Overzetten -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicator voor overzettingsoverdracht -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicator voor overzettingsoverdracht -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicator PDF overzetten -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicator PDF overzetten -rma_recordsmanagement.property.rma_transferLocation.title=PDF overzetten -rma_recordsmanagement.property.rma_transferLocation.decription=PDF overzetten -rma_recordsmanagement.association.rma_transferred.title=Overgezet -rma_recordsmanagement.association.rma_transferred.decription=Overgezet - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Onderdeel ordeningsplan -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Onderdeel ordeningsplan -rma_recordsmanagement.property.rma_rootNodeRef.title=Oorsprongnode -rma_recordsmanagement.property.rma_rootNodeRef.decription=Oorsprongnode - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Oorsprong Records Management -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Oorsprong Records Management -rma_recordsmanagement.association.rma_holds.title=Bewaringen -rma_recordsmanagement.association.rma_holds.decription=Bewaringen -rma_recordsmanagement.association.rma_transfers.title=Overzettingen -rma_recordsmanagement.association.rma_transfers.decription=Overzettingen - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Afgerond archiefstuk -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Afgerond archiefstuk -rma_recordsmanagement.property.rma_declaredAt.title=Datum afgerond -rma_recordsmanagement.property.rma_declaredAt.decription=Datum afgerond -rma_recordsmanagement.property.rma_declaredBy.title=Afgerond door -rma_recordsmanagement.property.rma_declaredBy.decription=Afgerond door - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificatie archiefstukonderdeel -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificatie archiefstukonderdeel -rma_recordsmanagement.property.rma_identifier.title=Archiefstuk-id -rma_recordsmanagement.property.rma_identifier.decription=Unieke identificatie archiefstuk -rma_recordsmanagement.property.rma_dbUniquenessId.title=Uniekheid database -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Uniekheid database - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definitie vitaal archiefstuk -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definitie vitaal archiefstuk - -rma_recordsmanagement.property.rma_reviewPeriod.title=Revisieperiode -rma_recordsmanagement.property.rma_reviewPeriod.decription=Revisieperiode -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicator vitaal archiefstuk -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicator vitaal archiefstuk - -rma_recordsmanagement.aspect.rma_record.title=Archiefstuk -rma_recordsmanagement.aspect.rma_record.decription=Archiefstuk -rma_recordsmanagement.property.rma_dateFiled.title=Datum gearchiveerd -rma_recordsmanagement.property.rma_dateFiled.decription=Datum gearchiveerd -rma_recordsmanagement.property.rma_origionalName=Oorspronkelijke naam - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metagegevens van archiefstuk -rma_recordsmanagement.aspect.rma_recordMetaData.description=Markeraspect voor metagegevens van archiefstuk - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Algemene archiefstukgegevens -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Algemene metagegevens voor alle archiefstuktypes -rma_recordsmanagement.property.rma_location.title=Locatie -rma_recordsmanagement.property.rma_location.decription=Locatie - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Vitaal archiefstuk -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vitaal archiefstuk -rma_recordsmanagement.property.rma_reviewAsOf.title=Volgende revisie -rma_recordsmanagement.property.rma_reviewAsOf.decription=Volgende revisie - -rma_recordsmanagement.aspect.rma_scheduled.title=Gepland -rma_recordsmanagement.aspect.rma_scheduled.decription=Gepland -rma_recordsmanagement.association.rma_dispositionSchedule.title=Retentieschema -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retentieschema - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Retentiecyclus -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Retentiecyclus -rma_recordsmanagement.association.rma_nextDispositionAction.title=Volgende retentieactie -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Volgende retentieactie -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Geschiedenis retentieactie -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Geschiedenis retentieactie - -rma_recordsmanagement.aspect.rma_cutOff.title=Afsluiten -rma_recordsmanagement.aspect.rma_cutOff.decription=Afsluiten -rma_recordsmanagement.property.rma_cutOffDate.title=Datum voor afsluiten -rma_recordsmanagement.property.rma_cutOffDate.decription=Datum voor afsluiten - -rma_recordsmanagement.aspect.rma_transferred.title=Overgezet -rma_recordsmanagement.aspect.rma_transferred.decription=Overgezet - -rma_recordsmanagement.aspect.rma_ascended.title=Opgelopen -rma_recordsmanagement.aspect.rma_ascended.decription=Opgelopen - -rma_recordsmanagement.aspect.rma_frozen.title=In bewaring -rma_recordsmanagement.aspect.rma_frozen.decription=In bewaring -rma_recordsmanagement.property.rma_frozenAt.title=In bewaring in -rma_recordsmanagement.property.rma_frozenAt.decription=In bewaring in -rma_recordsmanagement.property.rma_frozenBy.title=In bewaring door -rma_recordsmanagement.property.rma_frozenBy.decription=In bewaring door - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Oorsprong Caveat-configuratie -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Oorsprong Caveat-configuratie -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat-configuratie -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat-configuratie - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Oorsprong e-mailconfiguratie -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Oorsprong e-mailconfiguratie -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-mailconfiguratie -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-mailconfiguratie - -rma_recordsmanagement.aspect.rma_recordSearch.title=Archiefstuk zoeken -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informatie ter ondersteuning van Records Management-zoekopdracht -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Heeft retentieschema -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Geeft aan of er een retentieschema aan het onderdeel is gekoppeld -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Naam retentieactie -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=De naam van de volgende retentieactie -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retentieactie van -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=De datum waarop de volgende retentieactie in aanmerking komt -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uitdrukking retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uitdrukking retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retentieautoriteit -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retentieautoriteit -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retentie-instructies -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retentie-instructies -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Reden van bewaring -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Reden van bewaring -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Revisieperiode vitaal archiefstuk -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Revisieperiode vitaal archiefstuk -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Uitdrukking van revisieperiode -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Uitdrukking van revisieperiode - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Archiefstuk met versiebeheer -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Archiefstuk met versiebeheer - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Ongepubliceerde update -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Ongepubliceerde update -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Ongepubliceerde update -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Geeft aan of er een ongepubliceerde update is -rma_recordsmanagement.property.rma_updateTo.title=Bijwerken naar -rma_recordsmanagement.property.rma_updateTo.description=Bestemming van de update -rma_recordsmanagement.property.rma_updatedProperties.title=Bijgewerkte eigenschappen -rma_recordsmanagement.property.rma_updatedProperties.description=De bijgewerkte eigenschappen -rma_recordsmanagement.property.rma_publishInProgress.title=Publicatie bezig -rma_recordsmanagement.property.rma_publishInProgress.description=Geeft aan of er momenteel een publicatie wordt uitgevoerd - -rma_recordsmanagement.aspect.dod_ghosted.title=Archiefstuk met alleen metagegevens -rma_recordsmanagement.aspect.dod_ghosted.description=Archiefstuk met alleen metagegevens - -listconstraint.rmc_tlList.title=Overzetlocaties -listconstraint.rmc_smList.title=Aanvullende markeringen diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties deleted file mode 100644 index 3257b661d4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=Modelo do conte\u00fado do Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Site do Records Management -rma_recordsmanagement.type.rma_rmsite.description=Site especializado do Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Configura\u00e7\u00e3o de controles de seguran\u00e7a -rma_recordsmanagement.type.rma_caveatConfig.decription=Configura\u00e7\u00e3o de controles de seguran\u00e7a - -rma_recordsmanagement.type.rma_emailConfig.title=Configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.type.rma_emailConfig.decription=Configura\u00e7\u00e3o de e-mail - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Cont\u00eainer do Records Management -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Cont\u00eainer do Records Management - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Cont\u00eainer da raiz do Records Management -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Cont\u00eainer da raiz do Records Management - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Programa\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Programa\u00e7\u00e3o de reten\u00e7\u00e3o - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Autoridade de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autoridade de reten\u00e7\u00e3o - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instru\u00e7\u00f5es de reten\u00e7\u00e3o - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Reten\u00e7\u00e3o de n\u00edvel de documento arquiv\u00edstico -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Reten\u00e7\u00e3o de n\u00edvel de documento arquiv\u00edstico - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=A\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=A\u00e7\u00f5es de reten\u00e7\u00e3o - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionName.title=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionDescription.title=Descri\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionDescription.decription=Descri\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionLocation.title=Localiza\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionLocation.decription=Localiza\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriod.title=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propriedade do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propriedade do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEvent.title=Evento de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combina\u00e7\u00e3o de eventos de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combina\u00e7\u00e3o de eventos de reten\u00e7\u00e3o - -rma_recordsmanagement.type.rma_recordFolder.title=Pasta de documento arquiv\u00edstico -rma_recordsmanagement.type.rma_recordFolder.decription=Pasta de documento arquiv\u00edstico -rma_recordsmanagement.property.rma_isClosed.title=Documento arquiv\u00edstico -rma_recordsmanagement.property.rma_isClosed.decription=Documento arquiv\u00edstico - -rma_recordsmanagement.type.rma_recordCategory.title=Categoria de documento arquiv\u00edstico -rma_recordsmanagement.type.rma_recordCategory.decription=Categoria de documento arquiv\u00edstico - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento n\u00e3o eletr\u00f4nico -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento n\u00e3o eletr\u00f4nico -rma_recordsmanagement.property.rma_physicalSize.title=Tamanho f\u00edsico -rma_recordsmanagement.property.rma_physicalSize.decription=O tamanho do documento medido em metros lineares. -rma_recordsmanagement.property.rma_numberOfCopies.title=N\u00famero de c\u00f3pias -rma_recordsmanagement.property.rma_numberOfCopies.description=O n\u00famero de c\u00f3pias do documento. -rma_recordsmanagement.property.rma_storageLocation.title=Local de armazenamento -rma_recordsmanagement.property.rma_storageLocation.decription=O local f\u00edsico de armazenamento do documento arquiv\u00edstico. -rma_recordsmanagement.property.rma_shelf.title=Prateleira -rma_recordsmanagement.property.rma_shelf.decription=A prateleira em que o documento arquiv\u00edstico est\u00e1 armazenado. -rma_recordsmanagement.property.rma_box.title=Caixa -rma_recordsmanagement.property.rma_box.description=A caixa em que o documento arquiv\u00edstico est\u00e1 armazenado. -rma_recordsmanagement.property.rma_file.title=Arquivo -rma_recordsmanagement.property.rma_file.decription=O arquivo em que o documento arquiv\u00edstico est\u00e1 armazenado. - -rma_recordsmanagement.type.rma_dispositionAction.title=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.type.rma_dispositionAction.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionId.title=ID da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAction.title=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAction.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAsOf.title=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAsOf.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada em -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada em -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada por -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada por -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda em -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda em -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda por -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda por -rma_recordsmanagement.association.rma_eventExecutions.title=Execu\u00e7\u00f5es de eventos -rma_recordsmanagement.association.rma_eventExecutions.decription=Execu\u00e7\u00f5es de eventos - -rma_recordsmanagement.type.rma_eventExecution.title=Execu\u00e7\u00e3o do evento -rma_recordsmanagement.type.rma_eventExecution.decription=Execu\u00e7\u00e3o do evento -rma_recordsmanagement.property.rma_eventExecutionName.title=Nome do evento -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nome do evento -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento conclu\u00eddo -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento conclu\u00eddo -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento conclu\u00eddo por -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento conclu\u00eddo por -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento conclu\u00eddo em -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento conclu\u00eddo em - -rma_recordsmanagement.type.rma_hold.title=Espera -rma_recordsmanagement.type.rma_hold.decription=Espera -rma_recordsmanagement.property.rma_holdReason.title=Motivo para espera -rma_recordsmanagement.property.rma_holdReason.decription=Motivo para espera -rma_recordsmanagement.association.rma_frozenRecords.title=Documentos arquiv\u00edsticos mantidos -rma_recordsmanagement.association.rma_frozenRecords.decription=Documentos arquiv\u00edsticos mantidos - -rma_recordsmanagement.type.rma_transfer.title=Transferir -rma_recordsmanagement.type.rma_transfer.decription=Transferir -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transferir indicador de ades\u00e3o -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transferir indicador de ades\u00e3o -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transferir indicador do PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transferir indicador do PDF -rma_recordsmanagement.property.rma_transferLocation.title=Transferir PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transferir PDF -rma_recordsmanagement.association.rma_transferred.title=Transferido -rma_recordsmanagement.association.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente do plano de arquivamento -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente do plano de arquivamento -rma_recordsmanagement.property.rma_rootNodeRef.title=N\u00f3 raiz -rma_recordsmanagement.property.rma_rootNodeRef.decription=N\u00f3 raiz - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Raiz do Records Management -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Raiz do Records Management -rma_recordsmanagement.association.rma_holds.title=Esperas -rma_recordsmanagement.association.rma_holds.decription=Esperas -rma_recordsmanagement.association.rma_transfers.title=Transfer\u00eancias -rma_recordsmanagement.association.rma_transfers.decription=Transfer\u00eancias - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Documento arquiv\u00edstico conclu\u00eddo -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Documento arquiv\u00edstico conclu\u00eddo -rma_recordsmanagement.property.rma_declaredAt.title=Data de conclus\u00e3o -rma_recordsmanagement.property.rma_declaredAt.decription=Data de conclus\u00e3o -rma_recordsmanagement.property.rma_declaredBy.title=Conclu\u00eddo por -rma_recordsmanagement.property.rma_declaredBy.decription=Conclu\u00eddo por - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificador do componente do documento arquiv\u00edstico -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificador do componente do documento arquiv\u00edstico -rma_recordsmanagement.property.rma_identifier.title=ID do documento arquiv\u00edstico -rma_recordsmanagement.property.rma_identifier.decription=Identificador de documento arquiv\u00edstico exclusivo -rma_recordsmanagement.property.rma_dbUniquenessId.title=Exclusividade do banco de dados -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Exclusividade do banco de dados - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Defini\u00e7\u00e3o do documento arquiv\u00edstico vital -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Defini\u00e7\u00e3o do documento arquiv\u00edstico vital - -rma_recordsmanagement.property.rma_reviewPeriod.title=Per\u00edodo de revis\u00e3o -rma_recordsmanagement.property.rma_reviewPeriod.decription=Per\u00edodo de revis\u00e3o -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicador de documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicador de documento arquiv\u00edstico vital - -rma_recordsmanagement.aspect.rma_record.title=Documento arquiv\u00edstico -rma_recordsmanagement.aspect.rma_record.decription=Documento arquiv\u00edstico -rma_recordsmanagement.property.rma_dateFiled.title=Data de arquivamento -rma_recordsmanagement.property.rma_dateFiled.decription=Data de arquivamento -rma_recordsmanagement.property.rma_origionalName=Nome original - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadados do documento arquiv\u00edstico -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspecto do marcador de metadados do documento arquiv\u00edstico - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Detalhes comuns dos documentos arquiv\u00edsticos -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadados comuns de todos os tipos de documentos arquiv\u00edsticos -rma_recordsmanagement.property.rma_location.title=Localiza\u00e7\u00e3o -rma_recordsmanagement.property.rma_location.decription=Localiza\u00e7\u00e3o - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento arquiv\u00edstico vital -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revis\u00e3o -rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revis\u00e3o - -rma_recordsmanagement.aspect.rma_scheduled.title=Programado -rma_recordsmanagement.aspect.rma_scheduled.decription=Programado -rma_recordsmanagement.association.rma_dispositionSchedule.title=Programa\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Programa\u00e7\u00e3o de reten\u00e7\u00e3o - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo de vida de reten\u00e7\u00e3o -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo de vida de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_nextDispositionAction.title=Pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Hist\u00f3rico de a\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Hist\u00f3rico de a\u00e7\u00f5es de reten\u00e7\u00e3o - -rma_recordsmanagement.aspect.rma_cutOff.title=Cortar -rma_recordsmanagement.aspect.rma_cutOff.decription=Cortar -rma_recordsmanagement.property.rma_cutOffDate.title=Data do corte -rma_recordsmanagement.property.rma_cutOffDate.decription=Data do corte - -rma_recordsmanagement.aspect.rma_transferred.title=Transferido -rma_recordsmanagement.aspect.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_ascended.title=Elevado -rma_recordsmanagement.aspect.rma_ascended.decription=Elevado - -rma_recordsmanagement.aspect.rma_frozen.title=Em espera -rma_recordsmanagement.aspect.rma_frozen.decription=Em espera -rma_recordsmanagement.property.rma_frozenAt.title=Mantido em -rma_recordsmanagement.property.rma_frozenAt.decription=Mantido em -rma_recordsmanagement.property.rma_frozenBy.title=Mantido por -rma_recordsmanagement.property.rma_frozenBy.decription=Mantido por - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Raiz da Configura\u00e7\u00e3o Caveat -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Raiz da Configura\u00e7\u00e3o Caveat -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configura\u00e7\u00e3o Caveat -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configura\u00e7\u00e3o Caveat - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Raiz da configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Raiz da configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configura\u00e7\u00e3o de e-mail - -rma_recordsmanagement.aspect.rma_recordSearch.title=Pesquisa de documentos arquiv\u00edsticos -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informa\u00e7\u00f5es para suportar a pesquisa do Records Management -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Tem programa\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica se o item tem uma programa\u00e7\u00e3o de reten\u00e7\u00e3o associada -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=O nome da pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=A\u00e7\u00e3o de reten\u00e7\u00e3o de -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=A data em que a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o torna-se qualificada -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Express\u00e3o do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Express\u00e3o do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventos de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventos de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autoridade de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autoridade de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motivo para espera -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motivo para espera -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Per\u00edodo de revis\u00e3o do documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Per\u00edodo de revis\u00e3o do documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Express\u00e3o do per\u00edodo de revis\u00e3o -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Express\u00e3o do per\u00edodo de revis\u00e3o - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Documento arquiv\u00edstico com vers\u00e3o -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Documento arquiv\u00edstico com vers\u00e3o - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica se h\u00e1 uma atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.property.rma_updateTo.title=Atualizar para -rma_recordsmanagement.property.rma_updateTo.description=Destino da atualiza\u00e7\u00e3o -rma_recordsmanagement.property.rma_updatedProperties.title=Propriedades atualizadas -rma_recordsmanagement.property.rma_updatedProperties.description=As propriedades atualizadas -rma_recordsmanagement.property.rma_publishInProgress.title=Publica\u00e7\u00e3o em andamento -rma_recordsmanagement.property.rma_publishInProgress.description=Indica se uma publica\u00e7\u00e3o est\u00e1 em andamento atualmente - -rma_recordsmanagement.aspect.dod_ghosted.title=Documento arquiv\u00edstico somente de metadados -rma_recordsmanagement.aspect.dod_ghosted.description=Documento arquiv\u00edstico somente de metadados - -listconstraint.rmc_tlList.title=Locais de transfer\u00eancia -listconstraint.rmc_smList.title=Marca\u00e7\u00f5es complementares diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties deleted file mode 100644 index a36fd1abf8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_rmsite.title=\u0421\u0430\u0439\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.type.rma_rmsite.description=\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_caveatConfig.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e -rma_recordsmanagement.type.rma_caveatConfig.decription=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e - -rma_recordsmanagement.type.rma_emailConfig.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.type.rma_emailConfig.decription=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_dispositionSchedule.title=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.property.rma_dispositionAuthority.title=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 - -rma_recordsmanagement.property.rma_dispositionInstructions.title=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionName.title=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionName.decription=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionDescription.title=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionDescription.decription=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionLocation.title=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionLocation.decription=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEvent.title=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEvent.decription=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.type.rma_recordFolder.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.type.rma_recordFolder.decription=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.property.rma_isClosed.title=\u0417\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_isClosed.decription=\u0417\u0430\u043f\u0438\u0441\u044c - -rma_recordsmanagement.type.rma_recordCategory.title=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.type.rma_recordCategory.decription=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u041d\u0435\u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u041d\u0435\u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 -rma_recordsmanagement.property.rma_physicalSize.title=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 -rma_recordsmanagement.property.rma_physicalSize.decription=\u0420\u0430\u0437\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0438\u0441\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 \u043c\u0435\u0442\u0440\u0430\u0445. -rma_recordsmanagement.property.rma_numberOfCopies.title=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043f\u0438\u0439 -rma_recordsmanagement.property.rma_numberOfCopies.description=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043f\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. -rma_recordsmanagement.property.rma_storageLocation.title=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_storageLocation.decription=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438. -rma_recordsmanagement.property.rma_shelf.title=\u041f\u043e\u043b\u043a\u0430 -rma_recordsmanagement.property.rma_shelf.decription=\u041f\u043e\u043b\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. -rma_recordsmanagement.property.rma_box.title=\u042f\u0449\u0438\u043a -rma_recordsmanagement.property.rma_box.description=\u042f\u0449\u0438\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. -rma_recordsmanagement.property.rma_file.title=\u0424\u0430\u0439\u043b -rma_recordsmanagement.property.rma_file.decription=\u0424\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. - -rma_recordsmanagement.type.rma_dispositionAction.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.type.rma_dispositionAction.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionId.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionId.decription=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAction.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAction.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAsOf.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u041a\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u041a\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u041a\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u041a\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_eventExecutions.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.association.rma_eventExecutions.decription=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f - -rma_recordsmanagement.type.rma_eventExecution.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.type.rma_eventExecution.decription=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionName.title=\u0418\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionName.decription=\u0418\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u0410\u0432\u0442\u043e\u043c\u0430\u0442. \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u0410\u0432\u0442\u043e\u043c\u0430\u0442. \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -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_transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -rma_recordsmanagement.type.rma_transfer.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -rma_recordsmanagement.property.rma_transferPDFIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 PDF -rma_recordsmanagement.property.rma_transferLocation.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c PDF -rma_recordsmanagement.property.rma_transferLocation.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c PDF -rma_recordsmanagement.association.rma_transferred.title=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e -rma_recordsmanagement.association.rma_transferred.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 -rma_recordsmanagement.property.rma_rootNodeRef.title=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 -rma_recordsmanagement.property.rma_rootNodeRef.decription=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 - -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_transfers.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -rma_recordsmanagement.association.rma_transfers.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 - -rma_recordsmanagement.aspect.rma_declaredRecord.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_declaredAt.title=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_declaredAt.decription=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_declaredBy.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c -rma_recordsmanagement.property.rma_declaredBy.decription=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_identifier.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_identifier.decription=\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 -rma_recordsmanagement.property.rma_dbUniquenessId.title=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 -rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.aspect.rma_record.title=\u0417\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.aspect.rma_record.decription=\u0417\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_dateFiled.title=\u0414\u0430\u0442\u0430 \u0432\u0432\u043e\u0434\u0430 -rma_recordsmanagement.property.rma_dateFiled.decription=\u0414\u0430\u0442\u0430 \u0432\u0432\u043e\u0434\u0430 -rma_recordsmanagement.property.rma_origionalName=\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f - -rma_recordsmanagement.aspect.rma_recordMetaData.title=\u041c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_recordMetaData.description=\u0410\u0441\u043f\u0435\u043a\u0442 \u043f\u043e\u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u041e\u0431\u0449\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.property.rma_location.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_location.decription=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 - -rma_recordsmanagement.aspect.rma_vitalRecord.title=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_reviewAsOf.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 -rma_recordsmanagement.property.rma_reviewAsOf.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 - -rma_recordsmanagement.aspect.rma_scheduled.title=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e -rma_recordsmanagement.aspect.rma_scheduled.decription=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e -rma_recordsmanagement.association.rma_dispositionSchedule.title=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_nextDispositionAction.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e - -rma_recordsmanagement.aspect.rma_cutOff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -rma_recordsmanagement.aspect.rma_cutOff.decription=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -rma_recordsmanagement.property.rma_cutOffDate.title=\u0414\u0430\u0442\u0430 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f -rma_recordsmanagement.property.rma_cutOffDate.decription=\u0414\u0430\u0442\u0430 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f - -rma_recordsmanagement.aspect.rma_transferred.title=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e -rma_recordsmanagement.aspect.rma_transferred.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e - -rma_recordsmanagement.aspect.rma_ascended.title=\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e -rma_recordsmanagement.aspect.rma_ascended.decription=\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e - -rma_recordsmanagement.aspect.rma_frozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -rma_recordsmanagement.aspect.rma_frozen.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -rma_recordsmanagement.property.rma_frozenAt.title=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 -rma_recordsmanagement.property.rma_frozenAt.decription=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 -rma_recordsmanagement.property.rma_frozenBy.title=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c -rma_recordsmanagement.property.rma_frozenBy.decription=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.association.rma_emailConfigAssoc.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.association.rma_emailConfigAssoc.description=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b - -rma_recordsmanagement.aspect.rma_recordSearch.title=\u041f\u043e\u0438\u0441\u043a \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_recordSearch.decription=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u0415\u0441\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u0418\u043c\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u0414\u0430\u0442\u0430, \u043f\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 - -rma_recordsmanagement.aspect.rma_versionedRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_updateTo.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e -rma_recordsmanagement.property.rma_updateTo.description=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_updatedProperties.title=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -rma_recordsmanagement.property.rma_updatedProperties.description=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -rma_recordsmanagement.property.rma_publishInProgress.title=\u0418\u0434\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 -rma_recordsmanagement.property.rma_publishInProgress.description=\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 - -rma_recordsmanagement.aspect.dod_ghosted.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 -rma_recordsmanagement.aspect.dod_ghosted.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 - -listconstraint.rmc_tlList.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -listconstraint.rmc_smList.title=\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0430 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties deleted file mode 100644 index 0472358f41..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties +++ /dev/null @@ -1,263 +0,0 @@ -rma_recordsmanagement.description=\u8bb0\u5f55\u7ba1\u7406\u5185\u5bb9\u6a21\u578b - -rma_recordsmanagement.type.rma_rmsite.title=\u8bb0\u5f55\u7ba1\u7406\u7ad9\u70b9 -rma_recordsmanagement.type.rma_rmsite.description=\u8bb0\u5f55\u7ba1\u7406\u4e13\u7528\u7ad9\u70b9 - -rma_recordsmanagement.type.rma_caveatConfig.title=\u5b89\u5168\u63a7\u4ef6\u914d\u7f6e -rma_recordsmanagement.type.rma_caveatConfig.decription=\u5b89\u5168\u63a7\u4ef6\u914d\u7f6e - -rma_recordsmanagement.type.rma_emailConfig.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e -rma_recordsmanagement.type.rma_emailConfig.decription=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u8bb0\u5f55\u7ba1\u7406\u5bb9\u5668 -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u8bb0\u5f55\u7ba1\u7406\u5bb9\u5668 - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u8bb0\u5f55\u7ba1\u7406\u6839\u5bb9\u5668 -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u8bb0\u5f55\u7ba1\u7406\u6839\u5bb9\u5668 - -rma_recordsmanagement.type.rma_dispositionSchedule.title=\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u4fdd\u7559\u8ba1\u5212 - -rma_recordsmanagement.property.rma_dispositionAuthority.title=\u4fdd\u7559\u6388\u6743 -rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u4fdd\u7559\u6388\u6743 - -rma_recordsmanagement.property.rma_dispositionInstructions.title=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u4fdd\u7559\u8bf4\u660e - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u8bb0\u5f55\u7ea7\u522b\u4fdd\u7559 -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u8bb0\u5f55\u7ea7\u522b\u4fdd\u7559 - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u4fdd\u7559\u64cd\u4f5c - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49 -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49 -rma_recordsmanagement.property.rma_dispositionActionName.title=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 -rma_recordsmanagement.property.rma_dispositionActionName.decription=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 -rma_recordsmanagement.property.rma_dispositionDescription.title=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_dispositionDescription.decription=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_dispositionLocation.title=\u4fdd\u7559\u4f4d\u7f6e -rma_recordsmanagement.property.rma_dispositionLocation.decription=\u4fdd\u7559\u4f4d\u7f6e -rma_recordsmanagement.property.rma_dispositionPeriod.title=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u4fdd\u7559\u5468\u671f\u5c5e\u6027 -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u4fdd\u7559\u5468\u671f\u5c5e\u6027 -rma_recordsmanagement.property.rma_dispositionEvent.title=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_dispositionEvent.decription=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u4fdd\u7559\u4e8b\u4ef6\u7ec4\u5408 -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u4fdd\u7559\u4e8b\u4ef6\u7ec4\u5408 - -rma_recordsmanagement.type.rma_recordFolder.title=\u8bb0\u5f55\u6587\u4ef6\u5939 -rma_recordsmanagement.type.rma_recordFolder.decription=\u8bb0\u5f55\u6587\u4ef6\u5939 -rma_recordsmanagement.property.rma_isClosed.title=\u8bb0\u5f55 -rma_recordsmanagement.property.rma_isClosed.decription=\u8bb0\u5f55 - -rma_recordsmanagement.type.rma_recordCategory.title=\u8bb0\u5f55\u7c7b\u522b -rma_recordsmanagement.type.rma_recordCategory.decription=\u8bb0\u5f55\u7c7b\u522b - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u975e\u7535\u5b50\u6587\u6863 -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u975e\u7535\u5b50\u6587\u6863 -rma_recordsmanagement.property.rma_physicalSize.title=\u7269\u7406\u5c3a\u5bf8 -rma_recordsmanagement.property.rma_physicalSize.decription=\u7ebf\u6027\u4eea\u8868\u6d4b\u91cf\u7684\u6587\u6863\u5c3a\u5bf8\u3002 -rma_recordsmanagement.property.rma_numberOfCopies.title=\u526f\u672c\u6570\u76ee -rma_recordsmanagement.property.rma_numberOfCopies.description=\u6587\u6863\u526f\u672c\u6570\u76ee\u3002 -rma_recordsmanagement.property.rma_storageLocation.title=\u5b58\u50a8\u4f4d\u7f6e -rma_recordsmanagement.property.rma_storageLocation.decription=\u8bb0\u5f55\u7684\u7269\u7406\u5b58\u50a8\u4f4d\u7f6e\u3002 -rma_recordsmanagement.property.rma_shelf.title=\u6258\u67b6 -rma_recordsmanagement.property.rma_shelf.decription=\u5b58\u50a8\u8bb0\u5f55\u7684\u673a\u67b6\u3002 -rma_recordsmanagement.property.rma_box.title=\u7bb1 -rma_recordsmanagement.property.rma_box.description=\u5b58\u50a8\u8bb0\u5f55\u7684\u7bb1\u3002 -rma_recordsmanagement.property.rma_file.title=\u6587\u4ef6 -rma_recordsmanagement.property.rma_file.decription=\u5b58\u50a8\u8bb0\u5f55\u7684\u6587\u4ef6\u3002 - -rma_recordsmanagement.type.rma_dispositionAction.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.type.rma_dispositionAction.decription=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionActionId.title=\u4fdd\u7559\u64cd\u4f5c ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=\u4fdd\u7559\u64cd\u4f5c ID -rma_recordsmanagement.property.rma_dispositionAction.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionAction.decription=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionAsOf.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u8005 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u8005 -rma_recordsmanagement.association.rma_eventExecutions.title=\u4e8b\u4ef6\u6267\u884c -rma_recordsmanagement.association.rma_eventExecutions.decription=\u4e8b\u4ef6\u6267\u884c - -rma_recordsmanagement.type.rma_eventExecution.title=\u4e8b\u4ef6\u6267\u884c -rma_recordsmanagement.type.rma_eventExecution.decription=\u4e8b\u4ef6\u6267\u884c -rma_recordsmanagement.property.rma_eventExecutionName.title=\u4e8b\u4ef6\u540d\u79f0 -rma_recordsmanagement.property.rma_eventExecutionName.decription=\u4e8b\u4ef6\u540d\u79f0 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u81ea\u52a8\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u81ea\u52a8\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u4e8b\u4ef6\u5b8c\u6210 -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u4e8b\u4ef6\u5b8c\u6210 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u4e8b\u4ef6\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u4e8b\u4ef6\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u4e8b\u4ef6\u5b8c\u6210\u65f6\u95f4 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u4e8b\u4ef6\u5b8c\u6210\u65f6\u95f4 - -rma_recordsmanagement.type.rma_hold.title=\u4fdd\u5b58 -rma_recordsmanagement.type.rma_hold.decription=\u4fdd\u5b58 -rma_recordsmanagement.property.rma_holdReason.title=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.property.rma_holdReason.decription=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.association.rma_frozenRecords.title=\u4fdd\u5b58\u8bb0\u5f55 -rma_recordsmanagement.association.rma_frozenRecords.decription=\u4fdd\u5b58\u8bb0\u5f55 - -rma_recordsmanagement.type.rma_transfer.title=\u79fb\u4ea4 -rma_recordsmanagement.type.rma_transfer.decription=\u79fb\u4ea4 -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u79fb\u4ea4\u5165\u7ba1\u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u79fb\u4ea4\u5165\u7ba1\u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferPDFIndicator.title=\u79fb\u4ea4 PDF \u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=\u79fb\u4ea4 PDF \u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferLocation.title=\u79fb\u4ea4 PDF -rma_recordsmanagement.property.rma_transferLocation.decription=\u79fb\u4ea4 PDF -rma_recordsmanagement.association.rma_transferred.title=\u5df2\u79fb\u4ea4 -rma_recordsmanagement.association.rma_transferred.decription=\u5df2\u79fb\u4ea4 - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6 -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6 -rma_recordsmanagement.property.rma_rootNodeRef.title=\u6839\u8282\u70b9 -rma_recordsmanagement.property.rma_rootNodeRef.decription=\u6839\u8282\u70b9 - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u8bb0\u5f55\u7ba1\u7406\u6839 -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u8bb0\u5f55\u7ba1\u7406\u6839 -rma_recordsmanagement.association.rma_holds.title=\u4fdd\u5b58 -rma_recordsmanagement.association.rma_holds.decription=\u4fdd\u5b58 -rma_recordsmanagement.association.rma_transfers.title=\u79fb\u4ea4 -rma_recordsmanagement.association.rma_transfers.decription=\u79fb\u4ea4 - -rma_recordsmanagement.aspect.rma_declaredRecord.title=\u5b8c\u6210\u7684\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u5b8c\u6210\u7684\u8bb0\u5f55 -rma_recordsmanagement.property.rma_declaredAt.title=\u5b8c\u6210\u65e5\u671f -rma_recordsmanagement.property.rma_declaredAt.decription=\u5b8c\u6210\u65e5\u671f -rma_recordsmanagement.property.rma_declaredBy.title=\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_declaredBy.decription=\u5b8c\u6210\u8005 - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u8bb0\u5f55\u7ec4\u4ef6\u6807\u8bc6\u7b26 -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u8bb0\u5f55\u7ec4\u4ef6\u6807\u8bc6\u7b26 -rma_recordsmanagement.property.rma_identifier.title=\u8bb0\u5f55 ID -rma_recordsmanagement.property.rma_identifier.decription=\u552f\u4e00\u8bb0\u5f55\u6807\u8bc6\u7b26 -rma_recordsmanagement.property.rma_dbUniquenessId.title=\u6570\u636e\u5e93\u552f\u4e00\u6027 -rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u6570\u636e\u5e93\u552f\u4e00\u6027 - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u6838\u5fc3\u8bb0\u5f55\u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u6838\u5fc3\u8bb0\u5f55\u6307\u793a\u7b26 - -rma_recordsmanagement.aspect.rma_record.title=\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_record.decription=\u8bb0\u5f55 -rma_recordsmanagement.property.rma_dateFiled.title=\u7acb\u5377\u65e5\u671f -rma_recordsmanagement.property.rma_dateFiled.decription=\u7acb\u5377\u65e5\u671f -rma_recordsmanagement.property.rma_origionalName=\u539f\u59cb\u540d\u79f0 - -rma_recordsmanagement.aspect.rma_recordMetaData.title=\u8bb0\u5f55\u5143\u6570\u636e -rma_recordsmanagement.aspect.rma_recordMetaData.description=\u8bb0\u5f55\u5143\u6570\u636e\u7684\u6807\u8bb0\u5207\u9762 - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u5e38\u89c1\u8bb0\u5f55\u8be6\u7ec6\u4fe1\u606f -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u6240\u6709\u8bb0\u5f55\u7c7b\u578b\u901a\u7528\u7684\u5143\u6570\u636e -rma_recordsmanagement.property.rma_location.title=\u4f4d\u7f6e -rma_recordsmanagement.property.rma_location.decription=\u4f4d\u7f6e - -rma_recordsmanagement.aspect.rma_vitalRecord.title=\u6838\u5fc3\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u6838\u5fc3\u8bb0\u5f55 -rma_recordsmanagement.property.rma_reviewAsOf.title=\u4e0b\u4e2a\u5ba1\u67e5 -rma_recordsmanagement.property.rma_reviewAsOf.decription=\u4e0b\u4e2a\u5ba1\u67e5 - -rma_recordsmanagement.aspect.rma_scheduled.title=\u5df2\u8ba1\u5212 -rma_recordsmanagement.aspect.rma_scheduled.decription=\u5df2\u8ba1\u5212 -rma_recordsmanagement.association.rma_dispositionSchedule.title=\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u4fdd\u7559\u8ba1\u5212 - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u4fdd\u7559\u751f\u547d\u5468\u671f -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u4fdd\u7559\u751f\u547d\u5468\u671f -rma_recordsmanagement.association.rma_nextDispositionAction.title=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u4fdd\u7559\u64cd\u4f5c\u5386\u53f2\u8bb0\u5f55 -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u4fdd\u7559\u64cd\u4f5c\u5386\u53f2\u8bb0\u5f55 - -rma_recordsmanagement.aspect.rma_cutOff.title=\u4e2d\u65ad -rma_recordsmanagement.aspect.rma_cutOff.decription=\u4e2d\u65ad -rma_recordsmanagement.property.rma_cutOffDate.title=\u4e2d\u65ad\u65e5\u671f -rma_recordsmanagement.property.rma_cutOffDate.decription=\u4e2d\u65ad\u65e5\u671f - -rma_recordsmanagement.aspect.rma_transferred.title=\u5df2\u79fb\u4ea4 -rma_recordsmanagement.aspect.rma_transferred.decription=\u5df2\u79fb\u4ea4 - -rma_recordsmanagement.aspect.rma_ascended.title=\u5df2\u4e0a\u5347 -rma_recordsmanagement.aspect.rma_ascended.decription=\u5df2\u4e0a\u5347 - -rma_recordsmanagement.aspect.rma_frozen.title=\u4fdd\u5b58\u4e2d -rma_recordsmanagement.aspect.rma_frozen.decription=\u4fdd\u5b58\u4e2d -rma_recordsmanagement.property.rma_frozenAt.title=\u4fdd\u5b58\u4e8e -rma_recordsmanagement.property.rma_frozenAt.decription=\u4fdd\u5b58\u4e8e -rma_recordsmanagement.property.rma_frozenBy.title=\u4fdd\u5b58\u8005 -rma_recordsmanagement.property.rma_frozenBy.decription=\u4fdd\u5b58\u8005 - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u8b66\u544a\u914d\u7f6e\u6839 -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u8b66\u544a\u914d\u7f6e\u6839 -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u8b66\u544a\u914d\u7f6e -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u8b66\u544a\u914d\u7f6e - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e\u6839 -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e\u6839 -rma_recordsmanagement.association.rma_emailConfigAssoc.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e -rma_recordsmanagement.association.rma_emailConfigAssoc.description=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e - -rma_recordsmanagement.aspect.rma_recordSearch.title=\u8bb0\u5f55\u641c\u7d22 -rma_recordsmanagement.aspect.rma_recordSearch.decription=\u652f\u6301\u8bb0\u5f55\u7ba1\u7406\u641c\u7d22\u7684\u4fe1\u606f -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u6709\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u6307\u793a\u9879\u76ee\u662f\u5426\u6709\u5173\u8054\u7684\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u7684\u540d\u79f0 -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u5408\u6cd5\u7684\u65e5\u671f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u4fdd\u7559\u5468\u671f\u8868\u8fbe\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u4fdd\u7559\u5468\u671f\u8868\u8fbe\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u4fdd\u7559\u6388\u6743 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u4fdd\u7559\u6388\u6743 -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u6838\u5fc3\u8bb0\u5f55\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u6838\u5fc3\u8bb0\u5f55\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u5ba1\u67e5\u671f\u95f4\u8868\u8fbe\u5f0f -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u5ba1\u67e5\u671f\u95f4\u8868\u8fbe\u5f0f - -rma_recordsmanagement.aspect.rma_versionedRecord.title=\u7248\u672c\u5316\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u7248\u672c\u5316\u8bb0\u5f55 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u6307\u793a\u662f\u5426\u6709\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.property.rma_updateTo.title=\u66f4\u65b0\u81f3 -rma_recordsmanagement.property.rma_updateTo.description=\u66f4\u65b0\u76ee\u6807 -rma_recordsmanagement.property.rma_updatedProperties.title=\u66f4\u65b0\u7684\u5c5e\u6027 -rma_recordsmanagement.property.rma_updatedProperties.description=\u66f4\u65b0\u7684\u5c5e\u6027 -rma_recordsmanagement.property.rma_publishInProgress.title=\u53d1\u5e03\u8fdb\u884c\u4e2d -rma_recordsmanagement.property.rma_publishInProgress.description=\u6307\u793a\u53d1\u5e03\u5f53\u524d\u662f\u5426\u5728\u8fdb\u884c\u4e2d - -rma_recordsmanagement.aspect.dod_ghosted.title=\u4ec5\u5143\u6570\u636e\u8bb0\u5f55 -rma_recordsmanagement.aspect.dod_ghosted.description=\u4ec5\u5143\u6570\u636e\u8bb0\u5f55 - -listconstraint.rmc_tlList.title=\u79fb\u4ea4\u4f4d\u7f6e -listconstraint.rmc_smList.title=\u8865\u5145\u6807\u8bb0 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties deleted file mode 100644 index 4491007116..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Records Management Report Content Model - -rmr_recordsmanagementreport.type.rmr_report.title=Report -rmr_recordsmanagementreport.type.rmr_report.description=Records Management report. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Transfer Report -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management transfer report. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Destruction Report -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management destruction report. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Hold Report -rmr_recordsmanagementreport.type.rmr_holdReport.description=Records Management hold report. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties deleted file mode 100644 index a108c97470..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Content Model f\u00fcr Records Management Bericht - -rmr_recordsmanagementreport.type.rmr_report.title=Bericht -rmr_recordsmanagementreport.type.rmr_report.description=Records Management Bericht. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u00dcbertragungsbericht -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management \u00dcbertragungsbericht. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Vernichtungsprotokoll -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management Vernichtungsprotokoll. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Legal-Hold-Bericht -rmr_recordsmanagementreport.type.rmr_holdReport.description=Records Management-Legal-Hold-Bericht. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties deleted file mode 100644 index e1a0359220..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Modelo de contenido de informe de gesti\u00f3n de documentos de archivo - -rmr_recordsmanagementreport.type.rmr_report.title=Informe -rmr_recordsmanagementreport.type.rmr_report.description=Informe de Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Informe de transferencia -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Informe de transferencia de Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Informe de destrucci\u00f3n -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Informe de destrucci\u00f3n de Records Management. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Informe de retenci\u00f3n legal -rmr_recordsmanagementreport.type.rmr_holdReport.description=Informe de retenci\u00f3n legal de gesti\u00f3n de documentos de archivo. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties deleted file mode 100644 index 458df20988..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Mod\u00e8le de contenu de rapport de gestion des archives - -rmr_recordsmanagementreport.type.rmr_report.title=Rapport -rmr_recordsmanagementreport.type.rmr_report.description=Rapport de gestion des archives - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapport de transfert -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapport de transfert de gestion des archives. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapport de destruction -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapport de destruction de gestion des archives. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Rapport de suspension -rmr_recordsmanagementreport.type.rmr_holdReport.description=Rapport de suspension de gestion des archives. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties deleted file mode 100644 index 9ba698e423..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Modello di contenuto per rapporti di Records Management - -rmr_recordsmanagementreport.type.rmr_report.title=Rapporto -rmr_recordsmanagementreport.type.rmr_report.description=Rapporto Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapporto di trasferimento -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapporto di trasferimento Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapporto di eliminazione definitiva -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapporto di eliminazione definitiva Records Management. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Rapporto di sospensione -rmr_recordsmanagementreport.type.rmr_holdReport.description=Rapporto di sospensione Records Management. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties deleted file mode 100644 index 2042d12cf0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30ec\u30dd\u30fc\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb - -rmr_recordsmanagementreport.type.rmr_report.title=\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_report.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30ec\u30dd\u30fc\u30c8\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u3002 - -rmr_recordsmanagementreport.type.rmr_holdReport.title=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_holdReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties deleted file mode 100644 index 623cb31b0e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties deleted file mode 100755 index 7093e7c5cc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Contentmodel Records Management-rapport - -rmr_recordsmanagementreport.type.rmr_report.title=Rapport -rmr_recordsmanagementreport.type.rmr_report.description=Records Management-rapport. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Overzetrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management-overzetrapport. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Vernietigingsrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management-vernietigingsrapport. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Bewaringsrapport -rmr_recordsmanagementreport.type.rmr_holdReport.description=Records Management-bewaringsrapport diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties deleted file mode 100644 index d27dca1302..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Modelo do conte\u00fado do relat\u00f3rio do Records Management - -rmr_recordsmanagementreport.type.rmr_report.title=Relat\u00f3rio -rmr_recordsmanagementreport.type.rmr_report.description=Relat\u00f3rios do Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Relat\u00f3rio de transfer\u00eancia -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Relat\u00f3rio de transfer\u00eancia do Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Relat\u00f3rio de destrui\u00e7\u00e3o do Records Management. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Relat\u00f3rio de espera -rmr_recordsmanagementreport.type.rmr_holdReport.description=Relat\u00f3rio de espera do Records Management. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties deleted file mode 100644 index e2257dbc82..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043e\u0442\u0447\u0435\u0442\u0430 \u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rmr_recordsmanagementreport.type.rmr_report.title=\u041e\u0442\u0447\u0435\u0442 -rmr_recordsmanagementreport.type.rmr_report.description=\u041e\u0442\u0447\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. - -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\u0435 -rmr_recordsmanagementreport.type.rmr_holdReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties deleted file mode 100644 index ad742ac4af..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=\u8bb0\u5f55\u7ba1\u7406\u62a5\u544a\u5185\u5bb9\u6a21\u578b - -rmr_recordsmanagementreport.type.rmr_report.title=\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_report.description=\u8bb0\u5f55\u7ba1\u7406\u62a5\u544a\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u79fb\u4ea4\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u8bb0\u5f55\u7ba1\u7406\u79fb\u4ea4\u62a5\u544a\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u9500\u6bc1\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u8bb0\u5f55\u7ba1\u7406\u9500\u6bc1\u62a5\u544a\u3002 - -rmr_recordsmanagementreport.type.rmr_holdReport.title=\u4fdd\u5b58\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_holdReport.description=\u8bb0\u5f55\u7ba1\u7406\u4fdd\u5b58\u62a5\u544a\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service.properties deleted file mode 100644 index 1b2a8a061e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Report \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_de.properties deleted file mode 100644 index 61bb9762a5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_de.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Bericht diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_es.properties deleted file mode 100644 index d868ae8a71..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_es.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Informe diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_fr.properties deleted file mode 100644 index 3f02bff7c8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_fr.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Rapport diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_it.properties deleted file mode 100644 index 2682818873..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_it.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Rapporto diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_ja.properties deleted file mode 100644 index 0baed9e638..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_ja.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=\u30ec\u30dd\u30fc\u30c8 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nb.properties deleted file mode 100644 index 3f02bff7c8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nb.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Rapport diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nl.properties deleted file mode 100755 index 3f02bff7c8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nl.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Rapport diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_pt_BR.properties deleted file mode 100644 index 814f701f8b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_pt_BR.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Relat\u00f3rio diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_ru.properties deleted file mode 100644 index 01d984d8c5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_ru.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=\u041e\u0442\u0447\u0435\u0442 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_zh_CN.properties deleted file mode 100644 index e2dc09cd55..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-service_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=\u62a5\u544a diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties deleted file mode 100644 index 34f97a8c2c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Cut Off -cutoff.description=Cut Off -retain.title=Retain -retain.description=Retain -destroy.title=Destroy -destroy.description=Destroy - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties deleted file mode 100644 index b3f4e0ea58..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Trennen -cutoff.description=Trennen -retain.title=Aufbewahren -retain.description=Aufbewahren -destroy.title=Vernichten -destroy.description=Vernichten - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties deleted file mode 100644 index 5864fa03f3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Interrumpir -cutoff.description=Interrumpir -retain.title=Retener -retain.description=Retener -destroy.title=Destruir -destroy.description=Destruir - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties deleted file mode 100644 index 6f207d2fca..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=D\u00e9but de conservation -cutoff.description=D\u00e9but de conservation -retain.title=Conserver -retain.description=Conserver -destroy.title=D\u00e9truire -destroy.description=D\u00e9truire - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties deleted file mode 100644 index ff17b5bab8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Cut off -cutoff.description=Cut off -retain.title=Conserva -retain.description=Conserva -destroy.title=Elimina definitivamente -destroy.description=Elimina definitivamente - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties deleted file mode 100644 index 70b4db447d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -cutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5 -retain.title=\u4fdd\u7ba1 -retain.description=\u4fdd\u7ba1 -destroy.title=\u7834\u68c4 -destroy.description=\u7834\u68c4 - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties deleted file mode 100644 index 51d817a8ca..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Cut off -cutoff.description=Cut off -retain.title=Behold -retain.description=Behold -destroy.title=Destruer -destroy.description=Destruer - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties deleted file mode 100755 index 77644e5178..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Afsluiten -cutoff.description=Afsluiten -retain.title=Behouden -retain.description=Behouden -destroy.title=Vernietigen -destroy.description=Vernietigen - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties deleted file mode 100644 index 59b77b8f87..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=Cortar -cutoff.description=Cortar -retain.title=Manter -retain.description=Manter -destroy.title=Destruir -destroy.description=Destruir - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties deleted file mode 100644 index 2e084377df..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -cutoff.description=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -retain.title=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -retain.description=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -destroy.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c -destroy.description=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties deleted file mode 100644 index f87c7d5c18..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Retention Actions -cutoff.title=\u4e2d\u65ad -cutoff.description=\u4e2d\u65ad -retain.title=\u4fdd\u7559 -retain.description=\u4fdd\u7559 -destroy.title=\u9500\u6bc1 -destroy.description=\u9500\u6bc1 - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties deleted file mode 100644 index 329c771aa4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -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 -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 -rmevent.obsolete=Obsolete -rmevent.all_allowances_granted_are_terminated=All Allowances Granted are Terminated -rmevent.WGI_action_complete=WGI Action Complete -rmevent.separation=Separation -rmevent.case_complete=Case Complete -rmevent.declassification_review=Declassification Review \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties deleted file mode 100644 index f17930380b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -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 -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 -rmevent.obsolete=Veraltet -rmevent.all_allowances_granted_are_terminated=Alle einger\u00e4umten Berechtigungen sind beendet. -rmevent.WGI_action_complete=WGI-Aktion abschlie\u00dfen -rmevent.separation=Trennung -rmevent.case_complete=Fall abgeschlossen -rmevent.declassification_review=Deklassifizierungs\u00fcberpr\u00fcfung diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties deleted file mode 100644 index e752aac231..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -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 -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 -rmevent.obsolete=Obsoleto -rmevent.all_allowances_granted_are_terminated=Todas las provisiones otorgadas han terminado -rmevent.WGI_action_complete=Acci\u00f3n WGI completa -rmevent.separation=Separaci\u00f3n -rmevent.case_complete=Caso completo -rmevent.declassification_review=Revisi\u00f3n de la desclasificaci\u00f3n diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties deleted file mode 100644 index 9a7633d558..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -rmeventservice.rmEventType.simple=Ev\u00e9nement simple -rmeventservice.rmEventType.obsolete=Ev\u00e9nement obsol\u00e8te -rmeventservice.rmEventType.superseded=Ev\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 -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.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 -rmevent.all_allowances_granted_are_terminated=Toutes les autorisations accord\u00e9es sont termin\u00e9es -rmevent.WGI_action_complete=Action WGI termin\u00e9e -rmevent.separation=S\u00e9paration -rmevent.case_complete=Cas termin\u00e9 -rmevent.declassification_review=V\u00e9rification de d\u00e9classification diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties deleted file mode 100644 index 6264aa3c26..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -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 -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 -rmevent.obsolete=Obsoleto -rmevent.all_allowances_granted_are_terminated=Tutte le concessioni sono state terminate -rmevent.WGI_action_complete=Azione WGI completata -rmevent.separation=Separazione -rmevent.case_complete=Caso completato -rmevent.declassification_review=Esame di declassificazione diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties deleted file mode 100644 index 86d0efa00f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -rmeventservice.rmEventType.simple=\u7c21\u6613\u30a4\u30d9\u30f3\u30c8 -rmeventservice.rmEventType.obsolete=\u5ec3\u6b62\u30a4\u30d9\u30f3\u30c8 -rmeventservice.rmEventType.superseded=\u5dee\u3057\u66ff\u3048\u30a4\u30d9\u30f3\u30c8 -rmeventservice.rmEventType.crossReferencedRecordTransfered=\u76f8\u4e92\u53c2\u7167\u30ec\u30b3\u30fc\u30c9\u306e\u8ee2\u9001 -rmeventservice.rmEventType.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30a4\u30d9\u30f3\u30c8 - -# Default events -rmevent.case_closed=\u30b1\u30fc\u30b9\u7d42\u4e86 -rmevent.abolished=\u5ec3\u6b62 -rmevent.re_designated=\u518d\u6307\u5b9a -rmevent.no_longer_needed=\u4eca\u5f8c\u4e0d\u8981 -rmevent.superseded=\u5dee\u3057\u66ff\u3048 -rmevent.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406 -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\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u8ee2\u9001 -rmevent.obsolete=\u5ec3\u6b62 -rmevent.all_allowances_granted_are_terminated=\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u51e6\u7406\u304c\u7d42\u4e86 -rmevent.WGI_action_complete=WGI \u51e6\u7406\u5b8c\u4e86 -rmevent.separation=\u5206\u96e2 -rmevent.case_complete=\u30b1\u30fc\u30b9\u5b8c\u4e86 -rmevent.declassification_review=\u5206\u985e\u89e3\u9664\u306e\u30ec\u30d3\u30e5\u30fc diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties deleted file mode 100644 index a408568d85..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties +++ /dev/null @@ -1,23 +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 -rmevent.declassification_review=Gjennomgang av deklassifisering diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties deleted file mode 100755 index 30f1557b0b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -rmeventservice.rmEventType.simple=Eenvoudige gebeurtenis -rmeventservice.rmEventType.obsolete=Verouderde gebeurtenis -rmeventservice.rmEventType.superseded=Vervangen gebeurtenis -rmeventservice.rmEventType.crossReferencedRecordTransfered=Archiefstuk met kruisverwijzing overgezet -rmeventservice.rmEventType.versioned=Gebeurtenis met versiebeheer - -# Default events -rmevent.case_closed=Geval gesloten -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=Gerelateerd archiefstuk overgezet naar inactieve opslag -rmevent.obsolete=Verouderd -rmevent.all_allowances_granted_are_terminated=Alle toegekende rechten zijn be\u00ebindigd -rmevent.WGI_action_complete=WGI-actie afgerond -rmevent.separation=Scheiding -rmevent.case_complete=Geval afgerond -rmevent.declassification_review=Classificatieopheffingsrevisie diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties deleted file mode 100644 index 4a23145836..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -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 -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 -rmevent.obsolete=Obsoleto -rmevent.all_allowances_granted_are_terminated=Todas as bonifica\u00e7\u00f5es concedidas s\u00e3o rescindidas -rmevent.WGI_action_complete=A\u00e7\u00e3o de WGI conclu\u00edda -rmevent.separation=Separa\u00e7\u00e3o -rmevent.case_complete=Caso conclu\u00eddo -rmevent.declassification_review=Revis\u00e3o de desclassifica\u00e7\u00e3o diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties deleted file mode 100644 index fee3d91ea9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -rmeventservice.rmEventType.simple=\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -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 -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 -rmevent.obsolete=\u0423\u0441\u0442\u0430\u0440\u0435\u043b\u043e -rmevent.all_allowances_granted_are_terminated=\u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u0432\u043e\u0442\u044b \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u044b -rmevent.WGI_action_complete=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 WGI \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rmevent.separation=\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 -rmevent.case_complete=\u0421\u043b\u0443\u0447\u0430\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d -rmevent.declassification_review=\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0441\u0441\u0435\u043a\u0440\u0435\u0447\u0438\u0432\u0430\u043d\u0438\u044f diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties deleted file mode 100644 index dc778c1a1b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Event Types -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 -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 -rmevent.obsolete=\u8fc7\u65f6 -rmevent.all_allowances_granted_are_terminated=\u6240\u6709\u6388\u4e88\u7684\u9650\u989d\u5df2\u7ec8\u6b62 -rmevent.WGI_action_complete=WGI \u64cd\u4f5c\u5b8c\u6210 -rmevent.separation=\u5206\u79bb -rmevent.case_complete=\u6848\u4f8b\u5b8c\u6210 -rmevent.declassification_review=\u53d6\u6d88\u5206\u7c7b\u7684\u5ba1\u67e5 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties deleted file mode 100644 index 727ce24344..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Hold - -## Default roles -rm.role.extendedReaders=In-Place Readers -rm.role.extendedWriters=In-Place Writers -rm.role.user=Records Management User -rm.role.powerUser=Records Management Power User -rm.role.securityOfficer=Records Management Security Officer -rm.role.recordsManager=Records Management Manager -rm.role.administrator=Records Management Administrator -rm.role.all=All Records Management Roles - -## Default searches -rm.savedsearch.vitalRecordsName=Vital Records due for Review -rm.savedsearch.vitalRecordsDesc=All records currently due for review. -rm.savedsearch.incompleteRecordsName=Incomplete Records -rm.savedsearch.incompleteRecordsDesc=All incomplete records. -rm.savedsearch.cutoffRecordsName=Records and Record Folders Eligible for Cut Off -rm.savedsearch.cutoffRecordsDesc=All records and record folders currently eligible for cut off. -rm.savedsearch.transferRecordsName=Records and Record Folders Eligible for Transfer -rm.savedsearch.transferRecordsDesc=All record folders and records currently eligible for transfer. -rm.savedsearch.destructionRecordsName=Records and Record Folders Eligible for Destruction -rm.savedsearch.destructionRecordsDesc=All records currently eligible for destruction. -rm.savedsearch.frozenRecordsName= Records and Record Folders On Hold -rm.savedsearch.frozenRecordsDesc=All records and record folders currently on hold. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties deleted file mode 100644 index ff8e13147d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Legal Hold - -## Default roles -rm.role.extendedReaders=An Originalposition lesen -rm.role.extendedWriters=An Originalposition schreiben -rm.role.user=Records Management Benutzer -rm.role.powerUser=Records Management Profibenutzer -rm.role.securityOfficer=Records Management Sicherheitsbeauftragter -rm.role.recordsManager=Records Management Manager -rm.role.administrator=Records Management Administrator -rm.role.all=Alle Records Management Rollen - -## Default searches -rm.savedsearch.vitalRecordsName=Besonders relevante Records mit f\u00e4lliger \u00dcberpr\u00fcfung -rm.savedsearch.vitalRecordsDesc=Alle aktuell zum \u00dcberpr\u00fcfen f\u00e4lligen Records. -rm.savedsearch.incompleteRecordsName=Nicht abgeschlossene Records -rm.savedsearch.incompleteRecordsDesc=Alle nicht abgeschlossenen Records. -rm.savedsearch.cutoffRecordsName=Zur Trennung geeignete Records und Record-Ordner -rm.savedsearch.cutoffRecordsDesc=Alle derzeit zur Trennung geeigneten Records und Record-Ordner. -rm.savedsearch.transferRecordsName=Zur \u00dcbertragung geeignete Records und Record-Ordner -rm.savedsearch.transferRecordsDesc=Alle aktuell zur \u00dcbertragung geeigneten Records und Record-Ordner. -rm.savedsearch.destructionRecordsName=Zur Vernichtung geeignete Records und Record-Ordner -rm.savedsearch.destructionRecordsDesc=Alle aktuell zur Vernichtung geeigneten Records. -rm.savedsearch.frozenRecordsName=Records und Record-Ordner mit Legal Hold -rm.savedsearch.frozenRecordsDesc=Alle derzeit mit einem Legal Hold belegten Records und Record-Ordner. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties deleted file mode 100644 index 4049bdf4ba..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Retenci\u00f3n legal - -## Default roles -rm.role.extendedReaders=Lectores in situ -rm.role.extendedWriters=Escritores in situ -rm.role.user=Usuario de gesti\u00f3n de documentos de archivo -rm.role.powerUser=Usuario de potencia de gesti\u00f3n de documentos de archivo -rm.role.securityOfficer=Encargado de seguridad de gesti\u00f3n de documentos de archivo -rm.role.recordsManager=Gestor de gesti\u00f3n de documentos de archivo -rm.role.administrator=Jefe de gesti\u00f3n de documentos de archivo -rm.role.all=Todos los roles de gesti\u00f3n de documentos de archivo - -## Default searches -rm.savedsearch.vitalRecordsName=Documentos de archivo vitales pendientes de revisi\u00f3n -rm.savedsearch.vitalRecordsDesc=Todos los documentos de archivo pendientes de revisi\u00f3n. -rm.savedsearch.incompleteRecordsName=Documentos de archivo incompletos -rm.savedsearch.incompleteRecordsDesc=Todos los documentos de archivo incompletos. -rm.savedsearch.cutoffRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden interrumpir -rm.savedsearch.cutoffRecordsDesc=Todos los documentos de archivos y carpetas de documentos de archivos que se pueden interrumpir actualmente. -rm.savedsearch.transferRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden transferir -rm.savedsearch.transferRecordsDesc=Actualmente, todos los documentos y carpetas de documentos de archivo se pueden transferir. -rm.savedsearch.destructionRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden destruir -rm.savedsearch.destructionRecordsDesc=Actualmente, todos los documentos de archivo se pueden destruir. -rm.savedsearch.frozenRecordsName=Documentos de archivo y carpetas de documentos de archivo en retenci\u00f3n legal -rm.savedsearch.frozenRecordsDesc=Todos los documentos de archivo y carpetas de documentos de archivo est\u00e1n en retenci\u00f3n legal. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties deleted file mode 100644 index 60aa08bac8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Suspendre - -## Default roles -rm.role.extendedReaders=Lecteurs sur place -rm.role.extendedWriters=R\u00e9dacteurs sur place -rm.role.user=Utilisateur de la gestion des archives -rm.role.powerUser=Utilisateur principal de la gestion des archives -rm.role.securityOfficer=Agent de s\u00e9curit\u00e9 de la gestion des archives -rm.role.recordsManager=Responsable de la gestion des archives -rm.role.administrator=Administrateur de la gestion des archives -rm.role.all=Tous les r\u00f4les de la gestion des archives - -## Default searches -rm.savedsearch.vitalRecordsName=Documents d'archives essentiels arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification -rm.savedsearch.vitalRecordsDesc=Tous les documents d'archives arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification. -rm.savedsearch.incompleteRecordsName=Documents d'archives incomplets -rm.savedsearch.incompleteRecordsDesc=Tous les documents d'archives incomplets. -rm.savedsearch.cutoffRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour un d\u00e9but de conservation -rm.savedsearch.cutoffRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement \u00e9ligibles pour un d\u00e9but de conservation. -rm.savedsearch.transferRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour un transfert -rm.savedsearch.transferRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement \u00e9ligibles pour un transfert. -rm.savedsearch.destructionRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour une destruction -rm.savedsearch.destructionRecordsDesc=Tous les documents d'archives actuellement \u00e9ligibles pour destruction. -rm.savedsearch.frozenRecordsName=Documents d'archives et dossiers d'archives suspendus -rm.savedsearch.frozenRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement suspendus. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties deleted file mode 100644 index d27911978f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Sospensione - -## Default roles -rm.role.extendedReaders=Utenti con permessi di lettura -rm.role.extendedWriters=Utenti con permessi di scrittura -rm.role.user=Utente di Records Management -rm.role.powerUser=Power user di Records Management -rm.role.securityOfficer=Responsabile della sicurezza di Records Management -rm.role.recordsManager=Manager di Records Management -rm.role.administrator=Amministratore di Records Management -rm.role.all=Tutti i ruoli di Records Management - -## Default searches -rm.savedsearch.vitalRecordsName=Record fondamentali da esaminare -rm.savedsearch.vitalRecordsDesc=Tutti i record attualmente da esaminare. -rm.savedsearch.incompleteRecordsName=Record incompleti -rm.savedsearch.incompleteRecordsDesc=Tutti i record incompleti. -rm.savedsearch.cutoffRecordsName=Record e cartelle di record idonei per il cut off -rm.savedsearch.cutoffRecordsDesc=Tutti i record e le cartelle di record attualmente idonei per il cut off. -rm.savedsearch.transferRecordsName=Record e cartelle di record idonei per il trasferimento -rm.savedsearch.transferRecordsDesc=Tutti i record e le cartelle di record idonei per il trasferimento. -rm.savedsearch.destructionRecordsName=Record e cartelle di record idonei per l'eliminazione definitiva -rm.savedsearch.destructionRecordsDesc=Tutti i record attuali idonei per l'eliminazione definitiva. -rm.savedsearch.frozenRecordsName=Record e cartelle di record in sospeso -rm.savedsearch.frozenRecordsDesc=Tutti i record e le cartelle di record attuali in sospeso. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties deleted file mode 100644 index c1109705d4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=\u30db\u30fc\u30eb\u30c9 - -## Default roles -rm.role.extendedReaders=\u7d44\u307f\u8fbc\u307f\u8aad\u8005 -rm.role.extendedWriters=\u7d44\u307f\u8fbc\u307f\u8457\u8005 -rm.role.user=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30e6\u30fc\u30b6\u30fc -rm.role.powerUser=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30d1\u30ef\u30fc\u30e6\u30fc\u30b6\u30fc -rm.role.securityOfficer=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f79\u54e1 -rm.role.recordsManager=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30de\u30cd\u30fc\u30b8\u30e3\u30fc -rm.role.administrator=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u7ba1\u7406\u8005 -rm.role.all=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u3059\u3079\u3066\u306e\u5f79\u5272 - -## Default searches -rm.savedsearch.vitalRecordsName=\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u306e\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -rm.savedsearch.vitalRecordsDesc=\u73fe\u5728\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u306e\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.incompleteRecordsName=\u672a\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 -rm.savedsearch.incompleteRecordsDesc=\u3059\u3079\u3066\u306e\u672a\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.cutoffRecordsName=\u30ab\u30c3\u30c8\u30aa\u30d5\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.cutoffRecordsDesc=\u73fe\u5728\u30ab\u30c3\u30c8\u30aa\u30d5\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3002 -rm.savedsearch.transferRecordsName=\u8ee2\u9001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.transferRecordsDesc=\u73fe\u5728\u8ee2\u9001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.destructionRecordsName=\u7834\u68c4\u53ef\u80fd\u306a\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.destructionRecordsDesc=\u73fe\u5728\u7834\u68c4\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.frozenRecordsName=\u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.frozenRecordsDesc=\u73fe\u5728\u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties deleted file mode 100644 index 893a008059..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Hold - -## Default 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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties deleted file mode 100755 index 8c8cd894cb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Bewaring - -## Default roles -rm.role.extendedReaders=Ge\u00efntegreerde lezers -rm.role.extendedWriters=Ge\u00efntegreerde schrijvers -rm.role.user=Gebruiker Records Management -rm.role.powerUser=Hoofdgebruiker Records Management -rm.role.securityOfficer=Beveiligingsmedewerker Records Management -rm.role.recordsManager=Manager Records Management -rm.role.administrator=Beheerder Records Management -rm.role.all=Alle rollen voor Records Management - -## Default searches -rm.savedsearch.vitalRecordsName=Vitale archiefstukken gereed voor revisie -rm.savedsearch.vitalRecordsDesc=Alle archiefstukken die momenteel gereed zijn voor revisie. -rm.savedsearch.incompleteRecordsName=Niet-afgeronde archiefstukken -rm.savedsearch.incompleteRecordsDesc=Alle niet-afgeronde archiefstukken. -rm.savedsearch.cutoffRecordsName=Archiefstukken en archiefmappen die in aanmerking komen voor afsluiten -rm.savedsearch.cutoffRecordsDesc=Alle archiefstukken en archiefmappen die momenteel in aanmerking komen voor afsluiten -rm.savedsearch.transferRecordsName=Archiefstukken en archiefmappen die in aanmerking komen voor overzetten -rm.savedsearch.transferRecordsDesc=Alle archiefstukken en archiefmappen die momenteel in aanmerking komen voor overzetten. -rm.savedsearch.destructionRecordsName=Archiefstukken en archiefmappen die in aanmerking komen voor vernietiging -rm.savedsearch.destructionRecordsDesc=Alle archiefstukken die momenteel in aanmerking komen voor vernietiging. -rm.savedsearch.frozenRecordsName=Archiefstukken en archiefmappen die in bewaring zijn -rm.savedsearch.frozenRecordsDesc=Alle archiefstukken en archiefmappen die momenteel in bewaring zijn. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties deleted file mode 100644 index 5810c58c90..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Espera - -## Default roles -rm.role.extendedReaders=Leitores no local -rm.role.extendedWriters=Gravadores no local -rm.role.user=Usu\u00e1rio do Records Management -rm.role.powerUser=Usu\u00e1rio avan\u00e7ado do Records Management -rm.role.securityOfficer=Diretor de seguran\u00e7a do Records Management -rm.role.recordsManager=Gerente do Records Management -rm.role.administrator=Administrador do Records Management -rm.role.all=Todas as fun\u00e7\u00f5es do Records Management - -## Default searches -rm.savedsearch.vitalRecordsName=Documentos arquiv\u00edsticos vitais em prazo para revis\u00e3o -rm.savedsearch.vitalRecordsDesc=Todos os documentos arquiv\u00edsticos atualmente no prazo para revis\u00e3o. -rm.savedsearch.incompleteRecordsName=Documentos arquiv\u00edsticos incompletos -rm.savedsearch.incompleteRecordsDesc=Todos os documentos arquiv\u00edsticos incompletos. -rm.savedsearch.cutoffRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para corte -rm.savedsearch.cutoffRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para corte. -rm.savedsearch.transferRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para transfer\u00eancia -rm.savedsearch.transferRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para transfer\u00eancia. -rm.savedsearch.destructionRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para destrui\u00e7\u00e3o -rm.savedsearch.destructionRecordsDesc=Todos os documentos arquiv\u00edsticos atualmente qualificados para destrui\u00e7\u00e3o. -rm.savedsearch.frozenRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos em espera -rm.savedsearch.frozenRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos atualmente em espera. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties deleted file mode 100644 index bb82414f71..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 - -## Default roles -rm.role.extendedReaders=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 -rm.role.extendedWriters=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0433\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0438\u0441\u0438 -rm.role.user=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.powerUser=\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.securityOfficer=\u0421\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a \u0441\u043b\u0443\u0436\u0431\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.recordsManager=\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.administrator=\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.all=\u0412\u0441\u0435 \u0440\u043e\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -## Default searches -rm.savedsearch.vitalRecordsName=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 -rm.savedsearch.vitalRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.incompleteRecordsName=\u041d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rm.savedsearch.incompleteRecordsDesc=\u0412\u0441\u0435 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.savedsearch.cutoffRecordsName=\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 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f -rm.savedsearch.cutoffRecordsDesc=\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 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.transferRecordsName=\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 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties deleted file mode 100644 index 25eec46b96..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=\u4fdd\u5b58 - -## Default roles -rm.role.extendedReaders=\u5c31\u5730\u8bfb\u8005 -rm.role.extendedWriters=\u5c31\u5730\u4f5c\u8005 -rm.role.user=\u8bb0\u5f55\u7ba1\u7406\u7528\u6237 -rm.role.powerUser=\u8bb0\u5f55\u7ba1\u7406\u9ad8\u7ea7\u7528\u6237 -rm.role.securityOfficer=\u8bb0\u5f55\u7ba1\u7406\u5b89\u5168\u5b98\u5458 -rm.role.recordsManager=\u8bb0\u5f55\u7ba1\u7406\u7684\u7ba1\u7406\u4eba\u5458 -rm.role.administrator=\u8bb0\u5f55\u7ba1\u7406\u7684\u7ba1\u7406\u5458 -rm.role.all=\u6240\u6709\u8bb0\u5f55\u7ba1\u7406\u89d2\u8272 - -## Default searches -rm.savedsearch.vitalRecordsName=\u6838\u5fc3\u8bb0\u5f55\u7684\u5ba1\u67e5\u5230\u671f -rm.savedsearch.vitalRecordsDesc=\u6240\u6709\u8bb0\u5f55\u7684\u5ba1\u67e5\u5f53\u524d\u5df2\u5230\u671f\u3002 -rm.savedsearch.incompleteRecordsName=\u4e0d\u5b8c\u6574\u7684\u8bb0\u5f55 -rm.savedsearch.incompleteRecordsDesc=\u6240\u6709\u4e0d\u5b8c\u6574\u7684\u8bb0\u5f55\u3002 -rm.savedsearch.cutoffRecordsName=\u53ef\u4e2d\u65ad\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.cutoffRecordsDesc=\u5f53\u524d\u53ef\u4e2d\u65ad\u7684\u6240\u6709\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.savedsearch.transferRecordsName=\u53ef\u79fb\u4ea4\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.transferRecordsDesc=\u5f53\u524d\u53ef\u79fb\u4ea4\u7684\u6240\u6709\u8bb0\u5f55\u6587\u4ef6\u5939\u548c\u8bb0\u5f55\u3002 -rm.savedsearch.destructionRecordsName=\u53ef\u9500\u6bc1\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.destructionRecordsDesc=\u5f53\u524d\u53ef\u9500\u6bc1\u7684\u6240\u6709\u8bb0\u5f55\u3002 -rm.savedsearch.frozenRecordsName=\u4fdd\u5b58\u4e2d\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.frozenRecordsDesc=\u5f53\u524d\u4fdd\u5b58\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties deleted file mode 100644 index 98b96881a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Accession Report -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=declared by -file.report.declared.on=on -file.report.destroyed=Destroyed -file.report.destroyed.records=Destroyed Records -file.report.destruction.report=Destruction Report -file.report.disposition.authority=Retention Authority -file.report.disposition.instructions=Retention Instructions -file.report.nara=NARA -file.report.transfer.date=Transfer Date -file.report.transfer.location=Transfer Location -file.report.transfer.report=Transfer Report -file.report.transferred.items=Transferred Items -file.report.performed.by=Performed By -file.report.record=Record -file.report.record.folder=Record Folder -file.report.unique.folder.identifier=Unique Folder ID -file.report.unique.record.identifier=Unique Record ID -file.report.hold.report=Hold Report -file.report.hold.name=Hold Name -file.report.hold.description=Hold Description -file.report.hold.reason=Hold Reason -file.report.hold.held=Held -file.report.createdby=Created By -file.report.createdon=Created On \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties deleted file mode 100644 index 75a89aaefd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Bericht zur Aufnahme -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=deklariert von -file.report.declared.on=am -file.report.destroyed=Vernichtet -file.report.destroyed.records=Vernichtete Records -file.report.destruction.report=Vernichtungsprotokoll -file.report.disposition.authority=Aufbewahrungs-Authority -file.report.disposition.instructions=Aufbewahrungsanweisungen -file.report.nara=NARA -file.report.transfer.date=\u00dcbertragungsdatum -file.report.transfer.location=\u00dcbertragungsort -file.report.transfer.report=\u00dcbertragungsbericht -file.report.transferred.items=\u00dcbertragene Elemente -file.report.performed.by=Durchgef\u00fchrt von -file.report.record=Record -file.report.record.folder=Record-Ordner -file.report.unique.folder.identifier=Eindeutige Ordner-ID -file.report.unique.record.identifier=Eindeutige Record-ID -file.report.hold.report=Legal-Hold-Bericht -file.report.hold.name=Name des Legal Holds -file.report.hold.description=Beschreibung des Legal Holds -file.report.hold.reason=Grund f\u00fcr Legal Hold -file.report.hold.held=Mit Legal Hold belegt -file.report.createdby=Erstellt von -file.report.createdon=Erstellt am diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties deleted file mode 100644 index 370973abea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Informe de incorporaci\u00f3n -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=declarado por -file.report.declared.on=en -file.report.destroyed=Destruido -file.report.destroyed.records=Documentos de archivo destruidos -file.report.destruction.report=Informe de destrucci\u00f3n -file.report.disposition.authority=Autoridad de retenci\u00f3n -file.report.disposition.instructions=Instrucciones de retenci\u00f3n -file.report.nara=NARA -file.report.transfer.date=Fecha de transferencia -file.report.transfer.location=Ubicaci\u00f3n de transferencia -file.report.transfer.report=Informe de transferencia -file.report.transferred.items=Elementos transferidos -file.report.performed.by=Realizado por -file.report.record=Documento de archivo -file.report.record.folder=Carpeta de documentos de archivo -file.report.unique.folder.identifier=ID de carpeta \u00fanico -file.report.unique.record.identifier=ID de documento de archivo \u00fanico -file.report.hold.report=Informe de retenci\u00f3n legal -file.report.hold.name=Nombre de retenci\u00f3n legal -file.report.hold.description=Descripci\u00f3n de retenci\u00f3n legal -file.report.hold.reason=Raz\u00f3n de retenci\u00f3n legal -file.report.hold.held=Bloqueado -file.report.createdby=Creado por -file.report.createdon=Creado diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties deleted file mode 100644 index 3dfc8b0fd3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Rapport sur le versement \u00e0 un autre organisme -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 -file.report.destroyed.records=Documents d'archives d\u00e9truits -file.report.destruction.report=Rapport de destruction -file.report.disposition.authority=D\u00e9tenteur principal -file.report.disposition.instructions=Instructions de conservation -file.report.nara=NARA -file.report.transfer.date=Date de transfert -file.report.transfer.location=Emplacement de transfert -file.report.transfer.report=Rapport de transfert -file.report.transferred.items=El\u00e9ments transf\u00e9r\u00e9s -file.report.performed.by=Effectu\u00e9 par -file.report.record=Document d'archives -file.report.record.folder=Dossier d'archives -file.report.unique.folder.identifier=ID unique de dossier -file.report.unique.record.identifier=ID unique de document d'archives -file.report.hold.report=Rapport de suspension -file.report.hold.name=Nom de la suspension -file.report.hold.description=Description de la suspension -file.report.hold.reason=Motif de suspension -file.report.hold.held=Suspendu -file.report.createdby=Cr\u00e9\u00e9 par -file.report.createdon=Cr\u00e9\u00e9 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties deleted file mode 100644 index 842919536e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Rapporto di trasferimento ad altri -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=dichiarato da -file.report.declared.on=in data -file.report.destroyed=Eliminato definitivamente -file.report.destroyed.records=Record eliminati definitivamente -file.report.destruction.report=Rapporto di eliminazione definitiva -file.report.disposition.authority=Autorit\u00e0 di conservazione -file.report.disposition.instructions=Istruzioni per la conservazione -file.report.nara=NARA (USA) -file.report.transfer.date=Data di trasferimento -file.report.transfer.location=Posizione di trasferimento -file.report.transfer.report=Rapporto di trasferimento -file.report.transferred.items=Elementi trasferiti -file.report.performed.by=Eseguito da -file.report.record=Record -file.report.record.folder=Cartella di record -file.report.unique.folder.identifier=ID univoco cartella -file.report.unique.record.identifier=ID univoco record -file.report.hold.report=Rapporto di sospensione -file.report.hold.name=Nome sospensione -file.report.hold.description=Descrizione sospensione -file.report.hold.reason=Motivo sospensione -file.report.hold.held=Sospeso -file.report.createdby=Creato da -file.report.createdon=Creato il diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties deleted file mode 100644 index 499789a0ee..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=\u53d7\u8afe\u30ec\u30dd\u30fc\u30c8 -file.report.date.format=EEE\u5e74MMM\u6708dd\u65e5\u3001HH:mm:ss zzz yyyy -file.report.declared.by=\u5ba3\u8a00\u8005 -file.report.declared.on=\u5ba3\u8a00\u65e5 -file.report.destroyed=\u7834\u68c4\u6e08\u307f -file.report.destroyed.records=\u7834\u68c4\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -file.report.destruction.report=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8 -file.report.disposition.authority=\u4fdd\u7ba1\u6a29\u9650 -file.report.disposition.instructions=\u4fdd\u7ba1\u6307\u793a -file.report.nara=NARA -file.report.transfer.date=\u8ee2\u9001\u65e5 -file.report.transfer.location=\u8ee2\u9001\u5834\u6240 -file.report.transfer.report=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8 -file.report.transferred.items=\u8ee2\u9001\u6e08\u307f\u30a2\u30a4\u30c6\u30e0 -file.report.performed.by=\u5b9f\u884c\u8005 -file.report.record=\u30ec\u30b3\u30fc\u30c9 -file.report.record.folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -file.report.unique.folder.identifier=\u4e00\u610f\u306e\u30d5\u30a9\u30eb\u30c0 ID -file.report.unique.record.identifier=\u4e00\u610f\u306e\u30ec\u30b3\u30fc\u30c9 ID -file.report.hold.report=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 -file.report.hold.name=\u30db\u30fc\u30eb\u30c9\u540d -file.report.hold.description=\u30db\u30fc\u30eb\u30c9\u8aac\u660e -file.report.hold.reason=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -file.report.hold.held=\u30db\u30fc\u30eb\u30c9\u6e08\u307f -file.report.createdby=\u4f5c\u6210\u8005 -file.report.createdon=\u4f5c\u6210\u65e5 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties deleted file mode 100644 index fb366f7f0d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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 TT:mm:ss zzz \u00e5\u00e5\u00e5\u00e5 -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=Retensjonsrett -file.report.disposition.instructions=Retensjonsinstruksjoner -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties deleted file mode 100644 index 16470826ef..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Overdrachtsrapport -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 -file.report.destroyed.records=Vernietigde archiefstukken -file.report.destruction.report=Vernietigingsrapport -file.report.disposition.authority=Retentieautoriteit -file.report.disposition.instructions=Retentie-instructies -file.report.nara=Nationaal Archief -file.report.transfer.date=Overzetdatum -file.report.transfer.location=Overzetlocatie -file.report.transfer.report=Overzetrapport -file.report.transferred.items=Overgezette onderdelen -file.report.performed.by=Uitgevoerd door -file.report.record=Archiefstuk -file.report.record.folder=Archiefmap -file.report.unique.folder.identifier=Unieke id archiefmap -file.report.unique.record.identifier=Unieke id archiefstuk -file.report.hold.report=Bewaringsrapport -file.report.hold.name=Naam bewaring -file.report.hold.description=Beschrijving bewaring -file.report.hold.reason=Reden van bewaring -file.report.hold.held=In bewaring -file.report.createdby=Gemaakt door -file.report.createdon=Gemaakt op diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties deleted file mode 100644 index 64ce5f46ff..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Relat\u00f3rio de ades\u00e3o -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 -file.report.destroyed.records=Documentos arquiv\u00edsticos destru\u00eddos -file.report.destruction.report=Relat\u00f3rio de destrui\u00e7\u00e3o -file.report.disposition.authority=Autoridade de reten\u00e7\u00e3o -file.report.disposition.instructions=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -file.report.nara=NARA -file.report.transfer.date=Data de transfer\u00eancia -file.report.transfer.location=Local de transfer\u00eancia -file.report.transfer.report=Relat\u00f3rio de transfer\u00eancia -file.report.transferred.items=Itens transferidos -file.report.performed.by=Executado por -file.report.record=Documento arquiv\u00edstico -file.report.record.folder=Pasta de documento arquiv\u00edstico -file.report.unique.folder.identifier=ID exclusivo da pasta -file.report.unique.record.identifier=ID exclusivo do documento arquiv\u00edstico -file.report.hold.report=Relat\u00f3rio de espera -file.report.hold.name=Nome de espera -file.report.hold.description=Descri\u00e7\u00e3o de espera -file.report.hold.reason=Motivo para espera -file.report.hold.held=Mantido -file.report.createdby=Criado por -file.report.createdon=Criado em diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties deleted file mode 100644 index ff7b9e4049..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0435 -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e -file.report.declared.on=\u043d\u0430 -file.report.destroyed=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043e -file.report.destroyed.records=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -file.report.destruction.report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 -file.report.disposition.authority=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -file.report.disposition.instructions=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -file.report.nara=NARA -file.report.transfer.date=\u0414\u0430\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -file.report.transfer.location=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -file.report.transfer.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -file.report.transferred.items=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b -file.report.performed.by=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e -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.createdby=\u0421\u043e\u0437\u0434\u0430\u043b -file.report.createdon=\u0421\u043e\u0437\u0434\u0430\u043d\u043e diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties deleted file mode 100644 index 10c7fd29fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=\u5165\u7ba1\u62a5\u544a -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=\u58f0\u660e\u8005 -file.report.declared.on=\u5f00 -file.report.destroyed=\u5df2\u9500\u6bc1 -file.report.destroyed.records=\u5df2\u9500\u6bc1\u8bb0\u5f55 -file.report.destruction.report=\u9500\u6bc1\u62a5\u544a -file.report.disposition.authority=\u4fdd\u7559\u6388\u6743 -file.report.disposition.instructions=\u4fdd\u7559\u8bf4\u660e -file.report.nara=NARA -file.report.transfer.date=\u79fb\u4ea4\u65e5\u671f -file.report.transfer.location=\u79fb\u4ea4\u4f4d\u7f6e -file.report.transfer.report=\u79fb\u4ea4\u62a5\u544a -file.report.transferred.items=\u79fb\u4ea4\u7684\u9879 -file.report.performed.by=\u6267\u884c\u8005 -file.report.record=\u8bb0\u5f55 -file.report.record.folder=\u8bb0\u5f55\u6587\u4ef6\u5939 -file.report.unique.folder.identifier=\u552f\u4e00\u6587\u4ef6\u5939 ID -file.report.unique.record.identifier=\u552f\u4e00\u8bb0\u5f55 ID -file.report.hold.report=\u4fdd\u5b58\u62a5\u544a -file.report.hold.name=\u4fdd\u5b58\u540d\u79f0 -file.report.hold.description=\u4fdd\u5b58\u8bf4\u660e -file.report.hold.reason=\u4fdd\u5b58\u539f\u56e0 -file.report.hold.held=\u4fdd\u5b58 -file.report.createdby=\u521b\u5efa\u8005 -file.report.createdon=\u521b\u5efa\u65f6\u95f4 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml deleted file mode 100644 index d194cb8743..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml +++ /dev/null @@ -1,129 +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 - - - - - Destroyed - d:boolean - false> - - - - - - - - - - - - d:noderef - - - - - d:text - - - - d:text - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml deleted file mode 100644 index a667c393da..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml +++ /dev/null @@ -1,1280 +0,0 @@ - - - - - - - - - Records Management Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - - RM Site - st:site - false - - - - - Caveat Config - cm:content - false - - - - Email Config - cm:content - - rma:filePlanComponent - - - - - - - - Records Management Container - cm:folder - false - - - cm:titled - rma:recordComponentIdentifier - rma:filePlanComponent - - - - - - - Record Category - rma:recordsManagementContainer - - - rma:vitalRecordDefinition - - - - - - - File Plan - rma:recordsManagementContainer - - - rma:recordsManagementRoot - - - - - - Unfiled Record Container - rma:recordsManagementContainer - - - - Unfiled Record Folder - rma:recordsManagementContainer - - - - Hold Container - rma:recordsManagementContainer - - rma:countable - - - - - Transfer Container - rma:recordsManagementContainer - - rma:countable - - - - - - - Disposition Schedule - cm:cmobject - - - - - Disposition Authority - d:text - true - - true - false - false - - - - - Disposition Instructions - d:text - true - - - - Record Level Disposition - d:boolean - true - false - - - - - - - - Disposition Actions - - false - false - - - rma:dispositionActionDefinition - false - true - - - - - - - rma:filePlanComponent - - - - - - Disposition Action Definition - cm:cmobject - - - - - Disposition Action Name - d:text - true - - - - Disposition Description - d:text - false - - - - Disposition Location - d:text - false - - true - false - false - - - - - Disposition Period - d:period - false - none|0 - - - - Disposition Period Property - d:text - false - - true - false - false - - - - - Disposition Event - d:text - true - - true - false - false - - - - - Disposition Event Combination - d:text - true - or - - true - false - false - - - - - Disposition Evaluator Combination - d:boolean - false - - - - - rma:filePlanComponent - - - - - - Record Folder - cm:folder - false - - - - - - - - Record Folder Closed - Indicates whether the folder is closed - d:boolean - true - true - false - - - - - - cm:titled - rma:recordComponentIdentifier - rma:commonRecordDetails - rma:filePlanComponent - rma:heldChildren - - - - - - - Non-Electronic Document - cm:content - false - - - - Document Physical Size - d:int - false - - true - false - false - - - - 0 - 2147483647 - - - - - - Number Of Copies - d:int - false - 1 - - true - false - false - - - - 0 - 2147483647 - - - - - - Storage Location - d:text - false - - true - false - false - - - - - Shelf - d:text - false - - true - false - false - - - - - Box - d:text - false - - true - false - false - - - - - File - d:text - false - - true - false - false - - - - - - rma:filePlanComponent - - - - - Disposition Action - cm:cmobject - - - Disposition Action Id - d:text - true - - true - false - false - - - - Disposition Action - d:text - true - - true - false - false - - - - Disposition Action Date - d:date - false - - - Manually Set Disposition Date Flag - d:boolean - false - - - Disposition Events Eligible - d:boolean - false - - - Disposition Action Started At - d:date - false - - - Disposition Action Started By - d:text - false - - true - false - false - - - - Disposition Action Completed At - d:date - false - - - Disposition Action Copmleted By - d:text - false - - true - false - false - - - - - - - - - Event executions - - false - false - - - rma:eventExecution - false - true - - - - - - - rma:filePlanComponent - - - - - - - Event Execution - Execution details of an event - cm:cmobject - - - - - Event Name - d:text - true - - true - false - false - - - - Event automatic - d:boolean - true - - - Event complete - d:boolean - true - false - - - Event completed by - d:text - false - - true - false - false - - - - Event completed at - d:date - false - - - - - - rma:filePlanComponent - - - - - - Hold - rma:recordsManagementContainer - false - - - - - Hold Reason - d:text - true - - - - - - - - Frozen Records - - false - true - - - rma:filePlanComponent - false - true - - - - - Frozen Records - - false - true - - - cm:cmobject - false - true - - - - - - - - - Transfer - cm:folder - false - - - - - Transfer Accession Indicator - d:boolean - true - true - - - - Transfer PDF Indicator - Indicates that transfer includes PDF - d:boolean - true - false - - - - Transfer PDF Indicator - Transfer Location - d:text - - - - - - - - Transferred - - false - false - - - rma:dispositionLifecycle - false - true - - - - - - - cm:titled - rma:filePlanComponent - - - - - - - - - - - - File Plan Component - false - - - Root node reference - d:noderef - true - - - - - - - Records Management Root - - - - - Holds - - false - false - - - rma:hold - false - true - - - - - - Transfers - - false - false - - - rma:transfer - false - true - - - - - - - - Declared Record - - - Date Declared - d:date - - - Declared By - d:text - - true - false - false - - - - - rma:filePlanComponent - - - - - Record component identifier - - - Record Component Identifier - d:text - true - - true - false - false - - - - Database uniqueness id - d:text - true - false - - - - rma:filePlanComponent - - - - - Saved search - - - - Disposition processed - - - - Vital Record Definition - - - Review Period - d:period - none|0 - - - Vital Record Indicator - d:boolean - false - - - - rma:filePlanComponent - - - - - - - Record - - false - - - - - - - - Date Filed - d:date - - - - Original Name - d:text - true - - - - - - - - d:date - false - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - d:date - false - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - - - - cm:titled - rma:recordComponentIdentifier - rma:commonRecordDetails - rma:filePlanComponent - - - - - - - - - - - - - - Location - d:text - false - - true - false - false - - - - - - rma:filePlanComponent - - - - - - - - - d:any - true - - - d:any - true - - - - - - - - Vital Record - - - Next Review Date - d:date - false - - - - rma:filePlanComponent - - - - - Scheduled - - - - Disposition Schedule - - false - false - - - rma:dispositionSchedule - false - false - - - - - - rma:filePlanComponent - - - - - Disposition Lifecycle - - - - Next disposition action - - false - false - - - rma:dispositionAction - false - false - - - - - - Disposition Action History - - false - false - - - rma:dispositionAction - false - true - - - - - - rma:filePlanComponent - - - - - - Cut Off - - - Cut Off Date - d:date - true - - - - - - Uncut Off - - - - - Transferring - - - - - Transferred - - - - - Ascended - - - - Frozen - - - Frozen At Date - d:date - true - - - Frozen By - d:text - true - - true - false - false - - - - - - - Caveat Config Root - - - - true - false - - - rma:caveatConfig - false - false - - false - - - - - - Email Config Root - - - - true - false - - - rma:emailConfig - false - false - - false - - - - - - - - Record Search - - - d:boolean - true - - - d:text - true - - true - false - false - - - - d:date - true - - - d:text - true - - true - false - false - - - - d:text - true - - true - false - false - - - - d:boolean - true - - - d:text - true - true - - true - false - false - - - - d:text - true - - true - false - false - - - - d:text - true - - - - d:text - true - - - d:text - true - - true - false - false - - - - d:text - true - - true - false - false - - - - d:date - true - - - d:text - true - - true - false - false - - - - - - - Versioned Record - - - - Unpublished Update - - - d:boolean - true - true - - - d:text - - - d:any - - - d:boolean - true - false - - - - - - - Ghosted Record - false - - - - - Loaded Data Set Id - - - List of the loaded Data Set Ids - d:text - true - - - - - - - The originating details of a record - - - d:text - true - - - d:date - true - - - d:noderef - true - - - - - - - The rejection details of a record - - - d:text - true - - - d:date - true - - - d:text - true - - - - - - - - Held children - - - d:int - true - true - 0 - - - - - - - Countable aspect - - - d:int - true - true - 0 - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml deleted file mode 100644 index 9e748e4107..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml +++ /dev/null @@ -1,503 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml deleted file mode 100644 index d2d67043a6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - Records Management Report Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - - Report - cm:content - - - Destruction Report - rmr:report - - - Transfer Report - rmr:report - - - Hold Report - rmr:report - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml deleted file mode 100644 index 4ad1f6d179..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml deleted file mode 100644 index 4ccba8a2a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /${spaces.company_home.childname}/${spaces.dictionary.childname} - alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml - - - - - - - - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.notification-service - alfresco.module.org_alfresco_module_rm.messages.admin-service - alfresco.module.org_alfresco_module_rm.messages.records-management-service - alfresco.module.org_alfresco_module_rm.messages.action-service - alfresco.module.org_alfresco_module_rm.messages.actions - alfresco.module.org_alfresco_module_rm.messages.audit-service - alfresco.module.org_alfresco_module_rm.messages.rm-events - alfresco.module.org_alfresco_module_rm.messages.capability-service - alfresco.module.org_alfresco_module_rm.messages.dataset-service - alfresco.module.org_alfresco_module_rm.messages.rm-system - alfresco.module.org_alfresco_module_rm.messages.template - alfresco.module.org_alfresco_module_rm.messages.hold-service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rmService - - - - - - - - - - - - - - - - - - - - - - caveatConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EEE, d MMM yyyy HH:mm:ss Z - EEE, d MMM yy HH:mm:ss Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties deleted file mode 100644 index c0a84d9526..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Alfresco Governance Services Module Properties -module.id=org_alfresco_module_rm - -# 23/02/2012 - Renamed -module.aliases=org_alfresco_module_dod5015 - -module.title=AGS Repo -module.description=Alfresco Governance Services Repository Extension -module.version=${project.version} -module.repo.version.min=${ags.module.repo.version.min} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml deleted file mode 100755 index 09b4a74ae5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - classpath*:alfresco/module/org_alfresco_module_rm/version.properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml deleted file mode 100755 index 03af26dfad..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml deleted file mode 100755 index 578fc799bf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml deleted file mode 100755 index 1cf1af9cde..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.ghosting.enabled} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml deleted file mode 100644 index 64c135e23e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml deleted file mode 100644 index e263b4aa28..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v32-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v32-context.xml deleted file mode 100644 index ddf1e762cb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v32-context.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v33-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v33-context.xml deleted file mode 100644 index 2ceccd64c1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v33-context.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml deleted file mode 100644 index 6159adab5f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml deleted file mode 100644 index f537ba54d6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update alf_prop_string_value - set string_value = #{stringValue}, - string_end_lower = #{stringEndLower}, - string_crc = #{stringCrc} - where id = #{id} - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml deleted file mode 100644 index fd97f207cb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml deleted file mode 100644 index 28b518d348..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - classpath:alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml deleted file mode 100644 index d719d76697..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml +++ /dev/null @@ -1,1157 +0,0 @@ - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.rm-actions - - - - - - - - - RECORD_CATEGORY - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - js - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction - org.alfresco.repo.action.executer.ActionExecuter - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Destroy - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - ${rm.ghosting.enabled} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ReOpenFolders - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CloseFolders - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CycleVitalRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM.Declare.0 - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.UndeclareRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.PlanningReviewCycles - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ManuallyChangeDispositionDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeAllTransfers - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeNominatedTransfers - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CreateModifyDestroyFileplanMetadata - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.RejectRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.FileUnfiledRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.rmCopy - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.rmMove - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.LinkToRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${spaces.store} - - - /${spaces.company_home.childname} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteHold - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ExtendRetentionPeriodOrFreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Unfreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ViewUpdateReasonsForFreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml deleted file mode 100644 index 3596e79165..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml deleted file mode 100644 index 59c1e1b9a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml deleted file mode 100644 index 5e2b7d389d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.RecordsManagementService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml deleted file mode 100644 index a3056f1f0b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - cutoff - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml deleted file mode 100644 index 60e27e2b8c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml deleted file mode 100644 index 139ffbd577..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cutoff - retain - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0/30 * * * * ? - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml deleted file mode 100644 index 8218bd49d0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - alfresco/module/org_alfresco_module_rm/model/recordsModel.xml - - - - - alfresco/module/org_alfresco_module_rm/messages/records-model - - - - - - /app:company_home/app:dictionary/cm:records_management - - - path - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.alfresco.org/model/system/1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml deleted file mode 100644 index b711326ba6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - org.alfresco.rest.api.QuickShareLinks - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.rm.rest.api.RMSites - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml deleted file mode 100644 index 2fcb3340c2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - alfresco/model/permissionDefinitions.xml - - - alfresco/model/permissionSchema.dtd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - ${system.acl.maxPermissionCheckTimeMillis} - - - ${system.acl.maxPermissionChecks} - - - - {http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent - - - - - - - ${system.acl.maxPermissionCheckTimeMillis} - - - ${system.acl.maxPermissionChecks} - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml deleted file mode 100644 index a2486705dd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - alfresco/module/org_alfresco_module_rm/model/reportModel.xml - - - - - alfresco/module/org_alfresco_module_rm/messages/report-model - - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.report-service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rma:transfer - - - - - - - - - rma:hold - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml deleted file mode 100644 index 2b23c08a65..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml +++ /dev/null @@ -1,1717 +0,0 @@ - - - - - - - - ${rm.recordSearch.maxItems} - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.transfer.TransferService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rma:recordCategory - rma:recordFolder - rma:record - rma:nonElectronicDocument - - - - - - - org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cm:lastThumbnailModification - cm:autoVersion - cm:autoVersionOnUpdateProps - cm:initialVersion - - - - - - - org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.alfresco.org/model/security/1.0 - http://www.alfresco.org/model/system/1.0 - http://www.alfresco.org/model/workflow/1.0 - http://www.alfresco.org/model/application/1.0 - http://www.alfresco.org/model/datalist/1.0 - http://www.alfresco.org/model/dictionary/1.0 - http://www.alfresco.org/model/bpm/1.0 - http://www.alfresco.org/model/rendition/1.0 - - - - - http://www.alfresco.org/model/recordsmanagement/1.0 - http://www.alfresco.org/model/rmcustom/1.0 - http://www.alfresco.org/model/recordsmanagementreport/1.0 - http://www.alfresco.org/model/recordableversion/1.0 - http://www.alfresco.org/model/dod5015/1.0 - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.record.RecordService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Thread-Index - messageFrom - messageTo - messageCc - messageSubject - messageSent - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService - - - - customEmailMappingService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.caveatConfigTransactionalCache - - - - - - - - - - {http://www.alfresco.org/model/recordsmanagement/1.0}recordComponentIdentifier - - - - - - - - {http://www.alfresco.org/model/rmcustom/1.0}rmcustom - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService - - - - caveatConfigService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.hold.HoldService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml deleted file mode 100644 index 866ee4c2cc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml +++ /dev/null @@ -1,934 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - - - - - - - - - RECORD - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - - RECORD_CATEGORY - RECORD_FOLDER - RECORD - UNFILED_RECORD_FOLDER - HOLD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - RECORD_CATEGORY - RECORD_FOLDER - RECORD - UNFILED_RECORD_FOLDER - HOLD - - - - - - - - - - FILE_PLAN - RECORD - RECORD_CATEGORY - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - HOLD_CONTAINER - HOLD - TRANSFER - TRANSFER_CONTAINER - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - TRANSFER - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - - - - - - TRANSFER - - - - - - - - - - TRANSFER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - RECORD - - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - HOLD_CONTAINER - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - HOLD - - - - - - - - - - HOLD - - - - - - - - - - HOLD - - - - - - - - - - RECORD - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml deleted file mode 100644 index 1b85cae998..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml deleted file mode 100644 index 3416f71190..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml +++ /dev/null @@ -1,701 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${audit.rm.viewLog.maxSize} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.autocompletesuggestion.minfragmentsize} - - - ${rm.autocompletesuggestion.maxsuggestions.path} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml deleted file mode 100644 index defbe811fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - activiti - alfresco/workflow/requestInfo.bpmn20.xml - text/xml - false - - - - - - alfresco/workflow/rmWorkflowModel.xml - - - - - alfresco/workflow/rm-workflow-messages - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json deleted file mode 100644 index 257f495b84..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json +++ /dev/null @@ -1,228 +0,0 @@ -[ - { - "name" : "ExtendedReaders", - "displayLabel" : "rm.role.extendedReaders", - "isAdmin" : false, - "capabilities" : - [ - "ViewRecords" - ] - }, - { - "name" : "ExtendedWriters", - "displayLabel" : "rm.role.extendedWriters", - "isAdmin" : false, - "capabilities" : - [ - "ViewRecords", - "EditNonRecordMetadata" - ] - }, - { - "name" : "User", - "displayLabel" : "rm.role.user", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords" - ] - }, - { - "name" : "PowerUser", - "displayLabel" : "rm.role.powerUser", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "RequestRecordInformation", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "FileVersionRecords" - ] - }, - { - "name" : "SecurityOfficer", - "displayLabel" : "rm.role.securityOfficer", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "RequestRecordInformation", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "ManageAccessControls", - "FileVersionRecords" - ] - }, - { - "name" : "RecordsManager", - "displayLabel" : "rm.role.recordsManager", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "UpdateTriggerDates", - "CreateModifyDestroyEvents", - "ManageAccessRights", - "MoveRecords", - "ChangeOrDeleteReferences", - "DeleteLinks", - "EditDeclaredRecordMetadata", - "ManuallyChangeDispositionDates", - "ApproveRecordsScheduledForCutoff", - "CreateModifyRecordsInCutoffFolders", - "ExtendRetentionPeriodOrFreeze", - "ViewUpdateReasonsForFreeze", - "DestroyRecordsScheduledForDestruction", - "UpdateVitalRecordCycleInformation", - "UndeclareRecords", - "DeclareAuditAsRecord", - "DeleteAudit", - "AuthorizeNominatedTransfers", - "EditSelectionLists", - "AuthorizeAllTransfers", - "CreateModifyDestroyFileplanMetadata", - "CreateAndAssociateSelectionLists", - "AttachRulesToMetadataProperties", - "CreateModifyDestroyFileplanTypes", - "CreateModifyDestroyRecordTypes", - "MakeOptionalParametersMandatory", - "MapEmailMetadata", - "DeleteRecords", - "TriggerAnEvent", - "CreateModifyDestroyRoles", - "PasswordControl", - "EnableDisableAuditByTypes", - "SelectAuditMetadata", - "DisplayRightsReport", - "AccessAudit", - "ExportAudit", - "CreateModifyDestroyReferenceTypes", - "RequestRecordInformation", - "FileDestructionReport", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "FileTransferReport", - "CreateHold", - "AddToHold", - "RemoveFromHold", - "FileHoldReport", - "DeleteHold", - "EndRetention", - "EditHold", - "ManageAccessControls", - "FileVersionRecords" - ] - }, - { - "name" : "Administrator", - "displayLabel" : "rm.role.administrator", - "isAdmin" : true, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "UpdateTriggerDates", - "CreateModifyDestroyEvents", - "ManageAccessRights", - "MoveRecords", - "ChangeOrDeleteReferences", - "DeleteLinks", - "EditDeclaredRecordMetadata", - "ManuallyChangeDispositionDates", - "ApproveRecordsScheduledForCutoff", - "CreateModifyRecordsInCutoffFolders", - "ExtendRetentionPeriodOrFreeze", - "ViewUpdateReasonsForFreeze", - "DestroyRecordsScheduledForDestruction", - "UpdateVitalRecordCycleInformation", - "UndeclareRecords", - "DeclareAuditAsRecord", - "DeleteAudit", - "AuthorizeNominatedTransfers", - "EditSelectionLists", - "AuthorizeAllTransfers", - "CreateModifyDestroyFileplanMetadata", - "CreateAndAssociateSelectionLists", - "AttachRulesToMetadataProperties", - "CreateModifyDestroyFileplanTypes", - "CreateModifyDestroyRecordTypes", - "MakeOptionalParametersMandatory", - "MapEmailMetadata", - "DeleteRecords", - "TriggerAnEvent", - "CreateModifyDestroyRoles", - "CreateModifyDestroyUsersAndGroups", - "PasswordControl", - "EnableDisableAuditByTypes", - "SelectAuditMetadata", - "DisplayRightsReport", - "AccessAudit", - "ExportAudit", - "CreateModifyDestroyReferenceTypes", - "ManageAccessControls", - "ManageRules", - "RequestRecordInformation", - "FileDestructionReport", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "FileTransferReport", - "CreateHold", - "AddToHold", - "RemoveFromHold", - "FileHoldReport", - "DeleteHold", - "EditHold", - "EndRetention", - "FileVersionRecords" - ] - } -] \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml deleted file mode 100644 index 5bd3b02433..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - classpath*:alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties - - classpath*:alfresco/extension/rm-method-security.properties - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties deleted file mode 100644 index 8c9bd9a7e8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties +++ /dev/null @@ -1,231 +0,0 @@ -## -# RM Method security for Alfresco code services -# -# Note: add alfresco/extension/rm-method-security.properties to extend -## - -## Node Service - -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStores=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createStore=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.exists=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeStatus=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAllRootNodes=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getRootNode=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createNode=RM.Create.0.3 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.moveNode=RM.Move.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setChildAssociationIndex=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getType=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setType=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addAspect=RM.Update.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeAspect=RM.Update.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.hasAspect=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAspects=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.deleteNode=RM.Delete.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addChild=RM.Create.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeChild=RM.Delete.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeChildAssociation=RM.Delete.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getProperties=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getProperty=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setProperties=RM.UpdateProperties.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addProperties=RM.UpdateProperties.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setProperty=RM.UpdateProperties.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeProperty=RM.UpdateProperties.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getParentAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getParentAssocs=RM.Read.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocs=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildByName=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildrenByName=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPrimaryParent=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createAssociation=RM.Assoc.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeAssociation=RM.Assoc.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getTargetAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getSourceAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAssoc=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPath=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPaths=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.restoreNode=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=RM_ABSTAIN -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 - -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.list=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listFiles=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listFolders=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listDeepFolders=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getLocalizedSibling=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.search=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.searchSimple=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.rename=RM.Update.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.move=RM.Move.0.1 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.moveFrom=RM.Move.0.2 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.copy=RM.Read.0,RM.Create.1.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.create=RM.Create.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.delete=RM.Delete.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getNamePath=RM.Read.1 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getNameOnlyPath=RM.Read.1 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.resolveNamePath=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getFileInfo=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getReader=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getWriter=RM.WriteContent.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.exists=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getType=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.isHidden=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.setHidden=RM.Update.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.*=RM_DENY - -## Content Service - -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getStoreTotalSpace=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getStoreFreeSpace=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getRawReader=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getReader=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getWriter=RM.WriteContent.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.isTransformable=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getTransformer=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getMaxSourceSizeBytes=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getImageTransformer=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.transform=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getTempWriter=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.*=RM_DENY - -## Search Service - -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.query=RM_QUERY,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.selectNodes=RM_QUERY,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.selectProperties=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.contains=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.like=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.*=RM_DENY - -## Category Service - -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getChildren=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getCategories=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getClassifications=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getRootCategories=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getClassificationAspects=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createClassification=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createRootCategory=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createCategory=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.deleteClassification=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.deleteCategory=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getTopCategories=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.*=RM_DENY - -## Lock Service - -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.lock=RM.Create.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.unlock=RM.Create.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockStatus=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockType=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.checkForLock=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLocks=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.isLockedAndReadOnly=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.isLocked=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockState=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.*=RM_DENY - -## Multilingual Content Service - -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslations=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslationForLocale=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getMissingTranslations=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getPivotTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.isTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.makeTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.unmakeTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.copyTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.moveTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.deleteTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.*=RM_DENY - -## Edition Service - -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.createEdition=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getEditions=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getVersionedTranslations=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getVersionedMetadatas=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.*=RM_DENY - -## Check Out Check In Service - -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.checkout=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.checkin=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.cancelCheckout=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.getWorkingCopy=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.getCheckedOut=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.isWorkingCopy=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.isCheckedOut=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.*=RM_DENY - -## Permission Service - -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getOwnerAuthority=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllAuthorities=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllPermission=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getPermissions=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getSettablePermissions=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.hasPermission=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.deletePermissions=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.deletePermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.setPermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.setInheritParentPermissions=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getInheritParentPermissions=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.clearPermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.*=RM_DENY - -## Site service - -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.cleanSitePermissions=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.createContainer=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.createSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.deleteSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.findSites=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getContainer=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getMembersRole=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getMembersRoleInfo=ACL_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSite=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteGroup=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoleGroup=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoles=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoot=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasContainer=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasCreateSitePermissions=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.isMember=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembers=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembersInfo=ACL_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listSites=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.removeMembership=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.setMembership=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.updateSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembersPaged=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listContainers=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.countAuthoritiesWithRole=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.resolveSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listSitesPaged=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteShortName=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.canAddMember=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.*=RM_ALLOW - -## Form Service - -rm.methodsecurity.org.alfresco.repo.forms.FormService.getForm=RM_ALLOW -rm.methodsecurity.org.alfresco.repo.forms.FormService.saveForm=RM_ALLOW -rm.methodsecurity.org.alfresco.repo.forms.FormService.*=RM_DENY - -## Ownable Service - -rm.methodsecurity.org.alfresco.service.cmr.security.OwnableService.getOwner=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.security.OwnableService.*=RM_DENY \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml deleted file mode 100644 index 8a1b803c47..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties deleted file mode 100644 index a8d3e2c6b3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# RM Schema number - -version.rm.schema=3500 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml deleted file mode 100644 index fbcd9b30e8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Get RM/DM related class definitions - Gets the RM/DM related collection of class definitions - parameters classfilter, namespaceprefix and name. - /api/rm/classes?cf={classFilter?}&nsp={namespacePrefix?}&n={name?} - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl deleted file mode 100644 index 2c351fd443..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "classes.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml deleted file mode 100644 index 83fa618a06..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Get RM/DM property definitions - Gets the collection of RM/DM property definitions. - /api/rm/classes/{classname}/properties?nsp={namespacePrefix?}&n={name?} - /api/rm/properties?nsp={namespacePrefix?}&n={name?} - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl deleted file mode 100644 index 1dd8193be2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "properties.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml deleted file mode 100644 index 14851a41bc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Remove a group or a user from a role - - - /api/rm/roles/{roleId}/authorities/{authorityName} - /api/rm/{store_type}/{store_id}/{id}/roles/{roleId}/authorities/{authorityName} - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml deleted file mode 100644 index d5a0810210..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Add a group or a user to a role - - - /api/rm/roles/{roleId}/authorities/{authorityName} - /api/rm/{store_type}/{store_id}/{id}/roles/{roleId}/authorities/{authorityName} - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.desc.xml deleted file mode 100644 index c84c7fb643..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.desc.xml +++ /dev/null @@ -1,15 +0,0 @@ - - Removes dynamic authorities - - URL parameter batchsize is mandatory, and represents the maximum number of records that can be processed in one transaction.
- URL parameter maxProcessedRecords is optional, and represents the maximum number of records that will be processed in one request.
- URL parameter export is optional, and if the it's value is true, will export the processed records into a csv file.
- URL parameter parentNodeRef is optional, and represents the nodeRef of the folder that contains the records to be processed.
- ]]> -
- /api/rm/rm-dynamicauthorities?batchsize={batchsize}&maxProcessedRecords={maxProcessedRecords?}&export={export?}&parentNodeRef={parentNodeRef?} - argument - admin - required -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.json.ftl deleted file mode 100644 index 75c6fc5abe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.json.ftl +++ /dev/null @@ -1,30 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "responsestatus" : "${responsestatus?json_string}", - "message" : "${message?json_string}" -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml deleted file mode 100644 index 64948ba800..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Get action condition definition collection for RM - Gets a collection of the available action condition definitions in RM. - /api/rm/rm-actionconditiondefinitions - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl deleted file mode 100644 index 5e26f87d12..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "actionconditiondefinitions.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml deleted file mode 100644 index b51593347e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Get action definition collection for RM - Gets a collection of the available action definitions in RM. - /api/rm/rm-actiondefinitions - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl deleted file mode 100644 index 7198cc65c6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "actiondefinitions.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/schedules/rm-updaterecordschedule.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/schedules/rm-updaterecordschedule.get.desc.xml deleted file mode 100644 index 8ff54084a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/schedules/rm-updaterecordschedule.get.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - Updates Record Schedules based on Hierarchical Retention Instructions - - URL parameter maxRecordFolders is optional, and represents the maximum number of record folders that should be processed. If not specified maxRecordFolders will be set to the max value for an integer.
- URL parameter recordFolder is optional, and represents the nodeRef of a record folder whose records should be processed. If specified then maxRecordFolders will be ignored.
- ]]> -
- /api/rm/rm-updateRecordSchedule?maxRecordFolders={maxRecordFolders?}&recordFolder={recordFolder?} - argument - admin - required -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/schedules/rm-updaterecordschedule.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/schedules/rm-updaterecordschedule.get.json.ftl deleted file mode 100644 index 75c6fc5abe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/schedules/rm-updaterecordschedule.get.json.ftl +++ /dev/null @@ -1,30 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "responsestatus" : "${responsestatus?json_string}", - "message" : "${message?json_string}" -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml deleted file mode 100644 index 8665f19ad7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Get substitution suggestions for RM - Gets a collection of substitution suggestions for a text fragment for RM. - /api/rm/rm-substitutionsuggestions?fragment={fragment}&path={path?} - argument - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl deleted file mode 100644 index b9c9934bea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "substitutions": - [ - <#list substitutions as substitution> - "${substitution}"<#if substitution_has_next>, - - ] -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml deleted file mode 100644 index 54d1a8bf5d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js deleted file mode 100644 index 98b3cd0f80..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js +++ /dev/null @@ -1,151 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -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, isRecordedVersionDestroyed; - - 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"); - isRecordedVersionDestroyed = version.getVersionProperty("RecordedVersionDestroyed"); - - versions[versions.length] = - { - nodeRef: version.node.nodeRef.toString(), - name: (isRecordedVersionDestroyed == true) ? "" : 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() : "", - isRecordedVersionDestroyed: isRecordedVersionDestroyed - }; - } - } - 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: "", - isRecordedVersionDestroyed: false - }; - } - } - } - - // store node onto model - model.versions = versions; -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl deleted file mode 100644 index 79afd6bdf0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl +++ /dev/null @@ -1,48 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#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}", - "isRecordedVersionDestroyed": ${v.isRecordedVersionDestroyed?c} - }<#if (v_has_next)>, - -] - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml deleted file mode 100644 index 50fd1191b0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml +++ /dev/null @@ -1,15 +0,0 @@ - - Delete email property map - - DELETE /api/rma/admin/emailmap/{from}/{to} deletes the specified mapping - Returns data in the same format as the get method - ]]> - - /api/rma/admin/emailmap/{from}/{to} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl deleted file mode 100644 index 588396e731..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "emailmap.lib.ftl" as emailmapLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml deleted file mode 100644 index 1aeeb1fdc6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml +++ /dev/null @@ -1,29 +0,0 @@ - - Get the custom email property map - - fields are specified with "from" and "to". -
- Example data. -
-      "mappings":
-      [
-         {"from" : "messageTo", "to" : "imap:messageTo" } ,
-         {"from" : "Thread-Index", "to" : "imap:threadIndex" } ,
-         {"from" : "messageFrom", "to" : "imap:messageFrom" } ,
-         {"from" : "messageSubject", "to" : "cm:title" } ,
-         {"from" : "messageSubject", "to" : "imap:messageSubject" } ,
-         {"from" : "messageSubject", "to" : "cm:description" } ,
-         {"from" : "messageCc", "to" : "imap:messageCc" } ,
-         {"from" : "Message-ID", "to" : "imap:messageId" }
-      ]
-   
- ]]> -
- /api/rma/admin/emailmap - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl deleted file mode 100644 index 588396e731..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "emailmap.lib.ftl" as emailmapLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl deleted file mode 100644 index 5b10e25834..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl +++ /dev/null @@ -1,40 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#-- renders an email map object --> - -<#macro emailmapJSON emailmap> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "mappings": - [ - <#list emailmap as mapping> - {"from": "${mapping.from}", "to": "${mapping.to}" }<#if mapping_has_next>, - - ] - } - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml deleted file mode 100644 index 1b4ade6fb7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml +++ /dev/null @@ -1,20 +0,0 @@ - - Add email property map - - Data is specified in JSON format as a JSONObject -
-   {"to":"rmc:Wibble", "from":"whatever"}
-   
-
- POST /api/rma/admin/emailmap adds the specified mapping - Returns data in the same format as the get method - ]]> -
- /api/rma/admin/emailmap - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl deleted file mode 100644 index 588396e731..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "emailmap.lib.ftl" as emailmapLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml deleted file mode 100644 index 84a2019ff9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - RM Email Mapping Keys - Gets the list of email mapping keys - /api/rma/admin/emailmapkeys - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl deleted file mode 100644 index 947b77215b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data" : - { - "emailmapkeys": - [ - <#list emailmapkeys as emailmapkey> - '${emailmapkey}'<#if emailmapkey_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js deleted file mode 100644 index 0fe4ffc998..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -function existsTitle(caveatConfig, title) -{ - var constraints = caveatConfig.allConstraints; - - // Check for existing constraint... - var alreadyExists = false; - for (var i = 0; i < constraints.length; i++) - { - var currTitle = constraints[i].title; - if (currTitle + "" == title) - { - alreadyExists = true; - break; - } - } - - return alreadyExists; -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml deleted file mode 100644 index 0cbf8f2f2d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - Delete an RM Constraint list - - - - /api/rma/admin/rmconstraints/{listName} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js deleted file mode 100644 index d3723f339d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Delete the rm constraint list - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - caveatConfig.deleteConstraintList(shortName); - - // Pass the constraint name to the template - model.constraintName = shortName; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl deleted file mode 100644 index 441c5d55e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": { } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml deleted file mode 100644 index 6caa0bdcae..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml +++ /dev/null @@ -1,22 +0,0 @@ - - Get a RM Constraint method - - - Constraint object -
-
constraintName
the name of the constraint. The underscore character is used instead of the colon
-
constraintTitle
the title of the constraint (human readable)
-
caseSensitive
Are the values case sensitive
-
allowedValues
array of allowed values, this is the complete unrestricted list of all values
-
- ]]> -
- /api/rma/admin/rmconstraints/{listName} - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js deleted file mode 100644 index 7e9e50b42c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Get the detail of the rm constraint - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl deleted file mode 100644 index 451a6c0792..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> - -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl deleted file mode 100644 index 5b04ea4cf9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl +++ /dev/null @@ -1,87 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#-- renders an rm constraint object --> - -<#macro constraintSummaryJSON constraint> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", - "constraintName" : "${constraint.name}", - "constraintTitle" : "${msg(constraint.title)}" - } - - - -<#macro constraintJSON constraint> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", - "constraintName" : "${constraint.name}", - "caseSensitive" : "${constraint.caseSensitive?string("true", "false")}", - "constraintTitle" : "${constraint.title}", - "allowedValues" : [ <#list constraint.allowedValues as allowedValue> "${allowedValue}" <#if allowedValue_has_next>, ] - } - - - -<#macro constraintWithValuesJSON constraint> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", - "constraintName" : "${constraint.name}", - "caseSensitive" : "${constraint.caseSensitive?string("true", "false")}", - "constraintTitle" : "${msg(constraint.title)}", - "values" : [ - <#list constraint.values as value> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", - "valueName":"${value.valueName}", - "valueTitle":"${value.valueTitle}", - "authorities" : [ <#list value.authorities as authority> { "authorityName" : "${authority.authorityName}", "authorityTitle" : "${authority.authorityTitle}"} <#if authority_has_next>,] - }<#if value_has_next>, - - ] - } - - - -<#macro constraintWithValueJSON constraint value> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", - "constraintName" : "${constraint.name}", - "constraintTitle" : "${constraint.title}", - "value" : - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", - "valueName":"${value.valueName}", - "valueTitle":"${value.valueTitle}", - "authorities" : [ <#list value.authorities as authority> { "authorityName" : "${authority.authorityName}", "authorityTitle" : "${authority.authorityTitle}"} <#if authority_has_next>,] - } - } - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml deleted file mode 100644 index fef70b6ff0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml +++ /dev/null @@ -1,19 +0,0 @@ - - Update an RM Constraint List - - The following properties may be updatedConstraint object -
-
-
constraintTitle
Optional, the title of the constraint (human readable)
-
allowedValues
Optional, array of allowed values, the complete list must be specified
-
- ]]> -
- /api/rma/admin/rmconstraints/{listName} - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl deleted file mode 100644 index ea47e1ad15..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl +++ /dev/null @@ -1,37 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if !errorMessage??> - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> - <#else> - "message" : "${msg(errorMessage, title)}" - -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js deleted file mode 100644 index 08faf53f75..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js +++ /dev/null @@ -1,87 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Update an rm constraint - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - var allowedValues, - title = null; - - if (json.has("constraintTitle")) - { - title = json.get("constraintTitle"); - if (existsTitle(caveatConfig, title)) - { - status.code = 400; - model.errorMessage = "rm.admin.list-already-exists"; - model.title = title; - return; - } - constraint.updateTitle(title); - } - - if (json.has("allowedValues")) - { - values = json.getJSONArray("allowedValues"); - - var i = 0; - allowedValues = new Array(); - - if (values != null) - { - for (var x = 0; x < values.length(); x++) - { - allowedValues[i++] = values.get(x); - } - } - constraint.updateAllowedValues(allowedValues); - } - - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.properties deleted file mode 100644 index 28e2a155e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=A list with the name "{0}" already exists. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_de.properties deleted file mode 100644 index 314d26eb1a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_de.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Eine Liste mit dem Namen ''{0}'' ist bereits vorhanden. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_es.properties deleted file mode 100644 index abb262f8f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_es.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Ya existe una lista con el nombre ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_fr.properties deleted file mode 100644 index a5afa0860a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_fr.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Une liste portant le nom ''{0}'' existe d\u00e9j\u00e0. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_it.properties deleted file mode 100644 index a09b0ecfd8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_it.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Esiste gi\u00e0 un elenco con nome ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ja.properties deleted file mode 100644 index b4ce038947..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ja.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=''{0}''\u3068\u3044\u3046\u540d\u524d\u306e\u30ea\u30b9\u30c8\u304c\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nb.properties deleted file mode 100644 index d37e2d6961..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nl.properties deleted file mode 100755 index 2677b127f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nl.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Er bestaat al een lijst met de naam ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_pt_BR.properties deleted file mode 100644 index f570bd1f49..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_pt_BR.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=J\u00e1 existe uma lista com o nome ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties deleted file mode 100644 index f70fb3efce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties +++ /dev/null @@ -1 +0,0 @@ -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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_zh_CN.properties deleted file mode 100644 index 7aca9dd576..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=\u5df2\u7ecf\u5b58\u5728\u540d\u79f0\u4e3a ''{0}'' \u7684\u5217\u8868\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml deleted file mode 100644 index edc8be638e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Get the names of all RM Constraint Lists - -
-
constraintTitle
Human readable title for the custom constraint list
-
constraintName
the name of the constraint list, prefixed
-
url
-
- ]]> -
- /api/rma/admin/rmconstraints?withEmptyLists={withEmptyLists?} - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js deleted file mode 100644 index 1f9faac497..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * List the names of the rm constraints - */ -function main() -{ - var wel = true; - var withEmptyLists = args["withEmptyLists"]; - // Pass the information to the template - if (withEmptyLists != null && withEmptyLists === 'false') - { - model.constraints = caveatConfig.constraintsWithoutEmptyList; - } - else - { - model.constraints = caveatConfig.allConstraints; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl deleted file mode 100644 index 5539002261..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - [ - <#list constraints as constraint> - <@rmconstraintLib.constraintSummaryJSON constraint=constraint /> - <#if constraint_has_next>, - - ] -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml deleted file mode 100644 index 8e6dec15b4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml +++ /dev/null @@ -1,20 +0,0 @@ - - Create a new RM Constraint List - - The following properties may be specified -
-
-
constraintName
Optional the name of the constraint. If not specified then one will be generated.
-
constraintTitle
The title of the constraint (human readable)
-
allowedValues
array of allowed values, the complete list must be specified
-
- ]]> -
- /api/rma/admin/rmconstraints - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl deleted file mode 100644 index de882714e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl +++ /dev/null @@ -1,37 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if !errorMessage??> - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> - <#else> - "message" : "${msg(errorMessage, title)}" - -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js deleted file mode 100644 index 153aeb1025..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js +++ /dev/null @@ -1,81 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Create a new RM Constraint List - */ -function main() -{ - // Parse the passed in details - var title = null, - name = null, - allowedValues = {}; - - if (json.has("constraintName")) - { - name = json.get("constraintName"); - } - - if (json.has("constraintTitle")) - { - title = json.get("constraintTitle"); - } - else - { - title = name; - } - - if (existsTitle(caveatConfig, title)) - { - status.code = 400; - model.errorMessage = "rm.admin.list-already-exists"; - model.title = title; - return; - } - - if (json.has("allowedValues")) - { - values = json.getJSONArray("allowedValues"); - - var i = 0; - allowedValues = new Array(); - - if (values != null) - { - for (var x = 0; x < values.length(); x++) - { - allowedValues[i++] = values.get(x); - } - } - } - - model.constraint = caveatConfig.createConstraint(name, title, allowedValues); -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.properties deleted file mode 100644 index 28e2a155e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=A list with the name "{0}" already exists. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_de.properties deleted file mode 100644 index 314d26eb1a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_de.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Eine Liste mit dem Namen ''{0}'' ist bereits vorhanden. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_es.properties deleted file mode 100644 index abb262f8f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_es.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Ya existe una lista con el nombre ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_fr.properties deleted file mode 100644 index a5afa0860a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_fr.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Une liste portant le nom ''{0}'' existe d\u00e9j\u00e0. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_it.properties deleted file mode 100644 index a09b0ecfd8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_it.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Esiste gi\u00e0 un elenco con nome ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ja.properties deleted file mode 100644 index b4ce038947..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ja.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=''{0}''\u3068\u3044\u3046\u540d\u524d\u306e\u30ea\u30b9\u30c8\u304c\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nb.properties deleted file mode 100644 index d37e2d6961..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nl.properties deleted file mode 100755 index 2677b127f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nl.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=Er bestaat al een lijst met de naam ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_pt_BR.properties deleted file mode 100644 index f570bd1f49..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_pt_BR.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=J\u00e1 existe uma lista com o nome ''{0}''. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties deleted file mode 100644 index f70fb3efce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties +++ /dev/null @@ -1 +0,0 @@ -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. diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_zh_CN.properties deleted file mode 100644 index 7aca9dd576..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=\u5df2\u7ecf\u5b58\u5728\u540d\u79f0\u4e3a ''{0}'' \u7684\u5217\u8868\u3002 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml deleted file mode 100644 index fc447a85d1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml +++ /dev/null @@ -1,63 +0,0 @@ - - Get an RM Constraint - - - The list name is qualified with an underscore between prefix and name to be compatible with Java Script and URLs -
- e.g. rma_listName rather than rma:listName -
- Constraint object -
-
constraintName
the name of the constraint. The underscore character is used instead of the colon
-
caseSensitive
is the constraint case sensitive
-
constraintTitle
the display name of the constraint
-
allowedValues
array of the allowed values, this is the complete unrestricted list of all values
-
values
array of constraint values
-
- Constraint values object -
-
valueName
the full name of the value
-
valueTitle
the display name of the value
-
authorities
array of constraint authorities
-
- Example JSON data -
-   {
-      "data":
-      {
-         "url" : "\/alfresco\/service\/api\/rma\/admin\/rmconstraints\/rma_smList",
-         "constraintName" : "rma_smList",
-         "caseSensitive" :  "true",
-         "constraintTitle" : "Display title for rma:smList",
-         "allowedValues" : [ "Alpha" ,  "Beta" ,  "Gamma" ],
-         "values" :
-         [
-            {
-               "valueName":"NOCON",
-               "valueTitle":"NOCON",
-               "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} ]
-            },
-            {
-               "valueName":"NOFORN",
-               "valueTitle":"NOFORN",
-               "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} , { "authorityName" : "fbloggs", "authorityTitle" : "fbloggs"} , { "authorityName" : "jdoe", "authorityTitle" : "jdoe"} ]
-            },
-            {
-               "valueName":"FGI",
-               "valueTitle":"FGI",
-               "authorities" : [  { "authorityName" : "fbloggs", "authorityTitle" : "fbloggs"} , { "authorityName" : "jdoe", "authorityTitle" : "jdoe"} ]
-            }
-         ]
-      }
-   }
-   
- ]]> -
- /api/rma/admin/rmconstraints/{listName}/values - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js deleted file mode 100644 index f5a021a20c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Get the detail of the rm constraint - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = urlElements[0]; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl deleted file mode 100644 index 56324c0dd0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml deleted file mode 100644 index 86b6d17ed6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml +++ /dev/null @@ -1,28 +0,0 @@ - - Updates values in an an RM Constraint List - - If the authority is missing from the list then the value is deleted. -
- If an authority does not exist in a list then the authority is added. -
- Only the authorities for the specified values are updated. -
- If a value is missing it will not be affected. -
- JSON Parameter format: -
- "values" : [ ValueName, [ authorityName1, authorityName2 ]] -
- The input format for values is different to the output format. -
- Data Return format. - ]]> -
- /api/rma/admin/rmconstraints/{listName}/values - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl deleted file mode 100644 index 0fe6f57b1d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js deleted file mode 100644 index d0373f6142..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Update the details of a value in an rm constraint - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = urlElements[0]; - - var values = null; - - if (json.has("values")) - { - values = json.getJSONArray("values"); - } - - if (values == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "Values missing"); - return; - } - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - constraint.updateValues(values); - model.constraint = caveatConfig.getConstraint(shortName); - model.constraintName = shortName; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml deleted file mode 100644 index dfbe501e22..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - Delete a value from an RM Constraint List - - - /api/rma/admin/rmconstraints/{listName}/{valueName} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js deleted file mode 100644 index 48c252927f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Delete the rm constraint list - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = urlElements[0]; - var authorityName = urlElements[1]; - - if (shortName == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "shortName missing"); - return; - } - if (valueName == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "value missing"); - return; - } - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - caveatConfig.deleteRMConstraintListValue(shortName, valueName); - - var constraint = caveatConfig.getConstraint(shortName); - - // Pass the constraint name to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl deleted file mode 100644 index 0fe6f57b1d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml deleted file mode 100644 index c53b819e90..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml +++ /dev/null @@ -1,47 +0,0 @@ - - Get an RM Constraint Value - - - The list name is qualified with an underscore between prefix and name to be compatible with Java Script and URLs -
- e.g. rma_listName rather than rma:listName -
- Constraint object -
-
constraintName
the name of the constraint. The underscore character is used instead of the colon
-
constraintTitle
the display name of the constraint
-
value
constraint values
-
- Constraint values object -
-
valueName
the full name of the value
-
valueTitle
the display name of the value
-
authorities
array of constraint authorities
-
- Example JSON data: -
-   {
-      "data":
-      {
-         "url" : "\/alfresco\/service\/api\/rma\/admin\/rmconstraints\/rma_smList/values/NOCON",
-         "constraintName" : "rma_smList",
-         "constraintTitle" : "Display title for rma:smList",
-         "value" :
-         {
-           "valueName":"NOCON", 
-           "valueTitle":"NOCON",
-           "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} ]
-         }
-      }
-   }
-   
- ]]> -
- /api/rma/admin/rmconstraints/{listName}/values/{valueName} - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js deleted file mode 100644 index 3020aad401..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Get the detail of the rm constraint - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = decodeURIComponent(urlElements[0]); - var valueName = decodeURIComponent(urlElements[2]) - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - // Pass the constraint detail to the template - var value = constraint.getValue(valueName); - - if(value == null) - { - // Return 404 - status.setCode(404, "Constraint List: " + shortName + " value: " + valueName + "does not exist"); - return; - } - - model.value = value; - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl deleted file mode 100644 index b814694f80..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValueJSON constraint=constraint value=value/> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml deleted file mode 100644 index f0f74a4e42..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Deletes a records management event - - - - /api/rma/admin/rmevents/{eventname} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml deleted file mode 100644 index 4667b1a3ef..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Get an records management event - - - - /api/rma/admin/rmevents/{eventname} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl deleted file mode 100644 index ef20307740..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmEventLib.eventJSON event=event /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl deleted file mode 100644 index d3af881a63..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl +++ /dev/null @@ -1,38 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#-- renders an rm event object --> - -<#macro eventJSON event> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "eventName": "${event.name}", - "eventDisplayLabel": "${event.displayLabel}", - "eventType":"${event.type}" -} - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml deleted file mode 100644 index 20fa57cfea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Update a records management event - - - - /api/rma/admin/rmevents/{eventname} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl deleted file mode 100644 index ef20307740..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmEventLib.eventJSON event=event /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml deleted file mode 100644 index b80139a92d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Get list of records management events - - - - /api/rma/admin/rmevents - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl deleted file mode 100644 index c0991a328f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#list events as event> - "${event.name}": - <@rmEventLib.eventJSON event=event /><#if event_has_next>, - - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml deleted file mode 100644 index c7970590a4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Create a new records managment event - - - - /api/rma/admin/rmevents - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl deleted file mode 100644 index a9f4103dc1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl +++ /dev/null @@ -1,35 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmEventLib.eventJSON event=event /> - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml deleted file mode 100644 index 6d28dd8489..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Gets the records management event types - - - - /api/rma/admin/rmeventtypes - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl deleted file mode 100644 index 13461f071e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#list eventtypes as eventtype> - "${eventtype.name}": - { - "eventTypeName" : "${eventtype.name}", - "eventTypeDisplayLabel" : "<#if eventtype.displayLabel??>${eventtype.displayLabel}<#else>" - }<#if eventtype_has_next>, - - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml deleted file mode 100644 index 2977395daa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Deletes a records management role - - - - /api/rma/admin/rmroles/{rolename} - /api/rma/admin/{siteid}/rmroles/{rolename} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml deleted file mode 100644 index 5035c87ac1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Get an records management role - - - - /api/rma/admin/rmroles/{rolename} - /api/rma/admin/{siteid}/rmroles/{rolename} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl deleted file mode 100644 index c2673127a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmRoleLib.roleJSON role=role /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl deleted file mode 100644 index 24e1ef24e4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl +++ /dev/null @@ -1,65 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#-- renders an rm role object --> -<#macro roleJSON role> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "name": "${role.name}", - "displayLabel": "${role.displayLabel}", - "capabilities": - { - <#list role.capabilities as capability> - "${capability.name}": "${capability.title}" <#if capability_has_next>, - - } - <#if role.showAuths> - , - "assignedUsers" : - [ - <#list role.assignedUsers as user> - { - "name" : "${user.name}", - "displayLabel" : "${user.displayLabel}" - }<#if user_has_next>, - - ], - "assignedGroups" : - [ - <#list role.assignedGroups as group> - { - "name" : "${group.name}", - "displayLabel" : "${group.displayLabel}" - }<#if group_has_next>, - - ] - <#if role.groupShortName??> - ,"groupShortName": "${role.groupShortName}" - - -} - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml deleted file mode 100644 index c939ad16a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Update a records management role - - - - /api/rma/admin/rmroles/{rolename} - /api/rma/admin/{siteid}/rmroles/{rolename} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl deleted file mode 100644 index c2673127a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmRoleLib.roleJSON role=role /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml deleted file mode 100644 index d2a382d9aa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml +++ /dev/null @@ -1,22 +0,0 @@ - - Get list of records management roles and their details, for a file plan. - - - - /api/rma/admin/rmroles?user={user?}&auths={auths?}&is={is?} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles?user={user?}&auths={auths?}&is={is?} - /api/rma/admin/{siteid}/rmroles?user={user?}&auths={auths?}&is={is?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl deleted file mode 100644 index 1dafc42bd9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#list roles as role> - "${role.name}": - <@rmRoleLib.roleJSON role=role /><#if role_has_next>, - - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml deleted file mode 100644 index 8b472e934e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Create a new records managment role - - - - /api/rma/admin/rmroles - /api/rma/admin/{siteid}/rmroles - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl deleted file mode 100644 index c2673127a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmRoleLib.roleJSON role=role /> -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml deleted file mode 100644 index d1ca358cdd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml +++ /dev/null @@ -1,15 +0,0 @@ - - Applies fixes to the content model for DoD certification. - - Please note that this script will be removed after the certification process is complete. - ]]> - /api/rma/applydodcertmodelfixes - argument - admin - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl deleted file mode 100644 index 6db0af0ec2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml deleted file mode 100644 index b468a7889e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Applies fix for MOB-1573. - Fixes the RM custom model by changing the multiplicity on custom references to many-to-many. - /api/rma/applyfixmob1573 - argument - admin - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl deleted file mode 100644 index 6db0af0ec2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml deleted file mode 100644 index fb55a391ee..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Load the RM DOD bootstrap data. - WebScript to import and fix up the RM DOD bootstrap data. - /api/rma/bootstraptestdata?site={site?}&import={import?} - argument - admin - required - deprecated - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl deleted file mode 100644 index 6db0af0ec2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml deleted file mode 100644 index e8b2400d4d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Records Management Capabilities - Get the list of capabilities available to the current user on the given node. - /api/node/{store_type}/{store_id}/{id}/capabilities?includeAll={includeAll?} - /api/capabilities?includeAll={includeAll?}&grouped={grouped?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl deleted file mode 100644 index 2126ec496d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl +++ /dev/null @@ -1,59 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "data": - { - <#if groupedCapabilities??> - "groupedCapabilities": - [ - <#list groupedCapabilities?keys?sort as groupedCapabilityKey> - { - "${groupedCapabilityKey}": - { - <#assign groupedCapability = groupedCapabilities[groupedCapabilityKey]> - groupTitle: "${groupedCapability.groupTitle}", - capabilities: - { - <#assign capabilities = groupedCapability.capabilities> - <#list capabilities?keys?sort as capabilityKey> - "${capabilityKey}": "${capabilities[capabilityKey]}"<#if capabilityKey_has_next>, - - } - } - }<#if groupedCapabilityKey_has_next>, - - ] - <#else> - "capabilities": - [ - <#list capabilities as capability> - "${capability}"<#if capability_has_next>, - - ] - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml deleted file mode 100644 index 384249493f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Records Management Customisable Types and Aspects - - - /api/rma/admin/customisable - - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl deleted file mode 100644 index 20471e243b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl +++ /dev/null @@ -1,40 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - [ - <#list items as item> - { - "name" : "${item.name}", - "isAspect" : ${item.isAspect?string}, - "title" : "${item.title}" - }<#if item_has_next>, - - ] -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml deleted file mode 100644 index 24e24f2c0e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Attempts to remove specified Custom Property Definitions from the custom model - - It should be noted that it may not be possible to honour this request in all cases.
- In cases where instances of the specified property are already present in the system,
- the request will not succeed. In cases where there are no instances of the specified
- property in the system, the request will attempted.
-
- The propId is that returned by custompropertydefinitions.get. - ]]> -
- /api/rma/admin/custompropertydefinitions/{propId} - argument - user - required - internal -
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl deleted file mode 100644 index 25ac37ad7a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl +++ /dev/null @@ -1,34 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "customProperty": "${propertyqname}" - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml deleted file mode 100644 index 9d5af56a68..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml +++ /dev/null @@ -1,29 +0,0 @@ - - Add a Custom Property Definition to the custom model - -
- The URL query parameter 'element' defines which RM type will be able to have the property added.
- It should be a the customisable types short qname type (eg rma:recordCategory)
-
- The JSON parameter 'propId' is optional. If a value is provided it must only contain characters
- which are legal within URLs and within QNames.
- It is also the responsibility of the calling code to ensure the propId is unique across all custom properties.
- If a value is not provided, one will be generated.
-
- The body of the post should be in the form, e.g.
- {
-    "label": "sample Custom Property",
-    "dataType": "d:boolean",
-    "mandatory": false
, -    "constraintRef": "rmc:constraintName",
-    "propId": "myPropId"
- }
- ]]> -
- /api/rma/admin/custompropertydefinitions?element={element} - argument - user - required - internal -
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl deleted file mode 100644 index c41ddcd3ed..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "propId": "${propId!""}", - "url": "${url!""}", - "message": "${errorMessage!""}" -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml deleted file mode 100644 index f4dcf82e60..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml +++ /dev/null @@ -1,25 +0,0 @@ - - Updates a Custom Property Definition. - -
- There is currently support only for updating the label and/or for updating the constraint.
- The body of the PUT should be in the form, e.g.
- {
-    "label": "updated label value",
-    "constraintRef": "rmc:constraintName",
- }
- In the above example JSON, a constraintRef with QName "rmc:constraintName" will be added to the
- property definition if one does not exist. If there already is a constraint, it will be replaced.
- It is also possible to remove all constraints from the property definition by passing null:
- {
-    "constraintRef": null,
- }
- ]]> -
- /api/rma/admin/custompropertydefinitions/{propId} - argument - user - required - internal -
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl deleted file mode 100644 index 70518158b9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "propId": "${propId!""}", - "url": "${url!""}", - "message": "${errorMessage!""}" -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml deleted file mode 100644 index bd6b7b218c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Records Management Custom Model Property Definitions - - If a propId is specified within the URL, only that specific property definition is returned.
- ]]> -
- /api/rma/admin/custompropertydefinitions?element={element} - /api/rma/admin/custompropertydefinitions/{propId} - - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl deleted file mode 100644 index 424c93aaa1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl +++ /dev/null @@ -1,69 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "customProperties": - { - <#list customProps as prop> - "${prop.name.toPrefixString()}": - { - "dataType": "<#if prop.dataType??>${prop.dataType.name.toPrefixString()}", - "label": "${prop.title!""}", - "description": "${prop.description!""}", - "mandatory": ${prop.mandatory?string}, - "multiValued": ${prop.multiValued?string}, - "defaultValue": "${prop.defaultValue!""}", - "protected": ${prop.protected?string}, - "propId": "${prop.name.localName}", - "constraintRefs": - [ - <#list prop.constraints as con> - { - "name": "${con.constraint.shortName!""}", - "title": "${msg(con.constraint.title)!""}", - "type": "${con.constraint.type!""}", - "parameters": - { - <#-- Basic implementation. Only providing 2 hardcoded parameters. --> - <#assign lov = con.constraint.parameters["allowedValues"]> - "caseSensitive": ${con.constraint.parameters["caseSensitive"]?string}, - "listOfValues" : - [ - <#list lov as val>"${val}"<#if val_has_next>, - ] - } - }<#if con_has_next>, - - ] - }<#if prop_has_next>, - - } - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml deleted file mode 100644 index 62916a0b4f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Removes specified Custom Reference Instance from between the specified nodes - - The nodeRef encoded within the URL path is the 'fromNode' in the relationship.
- The nodeRef encoded within the query string is the 'toNode' in the relationship.
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/customreferences/{refId}?st={toStoreType}&si={toStoreId}&id={toId} - argument - user - required - internal -
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl deleted file mode 100644 index 50c6d059a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl +++ /dev/null @@ -1,29 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "success": ${success?string} -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml deleted file mode 100644 index 660c6f63c7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Add a Custom Reference instance to the specified record node - -
- The body of the post should be in the form, e.g.
- {
-    "toNode" : "workspace://SpacesStore/12345678-abcd-1234-abcd-1234567890ab",
-    "refId" : the refId as returned by customrefdefinitions.get
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/customreferences - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl deleted file mode 100644 index 3a98e35de1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml deleted file mode 100644 index d5a793f9ef..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml +++ /dev/null @@ -1,22 +0,0 @@ - - Add a Custom Reference Definition to the custom model - -
- The body of the post should be in the form, e.g.
- {
-    "referenceType" : ""parentchild" OR "bidirectional",
-    "label" : "bar"
-    "source" : "foo",
-    "target" : "bar"
- }
- For parentchild references, source and target must be provided. For bidirectional references, - a label is required.
- ]]> -
- /api/rma/admin/customreferencedefinitions - argument - user - required - internal -
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl deleted file mode 100644 index 127b42d347..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl +++ /dev/null @@ -1,36 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string}, - "data" : { - "referenceType": "${referenceType?string}", - "refId": "${refId?string}", - "url": "${url?string}" - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml deleted file mode 100644 index 45cf4a2301..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml +++ /dev/null @@ -1,25 +0,0 @@ - - Updates a Custom Reference Definition. - -
- There is currently support only for updating the label, source or target fields.
-
- The body of the PUT should be in the form, e.g.
- {
-    "label": "updated label value",
- }
- OR - {
-    "source": "updated source value",
-    "target": "updated target value",
- }
- for bidirectional and parentchild references respectively.
- ]]> -
- /api/rma/admin/customreferencedefinitions/{refId} - argument - user - required - internal -
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl deleted file mode 100644 index 7964b04ae8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl +++ /dev/null @@ -1,32 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "refId": "${refId}", - "url": "${url}" -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml deleted file mode 100644 index b474afd1ee..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml +++ /dev/null @@ -1,15 +0,0 @@ - - Records Management Custom Model Reference Definitions - - If a refId is specified, then only the reference definition corresponding to that
- id will be returned.
- ]]> -
- /api/rma/admin/customreferencedefinitions - /api/rma/admin/customreferencedefinitions/{refId} - - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl deleted file mode 100644 index 5a982834f6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "customReferences": - [ - <#list customRefs as ref> - { - <#assign keys = ref?keys> - <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, - }<#if ref_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml deleted file mode 100644 index ff5c9a054b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml +++ /dev/null @@ -1,45 +0,0 @@ - - Records Management Custom Reference Instances - - The response will have the form:
- {
- "data":
-   {
-   "nodeName": "samplename",
-   "nodeTitle": "sample title",
-   "customReferencesFrom":
-     [
-       {
-       "refId": "09876543-wxyz-0987-wxyz-098765432109",
-       "referenceType": "bidirectional",
-       "label": "BiDi",
-       "targetRef": "workspace://SpacesStore/zyxwvuts-4321-zyxw-4321-zyxwvutsrqpo",
-       "sourceRef": "workspace://SpacesStore/a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1"
-       }
-     ]
-   "customReferencesTo":
-     [
-       {
-       "childRef": "workspace://SpacesStore/12345678-abcd-1234-abcd-123456789012",
-       "refId": "versions",
-       "source": "VersionedBy",
-       "referenceType": "parentchild",
-       "target": "Versions",
-       "parentRef": "workspace://SpacesStore/abcdefgh-1234-abcd-1234-abcdefghijkl"
-       }
-     ]
-   }
- }
- The "customReferencesFrom" field gives the references that are from this node i.e. from the node
- to which the GET was issued. Conversely, the "customReferencesTo" field gives the references that
- are to this node.
- For parent/child reference types, the reference goes from the parent to the child.
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/customreferences - - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl deleted file mode 100644 index f3d07e809a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl +++ /dev/null @@ -1,53 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "nodeName": "${nodeName!""}", - "nodeTitle": "${nodeTitle!""}", - "customReferencesFrom": - [ - <#list customRefsFrom as ref> - { - <#assign keys = ref?keys> - <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, - }<#if ref_has_next>, - - ], - "customReferencesTo": - [ - <#list customRefsTo as ref> - { - <#assign keys = ref?keys> - <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, - }<#if ref_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml deleted file mode 100644 index a3ec79d5b2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Import data set into a file plan - WebScript to import a given data set into a given file plan - /api/rma/datasets/{dataSetId}?site={site} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl deleted file mode 100644 index d22e584b86..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl +++ /dev/null @@ -1,32 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string}, - "message": "${message}" -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml deleted file mode 100644 index e82285d044..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Get data sets - WebScript to get the list of available RM test data - /api/rma/datasets?site={site?}&unloadedonly={unloadedonly?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl deleted file mode 100644 index 54fda809b0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl +++ /dev/null @@ -1,41 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "data": - { - "datasets": - [ - <#list datasets as item> - { - "label": "${item.label}", - "id": "${item.id}", - "isLoaded": "${item.isLoaded}" - }<#if item_has_next>, - - ] - } -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml deleted file mode 100644 index eb7d36286d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Delete Disposition Action Definition - Deletes a disposition action definition from the collection. - /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions/{action_def_id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl deleted file mode 100644 index 17990db956..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "dispositionschedule.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl deleted file mode 100644 index c10ba7b98d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl +++ /dev/null @@ -1,45 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#macro actionJSON action> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "id": "${action.id}", - "url": "${action.url}", - "index": ${action.index}, - "name": "${action.name}", - "label": "${action.label}", - <#if (action.name == "destroy") && action.ghostOnDestroy??>"ghostOnDestroy": "${action.ghostOnDestroy}", - <#if action.description??>"description": "${action.description}", - <#if action.period??>"period": "${action.period}", - <#if action.periodProperty??>"periodProperty": "${action.periodProperty}", - <#if action.location??>"location": "${action.location}", - <#if action.combineDispositionStepConditions??>"combineDispositionStepConditions": "${action.combineDispositionStepConditions?string}", - <#if action.events??>"events": [<#list action.events as event>"${event}"<#if event_has_next>,], - "eligibleOnFirstCompleteEvent": ${action.eligibleOnFirstCompleteEvent?string} - } - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml deleted file mode 100644 index 7801f86edc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml +++ /dev/null @@ -1,21 +0,0 @@ - - Update Disposition Action Definition - - {
-    "name" : Name of action,
-    "description" : Description of the action definition,
-    "period" : The period of time,
-    "periodProperty" : Model property the period is relative to,
-    "eligibleOnFirstCompleteEvent" : Whether all events have to occur,
-    "events" : [List of event names]
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions/{action_def_id} - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl deleted file mode 100644 index 07fdec26b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> -{ - "data": - <@actionDefLib.actionJSON action=action/> -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml deleted file mode 100644 index 11d132b4c0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml +++ /dev/null @@ -1,21 +0,0 @@ - - Add Disposition Action Definition - - {
-    "name" : Name of action,
-    "description" : Description of the action definition,
-    "period" : The period of time,
-    "periodProperty" : Model property the period is relative to,
-    "eligibleOnFirstCompleteEvent" : Whether all events have to occur,
-    "events" : [List of event names]
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl deleted file mode 100644 index 07fdec26b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> -{ - "data": - <@actionDefLib.actionJSON action=action/> -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml deleted file mode 100644 index 2736331dae..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Get Dispositon Lifecycle - Returns Disposition Lifecycle data - /api/node/{store_type}/{store_id}/{id}/nextdispositionaction - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl deleted file mode 100644 index d73867c2ba..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl +++ /dev/null @@ -1,66 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#if nextaction.notFound?? && nextaction.notFound> - "notFound": ${nextaction.notFound?string}, - "message": "${nextaction.message}" - <#else> - "url": "${nextaction.url}", - "name": "${nextaction.name}", - "label": "${nextaction.label}", - "eventsEligible": ${nextaction.eventsEligible?string}, - <#if nextaction.asOf??>"asOf": "${nextaction.asOf}", - <#if nextaction.startedAt??>"startedAt": "${nextaction.startedAt}", - <#if nextaction.startedBy??>"startedBy": "${nextaction.startedBy}", - <#if nextaction.startedByFirstName??>"startedByFirstName": "${nextaction.startedByFirstName}", - <#if nextaction.startedByLastName??>"startedByLastName": "${nextaction.startedByLastName}", - <#if nextaction.completedAt??>"completedAt": "${nextaction.completedAt}", - <#if nextaction.completedBy??>"completedBy": "${nextaction.completedBy}", - <#if nextaction.completedByFirstName??>"completedByFirstName": "${nextaction.completedByFirstName}", - <#if nextaction.completedByLastName??>"completedByLastName": "${nextaction.completedByLastName}", - "events": - [ - <#list nextaction.events as event> - { - "name": "${event.name}", - "label": "${event.label}", - "complete": ${event.complete?string}, - <#if event.completedAt??>"completedAt": "${event.completedAt}", - <#if event.completedBy??>"completedBy": "${event.completedBy}", - <#if event.completedByFirstName??>"completedByFirstName": "${event.completedByFirstName}", - <#if event.completedByLastName??>"completedByLastName": "${event.completedByLastName}", - "automatic": ${event.automatic?string} - }<#if event_has_next>, - - ] - - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml deleted file mode 100644 index f268f3d88f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Disposition Properties - Returns a list of the disposition properties based on the context provided. - /api/rma/dispositionproperties?recordlevel={recordlevel}&dispositionaction={dispositionaction} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl deleted file mode 100644 index e6a3ecfd58..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl +++ /dev/null @@ -1,40 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "data" : - { - "properties": - [ - <#list properties as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - } -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml deleted file mode 100644 index 3ea48069e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Get Dispositon Schedule - Returns Disposition Schedule - /api/node/{store_type}/{store_id}/{id}/dispositionschedule?inherited={inherited?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl deleted file mode 100644 index ef8b184a3a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl +++ /dev/null @@ -1,55 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> - -<@scheduleJSON schedule=schedule/> - -<#macro scheduleJSON schedule> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "url": "${schedule.url}", - "nodeRef": "${schedule.nodeRef}", - <#if schedule.authority??>"authority": "${schedule.authority}", - <#if schedule.instructions??>"instructions": "${schedule.instructions}", - "unpublishedUpdates" : ${schedule.unpublishedUpdates?string}, - "publishInProgress" : ${schedule.publishInProgress?string}, - "recordLevelDisposition": ${schedule.recordLevelDisposition?string}, - "canStepsBeRemoved": ${schedule.canStepsBeRemoved?string}, - "actionsUrl": "${schedule.actionsUrl}", - "actions": - [ - <#list schedule.actions as action> - <@actionDefLib.actionJSON action=action/> - <#if action_has_next>, - - ] - } -} - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml deleted file mode 100644 index bb5f689ba8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Records Management DOD 5015 Custom Types - - ]]> - - /api/rma/admin/dodcustomtypes - - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl deleted file mode 100644 index 735b1918d7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "dodCustomTypes": - [ - <#list dodCustomTypes as aspDef> - { - "name": "${aspDef.name.prefixString}", - "title": "${aspDef.title!""}" - }<#if aspDef_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml deleted file mode 100644 index 4599afcb45..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Records Management Export - - The body of the post should be in the form
- {
-    "nodeRefs" : array of nodeRefs to export
- }
- ]]> -
- /api/rma/admin/export - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl deleted file mode 100644 index 40b13715d3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl +++ /dev/null @@ -1,45 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - Export failure - - -<#if (args.failureCallbackFunction?exists)> - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml deleted file mode 100644 index 4f99e04187..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - Get Fileplan Report - Returns STATUS_OK (200) - ]]> - - /api/node/{store_type}/{store_id}/{id}/fileplanreport - - user - required - draft_public_api - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js deleted file mode 100644 index 3721cd1c8d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js +++ /dev/null @@ -1,222 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Main entry point for this webscript. - * Builds a nodeRef from the url and creates a records series, category and/or folder - * template model depending on what nodeRef that has been given. - * - * @method main - */ -function main() -{ - // Get the node from the URL - var pathSegments = url.match.split("/"); - var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/")); - var node = search.findNode(pathSegments[2], reference); - - // 404 if the node is not found - if (node == null) - { - status.setCode(status.STATUS_NOT_FOUND, "The node could not be found"); - return; - } - - // Get rid of the model URL to enable support for both older DOD5015 and new recordsmanagement model namespaces - var nodeType = node.type.split("}")[1]; - - // Get the record series, categories and/or folders - if(nodeType == "filePlan") - { - var recordSeries = [], - seriesNodes = node.children, - seriesNode; - for (var rsi = 0, rsl = seriesNodes.length; rsi < rsl; rsi++) - { - var seriesNode = seriesNodes[rsi]; - if(seriesNode.type.split("}")[1] == "recordSeries") - { - recordSeries.push(getRecordSeries(seriesNode)); - } - } - recordSeries.sort(sortByName); - model.recordSeries = recordSeries; - } - else if(nodeType == "recordSeries") - { - var recordSeries = []; - recordSeries.push(getRecordSeries(node)); - model.recordSeries = recordSeries; - } - else if(nodeType == "recordCategory") - { - var recordCategories = []; - recordCategories.push(getRecordCategory(node, "/" + node.parent.name + "/")); - model.recordCategories = recordCategories; - } - else if(nodeType == "recordFolder") - { - var recordFolders = []; - var recordCategory = node.parent; - recordFolders.push(getRecordFolder(node, "" + recordCategory.parent.name + "/" + recordCategory.name + "/")); - model.recordFolders = recordFolders; - } else - { - // Throw an error if we don't recognise the node type - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Unrecognised node type: " + node.type) - return; - } -} - -/** - * Sort helper function for objects with names - * - * @method sortByName - * @param obj1 - * @param obj2 - */ -function sortByName(obj1, obj2) -{ - return (obj1.name > obj2.name) ? 1 : (obj1.name < obj2.name) ? -1 : 0; -} - -/** - * Takes a ScriptNode and builds a Record Series template model from it - * - * @method getRecordSeries - * @param seriesNode {ScriptNode} A ScriptNode of type "rma:recordSeries" - */ -function getRecordSeries(seriesNode) -{ - // Create Record Series object - var recordSerie = { - parentPath: "/", - name: seriesNode.name, - identifier: seriesNode.properties["rma:identifier"], - description: seriesNode.properties["description"] - }; - - // Find all Record Categories - var recordCategories = [], - categoryNodes = seriesNode.children, - categoryNode; - for (var rci = 0, rcl = categoryNodes.length; rci < rcl; rci++) - { - categoryNode = categoryNodes[rci]; - if(categoryNode.type == "{http://www.alfresco.org/model/dod5015/1.0}recordCategory") - { - // Create and add Record Category object - recordCategories.push(getRecordCategory(categoryNode, "/" + seriesNode.name + "/")); - } - } - recordCategories.sort(sortByName); - recordSerie.recordCategories = recordCategories; - - // Return Record Series - return recordSerie; -} - -/** - * Takes a ScriptNode and builds a Record Category template model from it - * - * @method getRecordCategory - * @param categoryNode {ScriptNode} A ScriptNode of type "rma:recordCategory" - * @param parentPath {string} The file path starting from the top of the fileplan - */ -function getRecordCategory(categoryNode, parentPath) -{ - // Create Record Category object - var recordCategory = { - parentPath: parentPath, - name: categoryNode.name, - identifier: categoryNode.properties["rma:identifier"], - vitalRecordIndicator: categoryNode.properties["vitalRecordIndicator"], - dispositionAuthority: categoryNode.properties["dispositionAuthority"], - recordFolders: [], - dispositionActions: [] - }; - - // Find all Record Folders & Disposition information - var recordFolders = [], - dispositionActions = [], - categoryChildren = categoryNode.children, - categoryChild, - dispScheduleChildren, - dispScheduleChild; - for (var cci = 0, ccil = categoryChildren.length; cci < ccil; cci++) - { - categoryChild = categoryChildren[cci] - if (categoryChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}recordFolder") - { - // Create and add Record Folder object - recordFolders.push(getRecordFolder(categoryChild, parentPath + categoryNode.name + "/")); - } - else if (categoryChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionSchedule") - { - // Get Disposition authority - recordCategory.dispositionAuthority = categoryChild.properties["rma:dispositionAuthority"]; - dispScheduleChildren = categoryChild.children; - for (var dsi = 0, dsil = dispScheduleChildren.length; dsi < dsil; dsi++) - { - dispScheduleChild = dispScheduleChildren[dsi]; - if (dispScheduleChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionActionDefinition") - { - // Add Disposition Action description - dispositionActions.push({ - dispositionDescription: dispScheduleChild.properties["rma:dispositionDescription"] - }); - } - } - } - } - - // Add Record Category to the list - recordFolders.sort(sortByName); - recordCategory.recordFolders = recordFolders; - recordCategory.dispositionActions = dispositionActions; - return recordCategory; -} - -/** - * Takes a ScriptNode and builds a Record Category template model from it - * - * @method getRecordFolder - * @param recordFolder {ScriptNode} A ScriptNode of type "rma:recordrecordFolder" - * @param parentPath {string} The file path starting from the top of the fileplan - */ -function getRecordFolder(recordFolder, parentPath) -{ - return { - parentPath: parentPath, - name: recordFolder.name, - identifier: recordFolder.properties["rma:identifier"], - vitalRecordIndicator: recordFolder.properties["vitalRecordIndicator"] - }; -} - -// Start webscript -main(); - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl deleted file mode 100644 index f66403ba05..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl +++ /dev/null @@ -1,45 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "fileplanreport.lib.ftl" as reportLib/> -<#macro dateFormat date>${date?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")} -<#escape x as jsonUtils.encodeJSONString(x)> -{ - data: - { - "firstName": <#if person.properties.firstName??>"${person.properties.firstName}"<#else>null, - "lastName": <#if person.properties.lastName??>"${person.properties.lastName}"<#else>null, - <#if (recordSeries??)> - "recordSeries": <@reportLib.recordSeriesJSON recordSeries=recordSeries/>, - <#elseif (recordCategories??)> - "recordCategories": <@reportLib.recordCategoriesJSON recordCategories=recordCategories/>, - <#elseif (recordFolders??)> - "recordFolders": <@reportLib.recordFoldersJSON recordFolders=recordFolders/>, - - "printDate": "<@dateFormat date=date/>" - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl deleted file mode 100644 index b3cb40c51a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl +++ /dev/null @@ -1,72 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#macro recordSeriesJSON recordSeries> -<#escape x as jsonUtils.encodeJSONString(x)> - [<#list recordSeries as recordSerie> - { - "parentPath": "${recordSerie.parentPath}", - "name": "${recordSerie.name}", - "identifier": "${recordSerie.identifier}", - "description": "${recordSerie.description}", - "recordCategories": <@recordCategoriesJSON recordCategories=recordSerie.recordCategories/> - }<#if (recordSerie_has_next)>, - ] - - - -<#macro recordCategoriesJSON recordCategories> -<#escape x as jsonUtils.encodeJSONString(x)> - [<#list recordCategories as recordCategory> - { - "parentPath": "${recordCategory.parentPath}", - "name": "${recordCategory.name}", - "identifier": "${recordCategory.identifier}", - <#if (recordCategory.vitalRecordIndicator??)>"vitalRecordIndicator": ${recordCategory.vitalRecordIndicator?string}, - <#if (recordCategory.dispositionAuthority??)>"dispositionAuthority": "${recordCategory.dispositionAuthority}", - "recordFolders": <@recordFoldersJSON recordFolders=recordCategory.recordFolders/>, - "dispositionActions": [<#list recordCategory.dispositionActions as dispositionAction> - { - "dispositionDescription": "${dispositionAction.dispositionDescription!""}" - }<#if (dispositionAction_has_next)>, - ] - }<#if (recordCategory_has_next)>, - ] - - - -<#macro recordFoldersJSON recordFolders> -<#escape x as jsonUtils.encodeJSONString(x)> - [<#list recordFolders as recordFolder> - { - "parentPath": "${recordFolder.parentPath}", - "name": "${recordFolder.name}", - "identifier": "${recordFolder.identifier}", - <#if (recordFolder.vitalRecordIndicator??)>"vitalRecordIndicator": "${recordFolder.vitalRecordIndicator?string}" - }<#if (recordFolder_has_next)>, - ] - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml deleted file mode 100644 index a1b5dac8dc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml +++ /dev/null @@ -1,17 +0,0 @@ - - Adds item(s) to the hold(s) - - The body of the post should be in the form
- {
-    "nodeRefs" : array of nodeRefs for item(s) (record(s) / record folder(s) / active content(s)),
-    "holds" : array of nodeRefs for the hold(s)
- }
- ]]> -
- /api/rma/holds - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml deleted file mode 100644 index f3684436e1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml +++ /dev/null @@ -1,17 +0,0 @@ - - Removes item(s) from the hold(s) - - The body of the put should be in the form
- {
-    "nodeRefs" : array of nodeRefs for the item(s) (record(s) / record folder(s) / active content(s)),
-    "holds" : array of nodeRefs for the hold(s)
- }
- ]]> -
- /api/rma/holds - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml deleted file mode 100644 index 5a20fceff7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml +++ /dev/null @@ -1,20 +0,0 @@ - - Gets the list of the hold(s) - - - /api/rma/{store_type}/{store_id}/{id}/holds?itemNodeRef={itemNodeRef?}&includedInHold={includedInHold?}&fileOnly={fileOnly?} - /api/rma/holds?itemNodeRef={itemNodeRef?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl deleted file mode 100644 index 74cb9996e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "holds": - [ - <#list holds as hold> - { - "name": "${hold.name}", - "nodeRef": "${hold.nodeRef}" - }<#if hold_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml deleted file mode 100644 index 6930926ff7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml +++ /dev/null @@ -1,17 +0,0 @@ - - Records Management Import - - The body of the post should be multipart/form-data and contain the following fields.
-
    -
  • destination: array of nodeRefs to export
  • -
  • archive: array of nodeRefs to export
  • -
- ]]> -
- /api/rma/admin/import - - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl deleted file mode 100644 index 2b1d056306..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl +++ /dev/null @@ -1,40 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> - - - Upload success - - -<#if (args.successCallback?exists)> - - - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl deleted file mode 100644 index 3a98e35de1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml deleted file mode 100644 index 16eb309e1f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - List Of Values - Returns lists of items used by the Records Management service - /api/rma/admin/listofvalues - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl deleted file mode 100644 index a8eb56078a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "listofvalues.lib.ftl" as listsLib/> -<@listsLib.listsJSON lists=lists/> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl deleted file mode 100644 index 2eb612da98..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl +++ /dev/null @@ -1,101 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#macro listsJSON lists> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "dispositionActions": - { - "url": "${lists.dispositionActions.url}", - "items": - [ - <#list lists.dispositionActions.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - }, - "events": - { - "url": "${lists.events.url}", - "items": - [ - <#list lists.events.items as item> - { - "label": "${item.label}", - "value": "${item.value}", - "automatic": ${item.automatic?string} - }<#if item_has_next>, - - ] - }, - "periodTypes": - { - "url": "${lists.periodTypes.url}", - "items": - [ - <#list lists.periodTypes.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - }, - "periodProperties": - { - "url": "${lists.periodProperties.url}", - "items": - [ - <#list lists.periodProperties.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - }, - "auditEvents": - { - "url": "${lists.auditEvents.url}", - "items": - [ - <#list lists.auditEvents.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - } - } -} - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml deleted file mode 100644 index ca9f61b006..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Record Metadata Aspects - - - /api/rma/recordmetadataaspects?noderef={?nodeRef} - - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl deleted file mode 100644 index 125558ca46..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl +++ /dev/null @@ -1,43 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "recordMetaDataAspects": - [ - <#list aspects as aspect> - { - "id" : "${aspect.id}", - "value" : "${aspect.value}" - } - <#if aspect_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml deleted file mode 100644 index 2b16d435ac..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl deleted file mode 100644 index 16208dadbc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl +++ /dev/null @@ -1,29 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "success": ${success?string} -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml deleted file mode 100644 index 4d34693449..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl deleted file mode 100644 index dceec3636e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "relationshipLabels": - [ - <#list relationshipLabels as relationshipLabel> - { - "label": "${relationshipLabel.label}", - "uniqueName": "${relationshipLabel.uniqueName}" - }<#if relationshipLabel_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml deleted file mode 100644 index ea306912b1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl deleted file mode 100644 index 8b584c0fe5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl +++ /dev/null @@ -1,41 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "items": - [ - <#list relationships as relationship> - { - "node": <#noescape>${relationship} - }<#if relationship_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml deleted file mode 100644 index 7f4a7f1dd6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml +++ /dev/null @@ -1,19 +0,0 @@ - - Records Management Action Execution - - The body of the post should be in the form
- {
-    "nodeRef" : nodeRef for target Record,
-    "nodeRefs" : array of nodeRef for target Records (either this or "nodeRef" should be present),
-    "name" : actionName,
-    "params" : {actionParameters}
- }
- ]]> -
- /api/rma/actions/ExecutionQueue - - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl deleted file mode 100644 index e1840e71d2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl +++ /dev/null @@ -1,40 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "message" : "${message}" -<#if result?exists> - ,"result" : "${result?string}" - -<#if results?exists> - ,"results" : - { - <#list results?keys as prop> - "${prop}" : "${results[prop]}"<#if prop_has_next>, - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml deleted file mode 100644 index 699de3dcde..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Clears Records Management Audit Log - Clears the Records Management audit log - /api/rma/admin/rmauditlog - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl deleted file mode 100644 index 0f73ef7be1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmauditlog.lib.ftl" as auditLib/> -<@auditLib.auditStatusJSON auditstatus=auditstatus/> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml deleted file mode 100644 index 3553d5b79f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml +++ /dev/null @@ -1,22 +0,0 @@ - - Records Management Audit Log - The following parameters can also be passed: -
    -
  • size: Maximum number of log entries to return
  • -
  • user: Only return log entries by the specified user
  • -
  • event: Only return log entries matching this event
  • -
  • from: Only return log entries after the specified date, date should be in yyyy-MM-dd format
  • -
  • to: Only return log entries before the specified date, date should be in yyyy-MM-dd format
  • -
  • export: Set this to 'true' to force the browser to display the Save As dialog
  • -
- ]]> -
- /api/rma/admin/rmauditlog - /api/node/{store_type}/{store_id}/{id}/rmauditlog - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl deleted file mode 100644 index 261ac3053a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl +++ /dev/null @@ -1,38 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#macro auditStatusJSON auditstatus> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "enabled": ${auditstatus.enabled?string}, - "started": "${auditstatus.started}", - "stopped": "${auditstatus.stopped}" - } -} - - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml deleted file mode 100644 index 0e70b5a335..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml +++ /dev/null @@ -1,23 +0,0 @@ - - Files a Records Management audit log as a record - - A JSON structure is expected as follows:
- {
-    "destination" : NodeRef of record folder to file the audit log in
-    "size" : Maximum number of log entries to return
-    "user" : Only return log entries by the specified user
-    "event" : Only return log entries matching this event
-    "from" : Only return log entries after the specified date, date should be in yyyy-MM-dd format
-    "to" : Only return log entries before the specified date, date should be in yyyy-MM-dd format
- }
- ]]> -
- /api/rma/admin/rmauditlog - /api/node/{store_type}/{store_id}/{id}/rmauditlog - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml deleted file mode 100644 index de86e27b70..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Start or Stop Records Management Audit Log - The body of the put should be in the form
- {
-    "enabled" : true|false
- }
- ]]> -
- /api/rma/admin/rmauditlog - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl deleted file mode 100644 index 0f73ef7be1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "rmauditlog.lib.ftl" as auditLib/> -<@auditLib.auditStatusJSON auditstatus=auditstatus/> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml deleted file mode 100644 index f3d37989ce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Records Management Audit Log Status - - - /api/rma/admin/rmauditlog/status - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl deleted file mode 100644 index 7764db6ca8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl +++ /dev/null @@ -1,32 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "data" : - { - "enabled" : ${enabled?string} - } -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml deleted file mode 100644 index 5e2e094870..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - Get the allowed values for the authenticated user for an rm list constraint. - - listName is the qualified name of the list with the ":" replaced by "_" eg rmc_smList - ]]> - - /api/rma/rmconstraints/{listName} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl deleted file mode 100644 index 0549f19c80..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl +++ /dev/null @@ -1,41 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": { - "constraintName": "${constraintName}", - "allowedValuesForCurrentUser" : [ - <#list allowedValuesForCurrentUser as item> - { - "label": "${item}", - "value": "${item}" - }<#if item_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml deleted file mode 100644 index cfd7423f82..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml +++ /dev/null @@ -1,36 +0,0 @@ - - Apply Records Management Permissions to a node - -
- The body of the post json should be of the form: -
-   {
-      "permissions":
-      [
-         {
-            "id": "Filing",
-            "authority": "GROUP_Administrator"
-         },
-         {
-            "id": "ReadRecords",
-            "authority": "userxyz"
-            "remove": true
-         },
-         ...
-      ]
-   }
-   
- Existing permissions will be updated by the supplied permission set, - where 'id' and 'authority' are mandatory values.
- If the optional 'remove' flag is set then the permission will be removed. - Note that it is only valid to set the following RM related permissions: - 'Filing', 'ReadRecords' and 'FileRecords'. - ]]> -
- /api/node/{store_type}/{store_id}/{id}/rmpermissions - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js deleted file mode 100644 index 3c24e3ff6d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Entry point for rmpermissions POST data webscript. - * Applies supplied RM permissions to an RM node. - * - * @method main - */ -function main() -{ - // Get the node from the URL - var pathSegments = url.match.split("/"); - var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/")); - var node = search.findNode(pathSegments[2], reference); - - // 404 if the node is not found - if (node == null) - { - status.setCode(status.STATUS_NOT_FOUND, "The node could not be found"); - return; - } - - if (json.has("permissions") == false) - { - status.setCode(status.STATUS_BAD_REQUEST, "Permissions value missing from request."); - } - - if (json.has("isInherited")) - { - node.setInheritsPermissions(json.getBoolean("isInherited")); - } - - var permissions = json.getJSONArray("permissions"); - for (var i=0; i - Records Management Transfer - Streams an Alfresco Content Pacakge (ACP) file containing the contents of a transfer - /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id} - argument - user - required - deprecated - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml deleted file mode 100644 index a450507a86..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Records Management Transfer Report - Returns a transfer report to the caller in JSON format - /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id}/report - argument - user - required - deprecated - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml deleted file mode 100644 index 26a514a0aa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Files a Records Management Transfer Report - A JSON structure is expected as follows:
- {
-    "destination" : NodeRef of record folder to file the transfer report in
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id}/report - argument - user - required - deprecated -
\ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml deleted file mode 100644 index 5026a37097..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Records Management User Rights Report - Returns a user rights report showing users, roles and groups to the caller in JSON format - /api/rma/admin/userrightsreport - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl deleted file mode 100644 index 082b46aa54..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl +++ /dev/null @@ -1,72 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "users": - { - <#list report.users?keys as user> - "${user}": - { - "userName": "${report.users[user].userName!""}", - "firstName": "${report.users[user].firstName!""}", - "lastName": "${report.users[user].lastName!""}", - "roles": [<#list report.users[user].roles as role>"${role}"<#if role_has_next>,], - "groups": [<#list report.users[user].groups as group>"${group}"<#if group_has_next>,] - } - <#if user_has_next>, - - }, - "roles": - { - <#list report.roles?keys as role> - "${role}": - { - "name": "${report.roles[role].name!""}", - "label": "${report.roles[role].displayLabel!""}", - "users": [<#list report.roles[role].users as user>"${user}"<#if user_has_next>,], - "capabilities": [<#list report.roles[role].capabilities as capability>"${capability}"<#if capability_has_next>,] - } - <#if role_has_next>, - - }, - "groups": - { - <#list report.groups?keys as group> - "${group}": - { - "name": "${report.groups[group].name!""}", - "label": "${report.groups[group].displayLabel!""}", - "users": [<#list report.groups[group].users as user>"${user}"<#if user_has_next>,] - } - <#if group_has_next>, - - } - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml deleted file mode 100644 index 61b91c6544..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - doclist-v2 - Document List v2 Component - records management doclist data webscript - /slingshot/doclib2/rm/doclist/{type}/site/{site}/{container}/{path} - /slingshot/doclib2/rm/doclist/{type}/site/{site}/{container} - /slingshot/doclib2/rm/doclist/{type}/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib2/rm/doclist/{type}/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js deleted file mode 100644 index f7e481f5e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Document List Component: doclist - */ -model.doclist = rm_doclist_main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl deleted file mode 100644 index 053cdb288e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "doclist.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js deleted file mode 100644 index 7ba584d4bc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js +++ /dev/null @@ -1,373 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -const REQUEST_MAX = 1000; - -/** - * Method that performs the actual loading of the nodes. - * - * Note! - * Will optimize performance by using ScriptNode.childFileFolders for directory listings - * In other words when the "path" filter is used. - * - * @method doclist_getAllNodes - * @param parsedArgs {Object} - * @param filterParams {Object} - * @param query {String} - * @param totalItemCount {int} - * @return {object} Returns the node and corresponding pagination metadata - * { - * allNodes: {Array} - * totalRecords: {int} - * requestTotalCountMax: {int} - * paged: {boolean} - * query: {String} - * } - */ -function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount) -{ - var filter = args.filter, - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - allNodes = []; - if ((filter || "path") == "path" || - query == "" && - ((filter || "unfiledRecords") == "unfiledRecords" || - (filter || "holds") == "holds" || - (filter || "transfers") == "transfers")) - { - // TODO also add DB filter by "node" (in addition to "path") - var parentNode = parsedArgs.pathNode; - if (parentNode !== null) - { - var skip = -1, - max = -1; - - if (args.size != null) - { - max = args.size; - - if (args.pos > 0) - { - skip = (args.pos - 1) * max; - } - } - - var sortField = (args.sortField == null ? "cm:name" : args.sortField), - sortAsc = (((args.sortAsc == null) || (args.sortAsc == "true")) ? true : false); - - // Get paged set - requestTotalCountMax = skip + REQUEST_MAX; - var pagedResult = parentNode.childFileFolders( - true, true, filterParams.ignoreTypes.concat(filterParams.ignoreAspects), - skip, max, requestTotalCountMax, sortField, sortAsc, ""); - - allNodes = pagedResult.page; - totalRecords = pagedResult.totalResultCountUpper; - paged = true; - } - } - else - { - // Query the nodes - passing in sort and result limit parameters - if (query !== "") - { - allNodes = search.query( - { - query: query, - language: filterParams.language, - page: - { - maxItems: totalItemCount - }, - sort: filterParams.sort, - templates: filterParams.templates, - namespace: (filterParams.namespace ? filterParams.namespace : null), - onerror: "no-results" - }); - - totalRecords = allNodes.length; - } - } - return { - allNodes: allNodes, - totalRecords: totalRecords, - requestTotalCountMax: requestTotalCountMax, - paged: paged, - query: query - }; -} - -/** - * Main entry point: Create collection of documents and folders in the given space - * - * @method rm_doclist_main - */ -function rm_doclist_main() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - var filter = args.filter, - items = []; - - // Try to find a filter query based on the passed-in arguments - var allNodes = [], - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - favourites = Common.getFavourites(), - filterParams = Filters.getFilterParams(filter, parsedArgs, - { - favourites: favourites - }), - query = filterParams.query, - allSites = (parsedArgs.nodeRef == "alfresco://sites/home"); - - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query); - - var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1; - // For all sites documentLibrary query we pull in all available results and post filter - if (totalItemCount === 0) totalItemCount = -1; - else if (allSites) totalItemCount = (totalItemCount > 0 ? totalItemCount * 10 : 500); - - - var allNodesResult = doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount); - allNodes = allNodesResult.allNodes; - totalRecords = allNodesResult.totalRecords; - requestTotalCountMax = allNodesResult.requestTotalCountMax; - paged = allNodesResult.paged; - query = allNodesResult.query; - - - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - query results: " + allNodes.length); - // Generate the qname path match regex required for all sites 'documentLibrary' results match - var pathRegex; - if (allSites) - { - // escape the forward slash characters in the qname path - // TODO: replace with java.lang.String regex match for performance - var pathMatch = new String(parsedArgs.rootNode.qnamePath).replace(/\//g, '\\/') + "\\/.*\\/cm:documentLibrary\\/.*"; - pathRegex = new RegExp(pathMatch, "gi"); - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - will match results using regex: " + pathMatch); - } - - // Ensure folders and folderlinks appear at the top of the list - var folderNodes = [], - documentNodes = []; - - for each (node in allNodes) - { - if (totalItemCount !== 0) - { - try - { - if (!allSites || node.qnamePath.match(pathRegex)) - { - totalItemCount--; - if (node.isContainer || node.isLinkToContainer) - { - folderNodes.push(node); - } - else - { - documentNodes.push(node); - } - } - } - catch (e) - { - // Possibly an old indexed node - ignore it - } - } else break; - } - - // Node type counts - var folderNodesCount = folderNodes.length, - documentNodesCount = documentNodes.length, - nodes; - - if (parsedArgs.type === "documents") - { - nodes = documentNodes; - totalRecords -= folderNodesCount; - } - else - { - // TODO: Sorting with folders at end -- swap order of concat() - nodes = folderNodes.concat(documentNodes); - } - - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - totalRecords: " + totalRecords); - - // Pagination - var pageSize = args.size || nodes.length, - pagePos = args.pos || "1", - startIndex = (pagePos - 1) * pageSize; - - if (!paged) - { - // Trim the nodes array down to the page size - nodes = nodes.slice(startIndex, pagePos * pageSize); - } - - // Common or variable parent container? - var parent = null; - - if (!filterParams.variablePath) - { - var node = parsedArgs.pathNode; - // Display the toolbar actions for the child containers within unfiled records container and holds correctly - if (filterParams.filter === "containerFilter" && args.filterData !== null) - { - node = search.findNode(args.filterData); - } - // Parent node permissions (and Site role if applicable) - parent = Evaluator.run(node, true); - } - - var thumbnail = null, - locationNode, - item; - - // Loop through and evaluate each node in this result set - for each (node in nodes) - { - // we have to check if we have read permission on the node parent as an error will be thrown if we try to - // get the evaluated properties for a linked record whose parent we do not have read permissions for - //TODO:permissions - - var parentReadable = true; - // Get evaluated properties. - item = Evaluator.run(node); - if (item !== null) - { - item.isFavourite = (favourites[item.node.nodeRef] === true); - item.likes = Common.getLikes(node); - - // Does this collection of nodes have potentially differering paths? - if (filterParams.variablePath || item.isLink || filterParams.filter === "containerFilter") - { - locationNode = item.isLink ? item.linkedNode : item.node; - // Ensure we have Read permissions on the destination on the link object - location = Common.getLocation(locationNode, parsedArgs.libraryRoot); - // Parent node - if (parentReadable) - { - item.parent = Evaluator.run(node.parent, true); - } - } - else - { - location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - sitePreset: parsedArgs.location.sitePreset, - container: parsedArgs.location.container, - containerType: parsedArgs.location.containerType, - path: parsedArgs.location.path, - file: node.name - }; - } - - // Resolved location - item.location = location; - - items.push(item); - } - else - { - --totalRecords; - } - } - - // Array Remove - By John Resig (MIT Licensed) - var fnArrayRemove = function fnArrayRemove(array, from, to) - { - var rest = array.slice((to || from) + 1 || array.length); - array.length = from < 0 ? array.length + from : from; - return array.push.apply(array, rest); - }; - - /** - * De-duplicate orignals for any existing working copies. - * This can't be done in evaluator.lib.js as it has no knowledge of the current filter or UI operation. - * Note: This may result in pages containing less than the configured amount of items (50 by default). - */ - for each (item in items) - { - if (item.workingCopy && item.workingCopy.isWorkingCopy) - { - var workingCopySource = String(item.workingCopy.sourceNodeRef); - for (var i = 0, ii = items.length; i < ii; i++) - { - if (String(items[i].node.nodeRef) == workingCopySource) - { - fnArrayRemove(items, i); - --totalRecords; - break; - } - } - } - } - - var paging = - { - totalRecords: totalRecords, - startIndex: startIndex - }; - - if (paged && (totalRecords == requestTotalCountMax)) - { - paging.totalRecordsUpper = requestTotalCountMax; - } - - return ( - { - luceneQuery: query, - paging: paging, - container: parsedArgs.rootNode, - parent: parent, - onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), - itemCount: - { - folders: folderNodesCount, - documents: documentNodesCount - }, - items: items, - customJSON: slingshotDocLib.getJSON() - }); -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js deleted file mode 100644 index d4bb5782b8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js +++ /dev/null @@ -1,222 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** -* Query templates for custom search -*/ -Filters.QUERY_TEMPLATES = -[ - { field: "keywords", template: "%(cm:name cm:title cm:description TEXT)" }, - { field: "name", template: "%(cm:name)" }, - { field: "title", template: "%(cm:title)" }, - { field: "description", template: "%(cm:description)" }, - { field: "creator", template: "%(cm:creator)" }, - { field: "created", template: "%(cm:created)" }, - { field: "modifier", template: "%(cm:modifier)" }, - { field: "modified", template: "%(cm:modified)" }, - { field: "author", template: "%(cm:author)" }, - { field: "markings", template: "%(rmc:supplementalMarkingList)" }, - { field: "dispositionEvents", template: "%(rma:recordSearchDispositionEvents)" }, - { field: "dispositionActionName", template: "%(rma:recordSearchDispositionActionName)" }, - { field: "dispositionActionAsOf", template: "%(rma:recordSearchDispositionActionAsOf)" }, - { field: "dispositionEventsEligible", template: "%(rma:recordSearchDispositionEventsEligible)" }, - { field: "dispositionPeriod", template: "%(rma:recordSearchDispositionPeriod)" }, - { field: "hasDispositionSchedule", template: "%(rma:recordSearchHasDispositionSchedule)" }, - { field: "dispositionInstructions", template: "%(rma:recordSearchDispositionInstructions)" }, - { field: "dispositionAuthority", template: "%(rma:recordSearchDispositionAuthority)" }, - { field: "vitalRecordReviewPeriod", template: "%(rma:recordSearchVitalRecordReviewPeriod)" } -]; - -Filters.IGNORED_TYPES = -[ - /* Defaults */ - "cm:systemfolder", - "fm:forums", - "fm:forum", - "fm:topic", - "fm:post", - /* Records Management */ - "rma:dispositionSchedule", - "rma:dispositionActionDefinition", - "rma:dispositionAction", - "rma:holdContainer", - "rma:transferContainer", - "rma:unfiledRecordContainer" -]; - -/** - * Create filter parameters based on input parameters - * - * @method getFilterParams - * @param filter {string} Required filter - * @param parsedArgs {object} Parsed arguments object literal - * @param optional {object} Optional arguments depending on filter type - * @return {object} Object literal containing parameters to be used in Lucene search - */ -Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filter, parsedArgs, optional) -{ - var filterParams = - { - query: "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\"", - limitResults: null, - sort: [ - { - column: "@cm:name", - ascending: true - }], - language: "lucene", - templates: null, - variablePath: true, - ignoreTypes: Filters.IGNORED_TYPES - }; - - optional = optional || {}; - - // Sorting parameters specified? - var sortAscending = args.sortAsc, - sortField = args.sortField; - - if (sortAscending == "false") - { - filterParams.sort[0].ascending = false; - } - if (sortField !== null) - { - filterParams.sort[0].column = (sortField.indexOf(":") != -1 ? "@" : "") + sortField; - } - - // Max returned results specified? - var argMax = args.max; - if ((argMax !== null) && !isNaN(argMax)) - { - filterParams.limitResults = argMax; - } - - // Create query based on passed-in arguments - var filterData = args.filterData, - filterQuery = ""; - - // Common types and aspects to filter from the UI - var filterQueryDefaults = ' -TYPE:"' + Filters.IGNORED_TYPES.join('" -TYPE:"') + '"'; - - // Create query based on passed-in arguments - switch (String(filter)) - { - case "all": - filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; - filterQuery += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "node": - parsedArgs.pathNode = parsedArgs.rootNode.parent; - filterParams.variablePath = false; - filterParams.query = "+ID:\"" + parsedArgs.rootNode.nodeRef + "\""; - break; - - case "savedsearch": - var searchNode = parsedArgs.location.siteNode.getContainer("Saved Searches"); - if (searchNode != null) - { - var ssNode = searchNode.childByNamePath(String(filterData)); - - if (ssNode != null) - { - var ssJson = eval('try{(' + ssNode.content + ')}catch(e){}'); - filterQuery = ssJson.query; - // Wrap the query so that only valid items within the filePlan are returned - filterParams.query = 'PATH:"' + parsedArgs.rootNode.qnamePath + '//*" AND (' + filterQuery + ')'; - filterParams.templates = Filters.QUERY_TEMPLATES; - filterParams.language = "fts-alfresco"; - filterParams.namespace = "http://www.alfresco.org/model/recordsmanagement/1.0"; - // gather up the sort by fields - // they are encoded as "property/dir" i.e. "cm:name/asc" - if (ssJson.sort && ssJson.sort.length !== 0) - { - var sortPairs = ssJson.sort.split(","); - var sort = []; - for (var i=0, j; i - node-v2 - Document List v2 Component - node data webscript - /slingshot/doclib2/rm/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js deleted file mode 100644 index 68de1e3d64..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js +++ /dev/null @@ -1,28 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl deleted file mode 100644 index 33b38b96a5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "node.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js deleted file mode 100644 index e3a3a168fb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js +++ /dev/null @@ -1,187 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/** - * Get and parse arguments - * - * @method getParsedArgs - * @return {array|null} Array containing the validated input parameters - */ -ParseArgs.getParsedArgs = function RecordsManagementFilter_getParsedArgs(containerType) -{ - var type = url.templateArgs.type, - libraryRoot = args.libraryRoot, - rootNode = null, - pathNode = null, - nodeRef = null, - path = "", - location = null; - - // Is this library rooted from a non-site nodeRef? - if (libraryRoot !== null) - { - libraryRoot = ParseArgs.resolveNode(libraryRoot); - } - - - if (url.templateArgs.store_type !== null) - { - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - nodeRef = storeType + "://" + storeId + "/" + id; - rootNode = libraryRoot || ParseArgs.resolveNode(nodeRef); - if (rootNode == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - // Special case: make sure filter picks up correct mode - if (type == null && args.filter == null) - { - args.filter = "node"; - } - } - else - { - /** - * Site and container input - */ - var siteId = url.templateArgs.site, - containerId = url.templateArgs.container, - siteNode = siteService.getSite(siteId); - - if (siteNode === null) - { - status.setCode(status.STATUS_GONE, "Site not found: '" + siteId + "'"); - return null; - } - - rootNode = siteNode.getContainer(containerId); - if (rootNode === null) - { - rootNode = siteNode.createContainer(containerId, containerType || "cm:folder"); - if (rootNode === null) - { - status.setCode(status.STATUS_GONE, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - - rootNode.properties["cm:description"] = "Document Library"; - - /** - * MOB-593: Add email alias on documentLibrary container creation - * - rootNode.addAspect("emailserver:aliasable"); - var emailAlias = siteId; - if (containerId != "documentLibrary") - { - emailAlias += "-" + containerId; - } - rootNode.properties["emailserver:alias"] = emailAlias; - */ - rootNode.save(); - } - } - - if (args.filter == "unfiledRecords") - { - var container = rootNode.childrenByXPath("rma:Unfiled_x0020_Records"); - if (container.length > 0) - { - pathNode = container[0]; - } - } - else if (args.filter == "holds") - { - var container = rootNode.childrenByXPath("rma:Holds"); - if (container.length > 0) - { - pathNode = container[0]; - } - } - else if (args.filter == "transfers") - { - var container = rootNode.childrenByXPath("rma:Transfers"); - if (container.length > 0) - { - pathNode = container[0]; - } - } - else - { - // Path input? - path = url.templateArgs.path || ""; - pathNode = path.length > 0 ? rootNode.childByNamePath(path) : (pathNode || rootNode); - } - - if (pathNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Path not found: '" + path + "'"); - return null; - } - - // Parent location parameter adjustment - location = Common.getLocation(pathNode, libraryRoot); - if (location === null) - { - status.setCode(status.STATUS_GONE, "Location is 'null'. (No permission?)"); - return null; - } - if (path !== "") - { - location.path = ParseArgs.combinePaths(location.path, location.file); - } - if (args.filter !== "node" && !pathNode.isContainer) - { - location.file = ""; - } - - var objRet = - { - rootNode: rootNode, - pathNode: pathNode, - libraryRoot: libraryRoot, - location: location, - path: path, - nodeRef: nodeRef, - type: type - }; - - // Multiple input files in the JSON body? - var files = ParseArgs.getMultipleInputValues("nodeRefs"); - if (typeof files != "string") - { - objRet.files = files; - } - - return objRet; -}; diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml deleted file mode 100644 index b6004fb1e4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl deleted file mode 100644 index 50ae7ffa2d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#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>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml deleted file mode 100644 index 3d9e11e440..0000000000 --- a/amps/ags/rm-community/rm-community-repo/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/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl deleted file mode 100644 index 2f7cdfd59c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml deleted file mode 100644 index 4e7e14fb4e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - rm-copy-to - Document List Action - Copy multiple files - /slingshot/doclib/action/rm-copy-to/site/{site}/{container}/{path} - /slingshot/doclib/action/rm-copy-to/site/{site}/{container} - /slingshot/doclib/action/rm-copy-to/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/rm-copy-to/node/{store_type}/{store_id}/{id} - /slingshot/doclib/action/rm-copy-to/node/{store_type}/{store_id} - argument - user - required - internal - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl deleted file mode 100644 index 79ae6b0290..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js deleted file mode 100644 index e505c7cc6e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js +++ /dev/null @@ -1,134 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Copy multiple files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - file, fileNode, result, nodeRef, - fromSite, copiedNode; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "copyFile", - success: false - }; - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = "Can't find source node."; - } - 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!"; - results.push(result); - continue; - } - else - { - result.id = fileNode.name; - result.name = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document" - - // Retain the name of the site the node is currently in. Null if it's not in a site. - fromSite = String(fileNode.siteShortName); - - // copy the node (deep copy for containers) - if (fileNode.isContainer) - { - copiedNode = fileNode.copy(destNode, true); - } - else - { - copiedNode = fileNode.copy(destNode); - } - - result.nodeRef = copiedNode.nodeRef.toString(); - result.success = (result.nodeRef != null); - - if (result.success) - { - // If this was an inter-site copy, we'll need to clean up the permissions on the node - if (fromSite != String(copiedNode.siteShortName)) - { - siteService.cleanSitePermissions(copiedNode); - } - } - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = e.message; - - // log the error - logger.error(e.message); - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml deleted file mode 100644 index 06fa861c15..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - rm-link - Document List Action - Link records - /slingshot/doclib/action/rm-link/site/{site}/{container}/{path} - /slingshot/doclib/action/rm-link/site/{site}/{container} - /slingshot/doclib/action/rm-link/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/rm-link/node/{store_type}/{store_id}/{id} - argument - user - required - internal - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl deleted file mode 100644 index 79ae6b0290..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js deleted file mode 100644 index 4d510b9b28..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js +++ /dev/null @@ -1,109 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Add multiple files as children action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - file, fileNode, result, nodeRef; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "addChild", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode === null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - 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!"; - results.push(result); - continue; - } - else - { - result.id = fileNode.name; - result.name = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - destNode.addNode(fileNode); - result.success = true; - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = e.message; - - // log the error - logger.error(e.message); - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml deleted file mode 100644 index 07390aa024..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - rm-move-to - Document List Action - Move multiple files - /slingshot/doclib/action/rm-move-to/site/{site}/{container}/{path} - /slingshot/doclib/action/rm-move-to/site/{site}/{container} - /slingshot/doclib/action/rm-move-to/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/rm-move-to/node/{store_type}/{store_id}/{id} - argument - user - required - internal - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl deleted file mode 100644 index 79ae6b0290..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js deleted file mode 100644 index c124cd908a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js +++ /dev/null @@ -1,128 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Move multiple files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - parent = null, - file, fileNode, result, nodeRef, - fromSite; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "moveFile", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - 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!"; - results.push(result); - continue; - } - else - { - if (p_params.parent && p_params.parent != null) - { - parent = search.findNode(p_params.parent); - } - result.id = fileNode.name; - result.name = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - - // Retain the name of the site the node is currently in. Null if it's not in a site. - fromSite = fileNode.siteShortName; - - // move the node - result.success = fileNode.move(parent, destNode); - - if (result.success) - { - // If this was an inter-site move, we'll need to clean up the permissions on the node - if (String(fromSite) !== String(fileNode.siteShortName)) - { - siteService.cleanSitePermissions(fileNode); - } - } - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - result.error = e.message; - - // log the error - logger.error(e.message); - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml deleted file mode 100644 index c7d8a558de..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - permissions - Document List Component - permissions data webscript - /slingshot/doclib/rm/permissions/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js deleted file mode 100644 index c2fb9c54fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js +++ /dev/null @@ -1,69 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -function getRmPermissions() -{ - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id, - node = ParseArgs.resolveNode(nodeRef); - - if (node == null) - { - node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - var permissionData = model.data, - settable = node.getSettablePermissions(), - canReadInherited = true; - - if (node.parent.hasPermission("ReadRecords")) - { - permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable); - } - else - { - canReadInherited = false; - } - - permissionData["canReadInherited"] = canReadInherited; - - model.data = permissionData; -} - -getRmPermissions(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl deleted file mode 100644 index 127c42a81d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#include "permissions.get.json.ftl"> diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml deleted file mode 100644 index 3b23c5431b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - doclist - Document List Component - rm saved searches data webscript - /slingshot/doclib/rm/savedsearches/site/{site}?p={public?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js deleted file mode 100644 index 18872eda38..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -function main() -{ - var savedSearches = [], - siteId = url.templateArgs.site, - siteNode = siteService.getSite(siteId), - bPublic = args.p; - - if (siteNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Site not found: '" + siteId + "'"); - return null; - } - - var searchNode = siteNode.getContainer("Saved Searches"); - if (searchNode != null) - { - var kids, ssNode; - - if (bPublic == null || bPublic == "true") - { - // public searches are in the root of the folder - kids = searchNode.children; - } - else - { - // user specific searches are in a sub-folder of username - var userNode = searchNode.childByNamePath(person.properties.userName); - if (userNode != null) - { - kids = userNode.children; - } - } - - if (kids) - { - for (var i = 0, ii = kids.length; i < ii; i++) - { - ssNode = kids[i]; - if (ssNode.isDocument) - { - savedSearches.push( - { - name: ssNode.name, - description: ssNode.properties.description - }); - } - } - } - } - - model.savedSearches = savedSearches; -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl deleted file mode 100644 index 675a50dfff..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list savedSearches as s> - { - "name": "${s.name}", - "description": "${s.description!""}" - }<#if s_has_next>, - - ] -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml deleted file mode 100644 index 03c9efc138..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - doclist-transfer - Document List Component - rm transfer query data webscript - /slingshot/doclib/rm/transfer/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js deleted file mode 100644 index 28b7a96fda..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -function main() -{ - var nodeRef = url.templateArgs.store_type + "://" + url.templateArgs.store_id + "/" + url.templateArgs.id, - transfer = search.findNode(nodeRef); - - if (transfer === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - if (String(transfer.typeShort) != "rma:transfer") - { - status.setCode(status.STATUS_BAD_REQUEST, "nodeRef: '" + nodeRef + "' is not of type 'rma:transfer'"); - return null; - } - - model.transfer = transfer; -} - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl deleted file mode 100644 index 0e83fc2c12..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if transfer??> - "transfer": - { - "nodeRef": "${transfer.nodeRef}", - "name": "${transfer.name}", - "rma:transferAccessionIndicator": ${(transfer.properties["rma:transferAccessionIndicator"]!false)?string}, - "rma:transferPDFIndicator": ${(transfer.properties["rma:transferPDFIndicator"]!false)?string} - } - -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml deleted file mode 100644 index 435570705e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - treenode - Document List Component - rm treenode data webscript - /slingshot/doclib/rm/treenode/site/{site}/{container}/{path} - /slingshot/doclib/rm/treenode/site/{site}/{container} - /slingshot/doclib/rm/treenode/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/rm/treenode/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js deleted file mode 100644 index bfc4125e7b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js +++ /dev/null @@ -1,163 +0,0 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Document List Component: treenode - */ -model.treenode = getTreenode(); - -/* Create collection of folders in the given space */ -function getTreenode() -{ - try - { - var items = new Array(), - hasSubfolders = true, - ignoredTypes = - { - "{http://www.alfresco.org/model/forum/1.0}forum": true, - "{http://www.alfresco.org/model/forum/1.0}topic": true, - "{http://www.alfresco.org/model/content/1.0}systemfolder": true, - "{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true - }, - skipPermissionCheck = args["perms"] == "false", - evalChildFolders = false, - item, rmNode, capabilities, cap; - - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - // Quick version if "skipPermissionCheck" flag set - if (skipPermissionCheck) - { - for each (item in parsedArgs.pathNode.children) - { - if (itemIsAllowed(item) && !(item.type in ignoredTypes)) - { - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders - }); - } - } - } - else - { - for each (item in parsedArgs.pathNode.children) - { - if (itemIsAllowed(item) && !(item.type in ignoredTypes)) - { - //capabilities = {}; - rmNode = rmService.getRecordsManagementNode(item); - - //for each (cap in rmNode.capabilitiesSet("Create")) - //{ - // capabilities[cap.name] = true; - //} - - // - - hasCreateCapability = rmNode.hasCapability("Create"); - - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders, - permissions: - { - create: hasCreateCapability - } - }); - } - } - } - - items.sort(sortByName); - - return ( - { - parent: parsedArgs.pathNode, - resultsTrimmed: false, - items: items - }); - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } -} - - -/* Sort the results by case-insensitive name */ -function sortByName(a, b) -{ - return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); -} - -/* Filter allowed types, etc. */ -function itemIsAllowed(item) -{ - // Must be a subtype of cm:folder - if (!item.isSubType("cm:folder")) - { - return false; - } - - var typeShort = String(item.typeShort); - - // Don't show Hold and Transfer top-level containers - if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer") - { - return false; - } - - // Must be a "dod:" or "rma:" namespaced type - if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0) - { - return false; - } - - return true; -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl deleted file mode 100644 index f48b338387..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl +++ /dev/null @@ -1,65 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#assign p = treenode.parent> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalResults": ${treenode.items?size?c}, - "resultsTrimmed": ${treenode.resultsTrimmed?string}, - "parent": - { - "nodeRef": "${p.nodeRef}", - "userAccess": - { - "create": ${p.hasPermission("CreateChildren")?string}, - "edit": ${p.hasPermission("Write")?string}, - "delete": ${p.hasPermission("Delete")?string} - } - }, - "items": - [ - <#list treenode.items as item> - <#assign t = item.node> - { - <#if item.permissions??> - "userAccess": - { - <#list item.permissions?keys as perm> - <#if item.permissions[perm]?is_boolean> - "${perm?string}": ${item.permissions[perm]?string}<#if perm_has_next>, - - - }, - - "nodeRef": "${t.nodeRef}", - "name": "${t.name}", - "description": "${(t.properties.description!"")}", - "hasChildren": ${item.hasSubfolders?string} - }<#if item_has_next>, - - ] -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml deleted file mode 100644 index 878c391608..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - RM node metadata retrieval service - Used by the extended RM forms service to retrieve RM node metadata. - /api/rmmetadata?noderef={noderef?}&type={type?}&extended={extended?} - - user - required - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl deleted file mode 100644 index d963b33a76..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "kind" : "${kind}" - <#if extended> - , - "aspects": - [ - <#list aspects as aspect> - { - "name": "${aspect.name}", - "prefixedName": "${aspect.prefixedName}" - } - <#if aspect_has_next>, - - ] - -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml deleted file mode 100644 index 7cec801193..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - RM Faceted Search - RM Faceted Search Component Data Webscript - /slingshot/rmsearch/faceted/rmsearch?term={term?}&tag={tag?}&site={site?}&container={container?}&sort={sort?}&query={query?}&repo={repo?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js deleted file mode 100644 index 507513b11b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js +++ /dev/null @@ -1,53 +0,0 @@ - - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -function main() { - var params = - { - siteId: args.site, - containerId: args.container, - repo: (args.repo !== null) ? (args.repo == "true") : false, - term: args.term, - tag: args.tag, - query: args.query, - rootNode: args.rootNode, - sort: args.sort, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, - facetFields: args.facetFields, - filters: args.filters, - spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false - }; - - model.data = getSearchResults(params); -}; - -main(); diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl deleted file mode 100644 index b35655cd5f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl +++ /dev/null @@ -1,115 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#--Copied from Share's search.get.json.ftl with RM specific additions noted below:--> -<#escape x as jsonUtils.encodeJSONString(x)> -{ -"totalRecords": ${data.paging.totalRecords?c}, -"totalRecordsUpper": ${data.paging.totalRecordsUpper?c}, -"startIndex": ${data.paging.startIndex?c}, -"numberFound": ${(data.paging.numberFound!-1)?c}, -"facets": -{ - <#if data.facets??><#list data.facets?keys as field> - "${field}": - [ - <#assign facets=data.facets[field]><#list facets as f> - { - "label": "${f.facetLabel}", - "value": "${f.facetValue}", - "hits": ${f.hits?c}, - "index": ${f.facetLabelIndex?c} - }<#if f_has_next>, - - ]<#if field_has_next>, - -}, -"items": -[ - <#list data.items as item> - { - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "name": "${item.name!''}", - "displayName": "${item.displayName!''}", - <#if item.title??> - "title": "${item.title}", - - "description": "${item.description!''}", - "modifiedOn": "${xmldate(item.modifiedOn)}", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "fromDate": "${xmldate(item.fromDate)}", - "size": ${item.size?c}, - "mimetype": "${item.mimetype!''}", - <#if item.site??> - "site": - { - "shortName": "${item.site.shortName}", - "title": "${item.site.title}" - }, - "container": "${item.container}", - - <#if item.path??> - "path": "${item.path}", - - "lastThumbnailModification": - [ - <#if item.lastThumbnailModification??> - <#list item.lastThumbnailModification as lastThumbnailMod> - "${lastThumbnailMod}" - <#if lastThumbnailMod_has_next>, - - - ], - "tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,] - <#--Add in full node details, if they exist--> - <#if item.nodeJSON??> - ,"node": <#noescape>${item.nodeJSON} - - }<#if item_has_next>, - -], -"spellcheck": -{ - <#if data.spellcheck?? && data.spellcheck.spellCheckExist> - "searchRequest": "${data.spellcheck.originalSearchTerm}", - <#if data.spellcheck.searchedFor> - <#list data.spellcheck.results as collationQueryStr> - "searchedFor": "${collationQueryStr?string}" - <#break> - - <#else> - "searchSuggestions": [ - <#list data.spellcheck.results as suggestion> - "${suggestion?string}"<#if suggestion_has_next>, - - ] - - -} -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js deleted file mode 100644 index 0511552ece..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -// RM Search Lib. - -// Wrap the original document item method with our own one that appends RM specific properties. -// Additional properties will also need rendering in rmsearch.get.json.ftl. -var getOriginalDocumentItem = getDocumentItem, - getOriginalRepositoryItem = getRepositoryItem; -getDocumentItem = function(siteId, containerId, pathParts, node, populate, highlighting){ - // Get original Document item. - var item = getOriginalDocumentItem(siteId, containerId, pathParts, node, populate, highlighting); - - item.nodeJSON = appUtils.toJSON(node, true); - - return item; -}; - -getRepositoryItem = function(folderPath, node, populate, highlighting){ - // Get Original Repo item - var item = getOriginalRepositoryItem(folderPath, node, populate, highlighting); - - if (item.type === "document") { - item.nodeJSON = appUtils.toJSON(node, true); - } - - return item; -}; diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml deleted file mode 100644 index b7258ad350..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - rmsavedsearches - RM Saved Searches - /slingshot/rmsavedsearches/site/{site}/{name} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl deleted file mode 100644 index f5f49054f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl +++ /dev/null @@ -1,29 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "success": ${success?string} -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml deleted file mode 100644 index 7a030401e0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - rmsavedsearches - RM Saved Searches - /slingshot/rmsavedsearches/site/{site}?p={public?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl deleted file mode 100644 index b6d0ebcafe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl +++ /dev/null @@ -1,42 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list savedSearches as s> - { - "name": "${s.name}", - "description": "${s.description!""}", - "query": "${s.query}", - "params": "${s.params}", - "sort": "${s.sort}" - }<#if s_has_next>, - - ] -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml deleted file mode 100644 index 799793fed6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - rmsavedsearches - RM Saved Searches - /slingshot/rmsavedsearches/site/{site} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl deleted file mode 100644 index f5f49054f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl +++ /dev/null @@ -1,29 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -{ - "success": ${success?string} -} diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml deleted file mode 100644 index e001ab570b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - rmsearch - Record Search Component Data Webscript - /slingshot/rmsearch/{site}?query={query?}&sortby={sortby?}&filters={filters?}&maxitems={maxitems?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl deleted file mode 100644 index 49182e3a51..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl +++ /dev/null @@ -1,74 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if !errorMessage??> - "items": - [ - <#list items as item> - { - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "name": "${item.name}", - "title": "${item.title!''}", - "description": "${item.description!''}", - "modifiedOn": "${xmldate(item.modifiedOn)}", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "createdOn": "${xmldate(item.createdOn)}", - "createdByUser": "${item.createdByUser}", - "createdBy": "${item.createdBy}", - "author": "${item.author!''}", - "size": ${item.size?c}, - <#if item.browseUrl??>"browseUrl": "${item.browseUrl}", - "parentFolder": "${item.parentFolder!""}", - "properties": - { - <#assign first=true> - <#list item.properties?keys as k> - <#if item.properties[k]??> - <#if !first>,<#else><#assign first=false>"${k}": - <#assign prop = item.properties[k]> - <#if prop?is_date>"${xmldate(prop)}" - <#elseif prop?is_boolean>${prop?string("true", "false")} - <#elseif prop?is_enumerable>[<#list prop as p>"${p}"<#if p_has_next>, ] - <#elseif prop?is_number>${prop?c} - <#elseif prop?is_string>"${prop}" - <#elseif prop?is_hash_ex>[<#list prop?values as p>"${p}"<#if p_has_next>, ] - <#else>"${prop}" - - - - } - }<#if item_has_next>, - - ] - <#else> - "errorMessage": "${errorMessage}" - -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml deleted file mode 100644 index 27f2ff01ac..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - rmsearchproperties - RM Search Properties - /slingshot/rmsearchproperties - argument - user - required - internal - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl deleted file mode 100644 index 88312f55e8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl +++ /dev/null @@ -1,53 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data" : - { - "groups" : - [ - <#list groups as group> - { - "id" : "${group.id}", - "label" : "${group.label}", - "properties" : - [ - <#list group.properties as property> - { - "prefix" : "${property.prefix}", - "name" : "${property.shortName}", - "label" : "${property.label}", - "type" : "${property.type}" - }<#if property_has_next>, - - ] - }<#if group_has_next>, - - ] - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search.lib.js b/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search.lib.js deleted file mode 100644 index 7632dedac7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search.lib.js +++ /dev/null @@ -1,316 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * NOTE: This file is a copy of the ~/slingshot/search/live-search.lib.js from core repository code and replaces that - * file when built with RM, in order to exclude some RM specific files from live search results. Ideally, any changes - * to the core file should be replicated here. - */ - -/** - * Live Search Component - * - * Takes the following object as Input: - * params - * { - * type: search mode type - one of "documents|sites|people" - * term: search terms - * maxResults: maximum results to return - * }; - * - * Outputs: - * items - Array of objects containing the search results - */ - -const DEFAULT_MAX_RESULTS = 5; -const SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; -const SURF_CONFIG_QNAMEPATH = "/cm:surf-config/"; - -/** - * Returns site information data structure. - * { shortName: siteId, title: title } - * - * Caches the data to avoid repeatedly querying the repository. - */ -var siteDataCache = {}; - -function getSiteData(siteId) { - if (typeof siteDataCache[siteId] === "object") - { - return siteDataCache[siteId]; - } - var site = siteService.getSite(siteId); - var data = - { - shortName : siteId, - title : (site !== null ? site.title : "unknown") - }; - siteDataCache[siteId] = data; - return data; -} - -/** - * Return the fts-alfresco query template to use. - * The default searches name, title, descripton, calendar, link, full text and tag fields. - * It is configurable via the .config.xml attached to this webscript. - */ -function getQueryTemplate() { - var t = - [{ - field: "keywords", - template: "%(cm:name cm:title cm:description TEXT TAG)" - }], - qt = new XML(config.script)["default-query-template"]; - if (qt != null && qt.length() != 0) - { - t[0].template = qt.toString(); - } - return t; -} - -/** - * Process and return a document item node - */ -function getDocumentItem(container, node) { - // check whether this is a valid folder or a file - var item = null; - if (node.qnamePath.indexOf(SURF_CONFIG_QNAMEPATH) === -1) - { - if (node.isDocument) - { - item = - { - nodeRef: node.nodeRef.toString(), - name: node.name, - title: node.properties["cm:title"], - description: node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedBy: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdBy: node.properties["cm:creator"], - mimetype: node.mimetype, - size: node.size - }; - if (container.siteId !== null) - { - item.site = getSiteData(container.siteId); - item.container = container.containerId; - } - if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}thumbnailModification")) - { - var dates = node.properties["lastThumbnailModification"]; - for (var i=0; i= 1) - { - var siteQName = Packages.org.alfresco.util.ISO9075.decode(tmp.split("/")[0]); - siteId = siteQName.substring(siteQName.indexOf(":") + 1); - tmp = tmp.substring(pos + 1); - pos = tmp.indexOf('/'); - if (pos >= 1) - { - // strip container id from the path - var containerId = tmp.substring(0, pos); - containerId = containerId.substring(containerId.indexOf(":") + 1); - - container.siteId = siteId; - container.containerId = containerId; - } - } - } - - return container; -} - -/** - * Dispatch a live search to the appropriate search method for the requested result type. - */ -function liveSearch(params) { - switch (params.type) - { - case "documents": - return getDocResults(params); - break; - case "sites": - return getSiteResults(params); - break; - case "people": - return getPeopleResults(params); - break; - } -} - -/** - * Return Document Search results with the given search terms. - * - * "AND" is the default operator unless configured otherwise, OR, AND and NOT are also supported - - * as is any other valid fts-alfresco elements such as "quoted terms" and (bracket terms) and also - * propname:propvalue syntax. - * - * @param params Object containing search parameters - see API description above - */ -function getDocResults(params) { - // ensure a TYPE is specified - var ftsQuery = params.term + ' AND +TYPE:"cm:content"'; - - // site constraint - if (params.siteId !== null) - { - // use SITE syntax to restrict to specific site - ftsQuery += ' AND SITE:"' + params.siteId + '"'; - } - - // root node - generally used for overridden Repository root in Share - if (params.rootNode !== null) - { - ftsQuery = 'PATH:"' + rootNode.qnamePath + '//*" AND (' + ftsQuery + ')'; - } - - // main query construction - ftsQuery = '(' + ftsQuery + ') AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"fm:post" AND -ASPECT:"sys:hidden" AND -ASPECT:"rma:savedSearch" AND -cm:creator:system'; - - if (logger.isLoggingEnabled()) - logger.log("LiveQuery:\r\n" + ftsQuery); - - // get default fts operator from the config - // - // TODO: common search lib - for both live and standard e.g. to get values like this... - // - var operator = "AND"; - var cf = new XML(config.script)["default-operator"]; - if (cf != null && cf.length != 0) - { - operator = cf.toString(); - } - - // perform fts-alfresco language query - var queryDef = { - query: ftsQuery, - language: "fts-alfresco", - templates: getQueryTemplate(), - defaultField: "keywords", - defaultOperator: operator, - onerror: "no-results", - page: { - maxItems: params.maxResults, - skipCount: params.startIndex - } - }; - var rs = search.queryResultSet(queryDef); - nodes = rs.nodes, - results = []; - - if (logger.isLoggingEnabled()) - logger.log("Processing resultset of length: " + nodes.length); - - for (var i=0, item; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties deleted file mode 100644 index 84187d7633..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Information requested for the record -activitiReviewPooled.workflow.info.provided=Information provided for the record -activitiReviewPooled.workflow.email.subject=Information provided for the record -activitiReviewPooled.workflow.email.body1=The user -activitiReviewPooled.workflow.email.body2=has provided the information required for the record. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Workflow Task -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Workflow Task -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Requested Information -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Requested Information -rmwf_workflowmodel.property.rmwf_message.title=Message -rmwf_workflowmodel.property.rmwf_message.decription=Message - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Request Information Task -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Request Information Task -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Assignees -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Assignees - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Request Information Task -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Request Information Task - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Request Information Task -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Request Information Task \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties deleted file mode 100644 index bbd943d17b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Informationen f\u00fcr Record angefordert -activitiReviewPooled.workflow.info.provided=Informationen f\u00fcr Record bereitgestellt -activitiReviewPooled.workflow.email.subject=Informationen f\u00fcr Record bereitgestellt -activitiReviewPooled.workflow.email.body1=Der Benutzer -activitiReviewPooled.workflow.email.body2=hat die f\u00fcr den Record erforderlichen Informationen bereitgestellt. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Aufgabe im Workflow -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Aufgabe im Workflow -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Angeforderte Informationen -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Angeforderte Informationen -rmwf_workflowmodel.property.rmwf_message.title=Nachricht -rmwf_workflowmodel.property.rmwf_message.decription=Nachricht - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Bevollm\u00e4chtigte -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Bevollm\u00e4chtigte - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Aufgabe 'Informationen anfordern' - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Aufgabe 'Informationen anfordern' diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties deleted file mode 100644 index df18f9609e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Informaci\u00f3n solicitada para el documento de archivo -activitiReviewPooled.workflow.info.provided=Informaci\u00f3n proporcionada para el documento de archivo -activitiReviewPooled.workflow.email.subject=Informaci\u00f3n proporcionada para el documento de archivo -activitiReviewPooled.workflow.email.body1=El usuario -activitiReviewPooled.workflow.email.body2=ha proporcionado la informaci\u00f3n requerida para el documento de archivo. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Tarea de flujo de trabajo -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Tarea de flujo de trabajo -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informaci\u00f3n solicitada -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informaci\u00f3n solicitada -rmwf_workflowmodel.property.rmwf_message.title=Mensaje -rmwf_workflowmodel.property.rmwf_message.decription=Mensaje - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Usuarios a asignar la tarea -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Usuarios a asignar la tarea - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Tarea de solicitud de informaci\u00f3n - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Tarea de solicitud de informaci\u00f3n diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties deleted file mode 100644 index 9860223b9c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Demande d'informations pour le document d'archives -activitiReviewPooled.workflow.info.provided=Informations fournies pour le document d'archives -activitiReviewPooled.workflow.email.subject=Informations fournies pour le document d'archives -activitiReviewPooled.workflow.email.body1=L'utilisateur -activitiReviewPooled.workflow.email.body2=a fourni les informations requises pour le document d'archives. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=T\u00e2che du workflow -rmwf_workflowmodel.type.rmwf_workflowTask.decription=T\u00e2che du workflow -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informations demand\u00e9es -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informations demand\u00e9es -rmwf_workflowmodel.property.rmwf_message.title=Message -rmwf_workflowmodel.property.rmwf_message.decription=Message - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=T\u00e2che de demande d'informations -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=T\u00e2che de demande d'informations -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Acteurs -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Acteurs - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=T\u00e2che de demande d'informations -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=T\u00e2che de demande d'informations - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=T\u00e2che de demande d'informations -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=T\u00e2che de demande d'informations diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties deleted file mode 100644 index 963176a754..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Informazioni richieste per il record -activitiReviewPooled.workflow.info.provided=Informazioni fornite per il record -activitiReviewPooled.workflow.email.subject=Informazioni fornite per il record -activitiReviewPooled.workflow.email.body1=L'utente -activitiReviewPooled.workflow.email.body2=ha fornito le informazioni richieste per il record. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Attivit\u00e0 del workflow -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Attivit\u00e0 del workflow -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informazioni richieste -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informazioni richieste -rmwf_workflowmodel.property.rmwf_message.title=Messaggio -rmwf_workflowmodel.property.rmwf_message.decription=Messaggio - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Assegnatari -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Assegnatari - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Attivit\u00e0 di richiesta informazioni - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Attivit\u00e0 di richiesta informazioni diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties deleted file mode 100644 index 9fa90f06ee..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 -activitiReviewPooled.workflow.info.provided=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u63d0\u4f9b\u3055\u308c\u305f\u60c5\u5831 -activitiReviewPooled.workflow.email.subject=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u63d0\u4f9b\u3055\u308c\u305f\u60c5\u5831 -activitiReviewPooled.workflow.email.body1=\u30e6\u30fc\u30b6\u30fc\u304c -activitiReviewPooled.workflow.email.body2=\u30ec\u30b3\u30fc\u30c9\u306b\u5fc5\u8981\u306a\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u307e\u3057\u305f\u3002 - -rmwf_workflowmodel.type.rmwf_workflowTask.title=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u30bf\u30b9\u30af -rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 -rmwf_workflowmodel.property.rmwf_message.title=\u30e1\u30c3\u30bb\u30fc\u30b8 -rmwf_workflowmodel.property.rmwf_message.decription=\u30e1\u30c3\u30bb\u30fc\u30b8 - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u62c5\u5f53\u8005 -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u62c5\u5f53\u8005 - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties deleted file mode 100644 index fca4bcec56..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Informasjon som ble forespurt for oppf\u00f8ringen -activitiReviewPooled.workflow.info.provided=Informasjon som er s\u00f8rget for, til oppf\u00f8ringen -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 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties deleted file mode 100755 index 123ec56cb2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Informatie aangevraagd voor het archiefstuk -activitiReviewPooled.workflow.info.provided=Informatie aangeleverd voor het archiefstuk -activitiReviewPooled.workflow.email.subject=Informatie aangeleverd voor het archiefstuk -activitiReviewPooled.workflow.email.body1=De gebruiker -activitiReviewPooled.workflow.email.body2=heeft de vereiste informatie voor het archiefstuk aangeleverd. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Workflowtaak -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Workflowtaak -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Aangevraagde informatie -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Aangevraagde informatie -rmwf_workflowmodel.property.rmwf_message.title=Bericht -rmwf_workflowmodel.property.rmwf_message.decription=Bericht - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Informatie-aanvraagtaak -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Informatie-aanvraagtaak -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Toegewezen personen -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Toegewezen personen - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Informatie-aanvraagtaak -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Informatie-aanvraagtaak - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Informatie-aanvraagtaak -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Informatie-aanvraagtaak diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties deleted file mode 100644 index 6170bd0604..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Informa\u00e7\u00f5es solicitadas do documento arquiv\u00edstico -activitiReviewPooled.workflow.info.provided=Informa\u00e7\u00f5es fornecidas do documento arquiv\u00edstico -activitiReviewPooled.workflow.email.subject=Informa\u00e7\u00f5es fornecidas do documento arquiv\u00edstico -activitiReviewPooled.workflow.email.body1=O usu\u00e1rio -activitiReviewPooled.workflow.email.body2=forneceu as informa\u00e7\u00f5es necess\u00e1rias do documento arquiv\u00edstico. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Tarefa de fluxo de trabalho -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Tarefa de fluxo de trabalho -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informa\u00e7\u00f5es solicitadas -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informa\u00e7\u00f5es solicitadas -rmwf_workflowmodel.property.rmwf_message.title=Mensagem -rmwf_workflowmodel.property.rmwf_message.decription=Mensagem - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Destinat\u00e1rios -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Destinat\u00e1rios - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties deleted file mode 100644 index db2fd5ff1f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 -activitiReviewPooled.workflow.info.provided=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 -activitiReviewPooled.workflow.email.subject=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 -activitiReviewPooled.workflow.email.body1=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c -activitiReviewPooled.workflow.email.body2=\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 -rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u0417\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 -rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e -rmwf_workflowmodel.property.rmwf_message.title=\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -rmwf_workflowmodel.property.rmwf_message.decription=\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties deleted file mode 100644 index c53f947909..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=\u4e3a\u8bb0\u5f55\u8bf7\u6c42\u7684\u4fe1\u606f -activitiReviewPooled.workflow.info.provided=\u4e3a\u8bb0\u5f55\u63d0\u4f9b\u7684\u4fe1\u606f -activitiReviewPooled.workflow.email.subject=\u4e3a\u8bb0\u5f55\u63d0\u4f9b\u7684\u4fe1\u606f -activitiReviewPooled.workflow.email.body1=\u7528\u6237 -activitiReviewPooled.workflow.email.body2=\u5df2\u7ecf\u63d0\u4f9b\u8bb0\u5f55\u6240\u9700\u7684\u4fe1\u606f\u3002 - -rmwf_workflowmodel.type.rmwf_workflowTask.title=\u5de5\u4f5c\u6d41\u7a0b\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u5de5\u4f5c\u6d41\u7a0b\u4efb\u52a1 -rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u8bf7\u6c42\u7684\u4fe1\u606f -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u8bf7\u6c42\u7684\u4fe1\u606f -rmwf_workflowmodel.property.rmwf_message.title=\u6d88\u606f -rmwf_workflowmodel.property.rmwf_message.decription=\u6d88\u606f - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u88ab\u6307\u6d3e\u8005\u6570 -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u88ab\u6307\u6d3e\u8005\u6570 - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml deleted file mode 100644 index 7ee9da4b23..0000000000 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - bpm:workflowTask - - - d:text - true - - - d:text - true - - - - - - rmwf:workflowTask - - - - false - false - - - cm:authority - true - true - - - - - - - rmwf:workflowTask - - - - rmwf:workflowTask - - - false - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/docker-compose.yml b/amps/ags/rm-community/rm-community-repo/docker-compose.yml deleted file mode 100644 index bdd8d01456..0000000000 --- a/amps/ags/rm-community/rm-community-repo/docker-compose.yml +++ /dev/null @@ -1,89 +0,0 @@ -version: "3" - -# For remote debug we need the CATALINA_OPTS and to expose port 8000. - -services: - alfresco: - # acs repo community image with ags repo community amp applied - image: alfresco/alfresco-governance-repository-community:latest - environment: - CATALINA_OPTS : " - -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n - " - JAVA_TOOL_OPTIONS: " - -Dencryption.keystore.type=JCEKS - -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding - -Dencryption.keyAlgorithm=DESede - -Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore - -Dmetadata-keystore.password=mp6yc0UD9e - -Dmetadata-keystore.aliases=metadata - -Dmetadata-keystore.metadata.password=oKIWzVdEdA - -Dmetadata-keystore.metadata.algorithm=DESede" - JAVA_OPTS : " - -Ddb.driver=org.postgresql.Driver - -Ddb.username=alfresco - -Ddb.password=alfresco - -Ddb.url=jdbc:postgresql://postgres:5432/alfresco - -Dsolr.host=search - -Dsolr.port=8983 - -Dsolr.secureComms=none - -Dsolr.base.url=/solr - -Dindex.subsystem.name=solr6 - -Dalfresco.restApi.basicAuthScheme=true - -Dimap.server.enabled=true - -Dimap.server.port=1143 - -Dftp.enabled=true - -Dftp.port=1221 - -Dftp.dataPortFrom=30000 - -Dftp.dataPortTo=30099 - -Dshare.host=localhost - -Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos - -Dmessaging.broker.url=\"failover:(tcp://activemq:61616)?timeout=3000&jms.useCompression=true\" - -DlocalTransform.core-aio.url=http://transform-core-aio:8090/ - " - ports: - - 8080:8080 - - 8000:8000 - - 1143:1143 - - "21:1221" - - "30000-30099:30000-30099" - - postgres: - image: library/postgres:${POSTGRES_TAG} - environment: - - POSTGRES_PASSWORD=alfresco - - POSTGRES_USER=alfresco - - POSTGRES_DB=alfresco - ports: - - 5432:5432 - - search: - image: alfresco/alfresco-search-services:${SOLR6_TAG} - environment: - #Solr needs to know how to register itself with Alfresco - - SOLR_ALFRESCO_HOST=alfresco - - SOLR_ALFRESCO_PORT=8080 - #Alfresco needs to know how to call solr - - SOLR_SOLR_HOST=search - - SOLR_SOLR_PORT=8983 - #Create the default alfresco and archive cores - - SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive - #HTTP by default - - ALFRESCO_SECURE_COMMS=none - ports: - - 8083:8983 #Browser port - - activemq: - image: alfresco/alfresco-activemq:${ACTIVEMQ_TAG} - ports: - - 8161:8161 # Web Console - - 5672:5672 # AMQP - - 61616:61616 # OpenWire - - 61613:61613 # STOMP - - transform-core-aio: - image: alfresco/alfresco-transform-core-aio:${TRANSFORMERS_TAG} - environment: - JAVA_OPTS: " -Xms256m -Xmx512m" - ports: - - 8090:8090 diff --git a/amps/ags/rm-community/rm-community-repo/pom.xml b/amps/ags/rm-community/rm-community-repo/pom.xml deleted file mode 100644 index abac8c6119..0000000000 --- a/amps/ags/rm-community/rm-community-repo/pom.xml +++ /dev/null @@ -1,619 +0,0 @@ - - 4.0.0 - alfresco-governance-services-community-repo - amp - Alfresco Governance Services Community Repository AMP - Alfresco Governance Services Repository Extension - - - org.alfresco - alfresco-governance-services-community-repo-parent - 11.28-SNAPSHOT - - - - alfresco/alfresco-governance-repository-community - - - - - org.alfresco - alfresco-data-model - ${project.version} - provided - - - org.alfresco - alfresco-remote-api - ${project.version} - provided - - - org.alfresco - alfresco-repository - ${project.version} - provided - - - org.alfresco - alfresco-repository - ${project.version} - tests - test - - - org.alfresco - alfresco-remote-api - ${project.version} - tests - test - - - org.alfresco - alfresco-core - ${project.version} - tests - test - - - javax.servlet - javax.servlet-api - provided - - - org.alfresco.surf - spring-webscripts - tests - test - - - io.takari.junit - takari-cpsuite - 1.2.7 - test - - - junit - junit - test - - - org.postgresql - postgresql - test - - - mysql - mysql-connector-java - test - - - org.reflections - reflections - test - - - - io.swagger - swagger-parser - test - - - - com.github.fge - json-schema-validator - test - - - org.mockito - mockito-all - test - - - com.fasterxml.jackson.core - jackson-core - provided - - - com.fasterxml.jackson.core - jackson-annotations - provided - - - com.fasterxml.jackson.core - jackson-databind - provided - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - provided - - - org.springframework - spring-test - test - - - - - source/java - test/java - - - config - ${app.filtering.enabled} - - - - - unit-test/resources - - - test/resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - - add-source - - - - source/compatibility - - - - - add-test-source - - add-test-source - - - - unit-test/java - - - - - - - maven-antrun-plugin - - - prepare-package - - run - - - - - - - - - - - - - - org.codehaus.mojo - properties-maven-plugin - - - initialize - - read-project-properties - - - - ${basedir}/src/main/resources/local.properties - - true - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/AllUnitTestSuite.class - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - integration-tests - integration-test - - integration-test - verify - - - - ${db.name} - ${alfresco.db.datasource.class} - ${alfresco.db.url} - ${project.build.directory}/alf-data-test - - - **/AllTestSuite.class - - - ${project.build.directory}/${project.build.finalName}/config - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - fetch-share-services-amp - process-test-resources - - copy - - - - - org.alfresco - alfresco-share-services - ${project.version} - amp - - - org.alfresco - alfresco-governance-services-community-rest-api-explorer - ${project.version} - war - gs-api-explorer-${project.version}.war - - - ${project.build.directory} - - - - unpack-alfresco - prepare-package - - unpack - - - ${app.amp.client.war.folder} - - - org.alfresco - content-services-community - war - ${project.version} - - - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - - - attach-alfresco-governance-services-jar - - amp - - - true - true - true - - - - amps-to-war-overlay - package - - install - - - - install-share-services-amp - - install - - prepare-package - - true - ${project.build.directory}/alfresco-share-services-${project.version}.amp - ${app.amp.client.war.folder} - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - - - - **/alfresco-global.properties - - - - - org.codehaus.mojo - license-maven-plugin - - alfresco_community - - source/java - unit-test/java - source/compatibility - config - test/java - test/resources - - - - - - - - - use-mysql - - ${my.db.name} - ${my.db.port} - org.alfresco.repo.domain.dialect.MySQLInnoDBDialect - - jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name} - jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name} - org.gjt.mm.mysql.Driver - - - - use-postgres - - ${my.db.name} - ${my.db.port} - org.alfresco.repo.domain.dialect.PostgreSQLDialect - - jdbc:postgresql:template1 - jdbc:postgresql:${alfresco.db.name} - org.postgresql.Driver - - - - - - start-postgres - - ${alfresco.test.db.name} - ${postgresql.tests.port} - jdbc:postgresql://${alfresco.db.host}:${alfresco.db.port}/${db.name} - jdbc:postgresql://${alfresco.db.host}:${alfresco.db.port}/${db.name} - org.postgresql.Driver - - - - - io.fabric8 - docker-maven-plugin - - - - - postgres:9.4.12 - - - - ${postgresql.tests.port}:${postgresql.port} - - - ${alfresco.db.password} - ${alfresco.db.username} - ${alfresco.test.db.name} - - - -c max_connections=300 - - - database system is ready to accept connections - - - - - - alfresco/alfresco-activemq:${dependency.activemq.version} - - - ${activemq.port1}:${activemq.port1} - ${activemq.port2}:${activemq.port2} - - - - - - - - before-integration-tests - pre-integration-test - - stop - start - - - - after-integration-tests - post-integration-test - - stop - - - - - - - - - - - start-mysql - - ${alfresco.db.name} - ${mysql.tests.port} - jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${db.name} - jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${db.name} - com.mysql.cj.jdbc.Driver - - - - - io.fabric8 - docker-maven-plugin - - - - mysql:${dependency.mysql-image.version} - - - ${mysql.tests.port}:${mysql.port} - - - ${alfresco.db.password} - ${alfresco.db.password} - ${alfresco.db.username} - ${alfresco.db.name} - - - --transaction-isolation=READ-COMMITTED - - - mysqld: ready for connections - - - - - - alfresco/alfresco-activemq:${dependency.activemq.version} - - - ${activemq.port1}:${activemq.port1} - ${activemq.port2}:${activemq.port2} - - - - - - - - before-integration-tests - pre-integration-test - - stop - start - - - - after-integration-tests - post-integration-test - - stop - - - - - - - - - - - build-docker-images - - - - io.fabric8 - docker-maven-plugin - - - - ${image.name}:${image.tag} - - - - - - build-image - package - - build - - - - - - - - - - push-docker-images - - - - - io.fabric8 - docker-maven-plugin - - - - - ${image.name}:${image.tag} - ${image.registry} - - - - ${image.name}:${image.tag} - - - - - - build-push-image - install - - build - push - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java deleted file mode 100644 index 5b1e5b3454..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_dod5015.caveat; - -/** - * Compatibility Implementation. - *

- * Used as a compatibility implementation when migrating from V1.0 to V2.0. RMCustom model still references - * this class implementation, but package has been changed. - * - * @author Roy Wetherall - */ -public class RMListOfValuesConstraint extends org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint -{ - // No implementation -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java deleted file mode 100644 index efb015a807..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException} - */ -public class CannotApplyConstraintMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint"; - - public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType) - { - super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java deleted file mode 100644 index 93f6e6502e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException} - */ -public abstract class CustomMetadataException extends Exception -{ - private static final long serialVersionUID = -6676112294794381360L; - - public CustomMetadataException(String msg) - { - super(msg); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java deleted file mode 100644 index b1bdc0b303..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException} - */ -public class InvalidCustomAspectMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect"; - - public InvalidCustomAspectMetadataException(QName customAspect, String aspectName) - { - super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java deleted file mode 100644 index 0ead867fb9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.NotCustomisableMetadataException} - */ -public class NotCustomisableMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable"; - - public NotCustomisableMetadataException(String aspectName) - { - super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java deleted file mode 100644 index db92613fa6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException} - */ -public class PropertyAlreadyExistsMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - - public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists"; - - public PropertyAlreadyExistsMetadataException(String propIdAsString) - { - super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java deleted file mode 100644 index ec1203cc04..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService} - */ -public interface RecordsManagementAdminService - extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService -{ - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java deleted file mode 100644 index 3064c292a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -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.freeze.FreezeService; -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.transfer.TransferService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management service interface. - * - * Allows simple creation, manipulation and querying of records management components. - * - * @author Roy Wetherall - * @deprecated as of 2.2 - */ -public interface RecordsManagementService -{ - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} - */ - @Deprecated - boolean isFilePlanComponent(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)} - */ - @Deprecated - FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)} - */ - @Deprecated - FilePlanComponentKind getFilePlanComponentKindFromType(QName type); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)} - */ - @Deprecated - boolean isRecordsManagementContainer(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} - */ - @Deprecated - boolean isFilePlan(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)} - */ - @Deprecated - boolean isRecordCategory(NodeRef nodeRef); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolder(NodeRef)} - */ - @Deprecated - boolean isRecordFolder(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link TransferService#isTransfer(NodeRef)} - */ - @Deprecated - boolean isTransfer(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link RecordService#isMetadataStub(NodeRef)} - */ - @Deprecated - boolean isMetadataStub(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link DispositionService#isDisposableItemCutoff(NodeRef)} - */ - boolean isCutoff(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)} - */ - @Deprecated - List getNodeRefPath(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)} - */ - @Deprecated - NodeRef getFilePlan(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()} - */ - @Deprecated - List getFilePlans(); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name, QName type); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name, Map properties); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)} - */ - @Deprecated - List getAllContained(NodeRef recordCategory, boolean deep); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef)} - */ - @Deprecated - List getAllContained(NodeRef recordCategory); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} - */ - @Deprecated - List getContainedRecordCategories(NodeRef recordCategory, boolean deep); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)} - */ - @Deprecated - List getContainedRecordCategories(NodeRef recordCategory); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} - */ - @Deprecated - List getContainedRecordFolders(NodeRef container, boolean deep); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)} - */ - @Deprecated - List getContainedRecordFolders(NodeRef container); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name, QName type); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name, Map properties); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderDeclared(NodeRef)} - */ - @Deprecated - boolean isRecordFolderDeclared(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderClosed(NodeRef)} - */ - @Deprecated - boolean isRecordFolderClosed(NodeRef nodeRef); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName)} - */ - @Deprecated - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName, Map)} - */ - @Deprecated - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String)} - */ - @Deprecated - NodeRef createRecordFolder(NodeRef parent, String name); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map) - */ - @Deprecated - NodeRef createRecordFolder(NodeRef parent, String name, Map properties); - - /** - * @deprecated As of 2.2, see {@link RecordService#getRecords(NodeRef)} - */ - @Deprecated - List getRecords(NodeRef recordFolder); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#getRecordFolders(NodeRef)} - */ - @Deprecated - List getRecordFolders(NodeRef record); - - /** - * @deprecated As of 2.1, replaced by {@link RecordService#getRecordMetaDataAspects()} - */ - @Deprecated - Set getRecordMetaDataAspects(); - - /** - * @deprecated As of 2.1, replaced by {@link RecordService#isDeclared(NodeRef)} - */ - @Deprecated - boolean isRecordDeclared(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, replaced by {@link FreezeService#isHold(NodeRef)} - */ - @Deprecated - boolean isHold(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, replaced by {@link FreezeService#isFrozen(NodeRef)} - */ - @Deprecated - boolean isFrozen(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, replaced by {@link FreezeService#hasFrozenChildren(NodeRef)} - */ - @Deprecated - boolean hasFrozenChildren(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, replaced by {@link RecordService#isRecord(NodeRef)} - */ - @Deprecated - boolean isRecord(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java deleted file mode 100644 index 5bc0ddbfcd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java +++ /dev/null @@ -1,504 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -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.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.transfer.TransferService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management service implementation. - * - * @author Roy Wetherall - * @deprecated as of 2.2 - */ -public class RecordsManagementServiceImpl extends ServiceBaseImpl - implements RecordsManagementService, - RecordsManagementModel -{ - /** Store that the RM roots are contained within */ - @SuppressWarnings("unused") - @Deprecated - private StoreRef defaultStoreRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - - /** Service registry */ - private RecordsManagementServiceRegistry serviceRegistry; - - /** - * Set the service registry service - * - * @param serviceRegistry service registry - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry) - { - // Internal ops use the unprotected services from the voter (e.g. nodeService) - this.serviceRegistry = serviceRegistry; - this.dictionaryService = serviceRegistry.getDictionaryService(); - } - - /** - * Sets the default RM store reference - * @param defaultStoreRef store reference - */ - @Deprecated - public void setDefaultStoreRef(StoreRef defaultStoreRef) - { - this.defaultStoreRef = defaultStoreRef; - } - - /** - * @return File plan service - */ - private FilePlanService getFilePlanService() - { - return serviceRegistry.getFilePlanService(); - } - - /** - * @return Record Folder Service - */ - private RecordFolderService getRecordFolderService() - { - return serviceRegistry.getRecordFolderService(); - } - - /** - * @return Record Service - */ - private RecordService getRecordService() - { - return serviceRegistry.getRecordService(); - } - - /** - * @return Freeze Service - */ - private FreezeService getFreezeService() - { - return serviceRegistry.getFreezeService(); - } - - /** - * @return Disposition Service - */ - private DispositionService getDispositionService() - { - return serviceRegistry.getDispositionService(); - } - - /** - * @return Transfer service - */ - private TransferService getTransferService() - { - return serviceRegistry.getTransferService(); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanComponent(NodeRef)} - */ - @Override - public boolean isFilePlanComponent(NodeRef nodeRef) - { - return getFilePlanService().isFilePlanComponent(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)} - */ - @Override - public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) - { - return getFilePlanService().getFilePlanComponentKind(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)} - */ - @Override - public FilePlanComponentKind getFilePlanComponentKindFromType(QName type) - { - return getFilePlanService().getFilePlanComponentKindFromType(type); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)} - */ - @Override - public boolean isRecordsManagementContainer(NodeRef nodeRef) - { - return getFilePlanService().isFilePlanContainer(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} - */ - @Override - public boolean isFilePlan(NodeRef nodeRef) - { - return getFilePlanService().isFilePlan(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)} - */ - @Override - public boolean isRecordCategory(NodeRef nodeRef) - { - return getFilePlanService().isRecordCategory(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolder(NodeRef)} - */ - @Override - public boolean isRecordFolder(NodeRef nodeRef) - { - return getRecordFolderService().isRecordFolder(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link TransferService#isTransfer(NodeRef)} - */ - @Override - public boolean isTransfer(NodeRef nodeRef) - { - return getTransferService().isTransfer(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link RecordService#isMetadataStub(NodeRef)} - */ - @Override - public boolean isMetadataStub(NodeRef nodeRef) - { - return getRecordService().isMetadataStub(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link DispositionService#isDisposableItemCutoff(NodeRef)} - */ - @Override - public boolean isCutoff(NodeRef nodeRef) - { - return getDispositionService().isDisposableItemCutoff(nodeRef); - } - - /** - * @deprecated as of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)} - */ - @Override - public List getNodeRefPath(NodeRef nodeRef) - { - return getFilePlanService().getNodeRefPath(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)} - */ - @Override - public NodeRef getFilePlan(NodeRef nodeRef) - { - return getFilePlanService().getFilePlan(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()} - */ - @Override - public List getFilePlans() - { - return new ArrayList<>(getFilePlanService().getFilePlans()); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, QName type) - { - return getFilePlanService().createFilePlan(parent, name, type); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties) - { - return getFilePlanService().createFilePlan(parent, name, type, properties); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name) - { - return getFilePlanService().createFilePlan(parent, name); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, Map properties) - { - return getFilePlanService().createFilePlan(parent, name, properties); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)} - */ - @Override - public List getAllContained(NodeRef container, boolean deep) - { - return getFilePlanService().getAllContained(container, deep); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef)} - */ - @Override - public List getAllContained(NodeRef container) - { - return getFilePlanService().getAllContained(container); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} - */ - @Override - public List getContainedRecordCategories(NodeRef container, boolean deep) - { - return getFilePlanService().getContainedRecordCategories(container, deep); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)} - */ - @Override - public List getContainedRecordCategories(NodeRef container) - { - return getFilePlanService().getContainedRecordCategories(container); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef, boolean)} - */ - @Override - public List getContainedRecordFolders(NodeRef container, boolean deep) - { - return getFilePlanService().getContainedRecordFolders(container, deep); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)} - */ - @Override - public List getContainedRecordFolders(NodeRef container) - { - return getFilePlanService().getContainedRecordFolders(container); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)} - */ - @Override - public NodeRef createRecordCategory(NodeRef parent, String name, QName type) - { - return getFilePlanService().createRecordCategory(parent, name, type); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)} - */ - @Override - public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties) - { - return getFilePlanService().createRecordCategory(parent, name, type, properties); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)} - */ - @Override - public NodeRef createRecordCategory(NodeRef parent, String name) - { - return getFilePlanService().createRecordCategory(parent, name); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)} - */ - public NodeRef createRecordCategory(NodeRef parent, String name, Map properties) - { - return getFilePlanService().createRecordCategory(parent, name, properties); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderDeclared(NodeRef)} - */ - @Override - public boolean isRecordFolderDeclared(NodeRef recordFolder) - { - return getRecordFolderService().isRecordFolderDeclared(recordFolder); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderClosed(NodeRef)} - */ - @Override - public boolean isRecordFolderClosed(NodeRef nodeRef) - { - return getRecordFolderService().isRecordFolderClosed(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName)} - */ - @Override - public NodeRef createRecordFolder(NodeRef parent, String name, QName type) - { - return getRecordFolderService().createRecordFolder(parent, name, type); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName, Map)} - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties) - { - return getRecordFolderService().createRecordFolder(rmContainer, name, type, properties); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String)} - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContrainer, String name) - { - return getRecordFolderService().createRecordFolder(rmContrainer, name); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map)} - */ - @Override - public NodeRef createRecordFolder(NodeRef parent, String name, Map properties) - { - return getRecordFolderService().createRecordFolder(parent, name, properties); - } - - /** - * @deprecated As of 2.2, see {@link RecordService#getRecords(NodeRef)} - */ - @Override - public List getRecords(NodeRef recordFolder) - { - return getRecordService().getRecords(recordFolder); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#getRecordFolders(NodeRef)} - */ - @Override - public List getRecordFolders(NodeRef record) - { - return getRecordFolderService().getRecordFolders(record); - } - - /** - * @deprecated As of 2.1, see {@link RecordService#getRecordMetaDataAspects()} - */ - @Override - public Set getRecordMetaDataAspects() - { - return getRecordService().getRecordMetaDataAspects(); - } - - /** - * @deprecated As of 2.1, see {@link RecordService#isDeclared(NodeRef)} - */ - @Override - public boolean isRecordDeclared(NodeRef nodeRef) - { - return getRecordService().isDeclared(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FreezeService#isHold(NodeRef)} - */ - @Override - public boolean isHold(NodeRef nodeRef) - { - return getFreezeService().isHold(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FreezeService#isFrozen(NodeRef)} - */ - @Override - public boolean isFrozen(NodeRef nodeRef) - { - return getFreezeService().isFrozen(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FreezeService#hasFrozenChildren(NodeRef)} - */ - @Override - public boolean hasFrozenChildren(NodeRef nodeRef) - { - return getFreezeService().hasFrozenChildren(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link RecordService#isRecord(NodeRef)} - */ - @Override - public boolean isRecord(NodeRef nodeRef) - { - return getRecordService().isRecord(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java deleted file mode 100644 index a9edb0041c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Deprecated records management audit interface methods. - * - * @author Roy Wetherall - * @since 2.1 - * @deprecated as of 2.1, see {@link RecordsManagementAuditService}. - */ -@AlfrescoPublicApi -public interface RecordsManagementAuditServiceDeprecated -{ - /** - * @deprecated as of 2.1, see {@link RecordsManagementAuditService#stopAuditLog(NodeRef)} - */ - @Deprecated - void stop(); - - /** - * @deprecated as of 2.1, see {@link RecordsManagementAuditService#clearAuditLog(NodeRef)} - */ - @Deprecated - void clear(); - - /** - * @deprecated as of 2.1, see {@link RecordsManagementAuditService#isAuditLogEnabled(NodeRef)} - */ - @Deprecated - boolean isEnabled(); - - /** - * @deprecated as of 2.1, see {@link RecordsManagementAuditService#getDateAuditLogLastStarted(NodeRef)} - */ - @Deprecated - Date getDateLastStarted(); - - /** - * @deprecated as of 2.1, see {@link RecordsManagementAuditService#getDateLastStopped()} - */ - Date getDateLastStopped(); - - /** - * @deprecated as of 2.1 - */ - @Deprecated - void auditRMAction(RecordsManagementAction action, NodeRef nodeRef, Map parameters); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java deleted file mode 100644 index 0bb513792e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/* package scope */ final class PivotUtil -{ - private PivotUtil() - { - // Will not be called - } - - static Map> getPivot(Map> source) - { - - Map> pivot = new HashMap<>(); - - for (Map.Entry> entry : source.entrySet()) - { - Listvalues = entry.getValue(); - for (String value : values) - { - String authority = entry.getKey(); - if (pivot.containsKey(value)) - { - // already exists - List list = pivot.get(value); - list.add(authority ); - } - else - { - // New value - List list = new ArrayList<>(); - list.add(authority); - pivot.put(value, list); - } - } - } - - return pivot; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java deleted file mode 100644 index 8c1784cfe4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.File; -import java.io.InputStream; -import java.util.List; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -public interface RMCaveatConfigComponent -{ - void init(); - - /** - * Get allowed values for given caveat list (for current user) - * - * @param constraintName - * @return - */ - List getRMAllowedValues(String constraintName); - - /** - * Get custom caveat models - * - * @return - */ - List getRMCaveatModels(); - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - boolean hasAccess(NodeRef nodeRef); - - /** - * Get RM constraint list - * - * @param listName the name of the RMConstraintList - */ - RMConstraintInfo getRMConstraint(String listName); - - /** - * Add RM constraint - */ - void addRMConstraint(String listName); - - /** - * Add RM constraint value for given authority - */ - void addRMConstraintListValue(String listName, String authorityName, String value); - - /** - * Update RM constraint values for given authority - */ - void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues); - - /** - * Update RM constraint authorities for given value - */ - void updateRMConstraintListValue(String listName, String valueName, Listauthorities); - - /** - * Remove RM constraint value (all authorities) - */ - void removeRMConstraintListValue(String listName, String valueName); - - /** - * Remove RM constraint authority (all values) - */ - void removeRMConstraintListAuthority(String listName, String authorityName); - - /** - * Delete RM Constraint - * - * @param listName the name of the RMConstraintList - */ - void deleteRMConstraint(String listName); - - /** - * Get the details of a caveat list - * @param listName - * @return - */ - Map> getListDetails(String listName); - - NodeRef updateOrCreateCaveatConfig(File jsonFile); - - NodeRef updateOrCreateCaveatConfig(String jsonString); - - NodeRef updateOrCreateCaveatConfig(InputStream is); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java deleted file mode 100644 index bbde6e14ed..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java +++ /dev/null @@ -1,1144 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import static org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace; - -import java.io.File; -import java.io.InputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import net.sf.acegisecurity.AccessDeniedException; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.content.ContentServicePolicies; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.dictionary.Constraint; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -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.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.JSONtoFmModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * RM Caveat Config component impl - * - * @author janv - */ -@BehaviourBean(defaultType = "rma:caveatConfig") -public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnContentUpdatePolicy, - NodeServicePolicies.BeforeDeleteNodePolicy, - NodeServicePolicies.OnCreateNodePolicy, - RMCaveatConfigComponent -{ - private static Log logger = LogFactory.getLog(RMCaveatConfigComponentImpl.class); - - private ContentService contentService; - private DictionaryService dictionaryService; - private NamespaceService namespaceService; - private AuthorityService authorityService; - private PersonService personService; - private NodeService nodeService; - - // Default - private StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private List caveatAspectURINames = new ArrayList<>(0); - private List caveatAspectQNames = new ArrayList<>(0); - - private List caveatModelURINames = new ArrayList<>(0); - private List caveatModelQNames = new ArrayList<>(0); - - private static final String CAVEAT_CONFIG_NAME = "caveatConfig.json"; - - private static final QName DATATYPE_TEXT = DataTypeDefinition.TEXT; - - /** - * Lock objects - */ - private ReadWriteLock lock = new ReentrantReadWriteLock(); - private Lock readLock = lock.readLock(); - private Lock writeLock = lock.writeLock(); - - /* - * Caveat Config (Shared) config - * first string is property name - * second string is authority name (user or group full name) - * third string is list of values of property - */ - private SimpleCache>> caveatConfig; - - public void setCaveatConfig(SimpleCache>> caveatConfig) - { - this.caveatConfig = caveatConfig; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - public void setStoreRef(String storeRef) - { - this.storeRef = new StoreRef(storeRef); - } - - public void setCaveatAspects(List caveatAspectNames) - { - this.caveatAspectURINames = caveatAspectNames; - } - - public void setCaveatModels(List caveatModelNames) - { - this.caveatModelURINames = caveatModelNames; - } - - /** - * Initialise behaviours and caveat config cache - */ - public void init() - { - if (caveatAspectURINames.size() > 0) - { - for (String caveatAspectURIName : caveatAspectURINames) - { - caveatAspectQNames.add(QName.createQName(caveatAspectURIName)); - } - - if (logger.isInfoEnabled()) - { - logger.info("Caveat aspects configured "+caveatAspectQNames); - } - } - else - { - logger.warn("No caveat aspects configured - caveats will not be applied"); - } - - if (caveatModelURINames.size() > 0) - { - for (String caveatModelURIName : caveatModelURINames) - { - caveatModelQNames.add(QName.createQName(caveatModelURIName)); - } - - if (logger.isInfoEnabled()) - { - logger.info("Caveat models configured "+caveatModelQNames); - } - } - else - { - logger.info("No caveat models configured - all models will be checked"); - } - - NodeRef caveatConfigNodeRef = getCaveatConfigNode(); - if (caveatConfigNodeRef != null) - { - validateAndReset(caveatConfigNodeRef); - } - } - - /** - * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) - * RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onContentUpdate(NodeRef nodeRef, boolean newContent) - { - if (logger.isInfoEnabled()) - { - logger.info("onContentUpdate: "+nodeRef+", "+newContent); - } - - validateAndReset(nodeRef); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS) - public void beforeDeleteNode(NodeRef nodeRef) - { - if (logger.isInfoEnabled()) - { - logger.info("beforeDeleteNode: "+nodeRef); - } - - validateAndReset(nodeRef); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - if (logger.isInfoEnabled()) - { - logger.info("onCreateNode: "+childAssocRef); - } - - validateAndReset(childAssocRef.getChildRef()); - } - - /** - * Validate the caveat config and optionally update the cache. - * - * @param nodeRef The nodeRef of the config - */ - @SuppressWarnings("unchecked") - protected void validateAndReset(NodeRef nodeRef) - { - ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - if (cr != null) - { - // TODO - check who can change caveat config ! - // TODO - locking (or checkout/checkin) - - String caveatConfigData = cr.getContentString(); - if (caveatConfigData != null) - { - NodeRef existing = getCaveatConfigNode(); - if ((existing != null && (! existing.equals(nodeRef)))) - { - throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing="+existing+", new="+nodeRef+")"); - } - - try - { - if (logger.isTraceEnabled()) - { - logger.trace(caveatConfigData); - } - - Set models = new HashSet<>(1); - Set props = new HashSet<>(10); - Set expectedPrefixes = new HashSet<>(10); - - if (caveatModelQNames.size() > 0) - { - models.addAll(caveatModelQNames); - } - else - { - models.addAll(dictionaryService.getAllModels()); - } - - if (logger.isTraceEnabled()) - { - logger.trace("validateAndReset: models to check "+models); - } - - for (QName model : models) - { - props.addAll(dictionaryService.getProperties(model, DATATYPE_TEXT)); - expectedPrefixes.addAll(namespaceService.getPrefixes(model.getNamespaceURI())); - } - - if (props.size() == 0) - { - logger.warn("validateAndReset: no caveat properties found"); - } - else - { - if (logger.isTraceEnabled()) - { - logger.trace("validateAndReset: properties to check "+props); - } - } - - Map caveatConfigMap = JSONtoFmModel.convertJSONObjectToMap(caveatConfigData); - - for (Map.Entry conEntry : caveatConfigMap.entrySet()) - { - String conStr = conEntry.getKey(); - - QName conQName = QName.resolveToQName(namespaceService, conStr); - - // check prefix - String conPrefix = QName.splitPrefixedQName(conStr)[0]; - boolean prefixFound = false; - for (String expectedPrefix : expectedPrefixes) - { - if (conPrefix.equals(expectedPrefix)) - { - prefixFound = true; - } - } - - if (! prefixFound) - { - throw new AlfrescoRuntimeException("Unexpected prefix: "+ conPrefix + " (" + conStr +") expected one of "+expectedPrefixes+")"); - } - - Map> caveatMap = (Map>)conEntry.getValue(); - - List allowedValues = null; - @SuppressWarnings("unused") - boolean found = false; - - for (QName propertyName : props) - { - PropertyDefinition propDef = dictionaryService.getProperty(propertyName); - List conDefs = propDef.getConstraints(); - for (ConstraintDefinition conDef : conDefs) - { - final Constraint con = conDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - String conName = ((RMListOfValuesConstraint)con).getShortName(); - if (conName.equals(conStr)) - { - // note: assumes only one caveat/LOV against a given property - allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return ((RMListOfValuesConstraint)con).getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - found = true; - break; - } - } - } - } - - if (allowedValues != null) - { - if (logger.isInfoEnabled()) - { - logger.info("Processing constraint: "+conQName); - } - - for (Map.Entry> caveatEntry : caveatMap.entrySet()) - { - String authorityName = caveatEntry.getKey(); - List caveatList = caveatEntry.getValue(); - - // validate authority (user or group) - note: groups are configured with fullname (ie. GROUP_xxx) - if ((! authorityService.authorityExists(authorityName) && ! personService.personExists(authorityName))) - { - // TODO - review warnings (& I18N) - String msg = "User/group does not exist: "+authorityName+" (constraint="+conStr+")"; - logger.warn(msg); - } - - // validate caveat list - for (String value : caveatList) - { - if (! allowedValues.contains(value)) - { - // TODO - review warnings (& add I18N) - String msg = "Invalid value in list: "+value+" (authority="+authorityName+", constraint="+conStr+")"; - logger.warn(msg); - } - } - } - } - } - - try - { - writeLock.lock(); - // we can't just clear the cache, as all puts to the cache afterwards in this transaction will be ignored - // first delete all keys that are now not in the config - caveatConfig.getKeys().retainAll(caveatConfigMap.keySet()); - - for (Map.Entry conEntry : caveatConfigMap.entrySet()) - { - String conStr = conEntry.getKey(); - Map> caveatMap = (Map>)conEntry.getValue(); - - Map> cacheValue = caveatConfig.get(conStr); - if (cacheValue == null || !cacheValue.equals(caveatMap)) - { - // update the cache - caveatConfig.put(conStr, caveatMap); - } - } - } - finally - { - writeLock.unlock(); - } - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Invalid caveat config syntax: "+e); - } - } - } - } - - private NodeRef getCaveatConfigNode() - { - NodeRef rootNode = nodeService.getRootNode(storeRef); - return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_CAVEAT_CONFIG, CAVEAT_CONFIG_NAME); - } - - - public NodeRef updateOrCreateCaveatConfig(InputStream is) - { - NodeRef caveatConfig = getOrCreateCaveatConfig(); - - // Update the content - ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(is); - - return caveatConfig; - } - - public NodeRef updateOrCreateCaveatConfig(File jsonFile) - { - NodeRef caveatConfig = getOrCreateCaveatConfig(); - - // Update the content - ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(jsonFile); - - return caveatConfig; - } - - public NodeRef updateOrCreateCaveatConfig(String jsonString) - { - NodeRef caveatConfig = getOrCreateCaveatConfig(); - - // Update the content - ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(jsonString); - - return caveatConfig; - } - - private NodeRef getOrCreateCaveatConfig() - { - NodeRef caveatConfig = getCaveatConfigNode(); - if (caveatConfig == null) - { - NodeRef rootNode = nodeService.getRootNode(storeRef); - nodeService.addAspect(rootNode, VersionModel.ASPECT_VERSION_STORE_ROOT, null); - - // Create caveat config - caveatConfig = nodeService.createNode(rootNode, - RecordsManagementModel.ASSOC_CAVEAT_CONFIG, - QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME), - RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef(); - - nodeService.setProperty(caveatConfig, ContentModel.PROP_NAME, CAVEAT_CONFIG_NAME); - } - - return caveatConfig; - } - - // Get list of all caveat qualified names - public Collection getRMConstraintNames() - { - Collection rmConstraintNames = Collections.emptySet(); - try - { - readLock.lock(); - rmConstraintNames = caveatConfig.getKeys(); - } - finally - { - readLock.unlock(); - } - return Collections.unmodifiableCollection(rmConstraintNames); - } - - // Get allowed values for given caveat (for current user) - public List getRMAllowedValues(String constraintName) - { - List allowedValues = new ArrayList<>(0); - - String userName = AuthenticationUtil.getRunAsUser(); - if (userName != null && !(AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser())) - { - // note: userName and userGroupNames must not be null - caveatConfig.get(constraintName); - - Set userGroupFullNames = authorityService.getAuthoritiesForUser(userName); - allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName); - } - - return allowedValues; - } - - private List getRMAllowedValues(String userName, Set userGroupFullNames, String constraintName) - { - SetallowedValues = new HashSet<>(); - - // note: userName and userGroupNames must not be null - Map> caveatConstraintDef = null; - try - { - readLock.lock(); - caveatConstraintDef = caveatConfig.get(constraintName); - } - finally - { - readLock.unlock(); - } - - if (caveatConstraintDef != null) - { - List direct = caveatConstraintDef.get(userName); - if(direct != null) - { - allowedValues.addAll(direct); - } - - for (String group : userGroupFullNames) - { - List values = caveatConstraintDef.get(group); - if(values != null) - { - allowedValues.addAll(values); - } - } - } - - Listret = new ArrayList<>(); - ret.addAll(allowedValues); - return Collections.unmodifiableList(ret); - } - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - @SuppressWarnings("unchecked") - public boolean hasAccess(NodeRef nodeRef) - { - try - { - if ((! nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0)) - { - return true; - } - - boolean found = false; - for (QName caveatAspectQName : caveatAspectQNames) - { - if (nodeService.hasAspect(nodeRef, caveatAspectQName)) - { - found = true; - break; - } - } - - if (! found) - { - // no caveat aspect - return true; - } - else - { - // check for caveats - String userName = AuthenticationUtil.getRunAsUser(); - if (userName != null) - { - // check all text properties - Map props = nodeService.getProperties(nodeRef); - for (Map.Entry entry : props.entrySet()) - { - QName propName = entry.getKey(); - PropertyDefinition propDef = dictionaryService.getProperty(propName); - - if ((propDef != null) && (propDef.getDataType().getName().equals(DATATYPE_TEXT))) - { - List conDefs = propDef.getConstraints(); - for (ConstraintDefinition conDef : conDefs) - { - Constraint con = conDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint)con); - String conName = rmCon.getShortName(); - MatchLogic matchLogic = rmCon.getMatchLogicEnum(); - Map> caveatConstraintDef = caveatConfig.get(conName); - if (caveatConstraintDef == null) - { - continue; - } - else - { - Set userGroupNames = authorityService.getAuthoritiesForUser(userName); - List allowedValues = getRMAllowedValues(userName, userGroupNames, conName); - - List propValues = null; - Object val = entry.getValue(); - if (val instanceof String) - { - propValues = new ArrayList<>(1); - propValues.add((String)val); - } - else if (val instanceof List) - { - propValues = (List)val; - } - - if (propValues != null && !isAllowed(propValues, allowedValues, matchLogic)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Veto access: caveat="+conName+", userName="+userName+", nodeRef="+nodeRef+", propName="+propName+", propValues="+propValues+", allowedValues="+allowedValues); - } - return false; - } - } - } - } - } - } - } - - return true; - } - } - catch (AccessDeniedException ade) - { - return false; - } - } - - private boolean isAllowed(List propValues, List userGroupValues, MatchLogic matchLogic) - { - if (matchLogic.equals(MatchLogic.AND)) - { - // check user/group values match all values on node - for (String propValue : propValues) - { - if (! userGroupValues.contains(propValue)) - { - if (logger.isTraceEnabled()) - { - logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic); - } - - return false; - } - } - - return true; - } - else if (matchLogic.equals(MatchLogic.OR)) - { - // check user/group values match at least one value on node - for (String propValue : propValues) - { - if (userGroupValues.contains(propValue)) - { - return true; - } - } - - if (logger.isTraceEnabled()) - { - logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic); - } - - return false; - } - - logger.error("Unexpected match logic type: "+matchLogic); - return false; - } - - /** - * Add a single value to an authority in a list. The existing values of the list remain. - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param value - * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. - */ - public void addRMConstraintListValue(String listName, String authorityName, String value) - { - Map> members = null; - try - { - readLock.lock(); - members = caveatConfig.get(listName); - if(members == null) - { - throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName); - } - - try - { - readLock.unlock(); - writeLock.lock(); - // check again - members = caveatConfig.get(listName); - if(members == null) - { - throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName); - } - - List values = members.get(authorityName); - if(values == null) - { - throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: "+ listName + " authorityName:" +authorityName); - } - values.add(value); - - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - readLock.lock(); - writeLock.unlock(); - } - - } - finally - { - readLock.unlock(); - } - } - - /** - * Get the member details of the specified list - * @param listName - * @return the details of the specified list - */ - public Map> getListDetails(String listName) - { - Map> listDetails = null; - try - { - readLock.lock(); - listDetails = caveatConfig.get(listName); - } - finally - { - readLock.unlock(); - } - if (listDetails == null) - { - return Collections.emptyMap(); - } - else - { - return Collections.unmodifiableMap(listDetails); - } - } - - public List getRMCaveatModels() - { - return caveatModelQNames; - } - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - public void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues) - { - Map> members = null; - try - { - writeLock.lock(); - members = caveatConfig.get(listName); - if(members == null) - { - // Create the new list, with the authority name - Map> constraint = new HashMap<>(0); - constraint.put(authorityName, new ArrayList<>(values)); - members = constraint; - } - else - { - members.put(authorityName, new ArrayList<>(values)); - } - - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } - - /** - * Replace the authorities for a value in a list - * - * @param listName - * @param valueName - * @param authorities - */ - public void updateRMConstraintListValue(String listName, String valueName, Listauthorities) - { - - Map> members = caveatConfig.get(listName); - try - { - writeLock.lock(); - - if(members == null) - { - // Members List does not exist - Map> emptyConstraint = new HashMap<>(0); - caveatConfig.put(listName, emptyConstraint); - members = emptyConstraint; - - } - // authorities contains authority, values[] - // pivot contains value, members[] - Map> pivot = PivotUtil.getPivot(members); - - // remove all authorities which have this value - List existingAuthorities = pivot.get(valueName); - if(existingAuthorities != null) - { - for(String authority : existingAuthorities) - { - List vals = members.get(authority); - vals.remove(valueName); - } - } - // add the new authorities for this value - for(String authority : authorities) - { - List vals = members.get(authority); - if(vals == null) - { - vals= new ArrayList<>(); - members.put(authority, vals); - } - vals.add(valueName); - } - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } - - public void removeRMConstraintListValue(String listName, String valueName) - { - Map> members = null; - try - { - readLock.lock(); - - members = caveatConfig.get(listName); - if (members != null) - { - try - { - readLock.unlock(); - writeLock.lock(); - // check again - members = caveatConfig.get(listName); - if (members != null) - { - // authorities contains authority, values[] - // pivot contains value, members[] - Map> pivot = PivotUtil.getPivot(members); - - // remove all authorities which have this value - List existingAuthorities = pivot.get(valueName); - if(existingAuthorities != null) - { - for(String authority : existingAuthorities) - { - List vals = members.get(authority); - vals.remove(valueName); - } - caveatConfig.put(listName, members); - } - } - - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - readLock.lock(); - writeLock.unlock(); - } - } - } - finally - { - readLock.unlock(); - } - } - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - */ - public void removeRMConstraintListAuthority(String listName, String authorityName) - { - Map> members = null; - try - { - writeLock.lock(); - members = caveatConfig.get(listName); - if(members != null) - { - members.remove(listName); - } - - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - - } - finally - { - writeLock.unlock(); - } -} - - /** - * @param config the configuration to convert - * @return a String containing the JSON representation of the configuration. - */ - private String convertToJSONString(SimpleCache>> config) - { - JSONObject configJSONObject = new JSONObject(); - - Collection listNames = config.getKeys(); - for (String listName : listNames) - { - Map> members = config.get(listName); - JSONObject listMembers = new JSONObject(); - - for (Map.Entry> member : members.entrySet()) - { - final String authorityName = member.getKey(); - final List authorities = member.getValue(); - try - { - listMembers.put(authorityName, authorities); - } - 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(getStackTrace(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(getStackTrace(error)); - throw new AlfrescoRuntimeException(sb.toString()); - } - } - - return configJSONObject.toString(); - } - - /** - * Get an RMConstraintInfo - * @param listQName - * @return the constraint or null if it does not exist - */ - public RMConstraintInfo getRMConstraint(QName listQName) - { - ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); - if(dictionaryDef != null) - { - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - - RMConstraintInfo info = new RMConstraintInfo(); - info.setName(listQName.toPrefixString()); - info.setTitle(con.getTitle()); - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); - info.setCaseSensitive(def.isCaseSensitive()); - return info; - } - } - return null; - } - - /** - * Get RM Constraint detail. - * - * @return the constraintInfo or null - */ - public RMConstraintInfo getRMConstraint(String listName) - { - QName listQName = QName.createQName(listName, namespaceService); - return getRMConstraint(listQName); - } - - public void deleteRMConstraint(String listName) - { - try - { - writeLock.lock(); - caveatConfig.remove(listName); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } - - public void addRMConstraint(String listName) - { - try - { - writeLock.lock(); - Map> emptyConstraint = new HashMap<>(0); - caveatConfig.put(listName, emptyConstraint); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java deleted file mode 100644 index 6edb31cd13..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.File; -import java.io.InputStream; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; - -public interface RMCaveatConfigService -{ - void init(); - - /** - * Get allowed values for given caveat list (for current user) - * @param constraintName - * @return - */ - List getRMAllowedValues(String constraintName); - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - boolean hasAccess(NodeRef nodeRef); - - /* - * Get a single RM constraint - */ - RMConstraintInfo getRMConstraint(String listName); - - /* - * Get the names of all the caveat lists - */ - Set getAllRMConstraints(); - - /** - * Get the details of a caveat list - * @param listName - * @return - */ - Map> getListDetails(String listName); - - NodeRef updateOrCreateCaveatConfig(File jsonFile); - - NodeRef updateOrCreateCaveatConfig(String jsonString); - - NodeRef updateOrCreateCaveatConfig(InputStream is); - - /** - * add RM constraint list - * @param listName the name of the RMConstraintList - * @param listTitle - */ - RMConstraintInfo addRMConstraint(String listName, String listTitle, String[] allowedValues); - - /** - * update RM constraint list allowed values - * @param listName the name of the RMConstraintList - can not be changed - * @param allowedValues - */ - RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues); - - /** - * update RM constraint Title - * @param listName the name of the RMConstraintList - can not be changed - * @param newTitle the new value for the title constraint - */ - RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle); - - - /** - * delete RM Constraint - * - * @param listName the name of the RMConstraintList - */ - void deleteRMConstraint(String listName); - - /** - * Add a single value to an authority in a list. The existing values of the list remain. - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param value - * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. - */ - void addRMConstraintListValue(String listName, String authorityName, String value); - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues); - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - */ - void removeRMConstraintListAuthority(String listName, String authorityName); - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param value - * @param authorities - */ - void updateRMConstraintListValue(String listName, String value, Listauthorities); - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param valueName - */ - void removeRMConstraintListValue(String listName, String valueName); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java deleted file mode 100644 index 7d8cc4f22b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.File; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -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; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * RM Caveat Config Service impl - * - * @author janv - */ -public class RMCaveatConfigServiceImpl implements RMCaveatConfigService -{ - private static Log logger = LogFactory.getLog(RMCaveatConfigServiceImpl.class); - - private NamespaceService namespaceService; - private DictionaryService dictionaryService; - - private RMCaveatConfigComponent rmCaveatConfigComponent; - private RecordsManagementAdminService recordsManagementAdminService; - - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setCaveatConfigComponent(RMCaveatConfigComponent rmCaveatConfigComponent) - { - this.rmCaveatConfigComponent = rmCaveatConfigComponent; - } - - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - public RecordsManagementAdminService getRecordsManagementAdminService() - { - return recordsManagementAdminService; - } - - public void init() - { - rmCaveatConfigComponent.init(); - } - - public NodeRef updateOrCreateCaveatConfig(InputStream is) - { - return rmCaveatConfigComponent.updateOrCreateCaveatConfig(is); - } - - public NodeRef updateOrCreateCaveatConfig(File jsonFile) - { - return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonFile); - } - - public NodeRef updateOrCreateCaveatConfig(String jsonString) - { - return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonString); - } - - // Get allowed values for given caveat (for current user) - public List getRMAllowedValues(String constraintName) - { - return rmCaveatConfigComponent.getRMAllowedValues(constraintName); - } - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - public boolean hasAccess(NodeRef nodeRef) - { - return rmCaveatConfigComponent.hasAccess(nodeRef); - } - - /** - * add RM constraint list - * @param listName the name of the RMConstraintList - */ - public RMConstraintInfo addRMConstraint(String listName, String title, String[] values) - { - return addRMConstraint(listName, title, values, MatchLogic.AND); - } - - public RMConstraintInfo addRMConstraint(String listName, String title, String[] values, MatchLogic matchLogic) - { - 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(); - } - - ListallowedValues = new ArrayList<>(); - for(String value : values) - { - allowedValues.add(value); - } - - QName listQName = QName.createQName(listName, namespaceService); - - // TEMP review - if it already exists then change it for now - try - { - recordsManagementAdminService.addCustomConstraintDefinition(listQName, title, true, allowedValues, matchLogic); - } - catch (AlfrescoRuntimeException e) - { - if (e.getMessage().contains("Constraint already exists")) - { - recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValues); - recordsManagementAdminService.changeCustomConstraintTitle(listQName, title); - } - } - - rmCaveatConfigComponent.addRMConstraint(listName); - - RMConstraintInfo info = new RMConstraintInfo(); - info.setName(listQName.toPrefixString()); - info.setTitle(title); - info.setAllowedValues(values); - info.setCaseSensitive(true); - return info; - } - - /** - * delete RM Constraint List - * - * @param listName the name of the RMConstraintList - */ - public void deleteRMConstraint(String listName) - { - rmCaveatConfigComponent.deleteRMConstraint(listName); - - QName listQName = QName.createQName(listName, namespaceService); - - recordsManagementAdminService.removeCustomConstraintDefinition(listQName); - } - - /** - * Add a single value to an authority in a list. The existing values of the list remain. - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param value - * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. - */ - public void addRMConstraintListValue(String listName, String authorityName, String value) - { - rmCaveatConfigComponent.addRMConstraintListValue(listName, authorityName, value); - } - - /** - * Get the details of the specified list - * @param listName - * @return the details of the specified list - */ - public Map> getListDetails(String listName) - { - return rmCaveatConfigComponent.getListDetails(listName); - } - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - public void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues) - { - rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values); - } - - /** - * Replace the authorities for a value in a list - * - * @param listName - * @param valueName - * @param authorities - */ - public void updateRMConstraintListValue(String listName, String valueName, Listauthorities) - { - rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities); - } - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - */ - public void removeRMConstraintListAuthority(String listName, String authorityName) - { - rmCaveatConfigComponent.removeRMConstraintListAuthority(listName, authorityName); - } - - /** - * Get all Constraint Lists - */ - public Set getAllRMConstraints() - { - Set info = new HashSet<>(); - - List defs = new ArrayList<>(10); - for (QName caveatModelQName : rmCaveatConfigComponent.getRMCaveatModels()) - { - defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName)); - } - - for(ConstraintDefinition dictionaryDef : defs) - { - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - RMConstraintInfo i = new RMConstraintInfo(); - i.setName(def.getShortName()); - i.setTitle(def.getTitle()); - - // note: assumes only one caveat/LOV against a given property - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - i.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); - i.setCaseSensitive(def.isCaseSensitive()); - info.add(i); - } - - } - - return info; - } - - /** - * Get an RMConstraintInfo - * @param listQName - * @return the constraint or null if it does not exist - */ - public RMConstraintInfo getRMConstraint(QName listQName) - { - ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); - if(dictionaryDef != null) - { - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - - RMConstraintInfo info = new RMConstraintInfo(); - info.setName(listQName.toPrefixString()); - info.setTitle(con.getTitle()); - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); - info.setCaseSensitive(def.isCaseSensitive()); - return info; - } - } - return null; - } - - /** - * Get RM Constraint detail. - * - * @return the constraintInfo or null - */ - public RMConstraintInfo getRMConstraint(String listName) - { - QName listQName = QName.createQName(listName, namespaceService); - return getRMConstraint(listQName); - - } - - /** - * Update The allowed values for an RM Constraint. - * - * @param listName The name of the list. - * @param allowedValues the new alowed values - * - */ - public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues) - { - QName listQName = QName.createQName(listName, namespaceService); - - if(allowedValues != null) - { - ListallowedValueList = new ArrayList<>(); - for(String value : allowedValues) - { - allowedValueList.add(value); - } - - ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - List oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - /** - * Deal with any additions - */ - for(String newValue : allowedValueList) - { - if(!oldAllowedValues.contains(newValue) && logger.isDebugEnabled()) - { - // This is an addition - logger.debug("value added to list:" + listQName + ":" + newValue); - } - } - - /** - * Deal with any deletions - */ - for(String oldValue : oldAllowedValues) - { - if(!allowedValueList.contains(oldValue)) - { - // This is a deletion - if(logger.isDebugEnabled()) - { - logger.debug("value removed from list:" + listQName + ":" + oldValue); - } - removeRMConstraintListValue(listName, oldValue); - } - } - } - - recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValueList); - } - - return getRMConstraint(listName); - } - - /** - * Remove a value from a list and cascade delete. - */ - public void removeRMConstraintListValue(String listName, String valueName) - { - //TODO need to update the rm constraint definition - // recordsManagementAdminService. - - rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName); - } - - /** - * Update the title of this RM Constraint. - */ - public RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle) - { - QName listQName = QName.createQName(listName, namespaceService); - - recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle); - return getRMConstraint(listName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java deleted file mode 100644 index 839c58ea8d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.util.Arrays; - -public class RMConstraintInfo -{ - private String name; - private String title; - private boolean caseSensitive; - private String[] allowedValues; - - public void setName(String name) - { - this.name = name; - } - public String getName() - { - return name; - } - public void setTitle(String title) - { - this.title = title; - } - public String getTitle() - { - return title; - } - public void setCaseSensitive(boolean caseSensitive) - { - this.caseSensitive = caseSensitive; - } - public boolean isCaseSensitive() - { - return caseSensitive; - } - public void setAllowedValues(String[] values) - { - this.allowedValues = values.clone(); - } - public String[] getAllowedValues() - { - return allowedValues; - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(); - builder.append("RMConstraintInfo [name="); - builder.append(this.name); - builder.append(", title="); - builder.append(this.title); - builder.append(", caseSensitive="); - builder.append(this.caseSensitive); - builder.append(", allowedValues="); - builder.append(Arrays.toString(this.allowedValues)); - builder.append("]"); - return builder.toString(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java deleted file mode 100644 index b977ca7c70..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -/** - * A class to hold I18N keys for messages related to constraint validation. - * - * @author tpage - */ -public class RMConstraintMessageKeys -{ - public static final String ERR_NON_STRING = "d_dictionary.constraint.string_length.non_string"; - public static final String ERR_INVALID_VALUE = "d_dictionary.constraint.list_of_values.invalid_value"; -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java deleted file mode 100644 index 6915dded50..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.dictionary.ConstraintException; -import org.alfresco.service.cmr.i18n.MessageLookup; -import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; -import org.alfresco.service.cmr.repository.datatype.TypeConversionException; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * RM Constraint implementation that ensures the value is one of a constrained - * list of values. By default, this constraint is case-sensitive. - * - * @see #setAllowedValues(List) - * @see #setCaseSensitive(boolean) - * - * @author janv - */ -public class RMListOfValuesConstraint extends ListOfValuesConstraint -{ - private static final String LOV_CONSTRAINT_VALUE = "listconstraint"; - private List allowedValues; - private List allowedValuesUpper; - // defined match logic used by caveat matching (default = "AND") - private MatchLogic matchLogic = MatchLogic.AND; - - public enum MatchLogic - { - // closed marking - all values must match - AND, - // open marking - at least one value must match - OR - } - - // note: alternative to static init could be to use 'registered' constraint - private static RMCaveatConfigService caveatConfigService; - - public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) - { - RMListOfValuesConstraint.caveatConfigService = caveatConfigService; - } - - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(80); - sb.append("RMListOfValuesConstraint") - .append("[allowedValues=").append(getAllowedValues()) - .append(", caseSensitive=").append(isCaseSensitive()) - .append(", sorted=").append(isSorted()) - .append(", matchLogic=").append(getMatchLogic()) - .append("]"); - return sb.toString(); - } - - public RMListOfValuesConstraint() - { - super(); - - // Set RM list of value constraints to be sorted by default - sorted = true; - } - - /** - * Get the allowed values. Note that these are String instances, but may - * represent non-String values. It is up to the caller to distinguish. - * - * @return Returns the values allowed - */ - @Override - public List getRawAllowedValues() - { - String runAsUser = AuthenticationUtil.getRunAsUser(); - if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null)) - { - // get allowed values for current user - List allowedForUser = caveatConfigService.getRMAllowedValues(getShortName()); - - List filteredList = new ArrayList<>(allowedForUser.size()); - for (String allowed : allowedForUser) - { - if (this.allowedValues.contains(allowed)) - { - filteredList.add(allowed); - } - } - - return filteredList; - } - else - { - return this.allowedValues; - } - } - - public String getDisplayLabel(String constraintAllowableValue, MessageLookup messageLookup) - { - if (!this.allowedValues.contains(constraintAllowableValue)) - { - return null; - } - - String key = LOV_CONSTRAINT_VALUE; - key += "." + this.getShortName(); - key += "." + constraintAllowableValue; - key = StringUtils.replace(key, ":", "_"); - - String message = messageLookup.getMessage(key, I18NUtil.getLocale()); - return message == null ? constraintAllowableValue : message; - } - - private List getAllowedValuesUpper() - { - String runAsUser = AuthenticationUtil.getRunAsUser(); - if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null)) - { - // get allowed values for current user - List allowedForUser = caveatConfigService.getRMAllowedValues(getType()); - - List filteredList = new ArrayList<>(allowedForUser.size()); - for (String allowed : allowedForUser) - { - if (this.allowedValuesUpper.contains(allowed.toUpperCase())) - { - filteredList.add(allowed); - } - } - - return filteredList; - } - else - { - return this.allowedValuesUpper; - } - } - /** - * Set the values that are allowed by the constraint. - * - * @param allowedValues a list of allowed values - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void setAllowedValues(List allowedValues) - { - if (allowedValues == null) - { - allowedValues = new ArrayList(0); - } - int valueCount = allowedValues.size(); - this.allowedValues = Collections.unmodifiableList(allowedValues); - - // make the upper case versions - this.allowedValuesUpper = new ArrayList<>(valueCount); - for (String allowedValue : this.allowedValues) - { - allowedValuesUpper.add(allowedValue.toUpperCase()); - } - } - - @Override - public void initialize() - { - checkPropertyNotNull("allowedValues", allowedValues); - } - - @Override - public Map getParameters() - { - Map params = new HashMap<>(2); - - params.put("caseSensitive", isCaseSensitive()); - params.put("allowedValues", getAllowedValues()); - params.put("sorted", isSorted()); - params.put("matchLogic", getMatchLogic()); - - return params; - } - - public MatchLogic getMatchLogicEnum() - { - return matchLogic; - } - - public String getMatchLogic() - { - return matchLogic.toString(); - } - - public void setMatchLogic(String matchLogicStr) - { - this.matchLogic = MatchLogic.valueOf(matchLogicStr); - } - - @Override - protected void evaluateSingleValue(Object value) - { - // convert the value to a String - String valueStr = null; - try - { - valueStr = DefaultTypeConverter.INSTANCE.convert(String.class, value); - } - catch (TypeConversionException e) - { - throw new ConstraintException(RMConstraintMessageKeys.ERR_NON_STRING, value, e); - } - // check that the value is in the set of allowed values - if (isCaseSensitive()) - { - if (!getAllowedValues().contains(valueStr)) - { - throw new ConstraintException(RMConstraintMessageKeys.ERR_INVALID_VALUE, value); - } - } - else - { - if (!getAllowedValuesUpper().contains(valueStr.toUpperCase())) - { - throw new ConstraintException(RMConstraintMessageKeys.ERR_INVALID_VALUE, value); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java deleted file mode 100644 index e8da870d99..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.Serializable; - - -public class ScriptAuthority implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = 1L; - private String authorityTitle; - private String authorityName; - - public void setAuthorityName(String authorityName) - { - this.authorityName = authorityName; - } - public String getAuthorityName() - { - return authorityName; - } - public void setAuthorityTitle(String authorityName) - { - this.authorityTitle = authorityName; - } - public String getAuthorityTitle() - { - return authorityTitle; - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java deleted file mode 100644 index 1ce27d7d1e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.service.cmr.security.AuthorityService; -import org.apache.commons.lang3.StringUtils; -import org.json.JSONArray; -import org.json.JSONObject; - -public class ScriptConstraint implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = 1L; - - private RMConstraintInfo info; - - private RMCaveatConfigService rmCaveatconfigService; - - private AuthorityService authorityService; - - ScriptConstraint(RMConstraintInfo info, RMCaveatConfigService rmCaveatconfigService, AuthorityService authorityService) - { - this.info = info; - this.rmCaveatconfigService = rmCaveatconfigService; - this.authorityService = authorityService; - } - - public void setTitle(String title) - { - info.setTitle(title); - } - public String getTitle() - { - return info.getTitle(); - } - public void setName(String name) - { - info.setName(name); - } - - public String getName() - { - return info.getName().replace(":", "_"); - } - - public boolean isCaseSensitive() - { - return info.isCaseSensitive(); - } - - public String[] getAllowedValues() - { - return info.getAllowedValues(); - } - - public ScriptConstraintAuthority[] getAuthorities() - { - Map> values = rmCaveatconfigService.getListDetails(info.getName()); - - if (values == null) - { - return new ScriptConstraintAuthority[0]; - } - - ArrayList constraints = new ArrayList<>(values.size()); - for (Map.Entry> entry : values.entrySet()) - { - ScriptConstraintAuthority constraint = new ScriptConstraintAuthority(); - constraint.setAuthorityName(entry.getKey()); - constraint.setValues(entry.getValue()); - constraints.add(constraint); - } - return constraints.toArray(new ScriptConstraintAuthority[constraints.size()]); - } - - /** - * updateTitle - */ - public void updateTitle(String newTitle) - { - info.setTitle(newTitle); - rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle) ; - } - - /** - * updateAllowedValues - */ - public void updateAllowedValues(String[] allowedValues) - { - info.setAllowedValues(allowedValues); - rmCaveatconfigService.updateRMConstraintAllowedValues(info.getName(), allowedValues); - } - - /** - * Update a value - * @param bodge - */ - public void updateValues(JSONArray bodge) throws Exception - { - for(int i = 0; i < bodge.length(); i++) - { - - JSONObject obj = bodge.getJSONObject(i); - String value = obj.getString("value"); - JSONArray authorities = obj.getJSONArray("authorities"); - List aList = new ArrayList<>(); - for(int j = 0; j < authorities.length();j++) - { - aList.add(authorities.getString(j)); - } - rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, aList); - } - } - - /** - * Update a value - * @param value - * @param authorities - */ - public void updateValues(String value, String[] authorities) - { - List list = Arrays.asList(authorities); - rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, list); - } - - /** - * Cascade delete an authority - * @param authority - */ - public void deleteAuthority(String authority) - { - //Do nothing - } - - /** - * Cascade delete a value - * @param value - */ - public void deleteValue(String value) - { - //Do nothing - } - - - /** - * Get a single value - * @param value - * @return - */ - public ScriptConstraintValue getValue(String value) - { - ScriptConstraintValue[] values = getValues(); - - for(ScriptConstraintValue val : values) - { - if(val.getValueName().equalsIgnoreCase(value)) - { - return val; - } - } - return null; - } - - public ScriptConstraintValue[] getValues() - { - // authority, values - Map> details = rmCaveatconfigService.getListDetails(info.getName()); - - if (details == null) - { - details = new HashMap<>(); - } - - // values, authorities - Map> pivot = PivotUtil.getPivot(details); - - ArrayList constraints = new ArrayList<>(pivot.size()); - for (Map.Entry> entry : pivot.entrySet()) - { - ScriptConstraintValue constraint = new ScriptConstraintValue(); - constraint.setValueName(entry.getKey()); - constraint.setValueTitle(entry.getKey()); - - List authorities = entry.getValue(); - List sauth = new ArrayList<>(); - for(String authority : authorities) - { - ScriptAuthority a = new ScriptAuthority(); - a.setAuthorityName(authority); - - String displayName = authorityService.getAuthorityDisplayName(authority); - if(StringUtils.isNotBlank(displayName)) - { - a.setAuthorityTitle(displayName); - } - else - { - a.setAuthorityTitle(authority); - } - sauth.add(a); - } - constraint.setAuthorities(sauth); - constraints.add(constraint); - } - - /** - * Now go through and add any "empty" values - */ - Set values = pivot.keySet(); - for(String value : info.getAllowedValues()) - { - if(!values.contains(value)) - { - ScriptConstraintValue constraint = new ScriptConstraintValue(); - constraint.setValueName(value); - constraint.setValueTitle(value); - List sauth = new ArrayList<>(); - constraint.setAuthorities(sauth); - constraints.add(constraint); - } - } - - return constraints.toArray(new ScriptConstraintValue[constraints.size()]); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java deleted file mode 100644 index 77915c2fec..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.Serializable; -import java.util.List; - -public class ScriptConstraintAuthority implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -4659454215122271811L; - private String authorityName; - private Listvalues; - - public void setValues(List values) - { - this.values = values; - } - public List getValues() - { - return values; - } - public void setAuthorityName(String authorityName) - { - this.authorityName = authorityName; - } - public String getAuthorityName() - { - return authorityName; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java deleted file mode 100644 index 39abcd8197..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.io.Serializable; -import java.util.List; - -public class ScriptConstraintValue implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -4659454215122271811L; - private String value; - private Listauthorities; - - public void setAuthorities(List values) - { - this.authorities = values; - } - public List getAuthorities() - { - return authorities; - } - public void setValueName(String authorityName) - { - this.value = authorityName; - } - public String getValueName() - { - return value; - } - public void setValueTitle(String authorityName) - { - this.value = authorityName; - } - public String getValueTitle() - { - return value; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java deleted file mode 100644 index 19edee12e4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.caveat; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.alfresco.repo.jscript.BaseScopableProcessorExtension; -import org.alfresco.service.cmr.security.AuthorityService; - -/** - * Script projection of RM Caveat Config Service - * - * @author Mark Rogers - */ -public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension -{ - private RMCaveatConfigService caveatConfigService; - private AuthorityService authorityService; - - public void setCaveatConfigService(RMCaveatConfigService rmCaveatConfigService) - { - this.caveatConfigService = rmCaveatConfigService; - } - - public RMCaveatConfigService getRmCaveatConfigService() - { - return caveatConfigService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public AuthorityService getAuthorityService() - { - return authorityService; - } - - public ScriptConstraint getConstraint(String listName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - - RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx); - - if(info != null) - { - return new ScriptConstraint(info, caveatConfigService, getAuthorityService()); - } - - return null; - } - - public ScriptConstraint[] getAllConstraints() - { - return getConstraints(true); - } - - public ScriptConstraint[] getConstraintsWithoutEmptyList() - { - return getConstraints(false); - } - - private ScriptConstraint[] getConstraints(boolean includeEmptyList) - { - Set values = caveatConfigService.getAllRMConstraints(); - - List vals = new ArrayList<>(values.size()); - for(RMConstraintInfo value : values) - { - ScriptConstraint c = new ScriptConstraint(value, caveatConfigService, getAuthorityService()); - if (includeEmptyList) - { - vals.add(c); - } - else - { - if (c.getValues().length > 0) - { - vals.add(c); - } - } - } - - return vals.toArray(new ScriptConstraint[vals.size()]); - } - - /** - * Delete list - * @param listName - - */ - public void deleteConstraintList(String listName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - caveatConfigService.deleteRMConstraint(xxx); - } - - - - /** - * Update value - */ - public void updateConstraintValues(String listName, String authorityName, String[]values) - { - List vals = new ArrayList<>(); - caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals); - } - - /** - * Delete the constraint values. i.e remove an authority from a constraint list - */ - public void deleteRMConstraintListAuthority(String listName, String authorityName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - - caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName); - } - - /** - * Delete the constraint values. i.e remove a value from a constraint list - */ - public void deleteRMConstraintListValue(String listName, String valueName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - - caveatConfigService.removeRMConstraintListValue(xxx, valueName); - - } - - public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues) - { - //TODO Temporary conversion - if(listName != null) - { - listName = listName.replace("_", ":"); - } - - RMConstraintInfo info = caveatConfigService.addRMConstraint(listName, title, allowedValues); - return new ScriptConstraint(info, caveatConfigService, getAuthorityService()); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java deleted file mode 100644 index 46e448ed85..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.compatibility; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.service.namespace.QName; - -/** - * RM 1.0 compatibility model - * - * @author Roy Wetherall - */ -public interface CompatibilityModel extends DOD5015Model -{ - // Record series DOD type - QName TYPE_RECORD_SERIES = QName.createQName(DOD_URI, "recordSeries"); - - // V1.0 custom property aspect names - String NAME_CUSTOM_RECORD_PROPERTIES = "customRecordProperties"; - String NAME_CUSTOM_RECORD_FOLDER_PROPERTIES = "customRecordFolderProperties"; - String NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES = "customRecordCategoryProperties"; - String NAME_CUSTOM_RECORD_SERIES_PROPERTIES = "customRecordSeriesProperties"; -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java deleted file mode 100644 index aa810b0354..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Deprecated extended security service for compatibility. - * - * @author Roy Wetherall - */ -public interface DeprecatedExtendedSecurityService -{ - /** - * Gets the set of authorities that are extended readers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended readers - * - * @deprecated as of 2.5, use {@link ExtendedSecurityService#getReaders(NodeRef)} - */ - Set getExtendedReaders(NodeRef nodeRef); - - /** - * Get the set of authorities that are extended writers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended writers - * - * @deprecated as of 2.5, use {@link ExtendedSecurityService#getWriters(NodeRef)} - */ - Set getExtendedWriters(NodeRef nodeRef); - - /** - * Add extended security for the specified authorities to a node. - * - * As of, 2.5 this method no longer applies the extended security to parents. - * - * @param nodeRef node reference - * @param readers set of authorities to add extended read permissions - * @param writers set of authorities to add extended write permissions - * - * @deprecated as of 2.5, use {@link ExtendedSecurityService#set(NodeRef, Set, Set)} - */ - @Deprecated - void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers); - - /** - * Add extended security for the specified authorities to a node. - *

- * If specified, the read and write extended permissions are applied to all parents up to the file plan as - * extended read. This ensures parental read, but not parental write. - * - * @param nodeRef node reference - * @param readers set of authorities to add extended read permissions - * @param writers set of authorities to add extended write permissions - * @param applyToParents true if extended security applied to parents (read only) false otherwise. - * - * @deprecated as of 2.5, because extended security is no longer applied to parents. Note that calling this method will - * only apply the extended security to the node and the applyToParents parameter value will be ignored. - * - * @see ExtendedSecurityService#set(NodeRef, Set, Set) - */ - @Deprecated void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents); - - /** - * Remove all extended readers and writers from the given node reference. - * - * @param nodeRef node reference - * - * @deprecated as of 2.5, see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeAllExtendedSecurity(NodeRef nodeRef); - - /** - * Remove the extended security for the specified authorities from a node. - * - * @param nodeRef node reference - * @param readers set of authorities to remove as extended readers - * @param writers set of authorities to remove as extended writers - * - * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. - * Note that calling this method will now remove all extended security from the node and never applied to parents. - * - * @see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers); - - /** - * Remove the extended security for the specified authorities from a node. - *

- * If specified, extended security will also be removed from the parent hierarchy.(read only). Note that - * extended security is records as a reference count, so security will only be utterly removed from the parent - * hierarchy if all references to the authority are removed. - * - * @param nodeRef node reference - * @param readers set of authorities to remove as extended readers - * @param writers set of authorities to remove as extedned writers - * @param applyToParents true if removal of extended security is applied to parent hierarchy (read only), false - * otherwise - * - * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. - * Note that calling this method will now remove all extended security from the node and never applied to parents. - * - * @see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents); - - /** - * Remove all extended readers and writers from the given node reference. - * - * @param nodeRef node reference - * @param applyToParents if true then apply removal to parent hierarchy (read only) false otherwise. - * - * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. - * Note that calling this method will now remove all extended security from the node and never applied to parents. - * - * @see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java deleted file mode 100644 index a193996231..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Extended readers dynamic authority implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public class ExtendedReaderDynamicAuthority extends ExtendedSecurityBaseDynamicAuthority -{ - /** Extended reader role */ - public static final String EXTENDED_READER = "ROLE_EXTENDED_READER"; - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority() - */ - @Override - public String getAuthority() - { - return EXTENDED_READER; - } - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() - */ - @Override - public Set requiredFor() - { - if (requiredFor == null) - { - requiredFor = Collections.singleton(getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS)); - } - - return requiredFor; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - protected Set getAuthorites(NodeRef nodeRef) - { - Set result = null; - - Map readerMap = (Map)getNodeService().getProperty(nodeRef, PROP_READERS); - if (readerMap != null) - { - result = readerMap.keySet(); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName() - */ - @Override - protected String getTransactionCacheName() - { - return "rm.extendedreaderdynamicauthority"; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java deleted file mode 100644 index 80a3db378f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.permissions.DynamicAuthority; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.repo.security.permissions.impl.ModelDAO; -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.AuthorityService; -import org.alfresco.util.Pair; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Extended readers dynamic authority implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority, - RecordsManagementModel, - ApplicationContextAware -{ - /** Authority service */ - private AuthorityService authorityService; - - /** Extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** Node service */ - private NodeService nodeService; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** model DAO */ - protected ModelDAO modelDAO; - - /** permission reference */ - protected Set requiredFor; - - // NOTE: we get the services directly from the application context in this way to avoid - // cyclic relationships and issues when loading the application context - - /** - * @return authority service - */ - protected AuthorityService getAuthorityService() - { - if (authorityService == null) - { - authorityService = (AuthorityService)applicationContext.getBean("authorityService"); - } - return authorityService; - } - - /** - * @return extended security service - */ - protected ExtendedSecurityService getExtendedSecurityService() - { - if (extendedSecurityService == null) - { - extendedSecurityService = (ExtendedSecurityService)applicationContext.getBean("extendedSecurityService"); - } - return extendedSecurityService; - } - - /** - * @return node service - */ - protected NodeService getNodeService() - { - if (nodeService == null) - { - nodeService = (NodeService)applicationContext.getBean("dbNodeService"); - } - return nodeService; - } - - /** - * @return model DAO - */ - protected ModelDAO getModelDAO() - { - if (modelDAO == null) - { - modelDAO = (ModelDAO)applicationContext.getBean("permissionsModelDAO"); - } - return modelDAO; - } - - /** - * @return String transaction cache name - */ - protected abstract String getTransactionCacheName(); - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * Gets a list of the authorities from the extended security aspect that this dynamic - * authority is checking against. - * - * @param nodeRef - * @return - */ - protected abstract Set getAuthorites(NodeRef nodeRef); - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#hasAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public boolean hasAuthority(NodeRef nodeRef, String userName) - { - boolean result = false; - - Map, Boolean> transactionCache = TransactionalResourceHelper.getMap(getTransactionCacheName()); - Pair key = new Pair<>(nodeRef, userName); - - if (transactionCache.containsKey(key)) - { - result = transactionCache.get(key); - } - else - { - if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY)) - { - Set authorities = getAuthorites(nodeRef); - if (authorities != null) - { - // check for everyone or the user - if (authorities.contains("GROUP_EVEYONE") || - authorities.contains(userName)) - { - result = true; - } - else - { - // determine whether any of the users groups are in the extended security - Set contained = getAuthorityService().getAuthoritiesForUser(userName); - authorities.retainAll(contained); - result = (authorities.size() != 0); - } - } - } - - // cache result - transactionCache.put(key, result); - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java deleted file mode 100644 index 83dad76859..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Extended writers dynamic authority implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public class ExtendedWriterDynamicAuthority extends ExtendedSecurityBaseDynamicAuthority -{ - /** Extended writer role */ - public static final String EXTENDED_WRITER = "ROLE_EXTENDED_WRITER"; - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority() - */ - @Override - public String getAuthority() - { - return EXTENDED_WRITER; - } - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() - */ - @Override - public Set requiredFor() - { - if (requiredFor == null) - { - requiredFor = new HashSet<>(3); - Collections.addAll(requiredFor, - getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS), - getModelDAO().getPermissionReference(null, RMPermissionModel.FILING), - getModelDAO().getPermissionReference(null, RMPermissionModel.FILE_RECORDS)); - } - - return requiredFor; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - protected Set getAuthorites(NodeRef nodeRef) - { - Set result = null; - - Map map = (Map)getNodeService().getProperty(nodeRef, PROP_WRITERS); - if (map != null) - { - result = map.keySet(); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName() - */ - @Override - protected String getTransactionCacheName() - { - return "rm.extendedwriterdynamicauthority"; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java deleted file mode 100644 index 63ccdec394..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * File plan authentication service. - * - * @author Roy Wetherall - * @since 2.1 - * @deprecated as of 2.2, use {@link AuthenticationUtil}. - */ -public interface FilePlanAuthenticationService -{ - /** - * @return rm admin user name - * - * @deprecated as of 2.2, use {@link AuthenticationUtil#getAdminUserName()} - */ - String getRmAdminUserName(); - - /** - * Run provided work as the global rm admin user. - * - * @param return type - * @param runAsWork work to execute as the rm admin user - * @return R result of work execution - * - * @deprecated as of 2.2, use - * - * - * {@link AuthenticationUtil#runAs(RunAsWork, String)} - */ - R runAsRmAdmin(RunAsWork runAsWork); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java deleted file mode 100644 index 15a9cbd41a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public class FilePlanAuthenticationServiceImpl implements FilePlanAuthenticationService -{ - /** Default rm admin user values */ - @Deprecated - public static final String DEFAULT_RM_ADMIN_USER = "rmadmin"; - - /** - * @see FilePlanAuthenticationService#getRmAdminUserName() () - */ - @Override - @Deprecated - public String getRmAdminUserName() - { - return AuthenticationUtil.getAdminUserName(); - } - - /** - * @see FilePlanAuthenticationService#runAsRmAdmin(RunAsWork) - */ - @Override - @Deprecated - public R runAsRmAdmin(RunAsWork runAsWork) - { - return AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java deleted file mode 100644 index eb8fdd4f38..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management permission service interface - * - * @author Roy Wetherall - * - * @deprecated As of release 2.1, replaced by {@link ModelSecurityService}, {@link FilePlanRoleService} and {@link FilePlanPermissionService} - */ -public interface RecordsManagementSecurityService -{ - /** - * Creates the initial set of default roles for a root records management node - * - * @param rmRootNode root node - * - * @deprecated As of release 2.1, operation no longer supported - */ - @Deprecated - void bootstrapDefaultRoles(NodeRef rmRootNode); - - /** - * Returns the name of the container group for all roles of a specified file - * plan. - * - * @param filePlan file plan node reference - * @return String group name - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getAllRolesContainerGroup(NodeRef)} - */ - @Deprecated - String getAllRolesContainerGroup(NodeRef filePlan); - - /** - * Get all the available roles for the given records management root node - * - * @param rmRootNode root node - * @return {@link Set}<{@link Role}> all roles for a given root node - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRoles(NodeRef)} - */ - @Deprecated - Set getRoles(NodeRef rmRootNode); - - /** - * Gets the roles for a given user - * - * @param rmRootNode - * @param user - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRolesByUser(NodeRef, String)} - */ - @Deprecated - Set getRolesByUser(NodeRef rmRootNode, String user); - - /** - * Get a role by name - * - * @param rmRootNode - * @param role - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRole(NodeRef, String)} - */ - @Deprecated - Role getRole(NodeRef rmRootNode, String role); - - /** - * Indicate whether a role exists for a given records management root node - * @param rmRootNode - * @param role - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#existsRole(NodeRef, String)} - */ - @Deprecated - boolean existsRole(NodeRef rmRootNode, String role); - - /** - * Determines whether the given user has the RM Admin role - * - * @param rmRootNode RM root node - * @param user user name to check - * @return true if the user has the RM Admin role, false otherwise - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#hasRMAdminRole(NodeRef, String)} - */ - @Deprecated - boolean hasRMAdminRole(NodeRef rmRootNode, String user); - - /** - * Create a new role - * - * @param rmRootNode - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#createRole(NodeRef, String, String, Set)} - */ - @Deprecated - Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities); - - /** - * Update an existing role - * - * @param rmRootNode - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#updateRole(NodeRef, String, String, Set)} - */ - @Deprecated - Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities); - - /** - * Delete a role - * - * @param rmRootNode - * @param role - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#deleteRole(NodeRef, String)} - */ - @Deprecated - void deleteRole(NodeRef rmRootNode, String role); - - /** - * Assign a role to an authority - * - * @param authorityName - * @param rmRootNode - * @param role - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#assignRoleToAuthority(NodeRef, String, String)} - */ - @Deprecated - void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName); - - /** - * Sets a permission on a RM object. Assumes allow is true. Cascades permission down to record folder. - * Cascades ReadRecord up to file plan. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - * - * @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#setPermission(NodeRef, String, String)} - */ - @Deprecated - void setPermission(NodeRef nodeRef, String authority, String permission); - - /** - * Deletes a permission from a RM object. Cascades removal down to record folder. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - * - * @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#deletePermission(NodeRef, String, String)} - */ - @Deprecated - void deletePermission(NodeRef nodeRef, String authority, String permission); - - /** - * @return {@link Set}<{@link QName}> protected aspect names - * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedAspects} - */ - @Deprecated - Set getProtectedAspects(); - - /** - * @return {@link Set}<{@link QName}> protected properties - * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedProperties} - */ - Set getProtectedProperties(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java deleted file mode 100644 index a9df45a3c9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management permission service implementation - * - * @author Roy Wetherall - */ -@SuppressWarnings("deprecation") -public class RecordsManagementSecurityServiceImpl implements RecordsManagementSecurityService, - RecordsManagementModel -{ - /** Model security service */ - private ModelSecurityService modelSecurityService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** File plan permission service */ - private FilePlanPermissionService filePlanPermissionService; - - /** - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanPermissionService file plan permission service - */ - public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) - { - this.filePlanPermissionService = filePlanPermissionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedAspects() - */ - @Deprecated - @Override - public Set getProtectedAspects() - { - return modelSecurityService.getProtectedAspects(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedProperties() - */ - @Deprecated - @Override - public Set getProtectedProperties() - { - return modelSecurityService.getProtectedProperties(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Deprecated - @Override - public void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName) - { - filePlanRoleService.assignRoleToAuthority(rmRootNode, role, authorityName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#bootstrapDefaultRoles(org.alfresco.service.cmr.repository.NodeRef) - */ - @Deprecated - @Override - public void bootstrapDefaultRoles(NodeRef rmRootNode) - { - throw new UnsupportedOperationException("This method is no longer supported."); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#createRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - @Deprecated - @Override - public Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities) - { - return Role.toRole(filePlanRoleService.createRole(rmRootNode, role, roleDisplayLabel, capabilities)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public void deleteRole(NodeRef rmRootNode, String role) - { - filePlanRoleService.deleteRole(rmRootNode, role); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#existsRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public boolean existsRole(NodeRef rmRootNode, String role) - { - return filePlanRoleService.existsRole(rmRootNode, role); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getAllRolesContainerGroup(org.alfresco.service.cmr.repository.NodeRef) - */ - @Deprecated - @Override - public String getAllRolesContainerGroup(NodeRef filePlan) - { - return filePlanRoleService.getAllRolesContainerGroup(filePlan); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public Role getRole(NodeRef rmRootNode, String role) - { - return Role.toRole(filePlanRoleService.getRole(rmRootNode, role)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRoles(org.alfresco.service.cmr.repository.NodeRef) - */ - @Deprecated - @Override - public Set getRoles(NodeRef rmRootNode) - { - return Role.toRoleSet(filePlanRoleService.getRoles(rmRootNode)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRolesByUser(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public Set getRolesByUser(NodeRef rmRootNode, String user) - { - return Role.toRoleSet(filePlanRoleService.getRolesByUser(rmRootNode, user)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public boolean hasRMAdminRole(NodeRef rmRootNode, String user) - { - return filePlanRoleService.hasRMAdminRole(rmRootNode, user); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - @Deprecated - @Override - public Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities) - { - return Role.toRole(filePlanRoleService.updateRole(rmRootNode, role, roleDisplayLabel, capabilities)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deletePermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Deprecated - @Override - public void deletePermission(NodeRef nodeRef, String authority, String permission) - { - filePlanPermissionService.deletePermission(nodeRef, authority, permission); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#setPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Deprecated - @Override - public void setPermission(NodeRef nodeRef, String authority, String permission) - { - filePlanPermissionService.setPermission(nodeRef, authority, permission); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java b/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java deleted file mode 100644 index e194e7a3e3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; - -/** - * Records management role class - * - * @author Roy Wetherall - * - * @deprecated As of release 2.1, see {@link org.alfresco.module.org_alfresco_module_rm.role.Role} - */ -public class Role extends org.alfresco.module.org_alfresco_module_rm.role.Role -{ - /** - * Compatibility method - */ - public static Role toRole(org.alfresco.module.org_alfresco_module_rm.role.Role role) - { - return new Role(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName()); - } - - /** - * Compatibility method - */ - public static Set toRoleSet(Set roles) - { - Set result = new HashSet<>(roles.size()); - for (org.alfresco.module.org_alfresco_module_rm.role.Role role : roles) - { - result.add(Role.toRole(role)); - } - return result; - } - - /** - * Constructor - */ - @Deprecated - public Role(String name, String displayLabel, Set capabilities, String roleGroupName) - { - super(name, displayLabel, capabilities, roleGroupName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java deleted file mode 100644 index 812df217ae..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.policy.ClassPolicy; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Interface containing records management policies - * - * @author Roy Wetherall - */ -public interface RecordsManagementPolicies -{ - /** Policy names */ - QName BEFORE_RM_ACTION_EXECUTION = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRMActionExecution"); - QName ON_RM_ACTION_EXECUTION = QName.createQName(NamespaceService.ALFRESCO_URI, "onRMActionExecution"); - QName BEFORE_CREATE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateReference"); - QName ON_CREATE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateReference"); - QName BEFORE_REMOVE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveReference"); - QName ON_REMOVE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveReference"); - QName BEFORE_RECORD_DECLARATION = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordDeclaration"); - QName ON_RECORD_DECLARATION = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordDeclaration"); - QName BEFORE_RECORD_REJECTION = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordRejection"); - QName ON_RECORD_REJECTION = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordRejection"); - - /** Before records management action execution */ - interface BeforeRMActionExecution extends ClassPolicy - { - void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters); - } - - /** On records management action execution */ - interface OnRMActionExecution extends ClassPolicy - { - void onRMActionExecution(NodeRef nodeRef, String name, Map parameters); - } - - /** Before creation of reference */ - interface BeforeCreateReference extends ClassPolicy - { - void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** On creation of reference */ - interface OnCreateReference extends ClassPolicy - { - void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** Before removal of reference */ - interface BeforeRemoveReference extends ClassPolicy - { - void beforeRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** - * On removal of reference - * - * @since 1.0 - */ - interface OnRemoveReference extends ClassPolicy - { - /** - * @param fromNodeRef from node reference - * @param toNodeRef to node reference - * @param reference name of reference - */ - void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** - * Before record file policy - * - * @since 2.2 - */ - interface BeforeFileRecord extends ClassPolicy - { - /** policy name */ - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordFile"); - - /** - * @param nodeRef node reference - */ - void beforeFileRecord(NodeRef nodeRef); - } - - /** - * On record file policy - * - * @since 2.2 - */ - interface OnFileRecord extends ClassPolicy - { - /** policy name */ - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordFile"); - - /** - * @param nodeRef node reference - */ - void onFileRecord(NodeRef nodeRef); - } - - /** - * Before record declaration - * @since 2.5 - */ - interface BeforeRecordDeclaration extends ClassPolicy - { - void beforeRecordDeclaration(NodeRef nodeRef); - } - - /** - * On record declaration - * @since 2.5 - */ - interface OnRecordDeclaration extends ClassPolicy - { - void onRecordDeclaration(NodeRef nodeRef); - } - - /** - * Before record rejection - * @since 2.5 - */ - interface BeforeRecordRejection extends ClassPolicy - { - void beforeRecordRejection(NodeRef nodeRef); - } - - /** - * On record rejection - * @since 2.5 - */ - interface OnRecordRejection extends ClassPolicy - { - void onRecordRejection(NodeRef nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java deleted file mode 100644 index 1696b002ad..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -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.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -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.identifier.IdentifierService; -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.recordfolder.RecordFolderService; -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.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.service.NotAuditable; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Records management service registry - * - * @author Roy Wetherall - */ -@SuppressWarnings("deprecation") -public interface RecordsManagementServiceRegistry extends ServiceRegistry -{ - /** Service QName constants */ - QName RECORDS_MANAGEMENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementService"); - QName DISPOSITION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DispositionService"); - QName RECORDS_MANAGEMENT_ADMIN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAdminService"); - QName RECORDS_MANAGEMENT_ACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementActionService"); - QName RECORDS_MANAGEMENT_EVENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementEventService"); - QName RECORDS_MANAGEMENT_AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAuditService"); - QName CAPABILITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CapabilityService"); - QName RECORD_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordService"); - QName FREEZE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FreezeService"); - QName EXTENDED_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ExtendedSecurityService"); - QName FILE_PLAN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanService"); - QName FILE_PLAN_ROLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanRoleService"); - QName FILE_PLAN_PERMISSION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanPermissionService"); - QName FILE_PLAN_AUTHENTICATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanAuthenticationService"); - QName IDENTIFIER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "recordsManagementIdentifierService"); - QName RECORD_FOLDER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordFolderService"); - QName TRANSFER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TransferService"); - @Deprecated - QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService"); - - - /** - * @return records management service - */ - @NotAuditable - RecordsManagementService getRecordsManagementService(); - - /** - * @return record service - */ - @NotAuditable - RecordService getRecordService(); - - /** - * @return disposition service - */ - @NotAuditable - DispositionService getDispositionService(); - - /** - * @return records management admin service - */ - @NotAuditable - RecordsManagementAdminService getRecordsManagementAdminService(); - - /** - * @return records management action service - */ - @NotAuditable - RecordsManagementActionService getRecordsManagementActionService(); - - /** - * @return records management event service - */ - @NotAuditable - RecordsManagementEventService getRecordsManagementEventService(); - - /** - * @return records management security service - * - * @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService} - */ - @Deprecated - @NotAuditable - RecordsManagementSecurityService getRecordsManagementSecurityService(); - - /** - * @return records management audit service - */ - @NotAuditable - RecordsManagementAuditService getRecordsManagementAuditService(); - - /** - * @return capability service - * @since 2.0 - */ - @NotAuditable - CapabilityService getCapabilityService(); - - /** - * @return freeze service - * @since 2.1 - */ - @NotAuditable - FreezeService getFreezeService(); - - /** - * @return extended security service - * @since 2.1 - */ - @NotAuditable - ExtendedSecurityService getExtendedSecurityService(); - - /** - * @return file plan service - * @since 2.1 - */ - @NotAuditable - FilePlanService getFilePlanService(); - - /** - * @return file plan role service - * @since 2.1 - */ - @NotAuditable - FilePlanRoleService getFilePlanRoleService(); - - /** - * @return file plan permission service - * @since 2.1 - */ - @NotAuditable - FilePlanPermissionService getFilePlanPermissionService(); - - /** - * @return identifier service - * @since 2.1 - */ - IdentifierService getIdentifierService(); - - /** - * @return record folder service - * @since 2.2 - */ - @NotAuditable - RecordFolderService getRecordFolderService(); - - /** - * @return transfer service - * @since 2.2 - */ - @NotAuditable - TransferService getTransferService(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java deleted file mode 100644 index a52cdf3012..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm; - -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.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -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.identifier.IdentifierService; -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.repo.service.ServiceDescriptorRegistry; - -/** - * Records management service registry implementation - * - * @author Roy Wetherall - */ -@SuppressWarnings("deprecation") -public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry - implements RecordsManagementServiceRegistry -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementActionService() - */ - @Override - public RecordsManagementActionService getRecordsManagementActionService() - { - return (RecordsManagementActionService) getService(RECORDS_MANAGEMENT_ACTION_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementAdminService() - */ - @Override - public RecordsManagementAdminService getRecordsManagementAdminService() - { - return (RecordsManagementAdminService) getService(RECORDS_MANAGEMENT_ADMIN_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementEventService() - */ - @Override - public RecordsManagementEventService getRecordsManagementEventService() - { - return (RecordsManagementEventService) getService(RECORDS_MANAGEMENT_EVENT_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementService() - */ - @Override - public RecordsManagementService getRecordsManagementService() - { - return (RecordsManagementService) getService(RECORDS_MANAGEMENT_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordService() - */ - public RecordService getRecordService() - { - return (RecordService) getService(RECORD_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementSecurityService() - */ - @Override - @Deprecated - public RecordsManagementSecurityService getRecordsManagementSecurityService() - { - return (RecordsManagementSecurityService) getService(RECORDS_MANAGEMENT_SECURITY_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementAuditService() - */ - @Override - public RecordsManagementAuditService getRecordsManagementAuditService() - { - return (RecordsManagementAuditService) getService(RECORDS_MANAGEMENT_AUDIT_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getDictionaryService() - */ - @Override - public DispositionService getDispositionService() - { - return (DispositionService) getService(DISPOSITION_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getCapabilityService() - */ - @Override - public CapabilityService getCapabilityService() - { - return (CapabilityService) getService(CAPABILITY_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFreezeService() - */ - @Override - public FreezeService getFreezeService() - { - return (FreezeService) getService(FREEZE_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getExtendedSecurityService() - */ - @Override - public ExtendedSecurityService getExtendedSecurityService() - { - return (ExtendedSecurityService) getService(EXTENDED_SECURITY_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanService() - */ - @Override - public FilePlanService getFilePlanService() - { - return (FilePlanService) getService(FILE_PLAN_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanRoleService() - */ - @Override - public FilePlanRoleService getFilePlanRoleService() - { - return (FilePlanRoleService) getService(FILE_PLAN_ROLE_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanPermissionService() - */ - @Override - public FilePlanPermissionService getFilePlanPermissionService() - { - return (FilePlanPermissionService) getService(FILE_PLAN_PERMISSION_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getIdentifierService() - */ - @Override - public IdentifierService getIdentifierService() - { - return (IdentifierService) getService(IDENTIFIER_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordFolderService() - */ - @Override - public RecordFolderService getRecordFolderService() - { - return (RecordFolderService) getService(RECORD_FOLDER_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getTransferService() - */ - @Override - public TransferService getTransferService() - { - return (TransferService) getService(TRANSFER_SERVICE); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java deleted file mode 100644 index 486378c6d4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Auditable action executer abstract base - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class AuditableActionExecuterAbstractBase extends ActionExecuterAbstractBase implements ApplicationContextAware -{ - /** Indicates whether the action is auditable or not */ - private boolean auditable = true; - - /** Indicates whether the action is audited immediately or not */ - private boolean auditedImmediately = false; - - /** Application context */ - private ApplicationContext applicationContext; - - /** Records management audit service */ - private RecordsManagementAuditService auditService; - - /** - * @return True if auditable, false otherwise - */ - protected boolean isAuditable() - { - return this.auditable; - } - - /** - * @return True if audited immediately, false otherwise - */ - protected boolean isAuditedImmediately() - { - return this.auditedImmediately; - } - - /** - * @return Application context - */ - protected ApplicationContext getApplicationContext() - { - return this.applicationContext; - } - - /** - * @param auditable true if auditable, false otherwise - */ - public void setAuditable(boolean auditable) - { - this.auditable = auditable; - } - - /** - * @param auditedImmediately true if to be audited immediately, false to be audited after transaction commits - */ - public void setAuditedImmediately(boolean auditedImmediately) - { - this.auditedImmediately = auditedImmediately; - } - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * @return records management audit service - */ - private RecordsManagementAuditService getAuditService() - { - if (auditService == null) - { - auditService = (RecordsManagementAuditService) getApplicationContext().getBean("recordsManagementAuditService"); - } - return auditService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#init() - */ - @Override - public void init() - { - if (!(this instanceof RecordsManagementAction)) - { - super.init(); - } - - if (isAuditable()) - { - // get the details of the action - String name = getActionDefinition().getName(); - String title = getActionDefinition().getTitle(); - if (title == null || title.isEmpty()) - { - // default to name if no title available - title = name; - } - - // register audit event - getAuditService().registerAuditEvent(name, title); - } - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void execute(Action action, NodeRef actionedUponNodeRef) - { - // audit the execution of the action - if (isAuditable()) - { - if (isAuditedImmediately()) - { - // To be audited immediately before the action is executed, eg. to audit before actionedUponNodeRef gets deleted during the execution. - getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName(), null, null, true); - } - else - { - // To be stacked up with other audit entries and audited after the transaction commits. - getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName()); - } - } - - // execute the action - super.execute(action, actionedUponNodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java deleted file mode 100644 index 1415898be9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import org.alfresco.repo.action.parameter.ParameterProcessorComponent; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Extension to action implementation hierarchy to insert parameter substitution processing. - * - * NOTE: this should eventually be pushed into the core. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class PropertySubActionExecuterAbstractBase extends AuditableActionExecuterAbstractBase -{ - /** Parameter processor component */ - private ParameterProcessorComponent parameterProcessorComponent; - - /** Indicates whether parameter substitutions are allowed */ - private boolean allowParameterSubstitutions = false; - - /** - * @return Parameter processor component - */ - protected ParameterProcessorComponent getParameterProcessorComponent() - { - return this.parameterProcessorComponent; - } - - /** - * @return True if parameter substitutions are allowed, false otherwise - */ - protected boolean isAllowParameterSubstitutions() - { - return this.allowParameterSubstitutions; - } - - /** - * @param parameterProcessorComponent parameter processor component - */ - public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) - { - this.parameterProcessorComponent = parameterProcessorComponent; - } - - /** - * @param allowParameterSubstitutions true if property subs allowed, false otherwise - */ - public void setAllowParameterSubstitutions(boolean allowParameterSubstitutions) - { - this.allowParameterSubstitutions = allowParameterSubstitutions; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void execute(Action action, NodeRef actionedUponNodeRef) - { - // do the property subs (if any exist) - if (isAllowParameterSubstitutions()) - { - getParameterProcessorComponent().process(action, getActionDefinition(), actionedUponNodeRef); - } - - super.execute(action, actionedUponNodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java deleted file mode 100644 index e5928acc5c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java +++ /dev/null @@ -1,712 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import static org.apache.commons.lang3.StringUtils.leftPad; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -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.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -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.security.ModelSecurityService; -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.vital.VitalRecordService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.OwnableService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.PropertyCheck; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.util.StringUtils; - -/** - * Records management action executer base class - * - * @author Roy Wetherall - */ -public abstract class RMActionExecuterAbstractBase extends PropertySubActionExecuterAbstractBase - implements RecordsManagementAction, - RecordsManagementModel, - BeanNameAware -{ - /** Namespace service */ - private NamespaceService namespaceService; - - /** Used to control transactional behaviour including post-commit auditing */ - private TransactionService transactionService; - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Content service */ - private ContentService contentService; - - /** Action service */ - private ActionService actionService; - - /** Records management action service */ - private RecordsManagementAuditService recordsManagementAuditService; - - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Record service */ - private RecordService recordService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Vital record service */ - private VitalRecordService vitalRecordService; - - /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** Records management action service */ - private RecordsManagementAdminService recordsManagementAdminService; - - /** Ownable service **/ - private OwnableService ownableService; - - /** Freeze service */ - private FreezeService freezeService; - - /** Model security service */ - private ModelSecurityService modelSecurityService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Hold service */ - private HoldService holdService; - - /** Identifier service */ - private IdentifierService identifierService; - - /** List of kinds for which this action is applicable */ - protected Set applicableKinds = new HashSet<>(); - - /** - * Get the transaction service - * - * @return The transaction service - */ - protected TransactionService getTransactionService() - { - return this.transactionService; - } - - /** - * Set the transaction service - * - * @param transactionService The transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Gets the namespace service - * - * @return The namespace service - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - - /** - * Set the namespace service - * - * @param namespaceService The namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Gets the node service - * - * @return The node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Set 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; - } - - /** - * Set the dictionary service - * - * @param dictionaryService The dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Gets the content service - * - * @return The content service - */ - protected ContentService getContentService() - { - return this.contentService; - } - - /** - * Set the content service - * - * @param contentService The content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Gets the action service - * - * @return The action service - */ - protected ActionService getActionService() - { - return this.actionService; - } - - /** - * Set action service - * - * @param actionService The action service - */ - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - /** - * Gets the records management audit service - * - * @return The records management audit service - */ - protected RecordsManagementAuditService getRecordsManagementAuditService() - { - return this.recordsManagementAuditService; - } - - /** - * Set the audit service that action details will be sent to - * - * @param recordsManagementAuditService The audit service that action details will be sent to - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * Gets the records management action service - * - * @return The records management action service - */ - protected RecordsManagementActionService getRecordsManagementActionService() - { - return this.recordsManagementActionService; - } - - /** - * Set records management service - * - * @param recordsManagementActionService The records management service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * Gets the disposition service - * - * @return The disposition service - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - - /** - * Set the disposition service - * - * @param dispositionService The disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Gets the vital record service - * - * @return The vital record service - */ - protected VitalRecordService getVitalRecordService() - { - return this.vitalRecordService; - } - - /** - * Sets the vital record service - * - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * Gets the records management event service - * - * @return The records management event service - */ - protected RecordsManagementEventService getRecordsManagementEventService() - { - return this.recordsManagementEventService; - } - - /** - * Set the records management event service - * - * @param recordsManagementEventService The records management event service - */ - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * Gets the ownable service - * - * @return The ownable service - */ - protected OwnableService getOwnableService() - { - return this.ownableService; - } - - /** - * Set the ownable service - * - * @param ownableService The ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * Gets the freeze service - * - * @return The freeze service - */ - protected FreezeService getFreezeService() - { - return this.freezeService; - } - - /** - * Set freeze service - * - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * Gets the record service - * - * @return The record service - */ - protected RecordService getRecordService() - { - return this.recordService; - } - - /** - * Set record service - * - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Gets the records management admin service - * - * @return The records management admin service - */ - protected RecordsManagementAdminService getRecordsManagementAdminService() - { - return recordsManagementAdminService; - } - - /** - * Sets the records management admin service - * - * @param recordsManagementAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - /** - * Gets the model security service - * - * @return The model security service - */ - protected ModelSecurityService getModelSecurityService() - { - return this.modelSecurityService; - } - - /** - * Sets the model security service - * - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * Gets the record folder service - * - * @return The record folder service - */ - protected RecordFolderService getRecordFolderService() - { - return this.recordFolderService; - } - - /** - * Sets the record folder service - * - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Gets the hold service - * - * @return The hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - - /** - * Sets the hold service - * - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Gets the identifier service - * - * @return the identifier service - */ - public IdentifierService getIdentifierService() - { - return identifierService; - } - - /** - * Sets the identifier service - * - * @param identifierService the identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * Sets the applicable kinds - * - * @param applicableKinds kinds that this action is applicable for - */ - public void setApplicableKinds(String[] applicableKinds) - { - for(String kind : applicableKinds) - { - this.applicableKinds.add(FilePlanComponentKind.valueOf(kind)); - } - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#createActionDefinition(java.lang.String) - */ - @Override - protected ActionDefinition createActionDefinition(String name) - { - return new RecordsManagementActionDefinitionImpl(name); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#getActionDefinition() - */ - @Override - public ActionDefinition getActionDefinition() - { - ActionDefinition actionDefinition = super.getActionDefinition(); - ((RecordsManagementActionDefinitionImpl)this.actionDefinition).setApplicableKinds(applicableKinds); - return actionDefinition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getRecordsManagementActionDefinition() - */ - @Override - public RecordsManagementActionDefinition getRecordsManagementActionDefinition() - { - return (RecordsManagementActionDefinition)getActionDefinition(); - } - - /** - * Init method - */ - @Override - public void init() - { - PropertyCheck.mandatory(this, "namespaceService", namespaceService); - PropertyCheck.mandatory(this, "transactionService", transactionService); - PropertyCheck.mandatory(this, "nodeService", nodeService); - PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); - PropertyCheck.mandatory(this, "contentService", contentService); - PropertyCheck.mandatory(this, "actionService", actionService); - PropertyCheck.mandatory(this, "transactionService", transactionService); - PropertyCheck.mandatory(this, "recordsManagementAuditService", recordsManagementAuditService); - PropertyCheck.mandatory(this, "recordsManagementActionService", recordsManagementActionService); - PropertyCheck.mandatory(this, "recordsManagementAdminService", recordsManagementAdminService); - PropertyCheck.mandatory(this, "recordsManagementEventService", recordsManagementEventService); - PropertyCheck.mandatory(this, "identifierService", identifierService); - - super.init(); - } - - /** - * Indicates whether this records management action is public or not - * - * @return boolean true if public, false otherwise - */ - @Override - public boolean isPublicAction() - { - return publicAction; - } - - /** - * @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getName() - */ - public String getName() - { - return this.name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() - */ - public String getLabel() - { - String label = I18NUtil.getMessage(this.getTitleKey()); - - if (label == null) - { - // default to the name of the action with first letter capitalised - label = StringUtils.capitalize(this.name); - } - - return label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() - */ - public String getDescription() - { - String desc = I18NUtil.getMessage(this.getDescriptionKey()); - - if (desc == null) - { - // default to the name of the action with first letter capitalised - desc = StringUtils.capitalize(this.name); - } - - return desc; - } - - /** - * By default an action is not a disposition action - * - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#isDispositionAction() - */ - public boolean isDispositionAction() - { - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#execute(org.alfresco.service.cmr.repository.NodeRef, java.util.Map) - */ - public RecordsManagementActionResult execute(NodeRef filePlanComponent, Map parameters) - { - // Create the action - Action action = this.actionService.createAction(name); - action.setParameterValues(parameters); - - // disable model security whilst we execute the RM rule - modelSecurityService.disable(); - try - { - // Execute the action - actionService.executeAction(action, filePlanComponent); - } - finally - { - modelSecurityService.enable(); - } - - // Get the result - Object value = action.getParameterValue(ActionExecuterAbstractBase.PARAM_RESULT); - return new RecordsManagementActionResult(value); - } - - /** - * Function to pad a string with zero '0' characters to the required length - * - * @param s String to pad with leading zero '0' characters - * @param len Length to pad to - * - * @return padded string or the original if already at >= len characters - * - * @deprecated As of 2.1, replaced by {@link org.apache.commons.lang3.StringUtils#leftPad(String, int)} - */ - @Deprecated - protected String padString(String s, int len) - { - return leftPad(s, len); - } - - /** - * By default there are no parameters. - * - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // No parameters - } - - /** - * By default, rmActions do not provide an implicit target nodeRef. - */ - public NodeRef getImplicitTargetNodeRef() - { - return null; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java deleted file mode 100644 index 3ff506f6d5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @author Roy Wetherall - */ -public abstract class RMDispositionActionExecuterAbstractBase extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_RECORD_NOT_DECLARED = "rm.action.record-not-declared"; - private static final String MSG_EXPECTED_RECORD_LEVEL = "rm.action.expected-record-level"; - private static final String MSG_NOT_ALL_RECORDS_DECLARED = "rm.action.not-all-records-declared"; - private static final String MSG_NOT_ELIGIBLE = "rm.action.not-eligible"; - private static final String MSG_NO_DISPOITION_INSTRUCTIONS = "rm.action.no-disposition-instructions"; - private static final String MSG_NO_DIS_LIFECYCLE_SET = "rm.action.no-disposition-lisfecycle-set"; - private static final String MSG_NEXT_DISP_NOT_SET = "rm.action.next-disp-not-set"; - private static final String MSG_NOT_NEXT_DISP = "rm.action.not-next-disp"; - private static final String MSG_NOT_RECORD_FOLDER = "rm.action.not-record-folder"; - - /** Parameter value indicating whether we should be doing non-error raising state checks */ - public static final String PARAM_NO_ERROR_CHECK = "rm.no-error-check"; - - /** - * All children of this implementation are disposition actions. - * - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isDispositionAction() - */ - @Override - public boolean isDispositionAction() - { - return true; - } - - /** - * Indicates whether the disposition is marked complete - * - * @return true if marked complete, false otherwise - */ - public boolean getSetDispositionActionComplete() - { - return true; - } - - /** - * Indicates whether we should validate the next disposition action is the action we are - * trying to execute. - * - * @return - */ - protected boolean checkNextDispositionAction(NodeRef actionedUponNodeRef) - { - return true; - } - - /** - * Indicated whether we should validate the disposition action is eligible or not. - * - * @param actionedUponNodeRef - * @return - */ - protected boolean checkEligibility(NodeRef actionedUponNodeRef) - { - return true; - } - - /** - * @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) - { - NodeRef nextDispositionActionNodeRef = getNextDispostionAction(actionedUponNodeRef); - - // determine whether we should be raising errors during state checking or not - boolean checkError = true; - Boolean checkErrorValue = (Boolean)action.getParameterValue(PARAM_NO_ERROR_CHECK); - if (checkErrorValue != null) - { - checkError = checkErrorValue.booleanValue(); - } - - // Check the validity of the action (is it the next action, are we dealing with the correct type of object for - // the disposition level? - DispositionSchedule di = checkDispositionActionExecutionValidity(actionedUponNodeRef, nextDispositionActionNodeRef, checkError); - if (di != null) - { - // Check the eligibility of the action - if (!checkEligibility(actionedUponNodeRef) || - getDispositionService().isNextDispositionActionEligible(actionedUponNodeRef)) - { - if (di.isRecordLevelDisposition()) - { - // Check that we do indeed have a record - if (getRecordService().isRecord(actionedUponNodeRef)) - { - // Can only execute disposition action on record if declared - if (getRecordService().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()); - - // Execute record level disposition - executeRecordLevelDisposition(action, actionedUponNodeRef); - - if (getNodeService().exists(nextDispositionActionNodeRef) && - getSetDispositionActionComplete()) - { - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_NOT_DECLARED, getName(), actionedUponNodeRef.toString())); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EXPECTED_RECORD_LEVEL, getName(), actionedUponNodeRef.toString())); - } - } - else - { - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - if (getRecordFolderService().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()); - - executeRecordFolderLevelDisposition(action, actionedUponNodeRef); - - // Indicate that the disposition action is compelte - if (getNodeService().exists(nextDispositionActionNodeRef) && - getSetDispositionActionComplete()) - { - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); - } - - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ALL_RECORDS_DECLARED, getName(), actionedUponNodeRef.toString())); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_RECORD_FOLDER, getName(), actionedUponNodeRef.toString())); - } - - } - - if (getNodeService().exists(actionedUponNodeRef) && getSetDispositionActionComplete()) - { - // Update the disposition schedule - getDispositionService().updateNextDispositionAction(actionedUponNodeRef); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ELIGIBLE, getName(), actionedUponNodeRef.toString())); - } - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // TODO add the "checkEligibility" parameter - } - - /** - * @param action - * @param record - */ - protected abstract void executeRecordLevelDisposition(Action action, NodeRef record); - - /** - * @param action - * @param recordFolder - */ - protected abstract void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder); - - /** - * @param nodeRef - * @return - */ - protected DispositionSchedule checkDispositionActionExecutionValidity(NodeRef nodeRef, NodeRef nextDispositionActionNodeRef, boolean throwError) - { - // Check the node has associated disposition instructions - DispositionSchedule di = getDispositionService().getDispositionSchedule(nodeRef); - if (di == null) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_DISPOITION_INSTRUCTIONS, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - - // Check the node has the disposition schedule aspect applied - if (!getNodeService().hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_DIS_LIFECYCLE_SET, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - - if (checkNextDispositionAction(nodeRef)) - { - // Check this the next disposition action - NodeRef nextDispositionAction = nextDispositionActionNodeRef; - if (nextDispositionAction == null) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NEXT_DISP_NOT_SET, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - String actionName = (String) getNodeService().getProperty(nextDispositionAction, PROP_DISPOSITION_ACTION); - if (actionName == null || !actionName.equals(getName())) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_NEXT_DISP, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - } - - return di; - } - - /** - * Get the next disposition action node. Null if none present. - * - * @param nodeRef - * the disposable node reference - * @return NodeRef the next disposition action, null if none - */ - private NodeRef getNextDispostionAction(NodeRef nodeRef) - { - NodeRef result = null; - List assocs = getNodeService().getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL); - if (assocs.size() != 0) - { - result = assocs.get(0).getChildRef(); - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java deleted file mode 100644 index 6f1c5bd7f6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Record Management Action - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementAction -{ - /** - * Get the name of the action - * - * @return String action name - */ - String getName(); - - /** - * Get the label of the action - * - * @return String action label - */ - String getLabel(); - - /** - * Get the description of the action - * - * @return String action description - */ - String getDescription(); - - /** - * Indicates whether this is a disposition action or not - * - * @return boolean true if a disposition action, false otherwise - */ - boolean isDispositionAction(); - - /** - * Execution of the action - * - * @param filePlanComponent file plan component the action is executed upon - * @param parameters action parameters - * @return The result of the executed action - */ - RecordsManagementActionResult execute(NodeRef filePlanComponent, Map parameters); - - /** - * Some admin-related rmActions execute against a target nodeRef which is not provided - * by the calling code, but is instead an implementation detail of the action. - * - * @return the target nodeRef - */ - NodeRef getImplicitTargetNodeRef(); - - /** - * Get the records management action definition. - * - * @return The records management action definition. - * @since 2.1 - */ - RecordsManagementActionDefinition getRecordsManagementActionDefinition(); - - /** - * Indicates whether the action is public or not - * - * @return true if the action is public, false otherwise - * @since 2.1 - */ - boolean isPublicAction(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java deleted file mode 100644 index 0e3d9672a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Record Management Action Condition - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordsManagementActionCondition -{ - /** - * Get the name of the action condition - * - * @return String action condition name - */ - String getBeanName(); - - /** - * Get the label of the action condition - * - * @return String action condition label - */ - String getLabel(); - - /** - * Get the description of the action condition - * - * @return String action condition description - */ - String getDescription(); - - /** - * - * @return The records management action condition definition - */ - RecordsManagementActionConditionDefinition getRecordsManagementActionConditionDefinition(); - - /** - * - * @return true if the condition is public, false otherwise - */ - boolean isPublicCondition(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java deleted file mode 100644 index 0594c573c9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.action.ActionConditionDefinition; - -/** - * Records management condition definition. - * - * Primarily used as a marker interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordsManagementActionConditionDefinition extends ActionConditionDefinition -{ -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java deleted file mode 100644 index fc7a630674..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import org.alfresco.repo.action.ActionConditionDefinitionImpl; - -/** - * Records management condition definition implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementActionConditionDefinitionImpl extends ActionConditionDefinitionImpl - implements RecordsManagementActionConditionDefinition -{ - /** Serial Version UID */ - private static final long serialVersionUID = -7599279732731533610L; - - /** - * Default constructor. - * - * @param name name of the condition - */ - public RecordsManagementActionConditionDefinitionImpl(String name) - { - super(name); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java deleted file mode 100644 index 62e39cb1da..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.action.ActionConditionDefinition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Records management action condition evaluator abstract base implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class RecordsManagementActionConditionEvaluatorAbstractBase extends ActionConditionEvaluatorAbstractBase - implements RecordsManagementActionCondition, - BeanNameAware -{ - /** records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** bean name */ - private String beanName; - - /** public condition */ - private boolean publicCondition = true; - - private RetryingTransactionHelper retryingTransactionHelper; - - /** - * @return Records management action service - */ - protected RecordsManagementActionService getRecordsManagementActionService() - { - return this.recordsManagementActionService; - } - - /** - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * @param recordsManagementActionService records management action service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#init() - */ - @Override - public void init() - { - // override to prevent condition being registered with the core action service - - // run the following code as System - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - getRecordsManagementActionService().register(RecordsManagementActionConditionEvaluatorAbstractBase.this); - - return null; - } - }; - - retryingTransactionHelper.doInTransaction(callback); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - } - - @Override - public void setPublicCondition(boolean publicCondition) - { - this.publicCondition = publicCondition; - } - - /** - * @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.beanName = name; - super.setBeanName(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getBeanName() - */ - public String getBeanName() - { - return this.beanName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() - */ - public String getLabel() - { - return getActionConditionDefintion().getTitle(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() - */ - public String getDescription() - { - return getActionConditionDefintion().getDescription(); - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#getActionConditionDefintion() - * - * TODO base class should provide "createActionDefinition" method that can be over-ridden like the ActionExecuter - * base class to prevent duplication of code and a cleaner extension. - */ - @Override - public ActionConditionDefinition getActionConditionDefintion() - { - if (this.actionConditionDefinition == null) - { - this.actionConditionDefinition = new RecordsManagementActionConditionDefinitionImpl(beanName); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setTitleKey(getTitleKey()); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setDescriptionKey(getDescriptionKey()); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setAdhocPropertiesAllowed(getAdhocPropertiesAllowed()); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(beanName); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setLocalizedParameterDefinitions(getLocalizedParameterDefinitions()); - } - return this.actionConditionDefinition; - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List arg0) - { - // No param implementation by default - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#isPublicCondition() - */ - @Override - public boolean isPublicCondition() - { - return publicCondition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getRecordsManagementActionConditionDefinition() - */ - @Override - public RecordsManagementActionConditionDefinition getRecordsManagementActionConditionDefinition() - { - return (RecordsManagementActionConditionDefinition)getActionConditionDefintion(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java deleted file mode 100644 index 4f226b4765..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.action.ActionDefinition; - -/** - * Extended action definition interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordsManagementActionDefinition extends ActionDefinition -{ - /** - * @return list of applicable file plan component kinds - */ - Set getApplicableKinds(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java deleted file mode 100644 index 7a72c44910..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.repo.action.ActionDefinitionImpl; - -/** - * Extended action definition implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementActionDefinitionImpl extends ActionDefinitionImpl implements RecordsManagementActionDefinition -{ - /** generated serial version id */ - private static final long serialVersionUID = -5226538434707253206L; - - /** Applicable kinds */ - private Set applicableKinds; - - /** - * Default constructor. - * - * @param name action definition name - */ - public RecordsManagementActionDefinitionImpl(String name) - { - super(name); - } - - /** - * @param applicableKinds applicable kinds - */ - public void setApplicableKinds(Set applicableKinds) - { - this.applicableKinds = applicableKinds; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition#getApplicableKinds() - */ - @Override - public Set getApplicableKinds() - { - return applicableKinds; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java deleted file mode 100644 index 44c6614dbb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Records management action result. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public class RecordsManagementActionResult -{ - /** Result value */ - private Object value; - - /** - * Constructor. - * - * @param value result value - */ - public RecordsManagementActionResult(Object value) - { - this.value = value; - } - - /** - * @return result value - */ - public Object getValue() - { - return this.value; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java deleted file mode 100644 index d0bea022e6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - - -/** - * Records management action service interface - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementActionService -{ - /** - * Get a list of the available records management actions - * - * @return List of records management actions - */ - List getRecordsManagementActions(); - - /** - * Get a list of the available records management action conditions - * - * @return List of records management action conditions - * @since 2.1 - */ - List getRecordsManagementActionConditions(); - - /** - * Get a list of the available disposition actions. A disposition action is a records - * management action that can be used when defining disposition instructions. - * - * @return List of disposition actions - */ - List getDispositionActions(); - - /** - * Gets the named records management action - * - * @param name The name of the RM action to retrieve - * @return The RecordsManagementAction or null if it doesn't exist - */ - RecordsManagementAction getRecordsManagementAction(String name); - - /** - * Gets the named disposition action - * - * @param name The name of the disposition action to retrieve - * @return The RecordsManagementAction or null if it doesn't exist - */ - RecordsManagementAction getDispositionAction(String name); - - /** - * Execute a records management action - * - * @param nodeRef node reference to a rm container, rm folder or record - * @param name action name - * @return The result of executed records management action - */ - RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name); - - /** - * Execute a records management action against several nodes - * - * @param nodeRefs node references to rm containers, rm folders or records - * @param name action name - * @return The result of executed records management action against several nodes - */ - Map executeRecordsManagementAction(List nodeRefs, String name); - - /** - * Execute a records management action - * - * @param nodeRef node reference to a rm container, rm folder or record - * @param name action name - * @param parameters action parameters - * @return The result of executed records management action - */ - RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map parameters); - - /** - * Execute a records management action against several nodes - * - * @param nodeRefs node references to rm containers, rm folders or records - * @param name action name - * @param parameters action parameters - * @return The result of executed records management action against several nodes - */ - Map executeRecordsManagementAction(List nodeRefs, String name, Map parameters); - - /** - * Execute a records management action. The nodeRef against which the action is to be - * executed must be provided by the RecordsManagementAction implementation. - * - * @param name action name - * @param parameters action parameters - * @return The result of executed records management action - */ - RecordsManagementActionResult executeRecordsManagementAction(String name, Map parameters); - - /** - * Register records management action - * - * @param rmAction records management action - */ - void register(RecordsManagementAction rmAction); - - /** - * Register records management condition - * - * @param rmCondition records management condition - * @since 2.1 - */ - void register(RecordsManagementActionCondition rmCondition); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java deleted file mode 100644 index 69ecc6585d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; -import org.alfresco.repo.policy.ClassPolicyDelegate; -import org.alfresco.repo.policy.PolicyComponent; -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; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Records Management Action Service Implementation - * - * @author Roy Wetherall - */ -public class RecordsManagementActionServiceImpl implements RecordsManagementActionService -{ - /** I18N */ - private static final String MSG_NOT_DEFINED = "rm.action.not-defined"; - private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef"; - - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementActionServiceImpl.class); - - /** Registered records management actions */ - private Map rmActions = new HashMap<>(13); - private Map rmConditions = new HashMap<>(13); - - private Map dispositionActions = new HashMap<>(5); - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Node service */ - private NodeService nodeService; - - /** Policy delegates */ - private ClassPolicyDelegate beforeRMActionExecutionDelegate; - private ClassPolicyDelegate onRMActionExecutionDelegate; - - /** - * @return Policy component - */ - protected PolicyComponent getPolicyComponent() - { - return this.policyComponent; - } - - /** - * @return Node Service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Set the policy component - * - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Initialise RM action service - */ - public void init() - { - // Register the various policies - beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.class); - onRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(OnRMActionExecution.class); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction) - */ - public void register(RecordsManagementAction rmAction) - { - if (!rmActions.containsKey(rmAction.getName())) - { - rmActions.put(rmAction.getName(), rmAction); - - if (rmAction.isDispositionAction()) - { - dispositionActions.put(rmAction.getName(), rmAction); - } - } - } - - public void register(RecordsManagementActionCondition rmCondition) - { - if (!rmConditions.containsKey(rmCondition.getBeanName())) - { - rmConditions.put(rmCondition.getBeanName(), rmCondition); - } - } - - /** - * Invoke beforeRMActionExecution policy - * - * @param nodeRef node reference - * @param name action name - * @param parameters action parameters - */ - protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef); - // execute policy for node type and aspects - BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames); - policy.beforeRMActionExecution(nodeRef, name, parameters); - } - - /** - * Invoke onRMActionExecution policy - * - * @param nodeRef node reference - * @param name action name - * @param parameters action parameters - */ - protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef); - // execute policy for node type and aspects - OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames); - policy.onRMActionExecution(nodeRef, name, parameters); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActions() - */ - public List getRecordsManagementActions() - { - List result = new ArrayList<>(this.rmActions.size()); - result.addAll(this.rmActions.values()); - return Collections.unmodifiableList(result); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActionConditions() - */ - @Override - public List getRecordsManagementActionConditions() - { - List result = new ArrayList<>(rmConditions.size()); - result.addAll(rmConditions.values()); - return Collections.unmodifiableList(result); - } - - /** - * Gets the disposition actions for the given node - * - * @param nodeRef The node reference - * @return List of records management action - */ - @SuppressWarnings("unused") - public List getDispositionActions(NodeRef nodeRef) - { - List result = new ArrayList<>(this.rmActions.size()); - - for (RecordsManagementAction action : this.rmActions.values()) - { - // TODO check the permissions on the action ... - } - - return Collections.unmodifiableList(result); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionActions() - */ - public List getDispositionActions() - { - List result = new ArrayList<>(dispositionActions.size()); - result.addAll(dispositionActions.values()); - return Collections.unmodifiableList(result); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String) - */ - public RecordsManagementAction getDispositionAction(String name) - { - return dispositionActions.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementAction(java.lang.String) - */ - public RecordsManagementAction getRecordsManagementAction(String name) - { - return this.rmActions.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name) - { - return executeRecordsManagementAction(nodeRef, name, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String) - */ - public Map executeRecordsManagementAction(List nodeRefs, String name) - { - return executeRecordsManagementAction(nodeRefs, name, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map parameters) - { - if (logger.isDebugEnabled()) - { - logger.debug("Executing record management action on " + nodeRef); - logger.debug(" actionName = " + name); - logger.debug(" parameters = " + parameters); - } - - RecordsManagementAction rmAction = this.rmActions.get(name); - if (rmAction == null) - { - String msg = I18NUtil.getMessage(MSG_NOT_DEFINED, name); - if (logger.isWarnEnabled()) - { - logger.warn(msg); - } - throw new AlfrescoRuntimeException(msg); - } - - // Execute action - invokeBeforeRMActionExecution(nodeRef, name, parameters); - RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters); - if (getNodeService().exists(nodeRef)) - { - invokeOnRMActionExecution(nodeRef, name, parameters); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.lang.String, java.util.Map) - */ - public RecordsManagementActionResult executeRecordsManagementAction(String name, Map parameters) - { - RecordsManagementAction rmAction = rmActions.get(name); - - NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef(); - if (implicitTargetNode == null) - { - String msg = I18NUtil.getMessage(MSG_NO_IMPLICIT_NODEREF, name); - if (logger.isWarnEnabled()) - { - logger.warn(msg); - } - throw new AlfrescoRuntimeException(msg); - } - else - { - return this.executeRecordsManagementAction(implicitTargetNode, name, parameters); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String, java.util.Map) - */ - public Map executeRecordsManagementAction(List nodeRefs, String name, Map parameters) - { - // Execute the action on each node in the list - Map results = new HashMap<>(nodeRefs.size()); - for (NodeRef nodeRef : nodeRefs) - { - RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters); - results.put(nodeRef, result); - } - - return results; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java deleted file mode 100644 index b79b5e2451..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action; - -import java.util.Calendar; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -/** - * Scheduled disposition job. - * - * Automatically cuts off eligible nodes. - * - * @author Roy Wetherall - */ -public class ScheduledDispositionJob implements Job -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ScheduledDispositionJob.class); - - /** - * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) - */ - public void execute(JobExecutionContext context) throws JobExecutionException - { - RecordsManagementActionService rmActionService - = (RecordsManagementActionService)context.getJobDetail().getJobDataMap().get("recordsManagementActionService"); - NodeService nodeService = (NodeService)context.getJobDetail().getJobDataMap().get("nodeService"); - - - // Calculate the date range used in the query - Calendar cal = Calendar.getInstance(); - String year = String.valueOf(cal.get(Calendar.YEAR)); - String month = String.valueOf(cal.get(Calendar.MONTH) + 1); - String dayOfMonth = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); - - //TODO These pad() calls are in RMActionExecuterAbstractBase. I've copied them - // here as I have no access to that class. - - final String currentDate = padString(year, 2) + "-" + padString(month, 2) + - "-" + padString(dayOfMonth, 2) + "T00:00:00.00Z"; - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Executing ") - .append(this.getClass().getSimpleName()) - .append(" with currentDate ") - .append(currentDate); - logger.debug(msg.toString()); - } - - //TODO Copied the 1970 start date from the old RM JavaScript impl. - String dateRange = "[\"1970-01-01T00:00:00.00Z\" TO \"" + currentDate + "\"]"; - - // Execute the query and process the results - 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); - - List resultNodes = results.getNodeRefs(); - results.close(); - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Found ") - .append(resultNodes.size()) - .append(" records eligible for disposition."); - logger.debug(msg.toString()); - } - - for (NodeRef node : resultNodes ) - { - String dispActionName = (String)nodeService.getProperty(node, RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME); - - // Only automatically execute "cutoff" actions. - // destroy and transfer and anything else should be manual for now - if (dispActionName != null && dispActionName.equalsIgnoreCase("cutoff")) - { - rmActionService.executeRecordsManagementAction(node, dispActionName); - - if (logger.isDebugEnabled()) - { - logger.debug("Performing " + dispActionName + " dispoition action on disposable item " + node.toString()); - } - } - } - } - - //TODO This has been pasted out of RMActionExecuterAbstractBase. To be relocated. - private String padString(String s, int len) - { - String result = s; - for (int i=0; i<(len - s.length()); i++) - { - result = "0" + result; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java deleted file mode 100644 index 02c83e61f7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.constraint; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * A parameter constraint that reads in a list of allowable values from Spring configuration - * - * @author Craig Tan - * @since 2.1 - */ -public class CustomParameterConstraint extends BaseParameterConstraint -{ - private List parameterValues; - - /** - * Sets the parameter values - * - * @param parameterValues The parameter values - */ - public void setParameterValues(List parameterValues) - { - this.parameterValues = parameterValues; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - Map allowableValues = new HashMap<>(parameterValues.size()); - - for (Object parameterValue : parameterValues) - { - // Look up the I18N value - String displayLabel = getI18NLabel(parameterValue.toString()); - - // Add to the map of allowed values - allowableValues.put(parameterValue.toString(), displayLabel); - } - - return allowableValues; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java deleted file mode 100644 index b06d4d574e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.constraint; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * Record type parameter constraint - * - * @author Craig Tan - * @since 2.1 - */ -public class DispositionActionParameterConstraint extends BaseParameterConstraint -{ - /** Name constant */ - public static final String NAME = "rm-ac-record-types"; - - private RecordsManagementActionService rmActionService; - - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - List rmActions = rmActionService.getDispositionActions(); - - Map result = new HashMap<>(rmActions.size()); - for (RecordsManagementAction rmAction : rmActions) - { - result.put(rmAction.getName(), rmAction.getLabel()); - } - return result; - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java deleted file mode 100644 index c6fcc3afdb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.constraint; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * Manual event parameter constraint - * - * @author Craig Tan - */ -public class ManualEventParameterConstraint extends BaseParameterConstraint -{ - /** Name constant */ - public static final String NAME = "rm-ac-manual-events"; - - private RecordsManagementEventService recordsManagementEventService; - - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - List events = recordsManagementEventService.getEvents(); - Map result = new HashMap<>(events.size()); - for (RecordsManagementEvent event : events) - { - RecordsManagementEventType eventType = recordsManagementEventService.getEventType(event.getType()); - if (eventType != null && !eventType.isAutomaticEvent()) - { - result.put(event.getName(), event.getDisplayLabel()); - } - } - return result; - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java deleted file mode 100644 index faf4c5fa4d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.constraint; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; -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.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Record type parameter constraint - * - * @author Craig Tan - * @since 2.1 - */ -public class RecordTypeParameterConstraint extends BaseParameterConstraint -{ - /** Name constant */ - public static final String NAME = "rm-ac-record-types"; - - /** record service */ - private RecordService recordService; - - /** dictionary service */ - private DictionaryService dictionaryService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - return AuthenticationUtil.runAsSystem(new RunAsWork>() - { - @SuppressWarnings("unchecked") - public Map doWork() - { - Map result = Collections.EMPTY_MAP; - - // get the file plan - // TODO we will likely have to re-implement as a custom control so that context of the file - // plan can be correctly determined when setting the rule up - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - if (filePlan != null) - { - Set recordTypes = recordService.getRecordMetadataAspects(filePlan); - - result = new HashMap<>(recordTypes.size()); - for (QName recordType : recordTypes) - { - AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType); - if (aspectDefinition != null) - { - result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle(new StaticMessageLookup())); - } - } - } - - return result; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java deleted file mode 100644 index 60817da1b9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java deleted file mode 100644 index b45f2c7c5f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordActionUtils.resolvePath; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.action.dm.RecordActionUtils.Services; -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.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * Creates a new record from an existing content object. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Roy Wetherall - */ -public class CreateRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel -{ - /** Action name */ - public static final String NAME = "create-record"; - - /** Parameter names */ - public static final String PARAM_FILE_PLAN = "file-plan"; - public static final String PARAM_HIDE_RECORD = "hide-record"; - public static final String PARAM_PATH = "path"; - - /** - * Node service - */ - private NodeService nodeService; - - /** - * File plan service - */ - private FilePlanService filePlanService; - - /** - * Authentication util - */ - private AuthenticationUtil authenticationUtil; - - /** Record service */ - private RecordService recordService; - - /** - * @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 authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @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) - { - NodeRef filePlan = (NodeRef) action.getParameterValue(PARAM_FILE_PLAN); - - // resolve destination record folder if path supplied - NodeRef destinationRecordFolder = null; - String pathParameter = (String) action.getParameterValue(PARAM_PATH); - - // indicate whether the record should be hidden or not (default not) - boolean hideRecord = false; - Boolean hideRecordValue = ((Boolean) action.getParameterValue(PARAM_HIDE_RECORD)); - if (hideRecordValue != null) - { - hideRecord = hideRecordValue; - } - - if (pathParameter != null && !pathParameter.isEmpty()) - { - RecordActionUtils.Services services = new Services(nodeService, filePlanService, authenticationUtil); - destinationRecordFolder = resolvePath(services, filePlan, pathParameter, NAME); - } - - synchronized (this) - { - // create record from existing document - recordService.createRecord(filePlan, actionedUponNodeRef, destinationRecordFolder, !hideRecord); - - if (destinationRecordFolder != null) - { - recordService.file(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))); - params.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); - params.add(new ParameterDefinitionImpl(PARAM_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD))); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java deleted file mode 100644 index 00be062062..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -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.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.action.dm.RecordActionUtils.Services; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -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.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -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; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * 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"; - public static final String PARAM_PATH = "path"; - - private static final String FILE_VERSION_RECORDS_CAPABILITY = "FileVersionRecords"; - - /** 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; - - /** Record service */ - private RecordService recordService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * @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; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @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 (isActionEligible(actionedUponNodeRef)) - { - NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); - if (filePlan == null) - { - filePlan = RecordActionUtils.getDefaultFilePlan(authenticationUtil, filePlanService, NAME); - } - // verify that the provided file plan is actually a file plan - else 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."); - } - - // resolve destination record folder if path supplied - NodeRef destinationRecordFolder = null; - String pathParameter = (String) action.getParameterValue(PARAM_PATH); - if (pathParameter != null && !pathParameter.isEmpty()) - { - RecordActionUtils.Services services = new Services(nodeService, filePlanService, authenticationUtil); - destinationRecordFolder = RecordActionUtils.resolvePath(services, filePlan, pathParameter, NAME); - } - - // create record from latest version - if (destinationRecordFolder != null) - { - boolean hasCapability = capabilityService.hasCapability(destinationRecordFolder, FILE_VERSION_RECORDS_CAPABILITY); - // validate destination record folder - if (hasCapability) - { - NodeRef recordedVersion = recordableVersionService.createRecordFromLatestVersion(destinationRecordFolder, actionedUponNodeRef); - recordService.file(recordedVersion); - } - else - { - throw new AccessDeniedException(I18NUtil.getMessage("permissions.err_access_denied")); - } - } - else - { - 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))); - params.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); - } - - /* Check aspects that stop declaring the version as record.*/ - private boolean isActionEligible(NodeRef actionedUponNodeRef) - { - Map mappedAspects = new HashMap<>(); - - mappedAspects.put(ASPECT_RECORD, " is already a record."); - mappedAspects.put(ContentModel.ASPECT_WORKING_COPY, " is a working copy."); - mappedAspects.put(ASPECT_RECORD_REJECTION_DETAILS, " has previously been rejected."); - mappedAspects.put(ASPECT_SYNCED, " is synched content."); - - for (Map.Entry aspect : mappedAspects.entrySet()) - { - if (nodeService.hasAspect(actionedUponNodeRef, aspect.getKey())) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + aspect.getValue()); - } - return false; - } - } - 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."); - } - return false; - } - return true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java deleted file mode 100644 index 83e1b8839e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import java.util.List; - -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.action.executer.ScriptActionExecuter; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; - -/** - * Executes a JavaScript - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Craig Tan - */ -public class ExecuteScriptAction extends ScriptActionExecuter -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_SCRIPTREF, DataTypeDefinition.NODE_REF, true, - getParamDisplayLabel(PARAM_SCRIPTREF), false, "rm-ac-scripts")); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java deleted file mode 100644 index 1573092eca..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -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.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.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Hides a record within a collaboration site. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class HideRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel -{ - - /** Logger */ - private static Log logger = LogFactory.getLog(HideRecordAction.class); - - /** Action name */ - public static final String NAME = "hide-record"; - - /** Node service */ - private NodeService nodeService; - - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @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) - { - if (!nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - // we cannot hide a document which is not a record - if (logger.isDebugEnabled()) - { - logger.debug("Cannot hide the document, because '" + actionedUponNodeRef.toString() + "' is not a record."); - } - } - else - { - // hide the record from the collaboration site - inplaceRecordService.hideRecord(actionedUponNodeRef); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // Intentionally empty - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java deleted file mode 100644 index 12a119681b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.lang3.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java deleted file mode 100644 index ab71bebe23..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordActionUtils.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import java.util.Arrays; -import java.util.List; - -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.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - -/** - * Utility class containing helper methods for record - */ - -public class RecordActionUtils -{ - /** - * Logger - */ - private static final Logger LOGGER = LoggerFactory.getLogger(RecordActionUtils.class); - - /** Private constructor to prevent instantiation. */ - private RecordActionUtils() - { - } - - static class Services - { - private NodeService nodeService; - private FilePlanService filePlanService; - private AuthenticationUtil authenticationUtil; - - Services(NodeService nodeService, FilePlanService filePlanService, AuthenticationUtil authenticationUtil) - { - this.nodeService = nodeService; - this.filePlanService = filePlanService; - this.authenticationUtil = authenticationUtil; - } - - public NodeService getNodeService() - { - return nodeService; - } - - public FilePlanService getFilePlanService() - { - return filePlanService; - } - - public AuthenticationUtil getAuthenticationUtil() - { - return authenticationUtil; - } - } - - /** - * Helper method to get the target record folder node reference from the action path parameter - * - * @param filePlan The filePlan containing the path - * @param pathParameter The path - * @return The NodeRef of the resolved path - */ - static NodeRef resolvePath(Services services, NodeRef filePlan, final String pathParameter, String actionName) - { - NodeRef destinationFolder; - - if (filePlan == null) - { - filePlan = getDefaultFilePlan(services.getAuthenticationUtil(), services.getFilePlanService(), actionName); - } - - final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true); - if (pathElementsArray.length > 0) - { - destinationFolder = resolvePath(services.getNodeService(), filePlan, Arrays.asList(pathElementsArray), actionName); - - // destination must be a record folder - QName nodeType = services.getNodeService().getType(destinationFolder); - if (!nodeType.equals(RecordsManagementModel.TYPE_RECORD_FOLDER)) - { - throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path is not a record folder."); - } - } - else - { - throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path could not be found."); - } - return destinationFolder; - } - - /** - * Helper method to recursively get the next path element node reference from the action path parameter - * - * @param parent The parent of the path elements - * @param pathElements The path elements still to be resolved - * @return The NodeRef of the resolved path element - */ - static NodeRef resolvePath(NodeService nodeService, NodeRef parent, List pathElements, String actionName) - { - NodeRef nodeRef; - String childName = pathElements.get(0); - - nodeRef = nodeService.getChildByName(parent, ContentModel.ASSOC_CONTAINS, childName); - - if (nodeRef == null) - { - throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path could not be found."); - } - 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)) - { - throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path is invalid."); - } - if (pathElements.size() > 1) - { - nodeRef = resolvePath(nodeService, nodeRef, pathElements.subList(1, pathElements.size()), actionName); - } - return nodeRef; - } - - /** - * Helper method to get the default RM filePlan - * - * @return The NodeRef of the default RM filePlan - */ - static NodeRef getDefaultFilePlan(AuthenticationUtil authenticationUtil, FilePlanService filePlanService, String actionName) - { - NodeRef filePlan = authenticationUtil.runAsSystem(() -> filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID)); - - // if the file plan is still null, raise an exception - if (filePlan == null) - { - final String logMessage = - String.format("Unable to execute %s action, because the fileplan path could not be determined. Make sure at least one file plan has been created.", actionName); - LOGGER.debug(logMessage); - throw new AlfrescoRuntimeException(logMessage); - } - return filePlan; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java deleted file mode 100644 index 54dd24596a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java deleted file mode 100644 index e13f6a4d2c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Records management evaluator base implementation that delegates to a configured capability condition - * implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class CapabilityConditionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** Capability Condition */ - private CapabilityCondition capabilityCondition; - - /** - * @param capabilityCondition capability condition - */ - public void setCapabilityCondition(CapabilityCondition capabilityCondition) - { - this.capabilityCondition = capabilityCondition; - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - // check a capability condition has been set and delegate - ParameterCheck.mandatory("capabilityCondition", capabilityCondition); - return capabilityCondition.evaluate(actionedUponNodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java deleted file mode 100644 index 07aa4352ca..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.repo.action.evaluator.ActionConditionEvaluator; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Records management action condition who's implementation is delegated to an existing - * action condition. - *

- * Useful for creating a RM version of an existing action condition implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DelegateActionCondition extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** Delegate action evaluator */ - private ActionConditionEvaluator actionConditionEvaluator; - - /** - * Sets the action condition evaluator - * - * @param actionConditionEvaluator The action condition evaluator - */ - public void setActionConditionEvaluator(ActionConditionEvaluator actionConditionEvaluator) - { - this.actionConditionEvaluator = actionConditionEvaluator; - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - return actionConditionEvaluator.evaluate(actionCondition, actionedUponNodeRef); - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions() - */ - @Override - protected List getParameterDefintions() - { - return actionConditionEvaluator.getActionConditionDefintion().getParameterDefinitions(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java deleted file mode 100644 index 1cc976a4e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.evaluator; - -/** - * Disposition action relative position enumeration class.
- * - * @author Craig Tan - * @since 2.1 - */ -public enum DispositionActionRelativePositions -{ - ANY, NEXT, PREVIOUS -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java deleted file mode 100644 index 937e533fde..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -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.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - - -/** - * Records management hasDispositionAction evaluator that evaluates whether the given node's disposition schedule has the specified disposition action. - * - * @author Craig Tan - * @since 2.1 - */ -public class HasDispositionActionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** - * Evaluator constants - */ - public static final String NAME = "hasDispositionAction"; - - public static final String PARAM_DISPOSITION_ACTION_RELATIVE_POSITION = "position"; - - public static final String PARAM_DISPOSITION_ACTION = "action"; - - private DispositionService dispositionService; - - /** - * Sets the disposition service - * - * @param dispositionService The disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - boolean result = false; - String position = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION)).getLocalName(); - String action = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION)).getLocalName(); - - - if (dispositionService.isDisposableItem(actionedUponNodeRef)) - { - - if (position.equals(DispositionActionRelativePositions.ANY.toString())) - { - - DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(actionedUponNodeRef); - if (dispositionSchedule != null) - { - for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) - { - if (dispositionActionDefinition.getName().equals(action)) - { - result = true; - break; - } - } - } - } - else if (position.equals(DispositionActionRelativePositions.NEXT.toString())) - { - DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(actionedUponNodeRef); - if (nextDispositionAction != null) - { - // Get the disposition actions name - String actionName = nextDispositionAction.getName(); - if (actionName.equals(action)) - { - result = true; - } - } - } - else if (position.equals(DispositionActionRelativePositions.PREVIOUS.toString())) - { - DispositionAction lastCompletedDispositionAction = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef); - if (lastCompletedDispositionAction != null) - { - // Get the disposition actions name - String actionName = lastCompletedDispositionAction.getName(); - if (actionName.equals(action)) - { - result = true; - } - } - } - } - return result; - } - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION, DataTypeDefinition.QNAME, true, - getParamDisplayLabel(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION), false, "rm-ac-disposition-action-relative-positions")); - paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_DISPOSITION_ACTION), false, - "rm-ac-disposition-actions")); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java deleted file mode 100644 index 4b8ca36104..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - - -/** - * Records management IsKind evaluator that evaluates according to the file plan - * component kind passed in. - * - * @author Craig Tan - * @since 2.1 - */ -/** - * @author ctan - */ -public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** - * Evaluator constants - */ - public static final String NAME = "isKind"; - public static final String PARAM_KIND = "kind"; - - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - boolean result = false; - String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName(); - - FilePlanComponentKind filePlanComponentKind = getFilePlanService().getFilePlanComponentKind(actionedUponNodeRef); - - if (filePlanComponentKind != null && - filePlanComponentKind.toString().equals(kind)) - { - result = true; - } - return result; - } - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_KIND, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_KIND), false, "rm-ac-is-kind-kinds")); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java deleted file mode 100644 index 202d2aa935..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Records management IsRecordType evaluator that evaluates whether the record is of the specified type. - * - * @author Craig Tan - * @since 2.1 - */ -/** - * @author ctan - */ -public class IsRecordTypeEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase implements DOD5015Model -{ - /** - * Evaluator constants - */ - public static final String NAME = "isRecordType"; - - public static final String PARAM_RECORD_TYPE = "type"; - - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - boolean result = false; - String type = ((QName) actionCondition.getParameterValue(PARAM_RECORD_TYPE)).getLocalName(); - - if (type != null) - { - result = nodeService.hasAspect(actionedUponNodeRef, QName.createQName(DOD_URI, type)); - } - - return result; - } - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_RECORD_TYPE, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_RECORD_TYPE), false, "rm-ac-record-types")); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java deleted file mode 100644 index 3089d7c295..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -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; - -/** - * Action to add types to a record - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class AddRecordTypeAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(AddRecordTypeAction.class); - - /** I18N */ - private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; - - /** Constant */ - private static final String DELIMITER = ","; - - /** Parameter names */ - public static final String PARAM_ADD_RECORD_TYPES = "recordTypes"; - - /** Action name */ - public static final String NAME = "addRecordTypes"; - - /** - * @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 (eligibleForAction(actionedUponNodeRef)) - { - for (String type : getRecordTypes(action)) - { - getRecordService().addRecordType(actionedUponNodeRef, QName.createQName(type, getNamespaceService())); - } - } - else if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); - } - } - - /** - * Helper method to check the actioned upon node reference to decide to execute the action - * The preconditions are: - * - The node must exist - * - The node must not be frozen - * - The node must be record - * - The node must not be declared - * - * @param actionedUponNodeRef node reference - * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise - */ - private boolean eligibleForAction(NodeRef actionedUponNodeRef) - { - boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - getRecordService().isRecord(actionedUponNodeRef) && - !getRecordService().isDeclared(actionedUponNodeRef)) - { - result = true; - } - return result; - } - - /** - * Helper method to get the record types from the action - * - * @param action The action - * @return An array of record types - */ - private String[] getRecordTypes(Action action) - { - String recordTypes = (String) action.getParameterValue(PARAM_ADD_RECORD_TYPES); - return recordTypes.split(DELIMITER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_ADD_RECORD_TYPES, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_ADD_RECORD_TYPES))); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java deleted file mode 100644 index 12fa853294..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -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; - -/** - * This class applies the aspect specified in the spring bean property customTypeAspect. - * It is used to apply one of the 4 "custom type" aspects from the DOD 5015 model. - * - * @author Neil McErlean - */ -public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; - private static final String MSG_CUSTOM_ASPECT_NOT_RECOGNISED = "rm.action.custom-aspect-not-recognised"; - - private static Log logger = LogFactory.getLog(ApplyCustomTypeAction.class); - private QName customTypeAspect; - private List parameterDefinitions; - - public void setCustomTypeAspect(String customTypeAspect) - { - this.customTypeAspect = QName.createQName(customTypeAspect, getNamespaceService()); - } - - /** - * @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 (logger.isDebugEnabled()) - { - logger.debug("Executing action [" + action.getActionDefinitionName() + "] on " + actionedUponNodeRef); - } - - if (getRecordService().isRecord(actionedUponNodeRef)) - { - // Apply the appropriate aspect and set the properties. - Map aspectProps = getPropertyValues(action); - this.getNodeService().addAspect(actionedUponNodeRef, customTypeAspect, aspectProps); - } - else if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected final void addParameterDefinitions(List paramList) - { - AspectDefinition aspectDef = getDictionaryService().getAspect(customTypeAspect); - for (PropertyDefinition propDef : aspectDef.getProperties().values()) - { - QName propName = propDef.getName(); - QName propType = propDef.getDataType().getName(); - paramList.add(new ParameterDefinitionImpl(propName.toPrefixString(), propType, propDef.isMandatory(), null)); - } - } - - /** - * This method converts a Map of String, Serializable to a Map of QName, Serializable. - * To do this, it assumes that each parameter name is a String representing a qname - * of the form prefix:localName. - */ - private Map getPropertyValues(Action action) - { - Map paramValues = action.getParameterValues(); - - Map result = new HashMap<>(paramValues.size()); - for (Map.Entry entry : paramValues.entrySet()) - { - QName propQName = QName.createQName(entry.getKey(), this.getNamespaceService()); - result.put(propQName, entry.getValue()); - } - - return result; - } - - @Override - protected synchronized List getParameterDefintions() - { - // We can take these parameter definitions from the properties defined in the dod model. - if (this.parameterDefinitions == null) - { - AspectDefinition aspectDefinition = getDictionaryService().getAspect(customTypeAspect); - if (aspectDefinition == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_ASPECT_NOT_RECOGNISED, customTypeAspect)); - } - - Map props = aspectDefinition.getProperties(); - - this.parameterDefinitions = new ArrayList<>(props.size()); - - for (Map.Entry entry : props.entrySet()) - { - String paramName = entry.getKey().toPrefixString(getNamespaceService()); - PropertyDefinition value = entry.getValue(); - QName paramType = value.getDataType().getName(); - boolean paramIsMandatory = value.isMandatory(); - parameterDefinitions.add(new ParameterDefinitionImpl(paramName, paramType, paramIsMandatory, null)); - } - } - return parameterDefinitions; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java deleted file mode 100644 index 0d1f40c8c5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import static org.apache.commons.lang3.BooleanUtils.isNotTrue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -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.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.policy.BehaviourFilter; -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.Period; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Action to implement the consequences of a change to the value of the DispositionActionDefinition - * properties. When these properties are changed on a disposition schedule, then any associated - * disposition actions may need to be updated as a consequence. - * - * @author Neil McErlean - */ -public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(BroadcastDispositionActionDefinitionUpdateAction.class); - - public static final String NAME = "broadcastDispositionActionDefinitionUpdate"; - public static final String CHANGED_PROPERTIES = "changedProperties"; - - private BehaviourFilter behaviourFilter; - - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (!RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION.equals(getNodeService().getType(actionedUponNodeRef))) - { - return; - } - - 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); - - behaviourFilter.disableBehaviour(); - try - { - List disposableItems = getDispositionService().getDisposableItems(dispositionSchedule); - for (NodeRef disposableItem : disposableItems) - { - updateDisposableItem(dispositionSchedule, disposableItem, actionedUponNodeRef, changedProps); - } - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - - /** - * - * @param ds - * @param disposableItem - * @param dispositionActionDefinition - * @param changedProps - */ - private void updateDisposableItem(DispositionSchedule ds, NodeRef disposableItem, NodeRef dispositionActionDefinition, List changedProps) - { - // We need to check that this folder is under the management of the disposition schedule that - // has been updated - DispositionSchedule itemDs = getDispositionService().getDispositionSchedule(disposableItem); - if (itemDs != null && - itemDs.getNodeRef().equals(ds.getNodeRef())) - { - if (getNodeService().hasAspect(disposableItem, ASPECT_DISPOSITION_LIFECYCLE)) - { - // disposition lifecycle already exists for node so process changes - processActionDefinitionChanges(dispositionActionDefinition, changedProps, disposableItem); - } - else - { - // disposition lifecycle does not exist on the node so setup disposition - getDispositionService().updateNextDispositionAction(disposableItem); - } - - // update rolled up search information - rollupSearchProperties(disposableItem); - } - } - - /** - * Manually update the rolled up search properties - * - * @param disposableItem disposable item - */ - private void rollupSearchProperties(NodeRef disposableItem) - { - DispositionAction da = getDispositionService().getNextDispositionAction(disposableItem); - if (da != null) - { - Map props = getNodeService().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)); - - DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); - Period period = daDefinition.getPeriod(); - if (period != null) - { - props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType()); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression()); - } - else - { - props.put(PROP_RS_DISPOSITION_PERIOD, null); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null); - } - - List events = da.getEventCompletionDetails(); - List list = new ArrayList<>(events.size()); - for (EventCompletionDetails event : events) - { - list.add(event.getEventName()); - } - props.put(PROP_RS_DISPOSITION_EVENTS, (Serializable)list); - - getNodeService().setProperties(disposableItem, props); - } - } - - /** - * Processes all the changes applied to the given disposition - * action definition node for the given record or folder node. - * - * @param dispositionActionDef The disposition action definition node - * @param changedProps The set of properties changed on the action definition - * @param recordOrFolder The record or folder the changes potentially need to be applied to - */ - private void processActionDefinitionChanges(NodeRef dispositionActionDef, List changedProps, NodeRef recordOrFolder) - { - // 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); - if (doesChangedStepAffectNextAction(dispositionActionDef, nextAction)) - { - // the change does effect the nextAction for this node - // so go ahead and determine what needs updating - if ((changedProps.contains(PROP_DISPOSITION_PERIOD) || changedProps.contains(PROP_DISPOSITION_PERIOD_PROPERTY)) - && isNotTrue((Boolean) getNodeService().getProperty(nextAction.getNodeRef(), PROP_MANUALLY_SET_AS_OF))) - { - persistPeriodChanges(dispositionActionDef, nextAction); - } - - if (changedProps.contains(PROP_DISPOSITION_EVENT) || changedProps.contains(PROP_DISPOSITION_EVENT_COMBINATION)) - { - nextAction.refreshEvents(); - } - - 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); - } - } - } - - /** - * Determines whether the disposition action definition (step) being - * updated has any effect on the given next action - * - * @param dispositionActionDef The disposition action definition node - * @param nextAction The next disposition action - * @return true if the step change affects the next action - */ - private boolean doesChangedStepAffectNextAction(NodeRef dispositionActionDef, - DispositionAction nextAction) - { - boolean affectsNextAction = false; - - if (dispositionActionDef != null && nextAction != null) - { - // check whether the id of the action definition node being changed - // is the same as the id of the next action - String nextActionId = nextAction.getId(); - if (dispositionActionDef.getId().equals(nextActionId)) - { - affectsNextAction = true; - } - } - - return affectsNextAction; - } - - /** - * Persists any changes made to the period on the given disposition action - * definition on the given next action. - * - * @param dispositionActionDef The disposition action definition node - * @param nextAction The next disposition action - */ - protected void persistPeriodChanges(NodeRef dispositionActionDef, DispositionAction nextAction) - { - NodeRef dispositionedNode = getNodeService().getPrimaryParent(nextAction.getNodeRef()).getParentRef(); - DispositionActionDefinition definition = nextAction.getDispositionActionDefinition(); - Date newAsOfDate = getDispositionService().calculateAsOfDate(dispositionedNode, definition); - - if (logger.isDebugEnabled()) - { - logger.debug("Set disposition as of date for next action '" + nextAction.getName() + - "' (" + nextAction.getNodeRef() + ") to: " + newAsOfDate); - } - - getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_AS_OF, newAsOfDate); - } - - @Override - protected void addParameterDefinitions(List paramList) - { - // Intentionally empty - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java deleted file mode 100644 index 5ae23aa06f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -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.repository.NodeRef; - -/** - * Action to close the records folder - * - * @author Roy Wetherall - */ -public class CloseRecordFolderAction extends RMActionExecuterAbstractBase -{ - /** Parameter names */ - public static final String PARAM_CLOSE_PARENT = "closeParent"; - - /** - * @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, final NodeRef actionedUponNodeRef) - { - if (eligibleForAction(actionedUponNodeRef)) - { - // do the work of creating the record as the system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - getRecordFolderService().closeRecordFolder(actionedUponNodeRef); - - return null; - } - }); - } - } - - /** - * Helper method to check the actioned upon node reference to decide to execute the action - * The preconditions are: - * - The node must exist - * - The node must not be frozen - * - * @param actionedUponNodeRef node reference - * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise - */ - private boolean eligibleForAction(NodeRef actionedUponNodeRef) - { - boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - !TYPE_UNFILED_RECORD_FOLDER.equals(getNodeService().getType(actionedUponNodeRef))) - { - result = true; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java deleted file mode 100644 index 05678acf05..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.Date; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Complete event action - * - * @author Roy Wetherall - * @since 1.0 - */ -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"; - public static final String PARAM_EVENT_COMPLETED_AT = "eventCompletedAt"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, - DataTypeDefinition.TEXT, - true, - getParamDisplayLabel(PARAM_EVENT_NAME), - false, - "rm-ac-manual-events")); - } - - /** - * @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 (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().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)) - { - // Get the next disposition action - DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (da != null) - { - // complete event - da.completeEvent(eventName, eventCompletedAt, eventCompletedBy); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java deleted file mode 100644 index ddfd4ac9eb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java +++ /dev/null @@ -1,434 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.util.StringUtils; - -/** - * File To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstractBase -{ - private static Log logger = LogFactory.getLog(CopyMoveLinkFileToBaseAction.class); - - /** action parameters */ - public static final String PARAM_DESTINATION_RECORD_FOLDER = "destinationRecordFolder"; - public static final String PARAM_PATH = "path"; - public static final String PARAM_CREATE_RECORD_PATH = "createRecordPath"; - public static final String ACTION_FILETO = "fileTo"; - public static final String ACTION_LINKTO = "linkTo"; - - /** file folder service */ - private FileFolderService fileFolderService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** action modes */ - public enum CopyMoveLinkFileToActionMode - { - COPY, MOVE, LINK - } - - /** Action Mode */ - private CopyMoveLinkFileToActionMode mode; - - /** - * @return Action Mode - */ - protected CopyMoveLinkFileToActionMode getMode() - { - return this.mode; - } - - /** - * Sets the action mode - * - * @param mode Action mode - */ - protected void setMode(CopyMoveLinkFileToActionMode mode) - { - this.mode = mode; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); - paramList.add(new ParameterDefinitionImpl(PARAM_CREATE_RECORD_PATH, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_CREATE_RECORD_PATH))); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected synchronized void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { - String actionName = action.getActionDefinitionName(); - if (isOkToProceedWithAction(actionedUponNodeRef, actionName)) - { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); - - boolean targetIsUnfiledRecords; - if (ACTION_FILETO.equals(action.getActionDefinitionName())) - { - targetIsUnfiledRecords = false; - } - else - { - targetIsUnfiledRecords = (getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef)) - || TYPE_UNFILED_RECORD_FOLDER.equals(actionedUponType); - } - - // first look to see if the destination record folder has been specified - NodeRef recordFolder = (NodeRef)action.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER); - if (recordFolder == null) - { - recordFolder = createOrResolvePath(action, actionedUponNodeRef, targetIsUnfiledRecords); - } - - // now we have the reference to the target folder we can do some final checks to see if the action is valid - validateActionPostPathResolution(actionedUponNodeRef, recordFolder, actionName, targetIsUnfiledRecords); - - final NodeRef finalRecordFolder = recordFolder; - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - try - { - if (getMode() == CopyMoveLinkFileToActionMode.MOVE) - { - fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null); - } - else if (getMode() == CopyMoveLinkFileToActionMode.COPY) - { - fileFolderService.copy(actionedUponNodeRef, finalRecordFolder, null); - } - else if (getMode() == CopyMoveLinkFileToActionMode.LINK) - { - getRecordService().link(actionedUponNodeRef, finalRecordFolder); - } - } - catch (FileNotFoundException fileNotFound) - { - throw new AlfrescoRuntimeException("Unable to execute file to action, because the " + (mode == CopyMoveLinkFileToActionMode.MOVE ? "move" : "copy") + " operation failed.", fileNotFound); - } - - return null; - } - }); - } - } - - /** - * Return true if the passed parameters to the action are valid for the given action - * - * @param actionedUponNodeRef - * @param actionName - * @return - */ - private boolean isOkToProceedWithAction(NodeRef actionedUponNodeRef, String actionName) - { - // Check that the incoming parameters are valid prior to performing any action - boolean okToProceed = false; - if(getNodeService().exists(actionedUponNodeRef) && !getFreezeService().isFrozen(actionedUponNodeRef)) - { - QName actionedUponType = getNodeService().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); - 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"); - } - } - 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); - 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"); - } - } - else - { - okToProceed = true; - } - } - return okToProceed; - } - - /** - * Do a final validation for the parameters and the resolve target path - * - * @param actionedUponNodeRef - * @param target - * @param actionName - * @param targetIsUnfiledRecords - */ - private void validateActionPostPathResolution(NodeRef actionedUponNodeRef, NodeRef target, String actionName, boolean targetIsUnfiledRecords) - { - QName actionedUponType = getNodeService().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) - { - throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder could not be determined."); - } - if(targetIsUnfiledRecords) - { - QName targetFolderType = getNodeService().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."); - } - } - else - { - if(getRecordFolderService().isRecordFolder(target) && !getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && (getRecordFolderService().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)) - { - throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record category cannot contain a record"); - } - } - } - - /** - * Create or resolve the path specified in the action's path parameter - * - * @param action - * @param actionedUponNodeRef - * @param targetisUnfiledRecords true is the target is in unfiled records - * @return - */ - private NodeRef createOrResolvePath(final Action action, final NodeRef actionedUponNodeRef, final boolean targetisUnfiledRecords) - { - // get the starting context - final NodeRef context = getContext(action, actionedUponNodeRef, targetisUnfiledRecords); - NodeRef path = context; - - // get the path we wish to resolve - String pathParameter = (String)action.getParameterValue(PARAM_PATH); - final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true); - if((pathElementsArray != null) && (pathElementsArray.length > 0)) - { - // get the create parameter - Boolean createValue = (Boolean)action.getParameterValue(PARAM_CREATE_RECORD_PATH); - final boolean create = createValue == null ? false : createValue.booleanValue(); - QName type = getNodeService().getType(actionedUponNodeRef); - final boolean isRecord = getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT); - - // create or resolve the specified path - path = getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - return createOrResolvePath(action, context, actionedUponNodeRef, isRecord, Arrays.asList(pathElementsArray), targetisUnfiledRecords, create, false); - } - }, false, true); - } - return path; - } - - /** - * Create or resolve the specified path - * - * @param action Action to use for reporting if anything goes wrong - * @param parent Parent of path to be created - * @param actionedUponNodeRef The node subject to the file/move/copy action - * @param isRecord true if node is a CONTENT SubType - * @param pathElements The elements of the path to be created - * @param targetisUnfiledRecords true if the target is within unfiled records - * @param create true if the path should be creeated if it does not exist - * @param creating true if we have already created the parent and therefore can skip the check to see if the next path element already exists - * @return - */ - private NodeRef createOrResolvePath(Action action, NodeRef parent, NodeRef actionedUponNodeRef, boolean isRecord, List pathElements, boolean targetisUnfiledRecords, boolean create, boolean creating) - { - NodeRef nodeRef = null; - String childName = pathElements.get(0); - boolean lastPathElement = pathElements.size() == 1; - if(!creating) - { - nodeRef = getChild(parent, childName); - } - if(nodeRef == null) - { - if(create) - { - creating = true; - boolean lastAsFolder = lastPathElement && isRecord; - nodeRef = createChild(action, parent, childName, targetisUnfiledRecords, lastAsFolder); - } - else - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path could not be determined."); - } - } - else - { - QName nodeType = getNodeService().getType(nodeRef); - if(nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || - nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || - nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)) - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path in invalid."); - } - } - if(pathElements.size() > 1) - { - nodeRef = createOrResolvePath(action, nodeRef, actionedUponNodeRef, isRecord, pathElements.subList(1, pathElements.size()), targetisUnfiledRecords, create, creating); - } - return nodeRef; - } - - /** - * Get the specified child node ref of the specified parent if it exists, otherwise return null - * - * @param parent - * @param childName - * @return - */ - private NodeRef getChild(NodeRef parent, String childName) - { - return getNodeService().getChildByName(parent, ContentModel.ASSOC_CONTAINS, childName); - } - - /** - * Create the specified child of the specified parent - * - * @param action Action to use for reporting if anything goes wrong - * @param parent Parent of the child to be created - * @param childName The name of the child to be created - * @param targetisUnfiledRecords true if the child is being created in the unfiled directory (determines type as unfiled container child) - * @param lastAsFolder true if this is the last element of the pathe being created and it should be created as a folder. ignored if targetIsUnfiledRecords is true - * @return - */ - private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder) - { - // double check that the child hasn't been created by another thread - NodeRef child = getChild(parent, childName); - if (child == null) - { - if (targetisUnfiledRecords) - { - // create unfiled folder - child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); - } - else if (lastAsFolder) - { - // create record folder - child = getRecordFolderService().createRecordFolder(parent, childName); - } - else - { - // ensure we are not trying to create a record category in a record folder - if (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(getNodeService().getType(parent))) - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path has a record category within a record folder."); - } - - // create record category - child = filePlanService.createRecordCategory(parent, childName); - } - } - return child; - } - - /** - * Return the context. This will be the unfiled records container of the context if targetisUnfiledRecords is true - * - * @param action - * @param actionedUponNodeRef - * @param targetisUnfiledRecords - * @return - */ - private NodeRef getContext(Action action, NodeRef actionedUponNodeRef, boolean targetisUnfiledRecords) - { - NodeRef context = filePlanService.getFilePlan(actionedUponNodeRef); - if(targetisUnfiledRecords && (context != null) && getNodeService().exists(context)) - { - context = filePlanService.getUnfiledContainer(context); - } - if((context == null) || (!getNodeService().exists(context))) - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the path resolution context could not be determined."); - } - return context; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java deleted file mode 100644 index 101661178d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -/** - * File To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class CopyToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "copyTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.COPY); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java deleted file mode 100644 index 94c7047ceb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -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.springframework.extensions.surf.util.I18NUtil; - -/** - * Create disposition schedule action - * - * @author Roy Wetherall - */ -public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NODE_NOT_RECORD_CATEGORY = "rm.action.node-not-record-category"; - - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @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 (eligibleForAction(actionedUponNodeRef)) - { - // Create the disposition schedule - getDispositionService().createDispositionSchedule(actionedUponNodeRef, null); - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_RECORD_CATEGORY, actionedUponNodeRef)); - } - } - - /** - * Helper method to check the actioned upon node reference to decide to execute the action - * The preconditions are: - * - The node must exist - * - The node must not be a record category - * - * @param actionedUponNodeRef node reference - * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise - */ - private boolean eligibleForAction(NodeRef actionedUponNodeRef) - { - boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - filePlanService.isRecordCategory(actionedUponNodeRef)) - { - result = true; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java deleted file mode 100644 index 6e24e8d715..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cut off disposition action - * - * @author Roy Wetherall - */ -public class CutOffAction extends RMDispositionActionExecuterAbstractBase -{ - /** Action name */ - public static final String NAME = "cutoff"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - if(checkUncutOffStatus(action, recordFolder)) - { - // Mark the folder as cut off - getDispositionService().cutoffDisposableItem(recordFolder); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - if(checkUncutOffStatus(action, record)) - { - // Mark the record as cut off - getDispositionService().cutoffDisposableItem(record); - } - } - - /** - * Check if the record or folder has been uncut off. If it has and this cut off action is an - * automated disposition action then the cut off isn't run. If it has and this is a manual - * cut off action then the uncut off aspect is removed prior to the uncut action. - * - * @param action The cut off action - * @param recordOrFolder The record or folder to be cut off - * @return True if the record or folder can be cut off - */ - private boolean checkUncutOffStatus(Action action, NodeRef recordOrFolder) - { - boolean okToCutOff = true; - if(getNodeService().hasAspect(recordOrFolder, ASPECT_UNCUT_OFF)) - { - if(action.getParameterValue(PARAM_NO_ERROR_CHECK) != null) - { - // this exception stops the cut off disposition schedule action taking place and because we're - // running from the schedule (PARAM_NO_ERROR_CHECK is set) then the exception will not be reported - throw new AlfrescoRuntimeException("Cannot cut off from schedule when uncut off aspect is present"); - } - else - { - getNodeService().removeAspect(recordOrFolder, ASPECT_UNCUT_OFF); - } - } - return okToCutOff; - } - } diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java deleted file mode 100644 index 538c899527..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.record.RecordMissingMetadataException; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Declare record action - * - * @author Roy Wetherall - */ -public class DeclareRecordAction extends RMActionExecuterAbstractBase -{ - private static final String MISSING_PROPERTIES = "missingProperties"; - - /** action name */ - public static final String NAME = "declareRecord"; - - /** Record service */ - private RecordService recordService; - - /** - * Sets the record service - * - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @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) - { - ParameterCheck.mandatory("actionedUponNodeRef", actionedUponNodeRef); - try - { - recordService.complete(actionedUponNodeRef); - } - catch (RecordMissingMetadataException e) - { - action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, MISSING_PROPERTIES); - } - catch (IntegrityException e) - { - // IntegrityException is deliberately ignored here, there should be no action taken - } - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java deleted file mode 100644 index db163f5418..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.executer.ActionExecuter; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Records management action who's implementation is delegated to an existing Action. - *

- * Useful for creating a RM version of an existing action implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DelegateAction extends RMActionExecuterAbstractBase -{ - /** Delegate action executer*/ - private ActionExecuter delegateActionExecuter; - - /** should we check whether the node is frozen */ - private boolean checkFrozen = false; - - /** - * @param delegateActionExecuter delegate action executer - */ - public void setDelegateAction(ActionExecuter delegateActionExecuter) - { - this.delegateActionExecuter = delegateActionExecuter; - } - - /** - * @param checkFrozen true if we check whether the actioned upon node reference is frozen, false otherwise - */ - public void setCheckFrozen(boolean checkFrozen) - { - this.checkFrozen = checkFrozen; - } - - /** - * @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 (getNodeService().exists(actionedUponNodeRef) && - (!checkFrozen || !getFreezeService().isFrozen(actionedUponNodeRef))) - { - // do the property subs (if any exist) - if (isAllowParameterSubstitutions()) - { - getParameterProcessorComponent().process(action, delegateActionExecuter.getActionDefinition(), actionedUponNodeRef); - } - - delegateActionExecuter.execute(action, actionedUponNodeRef); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions() - */ - @Override - protected List getParameterDefintions() - { - return delegateActionExecuter.getActionDefinition().getParameterDefinitions(); - } - - @Override - protected void addParameterDefinitions(List paramList) - { - super.addParameterDefinitions(paramList); - paramList.addAll(delegateActionExecuter.getActionDefinition().getParameterDefinitions()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java deleted file mode 100644 index 4a2ba2f42a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Delete Hold Action - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class DeleteHoldAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_DELETE_NOT_HOLD_TYPE = "rm.action.delete-not-hold-type"; - - /** - * @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 (getHoldService().isHold(actionedUponNodeRef)) - { - getHoldService().deleteHold(actionedUponNodeRef); - } - else - { - throw new AlfrescoRuntimeException(MSG_DELETE_NOT_HOLD_TYPE, new Object[]{ TYPE_HOLD.toString(), actionedUponNodeRef.toString() }); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java deleted file mode 100644 index 3681cddc6f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.io.Serializable; -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.content.ContentDestructionComponent; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang3.StringUtils; - -/** - * Destroy action. - * - * @author Roy Wetherall - */ -public class DestroyAction extends RMDispositionActionExecuterAbstractBase -{ - /** Action name */ - public static final String NAME = "destroy"; - - /** content destruction component */ - private ContentDestructionComponent contentDestructionComponent; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Recordable version service */ - private RecordableVersionService recordableVersionService; - - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; - - /** Indicates if ghosting is enabled or not */ - private boolean ghostingEnabled = true; - - /** - * @param contentDestructionComponent content destruction component - */ - public void setContentDestructionComponent(ContentDestructionComponent contentDestructionComponent) - { - this.contentDestructionComponent = contentDestructionComponent; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * @param inplaceRecordService inplace record service - */ - public void setInplaceRecordService(InplaceRecordService inplaceRecordService) - { - this.inplaceRecordService = inplaceRecordService; - } - - /** - * @param ghostingEnabled true if ghosting is enabled, false otherwise - */ - public void setGhostingEnabled(boolean ghostingEnabled) - { - this.ghostingEnabled = ghostingEnabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#checkNextDispositionAction(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean checkNextDispositionAction(NodeRef actionedUponNodeRef) - { - return checkForDestroyRecordsCapability(actionedUponNodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#checkEligibility(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean checkEligibility(NodeRef actionedUponNodeRef) - { - return checkForDestroyRecordsCapability(actionedUponNodeRef); - } - - /** - * - * @param actionedUponNodeRef - * @return - */ - private boolean checkForDestroyRecordsCapability(NodeRef actionedUponNodeRef) - { - boolean result = true; - if (AccessStatus.ALLOWED.equals(capabilityService.getCapability("DestroyRecords").hasPermission(actionedUponNodeRef))) - { - result = false; - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - List records = getRecordService().getRecords(recordFolder); - for (NodeRef record : records) - { - executeRecordLevelDisposition(action, record); - } - if (isGhostOnDestroySetForAction(action, recordFolder)) - { - // add aspect - getNodeService().addAspect(recordFolder, ASPECT_GHOSTED, Collections. emptyMap()); - } - else - { - // just delete the node - getNodeService().deleteNode(recordFolder); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - if (isGhostOnDestroySetForAction(action, record)) - { - // mark version as destroyed - Version version = recordableVersionService.getRecordedVersion(record); - if (version != null) - { - recordableVersionService.destroyRecordedVersion(version); - } - - // Hide from inplace users to give the impression of destruction - inplaceRecordService.hideRecord(record); - - // Add the ghosted aspect - getNodeService().addAspect(record, ASPECT_GHOSTED, null); - - // destroy content - contentDestructionComponent.destroyContent(record); - } - else - { - // just delete the node - getNodeService().deleteNode(record); - } - } - - /** - * 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 - */ - private boolean isGhostOnDestroySetForAction(Action action, NodeRef nodeRef) - { - boolean ghostOnDestroy = this.ghostingEnabled; - String actionDefinitionName = action.getActionDefinitionName(); - if (!StringUtils.isEmpty(actionDefinitionName)) - { - DispositionSchedule dispositionSchedule = this.getDispositionService().getDispositionSchedule(nodeRef); - if (dispositionSchedule != null) - { - DispositionActionDefinition actionDefinition = dispositionSchedule - .getDispositionActionDefinitionByName(actionDefinitionName); - if (actionDefinition != null) - { - String ghostOnDestroyProperty = actionDefinition.getGhostOnDestroy(); - if (ghostOnDestroyProperty != null) - { - ghostOnDestroy = "ghost".equals(actionDefinition.getGhostOnDestroy()); - } - } - } - } - return ghostOnDestroy; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java deleted file mode 100644 index 70b4cead75..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.Date; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Edit review as of date action. - * - * @author Roy Wetherall - */ -public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_VALID_DATE_DISP_ASOF = "rm.action.valid-date-disp-asof"; - private static final String MSG_DISP_ASOF_LIFECYCLE_APPLIED = "rm.action.disp-asof-lifecycle-applied"; - - /** Action name */ - public static final String NAME = "editDispositionActionAsOfDate"; - - /** Action parameters */ - public static final String PARAM_AS_OF_DATE = "asOfDate"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Get the action parameter - Date asOfDate = (Date)action.getParameterValue(PARAM_AS_OF_DATE); - if (asOfDate == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_VALID_DATE_DISP_ASOF)); - } - - // Set the dispostion action as of date - DispositionAction da = getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (da != null) - { - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate); - getNodeService().setProperty(da.getNodeRef(), PROP_MANUALLY_SET_AS_OF, true); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DISP_ASOF_LIFECYCLE_APPLIED)); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java deleted file mode 100644 index a1a45c6810..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Edit freeze reason Action - * - * @author Roy Wetherall - */ -public class EditHoldReasonAction extends RMActionExecuterAbstractBase -{ - private static final String MSG_HOLD_EDIT_REASON_NONE = "rm.action.hold-edit-reason-none"; - private static final String MSG_HOLD_EDIT_TYPE = "rm.action.hold-edit-type"; - - /** Parameter names */ - public static final String PARAM_REASON = "reason"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getFreezeService().isHold(actionedUponNodeRef)) - { - // Get the property values - String reason = (String) action.getParameterValue(PARAM_REASON); - if (StringUtils.isBlank(reason)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_REASON_NONE)); - } - - // Update hold reason - getFreezeService().updateReason(actionedUponNodeRef, reason); - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_TYPE, TYPE_HOLD.toString(), actionedUponNodeRef.toString())); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java deleted file mode 100644 index c139fcec2c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.Date; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * - * Edit review as of date action - * - * @author Roy Wetherall - */ -public class EditReviewAsOfDateAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_SPECIFY_VALID_DATE = "rm.action.specify-avlid-date"; - private static final String MSG_REVIEW_DETAILS_ONLY = "rm.action.review-details-only"; - - public static final String PARAM_AS_OF_DATE = "asOfDate"; - - /** - * @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 (getRecordService().isRecord(actionedUponNodeRef) && - getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD)) - { - // Get the action parameter - Date reviewAsOf = (Date)action.getParameterValue(PARAM_AS_OF_DATE); - if (reviewAsOf == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SPECIFY_VALID_DATE)); - } - - // Set the as of date - this.getNodeService().setProperty(actionedUponNodeRef, PROP_REVIEW_AS_OF, reviewAsOf); - - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_REVIEW_DETAILS_ONLY)); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java deleted file mode 100644 index e551d112b6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -import org.alfresco.module.org_alfresco_module_rm.report.ReportService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.repo.content.MimetypeMap; -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.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * File report generic action. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class FileReportAction extends RMActionExecuterAbstractBase implements ReportModel -{ - /** action name */ - public static final String NAME = "fileReport"; - - /** Constants for the parameters passed from the UI */ - public static final String REPORT_TYPE = "reportType"; - - public static final String DESTINATION = "destination"; - - public static final String MIMETYPE = "mimetype"; - - /** I18N */ - private static final String MSG_PARAM_NOT_SUPPLIED = "rm.action.parameter-not-supplied"; - - /** Report service */ - private ReportService reportService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * @return Report service - */ - protected ReportService getReportService() - { - return this.reportService; - } - - /** - * @return Capability service - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * @param reportService report service - */ - public void setReportService(ReportService reportService) - { - this.reportService = reportService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @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) - { - // get the mimetype of the report - String mimetype = (String) action.getParameterValue(MIMETYPE); - if (mimetype == null || mimetype.isEmpty()) - { - mimetype = MimetypeMap.MIMETYPE_HTML; - } - - // get the report type - QName reportType = getReportType(action); - - // get the destination - final NodeRef destination = getDestination(action); - - // Check the filing permission only capability for the destination - checkFilingPermissionOnlyCapability(destination); - - // generate the report - final Report report = getReportService().generateReport(reportType, actionedUponNodeRef, mimetype); - - // file the report as system - NodeRef filedReport = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return getReportService().fileReport(destination, report); - } - }); - - // return the report name - String filedReportName = (String) getNodeService().getProperty(filedReport, ContentModel.PROP_NAME); - action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, filedReportName); - } - - /** - * Checks if the destination is frozen, closed, cut off or not. In case if it is an exception will be thrown. - * - * @param nodeRef The destination node reference for which the capability should be checked - */ - private void checkFilingPermissionOnlyCapability(NodeRef nodeRef) - { - 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!"); - } - } - - /** - * Retrieves the value of the given parameter. If the parameter has not been - * passed from the UI an error will be thrown - * - * @param action The action - * @param parameter The parameter for which the value should be retrieved - * @return The value of the given parameter - */ - private String getParameterValue(Action action, String parameter) - { - String paramValue = (String) action.getParameterValue(parameter); - if (StringUtils.isBlank(paramValue)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage( - MSG_PARAM_NOT_SUPPLIED, parameter)); } - return paramValue; - } - - /** - * Helper method for getting the destination. - * - * @param action The action - * @return The file plan node reference - */ - private NodeRef getDestination(Action action) - { - String destination = getParameterValue(action, DESTINATION); - return new NodeRef(destination); - } - - /** - * Helper method for getting the report type. - * - * @param action The action - * @return The report type - */ - private QName getReportType(Action action) - { - String reportType = getParameterValue(action, REPORT_TYPE); - return QName.createQName(reportType, getNamespaceService()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java deleted file mode 100644 index b029f40f4c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -/** - * File To action implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FileToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "fileTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.MOVE); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java deleted file mode 100644 index 180c59775f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze Action - * - * @author Roy Wetherall - */ -public class FreezeAction extends RMActionExecuterAbstractBase -{ - /** Parameter names */ - public static final String PARAM_REASON = "reason"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REASON))); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - 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)) - { - getFreezeService().freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java deleted file mode 100644 index ef6a218021..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -/** - * Link To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class LinkToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "linkTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.LINK); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java deleted file mode 100644 index 09d2f860f1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -/** - * File To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class MoveToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "moveTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.MOVE); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java deleted file mode 100644 index 2f76fdcaec..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -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.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Action to re-open the records folder - * - * @author Roy Wetherall - */ -public class OpenRecordFolderAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(OpenRecordFolderAction.class); - - /** I18N */ - private static final String MSG_NO_OPEN_RECORD_FOLDER = "rm.action.no-open-record-folder"; - - /** Parameter names */ - public static final String PARAM_OPEN_PARENT = "openParent"; - - /** - * @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 (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - !(getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) && !getRecordService().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)) - { - ChildAssociationRef assocRef = getNodeService().getPrimaryParent(actionedUponNodeRef); - if (assocRef != null) - { - actionedUponNodeRef = assocRef.getParentRef(); - } - } - - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - Boolean isClosed = (Boolean) getNodeService().getProperty(actionedUponNodeRef, PROP_IS_CLOSED); - if (Boolean.TRUE.equals(isClosed)) - { - getNodeService().setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false); - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString())); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java deleted file mode 100644 index c9db1a7b22..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Reject action for an unfiled record - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RejectAction extends RMActionExecuterAbstractBase -{ - /** Parameter names */ - public static final String PARAM_REASON = "reason"; - - /** Action name */ - public static final String NAME = "reject"; - - /** - * @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 (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - getNodeService().getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINATING_LOCATION) != null) - { - getRecordService().rejectRecord(actionedUponNodeRef, (String) action.getParameterValue(PARAM_REASON)); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_REASON))); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java deleted file mode 100644 index bfd1656ff3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Relinquish Hold Action - * - * @author Roy Wetherall - */ -public class RelinquishHoldAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NOT_HOLD_TYPE = "rm.action.not-hold-type"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getFreezeService().isHold(actionedUponNodeRef)) - { - getFreezeService().relinquish(actionedUponNodeRef); - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_HOLD_TYPE, TYPE_HOLD.toString(), actionedUponNodeRef.toString())); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java deleted file mode 100644 index 435aad4665..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.workflow.WorkflowModel; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Request info action for starting a workflow to request more information for an undeclared record - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RequestInfoAction.class); - - /** Parameter names */ - public static final String PARAM_REQUESTED_INFO = "requestedInfo"; - public static final String PARAM_ASSIGNEES = "assignees"; - public static final String PARAM_RULE_CREATOR = "ruleCreator"; - - /** Action name */ - public static final String NAME = "requestInfo"; - - /** Workflow definition name */ - private static final String REQUEST_INFO_WORKFLOW_DEFINITION_NAME = "activiti$activitiRequestForInformation"; - - /** Workflow service */ - private WorkflowService workflowService; - - /** - * @param workflowService workflow service - */ - public void setWorkflowService(WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - /** - * @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 (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - getRecordService().isRecord(actionedUponNodeRef) && - !getRecordService().isDeclared(actionedUponNodeRef)) - { - String workflowDefinitionId = workflowService.getDefinitionByName(REQUEST_INFO_WORKFLOW_DEFINITION_NAME).getId(); - Map parameters = new HashMap<>(); - - parameters.put(WorkflowModel.ASSOC_PACKAGE, getWorkflowPackage(action, actionedUponNodeRef)); - parameters.put(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action)); - parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action)); - parameters.put(RMWorkflowModel.RM_RULE_CREATOR, getRuleCreator(action)); - - workflowService.startWorkflow(workflowDefinitionId, parameters); - } - else - { - logger.info("Can't start the request information workflow for node '" + actionedUponNodeRef.toString() + "'."); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_REQUESTED_INFO, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REQUESTED_INFO))); - paramList.add(new ParameterDefinitionImpl(PARAM_ASSIGNEES, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_ASSIGNEES))); - paramList.add(new ParameterDefinitionImpl(PARAM_RULE_CREATOR, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_RULE_CREATOR))); - } - - /** - * Helper method for creating a workflow package to contain the actioned upon nodeRef - * - * @param action The request info action - * @param actionedUponNodeRef The actioned upon nodeRef - * @return Returns a workflow package containing the actioned upon nodeRef - */ - private NodeRef getWorkflowPackage(Action action, NodeRef actionedUponNodeRef) - { - NodeRef workflowPackage = (NodeRef) action.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(getNamespaceService())); - workflowPackage = workflowService.createPackage(workflowPackage); - ChildAssociationRef childAssoc = getNodeService().getPrimaryParent(actionedUponNodeRef); - getNodeService().addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName()); - return workflowPackage; - } - - /** - * Helper method for getting the assignees from the action - * - * @param action The request info action - * @return Returns a list of {@link NodeRef}s each representing the assignee - */ - private Serializable getAssignees(Action action) - { - List assigneesList = new ArrayList<>(); - String assigneesAsString = (String) action.getParameterValue(PARAM_ASSIGNEES); - String[] assignees = StringUtils.split(assigneesAsString, ','); - for (String assignee : assignees) - { - assigneesList.add(new NodeRef(assignee)); - } - return (Serializable) assigneesList; - } - - /** - * Helper method for getting the requested information from the action - * - * @param action The request info action - * @return Returns the requested information - */ - private Serializable getRequestedInformation(Action action) - { - return action.getParameterValue(PARAM_REQUESTED_INFO); - } - - /** - * Helper method for getting the rule creator - * - * @param action The request info action - * @return Returns the rule creator - */ - private Serializable getRuleCreator(Action action) - { - return action.getParameterValue(PARAM_RULE_CREATOR); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java deleted file mode 100644 index 59547d40fb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Retain action - * - * @author Roy Wetherall - */ -public class RetainAction extends RMDispositionActionExecuterAbstractBase -{ - /** - * Action name - */ - public static final String NAME = "retain"; - - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - // Do nothing - } - - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - // Do nothing - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java deleted file mode 100644 index 6ee60a5e68..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Serializable; -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; -import javax.mail.Part; -import javax.mail.internet.ContentType; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeUtility; - -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.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -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; -import org.springframework.util.FileCopyUtils; - -/** - * Split Email Action - * - * Splits the attachments for an email message out to independent records. - * - * @author Mark Rogers - */ -public class SplitEmailAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NO_READ_MIME_MESSAGE = "rm.action.no-read-mime-message"; - private static final String MSG_EMAIL_DECLARED = "rm.action.email-declared"; - private static final String MSG_EMAIL_NOT_RECORD = "rm.action.email-not-record"; - - /** Relationship Labels */ - private static final String REL_FROM = "Message"; - private static final String REL_TO = "Attachment"; - - /** 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; - - public void bootstrap() - { - Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - if (sourceText.equals(REL_FROM) && targetText.equals(REL_TO)) - { - relationshipUniqueName = relationshipDefinition.getUniqueName(); - } - } - - if (isBlank(relationshipUniqueName)) - { - RelationshipDisplayName displayName = new RelationshipDisplayName(REL_FROM, REL_TO); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - relationshipUniqueName = relationshipDefinition.getUniqueName(); - } - } - - /** - * @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) - { - // get node type - getNodeService().getType(actionedUponNodeRef); - - if (logger.isDebugEnabled()) - { - logger.debug("split email:" + actionedUponNodeRef); - } - - if (getRecordService().isRecord(actionedUponNodeRef)) - { - if (!getRecordService().isDeclared(actionedUponNodeRef)) - { - ChildAssociationRef parent = getNodeService().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); - if(refs.size() > 0) - { - if (logger.isDebugEnabled()) - { - logger.debug("mail message has already been split - do nothing"); - } - return; - } - - /** - * Get the content and if its a mime message then create atachments for each part - */ - try - { - ContentReader reader = getContentService().getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT); - InputStream is = reader.getContentInputStream(); - MimeMessage mimeMessage = new MimeMessage(null, is); - Object content = mimeMessage.getContent(); - if (content instanceof Multipart) - { - Multipart multipart = (Multipart)content; - - for (int i = 0, n = multipart.getCount(); i < n; i++) - { - Part part = multipart.getBodyPart(i); - if ("attachment".equalsIgnoreCase(part.getDisposition())) - { - createAttachment(actionedUponNodeRef, parent.getParentRef(), part); - } - } - } - } - catch (Exception e) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_READ_MIME_MESSAGE, e.toString()), e); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_DECLARED, actionedUponNodeRef.toString())); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_NOT_RECORD, actionedUponNodeRef.toString())); - } - } - - /** - * Create attachment from Mime Message Part - * @param messageNodeRef - the node ref of the mime message - * @param parentNodeRef - the node ref of the parent folder - * @param part - * @throws MessagingException - * @throws IOException - */ - private void createAttachment(NodeRef messageNodeRef, NodeRef parentNodeRef, Part part) throws MessagingException, IOException - { - String fileName = part.getFileName(); - try - { - fileName = MimeUtility.decodeText(fileName); - } - catch (UnsupportedEncodingException e) - { - if (logger.isWarnEnabled()) - { - logger.warn("Cannot decode file name '" + fileName + "'", e); - } - } - - Map messageProperties = getNodeService().getProperties(messageNodeRef); - String messageTitle = (String)messageProperties.get(ContentModel.PROP_NAME); - if(messageTitle == null) - { - messageTitle = fileName; - } - else - { - messageTitle = messageTitle + " - " + fileName; - } - - ContentType contentType = new ContentType(part.getContentType()); - - Map docProps = new HashMap<>(1); - docProps.put(ContentModel.PROP_NAME, messageTitle + " - " + fileName); - docProps.put(ContentModel.PROP_TITLE, fileName); - - /** - * Create an attachment node in the same folder as the message - */ - ChildAssociationRef attachmentRef = getNodeService().createNode(parentNodeRef, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName), - ContentModel.TYPE_CONTENT, - docProps); - - /** - * Write the content into the new attachment node - */ - ContentWriter writer = getContentService().getWriter(attachmentRef.getChildRef(), ContentModel.PROP_CONTENT, true); - writer.setMimetype(contentType.getBaseType()); - OutputStream os = writer.getContentOutputStream(); - FileCopyUtils.copy(part.getInputStream(), os); - - /** - * Create a link from the message to the attachment - */ - createRMReference(messageNodeRef, attachmentRef.getChildRef()); - - - } - - /** - * Create a link from the message to the attachment - */ - private void createRMReference(final NodeRef parentRef, final NodeRef childRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // add the relationship - getRelationshipService().addRelationship(relationshipUniqueName, parentRef, childRef); - - // add the IMAP attachment aspect - getNodeService().createAssociation( - parentRef, - childRef, - ImapModel.ASSOC_IMAP_ATTACHMENT); - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java deleted file mode 100644 index f1853f8bbf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.repo.action.executer.ActionExecuter; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Transfer action - * - * @author Roy Wetherall - */ -public class TransferAction extends RMDispositionActionExecuterAbstractBase -{ - /** Action name */ - public static final String NAME = "transfer"; - - /** Indicates whether the transfer is an accession or not */ - private boolean isAccession = false; - - /** transfer service */ - private TransferService transferService; - - /** - * Indicates whether this transfer is an accession or not - * - * @param isAccession Is the transfer an accession or not - */ - public void setIsAccession(boolean isAccession) - { - this.isAccession = isAccession; - } - - /** - * Sets the transfer service - * - * @param transferService transfer service - */ - public void setTransferService(TransferService transferService) - { - this.transferService = transferService; - } - - /** - * Do not set the transfer action to auto-complete - * - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#getSetDispositionActionComplete() - */ - @Override - public boolean getSetDispositionActionComplete() - { - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - doTransfer(action, recordFolder); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - doTransfer(action, record); - } - - /** - * Create the transfer node and link the disposition lifecycle node beneath it - * - * @param action action - * @param dispositionLifeCycleNodeRef disposition lifecycle node - */ - private void doTransfer(Action action, NodeRef dispositionLifeCycleNodeRef) - { - NodeRef transferNodeRef = transferService.transfer(dispositionLifeCycleNodeRef, isAccession); - - // Set the return value of the action - action.setParameterValue(ActionExecuter.PARAM_RESULT, transferNodeRef); - - // Cut off the disposable item if it's not cut off already - if (!getDispositionService().isDisposableItemCutoff(dispositionLifeCycleNodeRef)) - { - getDispositionService().cutoffDisposableItem(dispositionLifeCycleNodeRef); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java deleted file mode 100644 index 777bd035c1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Transfer complete action - * - * @author Roy Wetherall - */ -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; - - /** - * @return transfer service - */ - protected TransferService getTransferService() - { - return this.transferService; - } - - /** - * @param transferService transfer service - */ - public void setTransferService(TransferService transferService) - { - this.transferService = transferService; - } - - /** - * @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) - { - checkTransferSubClass(actionedUponNodeRef); - getTransferService().completeTransfer(actionedUponNodeRef); - } - - /** - * Checks if the actioned upon node reference is a sub class of transfer - * - * @param actionedUponNodeRef actioned upon node reference - */ - private void checkTransferSubClass(NodeRef actionedUponNodeRef) - { - QName type = getNodeService().getType(actionedUponNodeRef); - if (!getDictionaryService().isSubClass(type, TYPE_TRANSFER)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_TRANSFER)); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java deleted file mode 100644 index 98b561cc7e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * UnCutoff action implementation - * - * @author Roy Wetherall - */ -public class UnCutoffAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_UNDO_NOT_LAST = "rm.action.undo-not-last"; - - /** - * @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 (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) && - getNodeService().hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF)) - { - // Get the last disposition action - DispositionAction da = getDispositionService().getLastCompletedDispostionAction(actionedUponNodeRef); - - // Check that the last disposition action was a cutoff - if (da == null || !da.getName().equals("cutoff")) - { - // Can not undo cut off since cut off was not the last thing done - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDO_NOT_LAST)); - } - - // 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)) - { - List records = getRecordService().getRecords(actionedUponNodeRef); - for (NodeRef record : records) - { - getNodeService().removeAspect(record, ASPECT_CUT_OFF); - getNodeService().addAspect(record, ASPECT_UNCUT_OFF, null); - } - } - - // Delete the current disposition action - DispositionAction currentDa = getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (currentDa != null) - { - getNodeService().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); - - // 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); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java deleted file mode 100644 index 895e1d7549..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Undeclare record action - * - * @author Roy Wetherall - */ -public class UndeclareRecordAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(UndeclareRecordAction.class); - - /** I18N */ - private static final String MSG_RECORDS_ONLY_UNDECLARED = "rm.action.records_only_undeclared"; - - /** - * @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 (getNodeService().exists(actionedUponNodeRef)) - { - if (getRecordService().isRecord(actionedUponNodeRef)) - { - // repoen if already complete and not frozen - if (getRecordService().isDeclared(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) - { - // Remove the declared aspect - this.getNodeService().removeAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD); - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_RECORDS_ONLY_UNDECLARED)); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java deleted file mode 100644 index 07b10b145b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Undo event action - * - * @author Roy Wetherall - * @since 1.0 - */ -public class UndoEventAction extends RMActionExecuterAbstractBase -{ - /** Params */ - public static final String PARAM_EVENT_NAME = "eventName"; - - /** - * @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) - { - String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); - - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Get the next disposition action - DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (da != null) - { - // undo completed event - da.undoEvent(eventName); - } - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // TODO add parameter definitions .... - // eventName - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java deleted file mode 100644 index 256030a25c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unfreeze Action - * - * @author Roy Wetherall - */ -public class UnfreezeAction extends RMActionExecuterAbstractBase -{ - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - getFreezeService().unFreeze(actionedUponNodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java deleted file mode 100644 index 50904b211a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java deleted file mode 100644 index 14ab325a62..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.admin; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.CannotApplyConstraintMetadataException - */ -public class CannotApplyConstraintMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint"; - - public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType) - { - super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java deleted file mode 100644 index bf9f93da77..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.admin; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.CustomMetadataException - */ -@AlfrescoPublicApi -public abstract class CustomMetadataException extends Exception -{ - private static final long serialVersionUID = -6676112294794381360L; - - public CustomMetadataException(String msg) - { - super(msg); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java deleted file mode 100644 index 618c4430d1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.admin; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.InvalidCustomAspectMetadataException - */ -public class InvalidCustomAspectMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect"; - - public InvalidCustomAspectMetadataException(QName customAspect, String aspectName) - { - super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java deleted file mode 100644 index f08c469b5e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.admin; - -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.NotCustomisableMetadataException - */ -public class NotCustomisableMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable"; - - public NotCustomisableMetadataException(String aspectName) - { - super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java deleted file mode 100644 index 6996c35b89..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.admin; - -import org.alfresco.api.AlfrescoPublicApi; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.PropertyAlreadyExistsMetadataException - */ -@AlfrescoPublicApi -public class PropertyAlreadyExistsMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - - public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists"; - - public PropertyAlreadyExistsMetadataException(String propIdAsString) - { - super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java deleted file mode 100644 index b4f452af32..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java deleted file mode 100644 index f39111509a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.admin; - -import java.util.List; -import java.util.Map; -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.QNamePattern; - -/** - * Records management custom model service interface. Implementations of this class are responsible - * for the creation and maintenance of RM-related custom properties and custom associations. - * - * @author Neil McErlean, janv - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService - */ -// Not @AlfrescoPublicApi at the moment as it requires MatchLogic which is not public API. -public interface RecordsManagementAdminService -{ - /** - * Get a list of all registered customisable types and aspects. - * - * @return Set of <{@link QName}>s of customisable types and aspects - */ - Set getCustomisable(); - - /** - * Get a list of all the registered customisable types and aspects present on a given - * node reference. - * - * @param nodeRef node reference - * @return Set of <{@link QName}>s of customisable types and aspects, empty if none - */ - Set getCustomisable(NodeRef nodeRef); - - /** - * Indicates whether a type (or aspect) is customisable. - * - * @param type customisable type {@link QName} - * @return boolean true if type customisable, false otherwise - */ - boolean isCustomisable(QName type); - - /** - * Makes a type customisable. - * - * @param type type {@link QName} to make customisable - */ - void makeCustomisable(QName type); - - /** - * Assuming the custom properties are not in use, makes a type no longer customisable. - * - * @param type type {@link QName} to make customisable - */ - void unmakeCustomisable(QName type); - - /** - * Indicates whether the custom property exists. - * - * @param property properties {@link QName} - * @return boolean true if property exists, false otherwise - */ - boolean existsCustomProperty(QName property); - - /** - * This method returns the custom properties that have been defined for the specified - * customisable RM element. - *

- * Note: the custom property definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom properties created in the current transaction will not appear - * in the result of this method. - * - *

- * @param customisableType - * @return Map of <{@link QName}, {@link PropertyDefinition}>s of custom properties definitions - */ - Map getCustomPropertyDefinitions(QName customisableType); - - /** - * This method returns the custom properties that have been defined for all of - * the specified customisable RM elements. - *

- * Note: the custom property definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom properties created in the current transaction will not appear - * in the result of this method. - *

- * - * @return Map of <{@link QName}, {@link PropertyDefinition}>s of custom properties definitions - */ - Map getCustomPropertyDefinitions(); - - /** - * Add custom property definition - * - * Note: no default value, single valued, optional, not system protected, no constraints - * - * @param propId - If a value for propId is provided it will be used to identify property definitions - * within URLs and in QNames. Therefore it must contain URL/QName-valid characters - * only. It must also be unique. - * If a null value is passed, an id will be generated. - * @param typeName - mandatory. The aspect within which the property is to be defined. - * This must be one of the CustomisableRmElements. - * @param label - mandatory - * @param dataType - mandatory - * @param title - optional - * @param description - optional - * - * @return the propId, whether supplied as a parameter or generated. - */ - QName addCustomPropertyDefinition(QName propId, QName typeName, String label, QName dataType, String title, String description) throws CustomMetadataException; - - /** - * Add custom property definition with one optional constraint reference - * - * @param propId - If a value for propId is provided it will be used to identify property definitions - * within URLs and in QNames. Therefore it must contain URL/QName-valid characters - * only. It must also be unique. - * If a null value is passed, an id will be generated. - * @param typeName - mandatory. The aspect within which the property is to be defined. - * This must be one of the CustomisableRmElements. - * @param label - mandatory - * @param dataType - mandatory - * @param title - optional - * @param description - optional - * @param defaultValue - optional - * @param multiValued - TRUE if multi-valued property - * @param mandatory - TRUE if mandatory property - * @param isProtected - TRUE if protected property - * @param lovConstraintQName - optional custom constraint - * - * @return the propId, whether supplied as a parameter or generated. - */ - - // TODO propId string (not QName) ? - // TODO remove title (since it is ignored) (or remove label to title) - - QName addCustomPropertyDefinition(QName propId, - QName typeName, - String label, - QName dataType, - String title, - String description, - String defaultValue, - boolean multiValued, - boolean mandatory, - boolean isProtected, - QName lovConstraintQName) throws CustomMetadataException; - - /** - * Update the custom property definition's label (title). - * - * @param propQName the qname of the property definition - * @param newLabel the new value for the label. - * @return the propId. - */ - QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) throws PropertyAlreadyExistsMetadataException; - - /** - * Update the name and label of the custom property definition. - * @param propQName The qname of the existing property definition - * @param newName THe new name for both the custom property and its label. - * @return - * @throws CustomMetadataException - */ - QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException; - - /** - * Sets a new list of values constraint on the custom property definition. - * - * @param propQName the qname of the property definition - * @param newLovConstraint the List-Of-Values constraintRef. - * @return the propId. - */ - QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint); - - /** - * Removes all list of values constraints from the custom property definition. - * - * @param propQName the qname of the property definition - * @return the propId. - */ - QName removeCustomPropertyDefinitionConstraints(QName propQName); - - /** - * Remove custom property definition - * - * @param propQName - */ - void removeCustomPropertyDefinition(QName propQName); - - /** - * This method returns the custom references that have been defined in the custom - * model. - * Note: the custom reference definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom references created in the current transaction will not appear - * 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(); - - /** - * Fetches all associations from the given source. - * - * @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, QNamePattern)} with QNamePattern RegexQNamePattern.MATCH_ALL - * instead - */ - List getCustomReferencesFrom(NodeRef node); - - /** - * Fetches all child associations of the given source. i.e. all associations where the - * given node is the parent. - * - * @param node - * @return - * @deprecated as of RM 2.3, please use {@link NodeService#getChildAssocs(NodeRef)} instead. - */ - List getCustomChildReferences(NodeRef node); - - /** - * Returns a List of all associations to the given node. - * - * @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, QNamePattern)} with QNamePattern RegexQNamePattern.MATCH_ALL instead. - */ - List getCustomReferencesTo(NodeRef node); - - /** - * Fetches all child associations where the given node is the child. - * - * @param node - * @return - * @deprecated as of RM 2.3, please use {@link NodeService#getParentAssocs(NodeRef)} instead. - */ - List getCustomParentReferences(NodeRef node); - - /** - * This method adds the specified custom reference instance between the specified nodes. - * Only one instance of any custom reference type is allowed in a given direction - * between two given records. - * - * @param fromNode - * @param toNode - * @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); - - /** - * This method removes the specified custom reference instance from the specified node. - * - * @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); - - /** - * This method creates a new custom association, using the given label as the title. - * - * @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); - - /** - * This method creates a new custom child association, combining the given source and - * target and using the combined String as the title. - * - * @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); - - /** - * This method updates the source and target values for the specified child association. - * The source and target will be combined into a single string and stored in the title property. - * Source and target are String metadata for RM parent/child custom references. - * - * @param refQName qname of the child association. - * @param newSource the new value for the source field. - * @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); - - /** - * This method updates the label value for the specified association. - * The label will be stored in the title property. - * Label is String metadata for bidirectional custom references. - * - * @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); - - /** - * This method returns ConstraintDefinition objects defined in the given model - * (note: not property references or in-line defs) - * The custom constraint definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom constraints created in the current transaction will not appear - * in the results. - */ - List getCustomConstraintDefinitions(QName modelQName); - - /** - * This method adds a Constraint definition to the custom model. - * The implementation of this method would have to go into the M2Model and insert - * the relevant M2Objects for this new constraint. - * - * param type not included as it would always be RMListOfValuesConstraint for RM. - * - * @param constraintName the name e.g. rmc:foo - * @param title the human-readable title e.g. My foo list - * @param caseSensitive - * @param allowedValues the allowed values list - * @param matchLogic AND (all values must match), OR (at least one values must match) - */ - void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic); - - /** - * Remove custom constraint definition - if not referenced (by any properties) - * - * - * @param constraintName the name e.g. rmc:foo - */ - void removeCustomConstraintDefinition(QName constraintName); - - /** - * Update custom constraint definition with new list of values (replaces existing list, if any) - * - * @param constraintName the name e.g. rmc:foo - * @param newValues - */ - void changeCustomConstraintValues(QName constraintName, List newValues); - - /** - * - * @param constraintName - * @param title - */ - void changeCustomConstraintTitle(QName constraintName, String title); - - /** - * This method iterates over the custom properties, references looking for one whose id - * exactly matches that specified. - * - * @param localName the localName part of the qname of the property or reference definition. - * @return the QName of the property, association definition which matches, or null. - */ - QName getQNameForClientId(String localName); - - /** - * Given a compound id for source and target strings (as used with parent/child - * custom references), this method splits the String and returns an array containing - * the source and target IDs separately. - * - * @param sourceTargetId the compound ID. - * @return a String array, where result[0] == sourceId and result[1] == targetId. - */ - String[] splitSourceTargetId(String sourceTargetId); - - /** - * This method retrieves a compound ID (client-side) for the specified - * sourceId and targetId. - * - * @param sourceId - * @param targetId - * @return - */ - String getCompoundIdFor(String sourceId, String targetId); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java deleted file mode 100644 index 6fce532585..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java +++ /dev/null @@ -1,1435 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.admin; - -import static org.springframework.extensions.surf.util.ParameterCheck.mandatory; -import static org.springframework.extensions.surf.util.ParameterCheck.mandatoryString; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -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.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.repo.dictionary.IndexTokenisationMode; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2Constraint; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.dictionary.M2Property; -import org.alfresco.repo.lock.JobLockService; -import org.alfresco.repo.lock.LockAcquisitionException; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -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; -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.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.GUID; -import org.alfresco.util.LockCallback; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.Ordered; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.surf.util.URLDecoder; - -/** - * Records Management AdminService Implementation. - * - * @author Neil McErlean, janv - */ -@BehaviourBean -public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBase - implements RecordsManagementAdminService, - RecordsManagementCustomModel, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnCreateNodePolicy, - ApplicationListener, - Ordered -{ - - private static final Logger LOGGER = LoggerFactory.getLogger(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_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_ERROR_CLIENT_ID = "rm.admin.error-client-id"; - - /** Constants */ - private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName(); - private static final String CAPABILITY_CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_dod5015.caveat.RMListOfValuesConstraint.class.getName(); - private static final String PARAM_ALLOWED_VALUES = "allowedValues"; - private static final String PARAM_CASE_SENSITIVE = "caseSensitive"; - private static final String PARAM_MATCH_LOGIC = "matchLogic"; - - private static final QName LOCK_QNAME = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "RecordsManagementAdminServiceImpl"); - private static final long DEFAULT_TIME = 30000L; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Transaction service */ - private TransactionService transactionService; - - /** Job Lock service */ - private JobLockService jobLockService; - - /** List of types that can be customisable */ - private List pendingCustomisableTypes; - private Map customisableTypes; - - /** indicates whether the custom map has been initialised or not */ - private boolean isCustomMapInit = false; - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * @param jobLockService The Job Lock service - */ - public void setJobLockService(JobLockService jobLockService) - { - this.jobLockService = jobLockService; - } - - /** - * Indicate that this application content listener must be executed with the lowest - * precedence. (ie last) - * - * @see Ordered#getOrder() - */ - @Override - public int getOrder() - { - return Ordered.LOWEST_PRECEDENCE; - } - - /** - * Load the custom properties map - * - * @see ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) - */ - @Override - public void onApplicationEvent(ContextRefreshedEvent event) - { - final LockCallback lockCallback = new LockCallback(); - - // try and get the lock - String lockToken = getLock(); - if (lockToken != null) - { - try - { - jobLockService.refreshLock(lockToken, LOCK_QNAME, DEFAULT_TIME, lockCallback); - - if (!isCustomMapInit && getDictionaryService().getAllModels().contains(RM_CUSTOM_MODEL)) - { - // run as System on bootstrap - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - transactionService.getRetryingTransactionHelper() - .doInTransaction((RetryingTransactionCallback) () -> { - // initialise custom properties - initCustomMap(); - return null; - }); - return null; - }); - } - } - finally - { - try - { - lockCallback.setIsRunning(false); - jobLockService.releaseLock(lockToken, LOCK_QNAME); - } - catch (LockAcquisitionException e) - { - LOGGER.debug("Lock release failed: {}: {}", LOCK_QNAME, lockToken, e); - } - } - } - } - - /** - * Attempts to get the lock. If the lock couldn't be taken, then null is returned. - * - * @return Returns the lock token or null - */ - private String getLock() - { - try - { - return jobLockService.getLock(LOCK_QNAME, DEFAULT_TIME); - } - catch (LockAcquisitionException e) - { - return null; - } - } - - - /** - * Helper method to indicate whether the custom map is initialised or not. - * - * @return boolean true if initialised, false otherwise - */ - public boolean isCustomMapInit() - { - return isCustomMapInit; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - if (isCustomMapInit) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (getNodeService().exists(nodeRef) && - getDictionaryService().getAllModels().contains(RM_CUSTOM_MODEL) && - isCustomisable(aspectTypeQName)) - { - QName customPropertyAspect = getCustomAspect(aspectTypeQName); - getNodeService().addAspect(nodeRef, customPropertyAspect, null); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onRemoveAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - if (isCustomMapInit) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (getNodeService().exists(nodeRef) && - isCustomisable(aspectTypeQName)) - { - QName customPropertyAspect = getCustomAspect(aspectTypeQName); - getNodeService().removeAspect(nodeRef, customPropertyAspect); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * Make sure any custom property aspects are applied to newly created nodes. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateNode(final ChildAssociationRef childAssocRef) - { - if (isCustomMapInit) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (getDictionaryService().getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL)) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - QName type = getNodeService().getType(nodeRef); - while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) - { - if (isCustomisable(type)) - { - QName customPropertyAspect = getCustomAspect(type); - getNodeService().addAspect(nodeRef, customPropertyAspect, null); - } - - TypeDefinition def = getDictionaryService().getType(type); - if (def != null) - { - type = def.getParentName(); - } - else - { - type = null; - } - } - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * @param customisableTypes list of string representations of the type qnames that are customisable - */ - public void setCustomisableTypes(List customisableTypes) - { - mandatory("customisableTypes", customisableTypes); - - pendingCustomisableTypes = new ArrayList<>(); - for (String customisableType : customisableTypes) - { - pendingCustomisableTypes.add(QName.createQName(customisableType, getNamespaceService())); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable() - */ - public Set getCustomisable() - { - return getCustomisableMap().keySet(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable(org.alfresco.service.cmr.repository.NodeRef) - */ - @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); - while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) - { - // Add to the list if the type is customisable - if (isCustomisable(type)) - { - result.add(type); - } - - // Type and get the types parent - TypeDefinition def = getDictionaryService().getType(type); - if (def != null) - { - type = def.getParentName(); - } - else - { - type = null; - } - } - - // Get all the nodes aspects - Set aspects = getNodeService().getAspects(nodeRef); - for (QName aspect : aspects) - { - QName tempAspect = QName.createQName(aspect.toString()); - while (tempAspect != null) - { - // Add to the list if the aspect is customisable - if (isCustomisable(tempAspect)) - { - result.add(tempAspect); - } - - // Try and get the parent aspect - AspectDefinition aspectDef = getDictionaryService().getAspect(tempAspect); - if (aspectDef != null) - { - tempAspect = aspectDef.getParentName(); - } - else - { - tempAspect = null; - } - } - } - - return result; - } - - /** - * Initialise custom type map - */ - private void initCustomMap() - { - 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) && - // 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()); - } - - // 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); - } - } - } - } - - // 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); - - // Create the new aspect to hold the custom properties - M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); - aspect.setDescription(customisableType.toPrefixString(getNamespaceService())); - - // Make a record of the customisable type - customisableTypes.put(customisableType, customAspect); - } - } - finally - { - writeCustomContentModel(modelRef, model); - } - } - - // indicate map is initialised - isCustomMapInit = true; - } - - /** - * Gets a map containing all the customisable types - * - * @return map from the customisable type to its custom aspect - */ - private Map getCustomisableMap() - { - if (customisableTypes == null) - { - throw AlfrescoRuntimeException.create("Customisable map has not been initialised correctly."); - } - return customisableTypes; - } - - /** - * Gets the QName of the custom aspect given the customisable type QName - * - * @param customisableType - * @return - */ - private QName getCustomAspect(QName customisableType) - { - Map map = getCustomisableMap(); - QName result = map.get(customisableType); - if (result == null) - { - result = getCustomAspectImpl(customisableType); - } - return result; - } - - /** - * Builds a custom aspect QName from a customisable type/aspect QName - * - * @param customisableType - * @return - */ - private QName getCustomAspectImpl(QName customisableType) - { - String localName = customisableType.toPrefixString(getNamespaceService()).replace(":", ""); - localName = MessageFormat.format("{0}CustomProperties", localName); - return QName.createQName(RM_CUSTOM_URI, localName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#isCustomisable(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isCustomisable(QName type) - { - mandatory("type", type); - - return getCustomisable().contains(type); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#makeCustomisable(org.alfresco.service.namespace.QName) - */ - @Override - public void makeCustomisable(QName type) - { - 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); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#unmakeCustomisable(org.alfresco.service.namespace.QName) - */ - @Override - public void unmakeCustomisable(QName type) - { - mandatory("type", type); - - 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! - - 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); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#existsCustomProperty(org.alfresco.service.namespace.QName) - */ - @Override - public boolean existsCustomProperty(QName propertyName) - { - mandatory("propertyName", propertyName); - - boolean result = false; - if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) && - getDictionaryService().getProperty(propertyName) != null) - { - result = true; - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions() - */ - public Map getCustomPropertyDefinitions() - { - Map result = new HashMap<>(); - for (QName customisableType : getCustomisable()) - { - Map props = getCustomPropertyDefinitions(customisableType); - if (props != null) - { - result.putAll(props); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions(QName) - */ - public Map getCustomPropertyDefinitions(QName customisableType) - { - mandatory("customisableType", customisableType); - - Map propDefns = null; - QName relevantAspectQName = getCustomAspect(customisableType); - AspectDefinition aspectDefn = getDictionaryService().getAspect(relevantAspectQName); - if (aspectDefn != null) - { - propDefns = aspectDefn.getProperties(); - } - - return propDefns; - } - - /** - * @throws CustomMetadataException - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String) - */ - public QName addCustomPropertyDefinition(QName propId, QName aspectName, String label, QName dataType, String title, String description) throws CustomMetadataException - { - return addCustomPropertyDefinition(propId, aspectName, label, dataType, title, description, null, false, false, false, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean, org.alfresco.service.namespace.QName) - */ - public QName addCustomPropertyDefinition(QName propId, - QName aspectName, - String label, - QName dataType, - String title, - String description, - String defaultValue, - boolean multiValued, - boolean mandatory, - boolean isProtected, - QName lovConstraint) throws CustomMetadataException - { - if (!isCustomisable(aspectName)) - { - throw new NotCustomisableMetadataException(aspectName.toPrefixString(getNamespaceService())); - } - - // title parameter is currently ignored. Intentionally. - if (propId == null) - { - // Generate a propId - propId = this.generateQNameFor(label); - } - - mandatory("aspectName", aspectName); - mandatory("label", label); - mandatory("dataType", dataType); - - NodeRef modelRef = getCustomModelRef(propId.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - QName customAspect = getCustomAspect(aspectName); - M2Aspect customPropsAspect = deserializedModel.getAspect(customAspect.toPrefixString(getNamespaceService())); - - if (customPropsAspect == null) - { - throw new InvalidCustomAspectMetadataException(customAspect, aspectName.toPrefixString(getNamespaceService())); - } - - String propIdAsString = propId.toPrefixString(getNamespaceService()); - M2Property customProp = customPropsAspect.getProperty(propIdAsString); - if (customProp != null) - { - throw new PropertyAlreadyExistsMetadataException(propIdAsString); - } - - M2Property newProp = customPropsAspect.createProperty(propIdAsString); - newProp.setName(propIdAsString); - newProp.setType(dataType.toPrefixString(getNamespaceService())); - - // Note that the title is used to store the RM 'label'. - newProp.setTitle(label); - newProp.setDescription(description); - newProp.setDefaultValue(defaultValue); - - newProp.setMandatory(mandatory); - newProp.setProtected(isProtected); - newProp.setMultiValued(multiValued); - - newProp.setIndexed(true); - newProp.setIndexedAtomically(true); - newProp.setStoredInIndex(false); - newProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE); - - if (lovConstraint != null) - { - if (! dataType.equals(DataTypeDefinition.TEXT)) - { - throw new CannotApplyConstraintMetadataException(lovConstraint, propIdAsString, dataType); - } - - String lovConstraintQNameAsString = lovConstraint.toPrefixString(getNamespaceService()); - newProp.addConstraintRef(lovConstraintQNameAsString); - } - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("addCustomPropertyDefinition: "+label+ - "=" + propIdAsString + " to aspect: "+aspectName); - } - - return propId; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#updateCustomPropertyDefinitionName(org.alfresco.service.namespace.QName, java.lang.String) - */ - public QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException - { - mandatory("propQName", propQName); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - if (newName == null) - { - return propQName; - } - - QName newPropQName = getQNameForClientId(newName); - if (newPropQName != null) - { - PropertyDefinition newPropDefn = getDictionaryService().getProperty(newPropQName); - if (newPropDefn != null && !propDefn.equals(newPropDefn)) - { - // The requested QName is already in use - String propIdAsString = newPropQName.toPrefixString(getNamespaceService()); - throw new PropertyAlreadyExistsMetadataException(propIdAsString); - } - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProperty = findProperty(propQName, deserializedModel); - targetProperty.setName(new StringBuilder().append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX).append(QName.NAMESPACE_PREFIX).append(newName).toString()); - targetProperty.setTitle(URLDecoder.decode(newName)); - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("setCustomPropertyDefinitionLabel: "+propQName+ - "=" + newName); - } - - return propQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionLabel(org.alfresco.service.namespace.QName, java.lang.String) - */ - public QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) - { - mandatory("propQName", propQName); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - if (newLabel == null) - { - return propQName; - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProperty = findProperty(propQName, deserializedModel); - - targetProperty.setTitle(newLabel); - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("setCustomPropertyDefinitionLabel: "+propQName+ - "=" + newLabel); - } - - return propQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionConstraint(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName) - */ - public QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint) - { - mandatory("propQName", propQName); - mandatory("newLovConstraint", newLovConstraint); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProp = findProperty(propQName, deserializedModel); - String dataType = targetProp.getType(); - - if (! dataType.equals(DataTypeDefinition.TEXT.toPrefixString(getNamespaceService()))) - { - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, newLovConstraint, targetProp.getName(), dataType)); - } - String lovConstraintQNameAsString = newLovConstraint.toPrefixString(getNamespaceService()); - - // Add the constraint - if it isn't already there (there should only be one constraint). - String refOfExistingConstraint = (targetProp.getConstraints().isEmpty() ? - null : - targetProp.getConstraints().get(0).getRef()); - - if (refOfExistingConstraint != null) - { - targetProp.removeConstraintRef(refOfExistingConstraint); - } - targetProp.addConstraintRef(lovConstraintQNameAsString); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("addCustomPropertyDefinitionConstraint: "+lovConstraintQNameAsString); - } - - return propQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#removeCustomPropertyDefinitionConstraints(org.alfresco.service.namespace.QName) - */ - public QName removeCustomPropertyDefinitionConstraints(QName propQName) - { - mandatory("propQName", propQName); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProperty = findProperty(propQName, deserializedModel); - - // Need to count backwards to remove constraints - for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) - { - String ref = targetProperty.getConstraints().get(i).getRef(); - targetProperty.removeConstraintRef(ref); - } - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("removeCustomPropertyDefinitionConstraints: "+propQName); - } - - return propQName; - } - - /** - * - * @param propQName - * @param deserializedModel - * @return - */ - private M2Property findProperty(QName propQName, M2Model deserializedModel) - { - List aspects = deserializedModel.getAspects(); - // Search through the aspects looking for the custom property - for (M2Aspect aspect : aspects) - { - for (M2Property prop : aspect.getProperties()) - { - if (propQName.toPrefixString(getNamespaceService()).equals(prop.getName())) - { - return prop; - } - } - } - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_PROP_EXIST, propQName)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#removeCustomPropertyDefinition(org.alfresco.service.namespace.QName) - */ - public void removeCustomPropertyDefinition(QName propQName) - { - mandatory("propQName", propQName); - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String propQNameAsString = propQName.toPrefixString(getNamespaceService()); - - String aspectName = null; - - boolean found = false; - - // Need to select the correct aspect in the customModel from which we'll - // attempt to delete the property definition. - for (QName customisableType : getCustomisable()) - { - aspectName = getCustomAspect(customisableType).toPrefixString(getNamespaceService()); - M2Aspect customPropsAspect = deserializedModel.getAspect(aspectName); - - if (customPropsAspect == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName)); - } - - M2Property prop = customPropsAspect.getProperty(propQNameAsString); - if (prop != null) - { - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Attempting to delete custom property: "); - msg.append(propQNameAsString); - logger.debug(msg.toString()); - } - - found = true; - customPropsAspect.removeProperty(propQNameAsString); - break; - } - } - - if (!found) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQNameAsString)); - } - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("deleteCustomPropertyDefinition: "+propQNameAsString+" from aspect: "+aspectName); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomReferenceDefinitions() - */ - public Map getCustomReferenceDefinitions() - { - return getCustomAssociations(); - } - - /** - * @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); - - getRelationshipService().addRelationship(refId.getLocalName(), fromNode, toNode); - } - - /** - * @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); - - getRelationshipService().removeRelationship(assocId.getLocalName(), fromNode, toNode); - } - - /** - * @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); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomChildReferences(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getChildAssocs(node); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomReferencesTo(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getSourceAssocs(node, RegexQNamePattern.MATCH_ALL); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomParentReferences(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomParentReferences(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getParentAssocs(node); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomAssocDefinition(java.lang.String) - * - * note: currently RMC custom assocs only - */ - public QName addCustomAssocDefinition(String label) - { - mandatoryString("label", label); - - return addCustomChildAssocDefinition(label, label); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomChildAssocDefinition(java.lang.String, java.lang.String) - * - * note: currently RMC custom assocs only - */ - public QName addCustomChildAssocDefinition(String source, String target) - { - mandatoryString("source", source); - mandatoryString("target", target); - - RelationshipDisplayName displayName = new RelationshipDisplayName(source, target); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - - return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); - } - - /** - * @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 - */ - 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()); - } - - /** - * @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 - */ - public QName updateCustomAssocDefinition(QName refQName, String newLabel) - { - mandatory("refQName", refQName); - mandatoryString("newLabel", newLabel); - - return updateCustomChildAssocDefinition(refQName, newLabel, 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) - */ - 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); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint != null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONSTRAINT_EXISTS, constraintNameAsPrefixString)); - } - - M2Constraint newCon = deserializedModel.createConstraint(constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE); - - newCon.setTitle(title); - newCon.createParameter(PARAM_ALLOWED_VALUES, allowedValues); - newCon.createParameter(PARAM_CASE_SENSITIVE, caseSensitive ? "true" : "false"); - newCon.createParameter(PARAM_MATCH_LOGIC, matchLogic.toString()); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("addCustomConstraintDefinition: "+constraintNameAsPrefixString+" (valueCnt: "+allowedValues.size()+")"); - } - } - - /** - * @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); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); - } - - String type = customConstraint.getType(); - if (type == null || - (!type.equals(CUSTOM_CONSTRAINT_TYPE) && - !type.equals(CAPABILITY_CUSTOM_CONSTRAINT_TYPE))) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE)); - } - - customConstraint.removeParameter(PARAM_ALLOWED_VALUES); - customConstraint.createParameter(PARAM_ALLOWED_VALUES, newAllowedValues); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("changeCustomConstraintValues: "+constraintNameAsPrefixString+" (valueCnt: "+newAllowedValues.size()+")"); - } - } - - /** - * @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); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); - } - - String type = customConstraint.getType(); - if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE))) - { - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE)); - } - - customConstraint.setTitle(title); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("changeCustomConstraintTitle: "+constraintNameAsPrefixString+" (title: "+title+")"); - } - } - - /** - * @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); - - for (ConstraintDefinition conDef : conDefs) - { - Constraint con = conDef.getConstraint(); - if (! (con instanceof RMListOfValuesConstraint)) - { - conDefs.remove(conDef); - } - } - - 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); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint == null) - { - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); - } - - deserializedModel.removeConstraint(constraintNameAsPrefixString); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("deleteCustomConstraintDefinition: "+constraintNameAsPrefixString); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getQNameForClientId(java.lang.String) - */ - public QName getQNameForClientId(String localName) - { - //TODO 1. After certification. This implementation currently does not support reference, - // property, constraints definitions with the same names, which is technically allowed by Alfresco. - - //TODO 2. Note the implicit assumption here that all custom references will have - // unique titles. This is, in fact, not guaranteed. - - QName propertyResult = null; - for (QName qn : getCustomPropertyDefinitions().keySet()) - { - if (localName != null && localName.equals(qn.getLocalName())) - { - propertyResult = qn; - } - } - - if (propertyResult != null) - { - return propertyResult; - } - - QName referenceResult = null; - for (QName refQn : getCustomReferenceDefinitions().keySet()) - { - if (localName != null && localName.equals(refQn.getLocalName())) - { - referenceResult = refQn; - } - } - - // TODO Handle the case where both are not null - return referenceResult; - } - - /** - * @param clientId - * @return - */ - private QName generateQNameFor(String clientId) - { - if (getQNameForClientId(clientId) != null) - { - // TODO log it's already taken. What to do? - throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_CLIENT_ID, clientId)); - } - - String newGUID = GUID.generate(); - QName newQName = QName.createQName(RM_CUSTOM_PREFIX, newGUID, getNamespaceService()); - - 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); - } - - /** - * @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); - - return composeAssociationDefinitionTitle(sourceId, targetId); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java deleted file mode 100644 index 8dcdae0c2b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.ISO8601DateFormat; - -/** - * Class to represent a Records Management audit entry. - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -public final class RecordsManagementAuditEntry -{ - private final Date timestamp; - private final String userName; - private final String fullName; - private final String userRole; - private final NodeRef nodeRef; - private final String nodeName; - private final String nodeType; - private final String event; - private final String identifier; - private final String path; - private final Map beforeProperties; - private final Map afterProperties; - private Map> changedProperties; - - /** - * Default constructor - */ - public RecordsManagementAuditEntry(Date timestamp, - String userName, String fullName, String userRole, - NodeRef nodeRef, String nodeName, String nodeType, - String event, String identifier, String path, - Map beforeProperties, - Map afterProperties) - { - ParameterCheck.mandatory("timestamp", timestamp); - ParameterCheck.mandatory("userName", userName); - - this.timestamp = timestamp; - this.userName = userName; - this.userRole = userRole; - this.fullName = fullName; - this.nodeRef = nodeRef; - this.nodeName = nodeName; - this.nodeType = nodeType; - this.event = event; - this.identifier = identifier; - this.path = path; - this.beforeProperties = beforeProperties; - this.afterProperties = afterProperties; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("(") - .append("timestamp=").append(timestamp) - .append(", userName=").append(userName) - .append(", userRole=").append(userRole) - .append(", fullName=").append(fullName) - .append(", nodeRef=").append(nodeRef) - .append(", nodeName=").append(nodeName) - .append(", event=").append(event) - .append(", identifier=").append(identifier) - .append(", path=").append(path) - .append(", beforeProperties=").append(beforeProperties) - .append(", afterProperties=").append(afterProperties) - .append(", changedProperties=").append(changedProperties) - .append(")"); - return sb.toString(); - } - - /** - * - * @return The date of the audit entry - */ - public Date getTimestamp() - { - return this.timestamp; - } - - /** - * - * @return The date of the audit entry as an ISO8601 formatted String - */ - public String getTimestampString() - { - return ISO8601DateFormat.format(this.timestamp); - } - - /** - * - * @return The username of the user that caused the audit log entry to be created - */ - public String getUserName() - { - return this.userName; - } - - /** - * - * @return The full name of the user that caused the audit log entry to be created - */ - public String getFullName() - { - return this.fullName; - } - - /** - * - * @return The role of the user that caused the audit log entry to be created - */ - public String getUserRole() - { - return this.userRole; - } - - /** - * - * @return The NodeRef of the node the audit log entry is for - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * - * @return The name of the node the audit log entry is for - */ - public String getNodeName() - { - return this.nodeName; - } - - /** - * - * @return The type of the node the audit log entry is for - */ - public String getNodeType() - { - return this.nodeType; - } - - /** - * - * @return The human readable description of the reason for the audit log - * entry i.e. metadata updated, record declared - */ - public String getEvent() - { - return this.event; - } - - /** - * An identifier for the item being audited, for example for a record - * it will be the unique record identifier, for a user it would be the - * username etc. - * - * @return Ad identifier for the thing being audited - */ - public String getIdentifier() - { - return this.identifier; - } - - /** - * - * @return The path to the object being audited - */ - public String getPath() - { - return this.path; - } - - /** - * - * @return Map of properties before the audited action - */ - public Map getBeforeProperties() - { - return this.beforeProperties; - } - - /** - * - * @return Map of properties after the audited action - */ - public Map getAfterProperties() - { - return this.afterProperties; - } - - /** - * - * @return Map of changed properties - */ - public Map> getChangedProperties() - { - if (this.changedProperties == null) - { - initChangedProperties(); - } - - return this.changedProperties; - } - - /** - * Initialises the map of changed values given the before and after properties - */ - private void initChangedProperties() - { - if (this.beforeProperties != null && this.afterProperties != null) - { - this.changedProperties = new HashMap<>( - this.beforeProperties.size() + this.afterProperties.size()); - - // add all the properties present before the audited action - for (Map.Entry entry : this.beforeProperties.entrySet()) - { - final QName valuePropName = entry.getKey(); - Pair values = new Pair<>( - entry.getValue(), - this.afterProperties.get(valuePropName)); - this.changedProperties.put(valuePropName, values); - } - - // add all the properties present after the audited action that - // have not already been added - for (Map.Entry entry : this.afterProperties.entrySet()) - { - final QName valuePropName = entry.getKey(); - if (!this.beforeProperties.containsKey(valuePropName)) - { - Pair values = new Pair<>(null, entry.getValue()); - this.changedProperties.put(valuePropName, values); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java deleted file mode 100644 index 0cfb570cda..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit; - -import java.util.Date; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Class to represent the parameters for a Records Management - * audit log query. - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -public final class RecordsManagementAuditQueryParameters -{ - private int maxEntries = Integer.MAX_VALUE; - private String user; - private NodeRef nodeRef; - private Date dateFrom; - private Date dateTo; - private String event; - private QName property; - - /** - * Default constructor. - */ - public RecordsManagementAuditQueryParameters() - { - //Default constructor - } - - /** - * - * @return The username to filter by - */ - public String getUser() - { - return this.user; - } - - /** - * Restricts the retrieved audit trail to entries made by - * the provided user. - * - * @param user The username to filter by - */ - public void setUser(String user) - { - this.user = user; - } - - /** - * - * @return The maximum number of audit log entries to retrieve - */ - public int getMaxEntries() - { - return this.maxEntries; - } - - /** - * Restricts the retrieved audit trail to the last - * maxEntries entries. - * - * @param maxEntries Maximum number of entries - */ - public void setMaxEntries(int maxEntries) - { - this.maxEntries = maxEntries; - } - - /** - * - * @return The node to get entries for - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * Restricts the retrieved audit trail to only those entries - * created by the give node. - * - * @param nodeRef The node to get entries for - */ - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - /** - * - * @return The date to retrieve entries from - */ - public Date getDateFrom() - { - return this.dateFrom; - } - - /** - * Restricts the retrieved audit trail to only those entries - * that occurred after the given date. - * - * @param dateFrom Date to retrieve entries after - */ - public void setDateFrom(Date dateFrom) - { - this.dateFrom = dateFrom; - } - - /** - * - * @return The date to retrive entries to - */ - public Date getDateTo() - { - return this.dateTo; - } - - /** - * Restricts the retrieved audit trail to only those entries - * that occurred before the given date. - * - * @param dateTo Date to retrieve entries before - */ - public void setDateTo(Date dateTo) - { - this.dateTo = dateTo; - } - - /** - * - * @return The event to retrive entries for - */ - public String getEvent() - { - return this.event; - } - - /** - * Restricts the retrieved audit trail to only those entries - * that match the given event string. - * - * @param event Event to retrieve entries for - */ - public void setEvent(String event) - { - this.event = event; - } - - /** - * - * @return The property to retrieve entries for - */ - public QName getProperty() - { - return this.property; - } - - /** - * Restricts the audit trail to only those entries that involve - * the given property. - * - * @param property The property to retrieve entries for - */ - public void setProperty(QName property) - { - this.property = property; - } - - /* - * @see java.lang.Object#toString() - */ - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(super.toString()); - - builder.append(" (nodeRef='").append(nodeRef).append("', user='") - .append(user).append("', dateFrom='").append(dateFrom) - .append("', dateTo='").append(dateTo).append("', maxEntries='") - .append(maxEntries).append("', event='").append(event) - .append("', property='").append(property).append("')"); - - return builder.toString(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java deleted file mode 100644 index 35e5323171..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit; - -import java.io.File; -import java.io.Serializable; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management audit service. - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -@SuppressWarnings("deprecation") -public interface RecordsManagementAuditService extends RecordsManagementAuditServiceDeprecated -{ - public enum ReportFormat { HTML, JSON } - - /** - * Retrieves a list of audit events. - * - * @return List of audit events - */ - List getAuditEvents(); - - /** - * Register audit event. - *

- * Creates an instance of a simple audit event and registers it with - * the service. - * - * @param name name of audit event - * @param label display label of audit event - */ - void registerAuditEvent(String name, String label); - - /** - * Register audit event. - * - * @param auditEvent audit event - */ - void registerAuditEvent(AuditEvent auditEvent); - - /** - * Audits an event, assumes no properties where modified and that the event should not be audited - * immediately. - * - * @param nodeRef node reference - * @param eventName event name - */ - void auditEvent(NodeRef nodeRef, - String eventName); - - /** - * Audits an event, assumes that the event should not be audited immediately and not be removed if no property is changed. - * - * @param nodeRef node reference - * @param eventName event name - * @param before property values before event (this must be modifiable and may be changed by the method). - * @param after property values after event (this must be modifiable and may be changed by the method). - */ - void auditEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after); - - /** - * Audit event, assumes not to be removed if no property is changed. - * - * @param nodeRef node reference - * @param eventName event name - * @param before property values before event (this must be modifiable and may be changed by the method). - * @param after property values after event (this must be modifiable and may be changed by the method). - * @param immediate true if event is to be audited immediately, false otherwise - */ - void auditEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after, - boolean immediate); - - /** - * Audit event. - * - * @param nodeRef node reference - * @param eventName event name - * @param before property values before event (this must be modifiable and may be changed by the method). - * @param after property values after event (this must be modifiable and may be changed by the method). - * @param immediate true if event is to be audited immediately, false otherwise - * @param removeIfNoPropertyChanged true if event is not audited when there are no properties changed, false otherwise - */ - void auditEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after, - boolean immediate, - boolean removeIfNoPropertyChanged); - - /** - * Supply incremental changes as part of an event. This will either create a new event or update the existing details to put any supplied properties into the map. - * - * @param nodeRef node reference - * @param eventName event name - * @param before additional property values before event (this must be modifiable and may be changed by the method). - * @param after additional property values after event (this must be modifiable and may be changed by the method). - * @param removeIfNoPropertyChanged true if event is not audited when there are no properties changed, false otherwise - */ - void auditOrUpdateEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after, - boolean removeIfNoPropertyChanged); - - /** - * Determines whether the RM audit log is currently enabled. - * - * @param filePlan file plan - * @return true if RM auditing is active false otherwise - */ - boolean isAuditLogEnabled(NodeRef filePlan); - - /** - * Start RM auditing. - * - * @param filePlan file plan - */ - void startAuditLog(NodeRef filePlan); - - /** - * Stop RM auditing. - * - * @param filePlan file plan - */ - void stopAuditLog(NodeRef filePlan); - - /** - * Clears the RM audit. - * - * @param filePlan file plan - */ - void clearAuditLog(NodeRef filePlan); - - /** - * Returns the date the RM audit was last started. - * - * @param filePlan file plan - * @return Date the audit was last started - */ - Date getDateAuditLogLastStarted(NodeRef filePlan); - - /** - * Returns the date the RM audit was last stopped. - * - * @return Date the audit was last stopped - */ - Date getDateAuditLogLastStopped(NodeRef filePlan); - - /** - * Retrieves a list of audit log entries using the provided parameters - * represented by the RecordsManagementAuditQueryParameters instance. - *

- * The parameters are all optional so an empty RecordsManagementAuditQueryParameters - * object will result in ALL audit log entries for the RM system being - * returned. Setting the various parameters effectively filters the full - * audit trail. - * - * @param params Parameters to use to retrieve audit trail (never null) - * @param format The format the report should be produced in - * @return File containing JSON representation of audit trail - */ - File getAuditTrailFile(RecordsManagementAuditQueryParameters params, ReportFormat format); - - /** - * Retrieves a list of audit log entries using the provided parameters - * represented by the RecordsManagementAuditQueryParameters instance. - *

- * The parameters are all optional so an empty RecordsManagementAuditQueryParameters - * object will result in ALL audit log entries for the RM system being - * returned. Setting the various parameters effectively filters the full - * audit trail. - * - * @param params Parameters to use to retrieve audit trail (never null) - * @return All entries for the audit trail - */ - List getAuditTrail(RecordsManagementAuditQueryParameters params); - - /** - * Retrieves a list of audit log entries using the provided parameters - * represented by the RecordsManagementAuditQueryParameters instance and - * then files the resulting log as an undeclared record in the record folder - * represented by the given NodeRef. - *

- * The parameters are all optional so an empty RecordsManagementAuditQueryParameters - * object will result in ALL audit log entries for the RM system being - * returned. Setting the various parameters effectively filters the full - * audit trail. - * - * @param params Parameters to use to retrieve audit trail (never null) - * @param destination NodeRef representing a record folder in which to file the audit log - * @param format The format the report should be produced in - * @return NodeRef of the undeclared record filed - */ - NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, NodeRef destination, ReportFormat format); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java deleted file mode 100644 index ffaa0c7325..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java +++ /dev/null @@ -1,1985 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit; - -import static org.alfresco.model.ContentModel.PROP_AUTHORITY_DISPLAY_NAME; -import static org.alfresco.model.ContentModel.PROP_AUTHORITY_NAME; -import static org.alfresco.model.ContentModel.PROP_USERNAME; -import static org.alfresco.module.org_alfresco_module_rm.audit.event.UserGroupMembershipUtils.PARENT_GROUP; -import static org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model.TYPE_DOD_5015_SITE; -import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME; -import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4; -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import javax.transaction.SystemException; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -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.audit.AuditComponent; -import org.alfresco.repo.audit.model.AuditApplication; -import org.alfresco.repo.content.MimetypeMap; -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.TransactionalResourceHelper; -import org.alfresco.service.cmr.audit.AuditQueryParameters; -import org.alfresco.service.cmr.audit.AuditService; -import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -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.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.MLText; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -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.lang3.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.context.ApplicationEvent; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Records Management Audit Service Implementation. - * - * @author Gavin Cornwell - * @since 3.2 - */ -public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean - implements RecordsManagementAuditService -{ - /** I18N */ - private static final String MSG_TRAIL_FILE_FAIL = "rm.audit.trail-file-fail"; - private static final String MSG_AUDIT_REPORT = "rm.audit.audit-report"; - - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementAuditServiceImpl.class); - - private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit"; - - private static final String KEY_RM_AUDIT_NODE_RECORDS = "RMAUditNodeRecords"; - - protected static final String RM_AUDIT_EVENT_LOGIN_SUCCESS = "Login.Success"; - protected static final String RM_AUDIT_EVENT_LOGIN_FAILURE = "Login.Failure"; - - protected static final String RM_AUDIT_APPLICATION_NAME = "RM"; - protected static final String RM_AUDIT_PATH_ROOT = "/RM"; - protected static final String RM_AUDIT_SNIPPET_EVENT = "/event"; - protected static final String RM_AUDIT_SNIPPET_PERSON = "/person"; - protected static final String RM_AUDIT_SNIPPET_NAME = "/name"; - protected static final String RM_AUDIT_SNIPPET_NODE = "/node"; - protected static final String RM_AUDIT_SNIPPET_CHANGES = "/changes"; - protected static final String RM_AUDIT_SNIPPET_BEFORE = "/before"; - protected static final String RM_AUDIT_SNIPPET_AFTER = "/after"; - protected static final String RM_AUDIT_SITES_PATH = "/Sites"; - - protected static final String RM_AUDIT_DATA_PERSON_FULLNAME = "/RM/event/person/fullName"; - protected static final String RM_AUDIT_DATA_PERSON_ROLES = "/RM/event/person/roles"; - protected static final String RM_AUDIT_DATA_EVENT_NAME = "/RM/event/name/value"; - protected static final String RM_AUDIT_DATA_NODE_NODEREF = "/RM/event/node/noderef"; - protected static final String RM_AUDIT_DATA_NODE_NAME = "/RM/event/node/name"; - protected static final String RM_AUDIT_DATA_NODE_TYPE = "/RM/event/node/type"; - protected static final String RM_AUDIT_DATA_NODE_IDENTIFIER = "/RM/event/node/identifier"; - protected static final String RM_AUDIT_DATA_NODE_NAMEPATH = "/RM/event/node/namePath"; - protected static final String RM_AUDIT_DATA_NODE_CHANGES_BEFORE = "/RM/event/node/changes/before/value"; - protected static final String RM_AUDIT_DATA_NODE_CHANGES_AFTER = "/RM/event/node/changes/after/value"; - - protected static final String RM_AUDIT_DATA_LOGIN_USERNAME = "/RM/login/args/userName/value"; - protected static final String RM_AUDIT_DATA_LOGIN_FULLNAME = "/RM/login/no-error/fullName"; - protected static final String RM_AUDIT_DATA_LOGIN_ERROR = "/RM/login/error/value"; - - /* Provide Backward compatibility with DOD5015 Audit Events RM-904*/ - protected static final String DOD5015_AUDIT_APPLICATION_NAME = "DOD5015"; - protected static final String DOD5015_AUDIT_PATH_ROOT = "/DOD5015"; - protected static final String DOD5015_AUDIT_SNIPPET_EVENT = "/event"; - protected static final String DOD5015_AUDIT_SNIPPET_PERSON = "/person"; - protected static final String DOD5015_AUDIT_SNIPPET_NAME = "/name"; - protected static final String DOD5015_AUDIT_SNIPPET_NODE = "/node"; - protected static final String DOD5015_AUDIT_SNIPPET_CHANGES = "/changes"; - protected static final String DOD5015_AUDIT_SNIPPET_BEFORE = "/before"; - protected static final String DOD5015_AUDIT_SNIPPET_AFTER = "/after"; - - protected static final String DOD5015_AUDIT_DATA_PERSON_FULLNAME = "/DOD5015/event/person/fullName"; - protected static final String DOD5015_AUDIT_DATA_PERSON_ROLES = "/DOD5015/event/person/roles"; - protected static final String DOD5015_AUDIT_DATA_EVENT_NAME = "/DOD5015/event/name/value"; - protected static final String DOD5015_AUDIT_DATA_NODE_NODEREF = "/DOD5015/event/node/noderef"; - protected static final String DOD5015_AUDIT_DATA_NODE_NAME = "/DOD5015/event/node/name"; - protected static final String DOD5015_AUDIT_DATA_NODE_TYPE = "/DOD5015/event/node/type"; - protected static final String DOD5015_AUDIT_DATA_NODE_IDENTIFIER = "/DOD5015/event/node/identifier"; - protected static final String DOD5015_AUDIT_DATA_NODE_NAMEPATH = "/DOD5015/event/node/namePath"; - protected static final String DOD5015_AUDIT_DATA_NODE_CHANGES_BEFORE = "/DOD5015/event/node/changes/before/value"; - protected static final String DOD5015_AUDIT_DATA_NODE_CHANGES_AFTER = "/DOD5015/event/node/changes/after/value"; - - protected static final String DOD5015_AUDIT_DATA_LOGIN_USERNAME = "/DOD5015/login/args/userName/value"; - protected static final String DOD5015_AUDIT_DATA_LOGIN_FULLNAME = "/DOD5015/login/no-error/fullName"; - protected static final String DOD5015_AUDIT_DATA_LOGIN_ERROR = "/DOD5015/login/error/value"; - /* End Backward compatibility with DOD5015 Audit Events */ - - protected static final String AUDIT_TRAIL_FILE_PREFIX = "audit_"; - protected static final String AUDIT_TRAIL_JSON_FILE_SUFFIX = ".json"; - protected static final String AUDIT_TRAIL_HTML_FILE_SUFFIX = ".html"; - - /** Audit auditing events */ - private static final String AUDIT_EVENT_START = "audit.start"; - private static final String MSG_AUDIT_START = "rm.audit.audit-start"; - private static final String AUDIT_EVENT_STOP = "audit.stop"; - private static final String MSG_AUDIT_STOP = "rm.audit.audit-stop"; - private static final String AUDIT_EVENT_CLEAR = "audit.clear"; - private static final String MSG_AUDIT_CLEAR = "rm.audit.audit-clear"; - private static final String AUDIT_EVENT_VIEW = "audit.view"; - private static final String MSG_AUDIT_VIEW = "rm.audit.audit-view"; - - private static final QName PROPERTY_HOLD_NAME = QName.createQName(RecordsManagementModel.RM_URI, "Hold Name"); - private static final QName PROPERTY_HOLD_NODEREF = QName.createQName(RecordsManagementModel.RM_URI, "Hold NodeRef"); - private static final String HOLD_PERMISSION_DENIED_MSG = "rm.audit.holdPermission-Error"; - - private PolicyComponent policyComponent; - private DictionaryService dictionaryService; - private TransactionService transactionService; - private NodeService nodeService; - private SiteService siteService; - private ContentService contentService; - private AuditComponent auditComponent; - private AuditService auditService; - private RecordsManagementActionService rmActionService; - private FilePlanService filePlanService; - private NamespaceService namespaceService; - protected CapabilityService capabilityService; - protected PermissionService permissionService; - protected HoldService holdService; - - private boolean shutdown = false; - - private List ignoredAuditProperties; - - private List propertiesToBeRemoved = new ArrayList<>(); - - private RMAuditTxnListener txnListener = new RMAuditTxnListener(); - - /** Registered and initialised records management auditEvents */ - private Map auditEvents = new HashMap<>(); - - /** - * Set the component used to bind to behaviour callbacks - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Provides user-readable names for types - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Set the component used to start new transactions - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Sets the NodeService instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the site service (used to check the type of RM site created). - * - * @param siteService The site service. - */ - public void setSiteService(SiteService siteService) { this.siteService = siteService; } - - /** - * Sets the ContentService instance - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * The component to create audit events - */ - public void setAuditComponent(AuditComponent auditComponent) - { - this.auditComponent = auditComponent; - } - - /** - * Sets the AuditService instance - */ - public void setAuditService(AuditService auditService) - { - this.auditService = auditService; - } - - /** - * Sets the RecordsManagementActionService instance - */ - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - - /** - * @param ignoredAuditProperties - */ - public void setIgnoredAuditProperties(List ignoredAuditProperties) - { - this.ignoredAuditProperties = ignoredAuditProperties; - } - - /** - * - * @param permissionService - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * - * @param holdService - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(java.lang.String, java.lang.String) - */ - @Override - public void registerAuditEvent(String name, String label) - { - registerAuditEvent(new AuditEvent(name, label)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent) - */ - @Override - public void registerAuditEvent(AuditEvent auditEvent) - { - if (logger.isDebugEnabled()) - { - logger.debug("Registering audit event " + auditEvent.getName()); - } - - this.auditEvents.put(auditEvent.getName(), auditEvent); - } - - /** - * Checks that all necessary properties have been set. - */ - public void init() - { - PropertyCheck.mandatory(this, "policyComponent", policyComponent); - PropertyCheck.mandatory(this, "transactionService", transactionService); - PropertyCheck.mandatory(this, "nodeService", nodeService); - PropertyCheck.mandatory(this, "contentService", contentService); - PropertyCheck.mandatory(this, "auditComponent", auditComponent); - PropertyCheck.mandatory(this, "auditService", auditService); - PropertyCheck.mandatory(this, "rmActionService", rmActionService); - PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); - PropertyCheck.mandatory(this, "filePlanService", filePlanService); - - // register audit auditing events - registerAuditEvent(AUDIT_EVENT_CLEAR, MSG_AUDIT_CLEAR); - registerAuditEvent(AUDIT_EVENT_START, MSG_AUDIT_START); - registerAuditEvent(AUDIT_EVENT_STOP, MSG_AUDIT_STOP); - registerAuditEvent(AUDIT_EVENT_VIEW, MSG_AUDIT_VIEW); - - // properties to be ignored by audit - for (String qname : ignoredAuditProperties) - { - this.propertiesToBeRemoved.add(QName.createQName(qname, this.namespaceService)); - } - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onBootstrap(ApplicationEvent event) - { - shutdown = false; - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onShutdown(ApplicationEvent event) - { - shutdown = true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#isAuditLogEnabled(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isAuditLogEnabled(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - return auditService.isAuditEnabled( - RM_AUDIT_APPLICATION_NAME, - RM_AUDIT_PATH_ROOT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#startAuditLog(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void startAuditLog(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - auditService.enableAudit( - RM_AUDIT_APPLICATION_NAME, - RM_AUDIT_PATH_ROOT); - - if (logger.isInfoEnabled()) - { - logger.info("Started Records Management auditing"); - } - - auditEvent(filePlan, AUDIT_EVENT_START, null, null, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#stopAuditLog(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void stopAuditLog(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - auditEvent(filePlan, AUDIT_EVENT_STOP, null, null, true); - - auditService.disableAudit( - RM_AUDIT_APPLICATION_NAME, - RM_AUDIT_PATH_ROOT); - - if (logger.isInfoEnabled()) - { - logger.info("Stopped Records Management auditing"); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#clearAuditLog(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void clearAuditLog(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - auditService.clearAudit(RM_AUDIT_APPLICATION_NAME, null, null); - if (logger.isInfoEnabled()) - { - logger.debug("Records Management audit log has been cleared"); - } - - auditEvent(filePlan, AUDIT_EVENT_CLEAR, null, null, true); - } - - /** - * {@inheritDoc} - */ - @Override - public Date getDateAuditLogLastStarted(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - // TODO: return proper date, for now it's today's date - return getStartOfDay(new Date()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#getDateAuditLogLastStopped(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Date getDateAuditLogLastStopped(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - // TODO: return proper date, for now it's today's date - return getEndOfDay(new Date()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName) - { - auditEvent(nodeRef, eventName, null, null, false, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after) - { - auditEvent(nodeRef, eventName, before, after, false, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map, boolean) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after, boolean immediate) - { - auditEvent(nodeRef, eventName, before, after, immediate, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map, boolean) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after, boolean immediate, boolean removeIfNoPropertyChanged) - { - // deal with immediate auditing if required - if (immediate) - { - Map auditMap = buildAuditMap(nodeRef, eventName, before, after, removeIfNoPropertyChanged); - auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap); - } - else - { - // RM-936: Eliminate multiple audit maps from being generated when events with the same name are required to be fired multiple times in the same transaction. - // Check if auditDetails already contains an auditedNode with the same combination of nodeRef and eventName. - RMAuditNode existingEventNode = findExistingEventNode(nodeRef, eventName); - if (existingEventNode != null) - { - // If there exists such an auditNode, update its 'after' properties with the latest set of properties and leave its 'before' properties unchanged so that it - // retains the original set of properties. The first 'before' and last 'after' will be diff'ed when comes to building the auditMap later when the transaction - // commits. - existingEventNode.setNodePropertiesAfter(after); - } - else - { - createAuditEventInTransaction(nodeRef, eventName, before, after, removeIfNoPropertyChanged); - } - } - } - - /** {@inheritDoc} */ - @Override - public void auditOrUpdateEvent(NodeRef nodeRef, String eventName, Map before, - Map after, boolean removeIfNoPropertyChanged) - { - RMAuditNode existingEventNode = findExistingEventNode(nodeRef, eventName); - if (existingEventNode != null) - { - // Update the existing event to include all the new properties. - existingEventNode.getNodePropertiesBefore().putAll(before); - existingEventNode.getNodePropertiesAfter().putAll(after); - } - else - { - createAuditEventInTransaction(nodeRef, eventName, before, after, removeIfNoPropertyChanged); - } - } - - /** - * Create a new audit event for this transaction. - * - * @param nodeRef The node the audit message is about. - * @param eventName The event. - * @param before The before property map to use. - * @param after The after property map to use. - * @param removeIfNoPropertyChanged Whether to remove the event if no properties have changed. - */ - private void createAuditEventInTransaction(NodeRef nodeRef, String eventName, Map before, - Map after, boolean removeIfNoPropertyChanged) - { - // Create a new auditNode. - RMAuditNode auditedNode = new RMAuditNode(); - auditedNode.setNodeRef(nodeRef); - auditedNode.setEventName(eventName); - auditedNode.setNodePropertiesBefore(before); - auditedNode.setNodePropertiesAfter(after); - auditedNode.setRemoveIfNoPropertyChanged(removeIfNoPropertyChanged); - - // Add it to the transaction. - Set auditDetails = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); - auditDetails.add(auditedNode); - } - - /** - * Find an audit node if it already exists for the transaction. - * - * @param nodeRef The node the event is against. - * @param eventName The name of the event. - * @return The pre-existing event node, or null if none exists. - */ - private RMAuditNode findExistingEventNode(NodeRef nodeRef, String eventName) - { - AlfrescoTransactionSupport.bindListener(txnListener); - Set auditDetails = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); - for (RMAuditNode existingRMAuditNode : auditDetails) - { - if (existingRMAuditNode.getNodeRef().equals(nodeRef) && existingRMAuditNode.getEventName().equals(eventName)) - { - return existingRMAuditNode; - } - } - return null; - } - - /** - * Helper method to build audit map - * - * @param nodeRef - * @param eventName - * @return - * @since 2.0.3 - */ - private Map buildAuditMap(NodeRef nodeRef, String eventName, Map propertiesBefore, Map propertiesAfter, boolean removeOnNoPropertyChange) - { - Map auditMap = new HashMap<>(13); - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NAME), - eventName); - - if (nodeRef != null) - { - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NODE), - nodeRef); - } - - // Filter out any properties to be audited if specified in the Spring configuration. - if (!ignoredAuditProperties.isEmpty()) - { - removeAuditProperties(propertiesBefore, propertiesAfter); - } - - // Property changes - Pair, Map> deltaPair = PropertyMap.getBeforeAndAfterMapsForChanges(propertiesBefore, propertiesAfter); - - // If both the first and second Map in the deltaPair are empty and removeOnNoPropertyChange is true, the entire auditMap is discarded so it won't be audited. - if (deltaPair.getFirst().isEmpty() && deltaPair.getSecond().isEmpty() && removeOnNoPropertyChange) - { - auditMap.clear(); - } - else - { - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NODE, - RM_AUDIT_SNIPPET_CHANGES, - RM_AUDIT_SNIPPET_BEFORE), - (Serializable) deltaPair.getFirst()); - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NODE, - RM_AUDIT_SNIPPET_CHANGES, - RM_AUDIT_SNIPPET_AFTER), - (Serializable) deltaPair.getSecond()); - } - return auditMap; - } - - /** - * Helper method to remove system properties from maps - * - * @param before properties before event - * @param after properties after event - */ - private void removeAuditProperties(Map before, Map after) - { - if (before != null) - { - before.keySet().removeAll(this.propertiesToBeRemoved); - } - if (after != null) - { - after.keySet().removeAll(this.propertiesToBeRemoved); - } - } - - /** - * A stateless transaction listener for RM auditing. This component picks up the data of modified nodes and generates the audit information. - *

- * This class is not static so that the instances will have access to the action's implementation. - * - * @author Derek Hulley - * @since 3.2 - */ - private class RMAuditTxnListener extends TransactionListenerAdapter - { - private final Log logger = LogFactory.getLog(RecordsManagementAuditServiceImpl.class); - - /* - * Equality and hashcode generation are left unimplemented; we expect to only have a single - * instance of this class per action. - */ - - /** - * Get the action parameters from the transaction and audit them. - */ - @Override - public void afterCommit() - { - final Set auditedNodes = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); - - // Start a *new* read-write transaction to audit in - RetryingTransactionCallback auditCallback = new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - auditInTxn(auditedNodes); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(auditCallback, false, true); - } - - /** - * Do the actual auditing, assuming the presence of a viable transaction - * - * @param auditedNodes details of the nodes that were modified - */ - private void auditInTxn(Set auditedNodes) throws SystemException - { - // Go through all the audit information and audit it - boolean auditedSomething = false; - for (RMAuditNode auditedNode : auditedNodes) - { - NodeRef nodeRef = auditedNode.getNodeRef(); - - // If the node is gone, then do nothing - if (nodeRef != null && !nodeService.exists(nodeRef)) - { - continue; - } - - // build the audit map - Map auditMap = buildAuditMap(nodeRef, - auditedNode.getEventName(), - auditedNode.getNodePropertiesBefore(), - auditedNode.getNodePropertiesAfter(), - auditedNode.getRemoveIfNoPropertyChanged()); - // Audit it - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Auditing values: \n" + auditMap); - } - auditMap = auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap); - if (auditMap.isEmpty()) - { - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Nothing was audited."); - } - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Audited values: \n" + auditMap); - } - // We must commit the transaction to get the values in - auditedSomething = true; - } - } - // Check if anything was audited - if (!auditedSomething) - { - // Nothing was audited, so do nothing - RetryingTransactionHelper.getActiveUserTransaction().setRollbackOnly(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public File getAuditTrailFile(RecordsManagementAuditQueryParameters params, ReportFormat format) - { - ParameterCheck.mandatory("params", params); - - File auditTrailFile = TempFileProvider.createTempFile(AUDIT_TRAIL_FILE_PREFIX, - format == ReportFormat.HTML ? AUDIT_TRAIL_HTML_FILE_SUFFIX : AUDIT_TRAIL_JSON_FILE_SUFFIX); - - try (FileOutputStream fileOutputStream = new FileOutputStream(auditTrailFile); - Writer fileWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream,"UTF8"))) - { - // Get the results, dumping to file - getAuditTrailImpl(params, null, fileWriter, format); - // Done - return auditTrailFile; - } - catch (IOException e) - { - throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public List getAuditTrail(RecordsManagementAuditQueryParameters params) - { - ParameterCheck.mandatory("params", params); - - List entries = new ArrayList<>(50); - try - { - getAuditTrailImpl(params, entries, null, null); - // Done - return entries; - } - catch (IOException e) - { - // Should be - throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, e); - } - } - - /** - * Get the audit trail, optionally dumping the results the the given writer dumping to a list. - * - * @param params the search parameters - * @param results the list to which individual results will be dumped - * @param writer Writer to write the audit trail - * @param reportFormat Format to write the audit trail in, ignored if writer is null - */ - protected void getAuditTrailImpl( - final RecordsManagementAuditQueryParameters params, - final List results, - final Writer writer, - final ReportFormat reportFormat) - throws IOException - { - if (logger.isDebugEnabled()) - { - logger.debug("Retrieving audit trail in '" + reportFormat + "' format using parameters: " + params); - } - - // define the callback - AuditQueryCallback callback = new AuditTrailQueryCallback(results, writer, reportFormat); - - String user = params.getUser(); - Long fromTime = getFromDateTime(params.getDateFrom()); - Long toTime = getToDateTime(params.getDateTo()); - NodeRef nodeRef = params.getNodeRef(); - int maxEntries = params.getMaxEntries(); - // Reverse order if the results are limited - boolean forward = maxEntries <= 0; - - // start the audit trail report - writeAuditTrailHeader(writer, params, reportFormat); - - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Issuing query: " + params); - } - - // Build audit query parameters - AuditQueryParameters dod5015AuditQueryParams = new AuditQueryParameters(); - dod5015AuditQueryParams.setForward(forward); - dod5015AuditQueryParams.setApplicationName(DOD5015_AUDIT_APPLICATION_NAME); - dod5015AuditQueryParams.setUser(user); - dod5015AuditQueryParams.setFromTime(fromTime); - dod5015AuditQueryParams.setToTime(toTime); - if (nodeRef != null) - { - dod5015AuditQueryParams.addSearchKey(DOD5015_AUDIT_DATA_NODE_NODEREF, nodeRef); - } - - // - AuditQueryParameters auditQueryParams = new AuditQueryParameters(); - auditQueryParams.setForward(forward); - auditQueryParams.setApplicationName(RM_AUDIT_APPLICATION_NAME); - auditQueryParams.setUser(user); - auditQueryParams.setFromTime(fromTime); - auditQueryParams.setToTime(toTime); - if (nodeRef != null) - { - auditQueryParams.addSearchKey(RM_AUDIT_DATA_NODE_NODEREF, nodeRef); - } - else if (params.getEvent() != null) - { - if (params.getEvent().equalsIgnoreCase(RM_AUDIT_EVENT_LOGIN_SUCCESS)) - { - auditQueryParams.addSearchKey(RM_AUDIT_DATA_LOGIN_FULLNAME, null); - } - else if (params.getEvent().equalsIgnoreCase(RM_AUDIT_EVENT_LOGIN_FAILURE)) - { - auditQueryParams.addSearchKey(RM_AUDIT_DATA_LOGIN_ERROR, null); - } - else - { - auditQueryParams.addSearchKey(RM_AUDIT_DATA_EVENT_NAME, params.getEvent()); - } - } - - // Get audit entries - SiteInfo siteInfo = siteService.getSite(DEFAULT_SITE_NAME); - if (siteInfo != null) - { - QName siteType = nodeService.getType(siteInfo.getNodeRef()); - if (siteType.equals(TYPE_DOD_5015_SITE)) - { - auditService.auditQuery(callback, dod5015AuditQueryParams, maxEntries); - } - } - // We always need to make the standard query - regardless of the type of RM site (to get events like RM site created). - auditService.auditQuery(callback, auditQueryParams, maxEntries); - - // finish off the audit trail report - writeAuditTrailFooter(writer, reportFormat); - - // audit that the audit has been view'ed - if (nodeRef == null) - { - // grab the default file plan, but don't fail if it can't be found! - nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - auditEvent(nodeRef, AUDIT_EVENT_VIEW, null, null, true); - } - - /** - * Calculates the start of the given date. - * For example, if you had the date time of 12 Aug 2013 12:10:15.158 - * the result would be 12 Aug 2013 00:00:00.000. - * - * @param date The date for which the start should be calculated. - * @return Returns the start of the given date. - */ - protected Date getStartOfDay(Date date) - { - return DateUtils.truncate(date == null ? new Date() : date, Calendar.DATE); - } - - /** - * Gets the start of the from date - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl#getStartOfDay(java.util.Date) - * - * @param date The date for which the start should be retrieved. - * @return Returns null if the given date is null, otherwise the start of the given day. - */ - private Date getFromDate(Date date) - { - return date == null ? null : getStartOfDay(date); - } - - /** - * Returns the number of milliseconds for the "from date". - * - * @param date The date for which the number of milliseconds should retrieved. - * @return Returns null if the given date is null, otherwise the number of milliseconds for the given date. - */ - private Long getFromDateTime(Date date) - { - Long fromDateTime = null; - Date fromDate = getFromDate(date); - if (fromDate != null) - { - fromDateTime = Long.valueOf(fromDate.getTime()); - } - return fromDateTime; - } - - /** - * Calculates the end of the given date. - * For example, if you had the date time of 12 Aug 2013 12:10:15.158 - * the result would be 12 Aug 2013 23:59:59.999. - * - * @param date The date for which the end should be calculated. - * @return Returns the end of the given date. - */ - private Date getEndOfDay(Date date) - { - return DateUtils.addMilliseconds(DateUtils.ceiling(date == null ? new Date() : date, Calendar.DATE), -1); - } - - /** - * Gets the end of the from date - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl#getEndOfDay(java.util.Date) - * - * @param date The date for which the end should be retrieved. - * @return Returns null if the given date is null, otherwise the end of the given day. - */ - private Date getToDate(Date date) - { - return date == null ? null : getEndOfDay(date); - } - - /** - * Returns the number of milliseconds for the "to date". - * - * @param date The date for which the number of milliseconds should retrieved. - * @return Returns null if the given date is null, otherwise the number of milliseconds for the given date. - */ - private Long getToDateTime(Date date) - { - Long toDateTime = null; - Date toDate = getToDate(date); - if (toDate != null) - { - toDateTime = Long.valueOf(toDate.getTime()); - } - return toDateTime; - } - - /** - * {@inheritDoc} - */ - @Override - public NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, - NodeRef destination, ReportFormat format) - { - ParameterCheck.mandatory("params", params); - ParameterCheck.mandatory("destination", destination); - - // NOTE: the underlying RM services will check all the remaining pre-conditions - - NodeRef record = null; - - // get the audit trail for the provided parameters - File auditTrail = this.getAuditTrailFile(params, format); - - if (logger.isDebugEnabled()) - { - logger.debug("Filing audit trail in file " + auditTrail.getAbsolutePath() + - " as a record in record folder: " + destination); - } - - try - { - Map properties = new HashMap<>(1); - properties.put(ContentModel.PROP_NAME, auditTrail.getName()); - - // file the audit log as an undeclared record - record = this.nodeService.createNode(destination, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(auditTrail.getName())), - ContentModel.TYPE_CONTENT, properties).getChildRef(); - - // Set the content - ContentWriter writer = this.contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(format == ReportFormat.HTML ? MimetypeMap.MIMETYPE_HTML : MimetypeMap.MIMETYPE_JSON); - writer.setEncoding("UTF-8"); - writer.putContent(auditTrail); - } - finally - { - if (logger.isDebugEnabled()) - { - logger.debug("Audit trail report saved to temporary file: " + auditTrail.getAbsolutePath()); - } - else - { - auditTrail.delete(); - } - } - - return record; - } - - /** - * {@inheritDoc} - */ - @Override - public List getAuditEvents() - { - List listAuditEvents = new ArrayList<>(this.auditEvents.size()); - listAuditEvents.addAll(this.auditEvents.values()); - Collections.sort(listAuditEvents); - return listAuditEvents; - } - - /** - * Writes the start of the audit trail stream to the given writer - * - * @param writer The writer to write to - * @params params The parameters being used - * @param reportFormat The format to write the header in - * @throws IOException - */ - private void writeAuditTrailHeader(Writer writer, - RecordsManagementAuditQueryParameters params, - ReportFormat reportFormat) throws IOException - { - if (writer == null) - { - return; - } - - if (reportFormat == ReportFormat.HTML) - { - // write header as HTML - writer.write("\n"); - writer.write("\n\n"); - writer.write(""); - writer.write(I18NUtil.getMessage(MSG_AUDIT_REPORT)); - writer.write("\n"); - writer.write("\n"); - writer.write("\n

"); - writer.write(I18NUtil.getMessage(MSG_AUDIT_REPORT)); - writer.write("

\n"); - writer.write("
\n"); - - writer.write("From:"); - writer.write(""); - Date from = params.getDateFrom(); - writer.write(from == null ? "<Not Set>" : escapeHtml4(from.toString())); - writer.write(""); - - writer.write("To:"); - writer.write(""); - Date to = params.getDateTo(); - writer.write(to == null ? "<Not Set>" : escapeHtml4(to.toString())); - writer.write(""); - - writer.write("Property:"); - writer.write(""); - QName prop = params.getProperty(); - writer.write(prop == null ? "All" : escapeHtml4(getPropertyLabel(prop))); - writer.write(""); - - writer.write("User:"); - writer.write(""); - writer.write(params.getUser() == null ? "All" : escapeHtml4(params.getUser())); - writer.write(""); - - writer.write("Event:"); - writer.write(""); - writer.write(params.getEvent() == null ? "All" : escapeHtml4(getAuditEventLabel(params.getEvent()))); - writer.write("\n"); - - writer.write("
\n"); - } - else - { - // write header as JSON - writer.write("{\n\t\"data\":\n\t{"); - writer.write("\n\t\t\"started\": \""); - writer.write(ISO8601DateFormat.format(getStartOfDay(params.getDateFrom()))); - writer.write("\",\n\t\t\"stopped\": \""); - writer.write(ISO8601DateFormat.format(getEndOfDay(params.getDateTo()))); - writer.write("\",\n\t\t\"enabled\": "); - writer.write(Boolean.toString(isEnabled())); - writer.write(",\n\t\t\"entries\":["); - } - } - - /** - * Writes an audit trail entry to the given writer - * - * @param writer The writer to write to - * @param entry The entry to write - * @param reportFormat The format to write the header in - * @throws IOException - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private void writeAuditTrailEntry(Writer writer, RecordsManagementAuditEntry entry, - ReportFormat reportFormat) throws IOException - { - if (writer == null) - { - return; - } - - if (reportFormat == ReportFormat.HTML) - { - writer.write("
\n"); - writer.write("
"); - writer.write("Timestamp:"); - writer.write(""); - writer.write(escapeHtml4(entry.getTimestamp().toString())); - writer.write(""); - writer.write("User:"); - writer.write(""); - writer.write(entry.getFullName() != null ? - escapeHtml4(entry.getFullName()) : - escapeHtml4(entry.getUserName())); - writer.write(""); - if (entry.getUserRole() != null && entry.getUserRole().length() > 0) - { - writer.write("Role:"); - writer.write(""); - writer.write(escapeHtml4(entry.getUserRole())); - writer.write(""); - } - if (entry.getEvent() != null && entry.getEvent().length() > 0) - { - writer.write("Event:"); - writer.write(""); - writer.write(escapeHtml4(getAuditEventLabel(entry.getEvent()))); - writer.write("\n"); - } - writer.write("
\n"); - writer.write("
"); - if (entry.getIdentifier() != null && entry.getIdentifier().length() > 0) - { - writer.write("Identifier:"); - writer.write(""); - writer.write(escapeHtml4(entry.getIdentifier())); - writer.write(""); - } - if (entry.getNodeType() != null && entry.getNodeType().length() > 0) - { - writer.write("Type:"); - writer.write(""); - writer.write(escapeHtml4(entry.getNodeType())); - writer.write(""); - } - if (entry.getPath() != null && entry.getPath().length() > 0) - { - // we need to strip off the first part of the path - String path = entry.getPath(); - String displayPath; - int idx = path.indexOf(RM_AUDIT_SITES_PATH); - if (idx != -1) - { - displayPath = path.substring(idx + RM_AUDIT_SITES_PATH.length()); - } - else - { - displayPath = path; - } - - writer.write("Location:"); - writer.write(""); - writer.write(escapeHtml4(displayPath)); - writer.write(""); - } - writer.write("
\n"); - - if (entry.getChangedProperties() != null && !entry.getChangedProperties().isEmpty()) - { - writer.write(""); - writer.write(""); - - // create an entry for each property that changed - for (QName valueName : entry.getChangedProperties().keySet()) - { - Pair values = entry.getChangedProperties().get(valueName); - writer.write(""); - } - - writer.write("
PropertyPrevious ValueNew Value
"); - writer.write(getPropertyLabel(valueName)); - writer.write(""); - - // inspect the property to determine it's data type - QName propDataType = DataTypeDefinition.TEXT; - PropertyDefinition propDef = dictionaryService.getProperty(valueName); - if (propDef != null) - { - propDataType = propDef.getDataType().getName(); - } - - if(DataTypeDefinition.MLTEXT.equals(propDataType)) - { - writer.write(values.getFirst() == null ? "<none>" : escapeHtml4(convertToMlText((Map) values.getFirst()).getDefaultValue())); - writer.write(""); - writer.write(values.getSecond() == null ? "<none>" : escapeHtml4(convertToMlText((Map) values.getSecond()).getDefaultValue())); - } - else - { - Serializable oldValue = values.getFirst(); - writer.write(oldValue == null ? "<none>" : escapeHtml4(oldValue.toString())); - writer.write(""); - Serializable newValue = values.getSecond(); - writer.write(newValue == null ? "<none>" : escapeHtml4(newValue.toString())); - } - - writer.write("
\n"); - } - - writer.write("
"); - } - else - { - try - { - JSONObject json = new JSONObject(); - - json.put("timestamp", entry.getTimestampString()); - json.put("userName", entry.getUserName()); - json.put("userRole", entry.getUserRole() == null ? "": entry.getUserRole()); - json.put("fullName", entry.getFullName() == null ? "": entry.getFullName()); - json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef()); - - setNodeName(entry, json); - - 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()); - json.put("path", entry.getPath() == null ? "": entry.getPath()); - - JSONArray changedValues = new JSONArray(); - - if (entry.getChangedProperties() != null) - { - // create an entry for each property that changed - for (QName valueName : entry.getChangedProperties().keySet()) - { - Pair values = entry.getChangedProperties().get(valueName); - - JSONObject changedValue = new JSONObject(); - changedValue.put("name", getPropertyLabel(valueName)); - - // inspect the property to determine it's data type - QName propDataType = DataTypeDefinition.TEXT; - PropertyDefinition propDef = dictionaryService.getProperty(valueName); - if (propDef != null) - { - propDataType = propDef.getDataType().getName(); - } - - // handle output of mltext properties - if(DataTypeDefinition.MLTEXT.equals(propDataType)) - { - changedValue.put("previous", values.getFirst() == null ? "" : convertToMlText((Map)values.getFirst()).getDefaultValue()); - changedValue.put("new", values.getSecond() == null ? "" : convertToMlText((Map)values.getSecond()).getDefaultValue()); - } - else - { - changedValue.put("previous", values.getFirst() == null ? "" : values.getFirst().toString()); - changedValue.put("new", values.getSecond() == null ? "" : values.getSecond().toString()); - } - - changedValues.put(changedValue); - } - } - - json.put("changedValues", changedValues); - writer.write(json.toString()); - } - catch (JSONException je) - { - writer.write("{}"); - } - } - } - - /** - * Update a JSON object with a node name for an audit event. - * - * @param entry The audit event. - * @param json The object to update. - * @throws JSONException If there is a problem updating the JSON. - */ - private void setNodeName(RecordsManagementAuditEntry entry, JSONObject json) throws JSONException - { - String nodeName = null; - if (entry.getNodeRef() != null) - { - // TODO: Find another way for checking the event - switch (entry.getEvent()) - { - case "Create Person": - nodeName = getNodeName(entry.getAfterProperties(), PROP_USERNAME); - // This is needed as older audit events (pre-2.7) were created without PROP_USERNAME being set. - NodeRef nodeRef = entry.getNodeRef(); - if (nodeName == null && nodeService.exists(nodeRef)) - { - nodeName = (String) nodeService.getProperty(nodeRef, PROP_USERNAME); - } - json.put("createPerson", true); - break; - - case "Delete Person": - nodeName = getNodeName(entry.getBeforeProperties(), PROP_USERNAME); - json.put("noAvailableLink", true); - break; - - case "Create User Group": - nodeName = getNodeName(entry.getAfterProperties(), PROP_AUTHORITY_DISPLAY_NAME, PROP_AUTHORITY_NAME); - json.put("noAvailableLink", true); - break; - - case "Delete User Group": - nodeName = getNodeName(entry.getBeforeProperties(), PROP_AUTHORITY_DISPLAY_NAME, PROP_AUTHORITY_NAME); - json.put("noAvailableLink", true); - break; - - case "Add To User Group": - nodeName = getNodeName(entry.getAfterProperties(), PARENT_GROUP); - json.put("noAvailableLink", true); - break; - - case "Remove From User Group": - nodeName = getNodeName(entry.getBeforeProperties(), PARENT_GROUP); - json.put("noAvailableLink", true); - break; - - case "Delete RM Object": - case "Delete Hold": - nodeName = entry.getNodeName(); - json.put("noAvailableLink", true); - break; - - default: - nodeName = entry.getNodeName(); - break; - } - } - json.put("nodeName", nodeName == null ? "" : nodeName); - } - - /** - * Get a node name using the first non-blank value from a properties object using a list of property names. - * - * @param properties The properties object. - * @param propertyNames The names of the properties to use. Return the first value that is not empty. - * @return The value of the property, or null if it's not there. - */ - private String getNodeName(Map properties, QName... propertyNames) - { - for (QName propertyName : propertyNames) - { - String nodeName = (properties != null ? (String) properties.get(propertyName) : null); - if (!isBlank(nodeName)) - { - return nodeName; - } - } - return null; - } - - /** - * Helper method to convert value to MLText - * - * @param map map of locale's and values - * @return {@link MLText} multilingual text value - */ - private MLText convertToMlText(Map map) - { - MLText mlText = new MLText(); - mlText.putAll(map); - return mlText; - } - - /** - * Writes the end of the audit trail stream to the given writer - * - * @param writer The writer to write to - * @param reportFormat The format to write the footer in - * @throws IOException - */ - private void writeAuditTrailFooter(Writer writer, ReportFormat reportFormat) throws IOException - { - if (writer == null) - { - return; - } - - if (reportFormat == ReportFormat.HTML) - { - // write footer as HTML - writer.write("\n"); - } - else - { - // write footer as JSON - writer.write("\n\t\t]\n\t}\n}"); - } - } - - /** - * Returns the display label for a property QName - * - * @param property The property to get label for - * @return The label - */ - private String getPropertyLabel(QName property) - { - String label = null; - - PropertyDefinition propDef = this.dictionaryService.getProperty(property); - if (propDef != null) - { - label = propDef.getTitle(dictionaryService); - } - - if (label == null) - { - label = property.getLocalName(); - } - - return label; - } - - /** - * Returns the display label for the given audit event key - * - * @param eventKey The audit event key - * @return The display label or null if the key does not exist - */ - private String getAuditEventLabel(String eventKey) - { - String label = eventKey; - - AuditEvent event = this.auditEvents.get(eventKey); - if (event != null) - { - label = event.getLabel(); - } - - return label; - } - - /** - * A class to carry audit information through the transaction. - * - * @author Derek Hulley - * @since 3.2 - */ - private static class RMAuditNode - { - private NodeRef nodeRef; - private String eventName; - private Map nodePropertiesBefore; - private Map nodePropertiesAfter; - private boolean removeIfNoPropertyChanged = false; - - public NodeRef getNodeRef() - { - return nodeRef; - } - - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - public String getEventName() - { - return eventName; - } - - public void setEventName(String eventName) - { - this.eventName = eventName; - } - - public Map getNodePropertiesBefore() - { - return nodePropertiesBefore; - } - - public void setNodePropertiesBefore(Map nodePropertiesBefore) - { - this.nodePropertiesBefore = nodePropertiesBefore; - } - - public Map getNodePropertiesAfter() - { - return nodePropertiesAfter; - } - - public void setNodePropertiesAfter(Map nodePropertiesAfter) - { - this.nodePropertiesAfter = nodePropertiesAfter; - } - - public boolean getRemoveIfNoPropertyChanged() - { - return removeIfNoPropertyChanged; - } - - public void setRemoveIfNoPropertyChanged(boolean removeIfNoPropertyChanged) - { - this.removeIfNoPropertyChanged = removeIfNoPropertyChanged; - } - } - - /** Deprecated Method Implementations **/ - - /** - * Helper method to get the default file plan - * - * @return NodRef default file plan - */ - private NodeRef getDefaultFilePlan() - { - NodeRef defaultFilePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (defaultFilePlan == null) - { - throw new AlfrescoRuntimeException("Default file plan could not be found."); - } - return defaultFilePlan; - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public boolean isEnabled() - { - return isAuditLogEnabled(getDefaultFilePlan()); - } - - /** - * use {@link #startAuditLog(NodeRef)} instead - * - */ - @Deprecated - public void start() - { - startAuditLog(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public void stop() - { - stopAuditLog(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public Date getDateLastStarted() - { - return getDateAuditLogLastStarted(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public Date getDateLastStopped() - { - return getDateAuditLogLastStopped(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public void clear() - { - clearAuditLog(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - * @since 3.2 - * @deprecated since 2.1 - */ - @Override - @Deprecated - public void auditRMAction( - RecordsManagementAction action, - NodeRef nodeRef, - Map parameters) - { - auditEvent(nodeRef, action.getName()); - } - - private class AuditTrailQueryCallback implements AuditQueryCallback - { - private final List results; - private final Writer writer; - private final ReportFormat reportFormat; - private boolean firstEntry; - - public AuditTrailQueryCallback(List results, Writer writer, ReportFormat reportFormat) - { - this.results = results; - this.writer = writer; - this.reportFormat = reportFormat; - firstEntry = true; - } - - - @Override - public boolean valuesRequired() - { - return true; - } - - /** - * Just log the error, but continue - */ - @Override - public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error) - { - logger.warn(errorMsg, error); - return true; - } - - @Override - @SuppressWarnings("unchecked") - public boolean handleAuditEntry( - Long entryId, - String applicationName, - String user, - long time, - Map values) - { - // Check for context shutdown - if (shutdown) - { - return false; - } - - - Date timestamp = new Date(time); - String eventName = null; - String fullName = null; - String userRoles = null; - NodeRef nodeRef = null; - String nodeName = null; - String nodeType = null; - String nodeIdentifier = null; - String namePath = null; - Map beforeProperties = null; - Map afterProperties = null; - - if (values.containsKey(RM_AUDIT_DATA_EVENT_NAME)) - { - // This data is /RM/event/... - eventName = (String) values.get(RM_AUDIT_DATA_EVENT_NAME); - fullName = (String) values.get(RM_AUDIT_DATA_PERSON_FULLNAME); - userRoles = (String) values.get(RM_AUDIT_DATA_PERSON_ROLES); - nodeRef = (NodeRef) values.get(RM_AUDIT_DATA_NODE_NODEREF); - nodeName = (String) values.get(RM_AUDIT_DATA_NODE_NAME); - QName nodeTypeQname = (QName) values.get(RM_AUDIT_DATA_NODE_TYPE); - nodeIdentifier = (String) values.get(RM_AUDIT_DATA_NODE_IDENTIFIER); - namePath = (String) values.get(RM_AUDIT_DATA_NODE_NAMEPATH); - beforeProperties = (Map) values.get(RM_AUDIT_DATA_NODE_CHANGES_BEFORE); - afterProperties = (Map) values.get(RM_AUDIT_DATA_NODE_CHANGES_AFTER); - - // Convert some of the values to recognizable forms - if (nodeTypeQname != null) - { - TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname); - nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null; - } - } - else if (values.containsKey(DOD5015_AUDIT_DATA_EVENT_NAME)) - { - // This data is /DOD5015/event/... - eventName = (String) values.get(DOD5015_AUDIT_DATA_EVENT_NAME); - fullName = (String) values.get(DOD5015_AUDIT_DATA_PERSON_FULLNAME); - userRoles = (String) values.get(DOD5015_AUDIT_DATA_PERSON_ROLES); - nodeRef = (NodeRef) values.get(DOD5015_AUDIT_DATA_NODE_NODEREF); - nodeName = (String) values.get(DOD5015_AUDIT_DATA_NODE_NAME); - QName nodeTypeQname = (QName) values.get(DOD5015_AUDIT_DATA_NODE_TYPE); - nodeIdentifier = (String) values.get(DOD5015_AUDIT_DATA_NODE_IDENTIFIER); - namePath = (String) values.get(DOD5015_AUDIT_DATA_NODE_NAMEPATH); - beforeProperties = (Map) values.get( DOD5015_AUDIT_DATA_NODE_CHANGES_BEFORE); - afterProperties = (Map) values.get(DOD5015_AUDIT_DATA_NODE_CHANGES_AFTER); - - // Convert some of the values to recognizable forms - if (nodeTypeQname != null) - { - TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname); - nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null; - } - } - else if (values.containsKey(RM_AUDIT_DATA_LOGIN_USERNAME)) - { - user = (String) values.get(RM_AUDIT_DATA_LOGIN_USERNAME); - if (values.containsKey(RM_AUDIT_DATA_LOGIN_ERROR)) - { - eventName = RM_AUDIT_EVENT_LOGIN_FAILURE; - // The user didn't log in - fullName = user; - } - else - { - eventName = RM_AUDIT_EVENT_LOGIN_SUCCESS; - fullName = (String) values.get(RM_AUDIT_DATA_LOGIN_FULLNAME); - } - } - else if (values.containsKey(DOD5015_AUDIT_DATA_LOGIN_USERNAME)) - { - user = (String) values.get(DOD5015_AUDIT_DATA_LOGIN_USERNAME); - if (values.containsKey(DOD5015_AUDIT_DATA_LOGIN_ERROR)) - { - eventName = RM_AUDIT_EVENT_LOGIN_FAILURE; - // The user didn't log in - fullName = user; - } - else - { - eventName = RM_AUDIT_EVENT_LOGIN_SUCCESS; - fullName = (String) values.get(DOD5015_AUDIT_DATA_LOGIN_FULLNAME); - } - } - else - { - // This is not recognisable data - logger.warn( - "Unable to process audit entry for RM. Unexpected data: \n" + - " Entry: " + entryId + "\n" + - " Data: " + values); - // Skip it - return true; - } - - if (nodeRef != null && nodeService.exists(nodeRef)) - { - if ((filePlanService.isFilePlanComponent(nodeRef) && - !AccessStatus.ALLOWED.equals( - capabilityService.getCapabilityAccessState(nodeRef, ACCESS_AUDIT_CAPABILITY))) || - (!AccessStatus.ALLOWED.equals(permissionService.hasPermission(nodeRef, PermissionService.READ)))) - { - return true; - } - - checkPermissionIfHoldInProperties(beforeProperties); - checkPermissionIfHoldInProperties(afterProperties); - } - - // remove any hold node refs from view - removeHoldNodeRefIfPresent(beforeProperties); - removeHoldNodeRefIfPresent(afterProperties); - - // TODO: Refactor this to use the builder pattern - RecordsManagementAuditEntry entry = new RecordsManagementAuditEntry( - timestamp, - user, - fullName, - // A concatenated string of roles - userRoles, - nodeRef, - nodeName, - nodeType, - eventName, - nodeIdentifier, - namePath, - beforeProperties, - afterProperties); - - // write out the entry to the file in requested format - writeEntryToFile(entry); - - if (results != null) - { - results.add(entry); - } - - if (logger.isDebugEnabled()) - { - logger.debug(" " + entry); - } - - // Keep going - return true; - } - - /** - * Helper method to check permission on the hold, if any, from the given event properties - * @param eventProperties event properties - */ - private void checkPermissionIfHoldInProperties(Map eventProperties) - { - NodeRef holdNodeRef = eventProperties != null ? (NodeRef) eventProperties.get(PROPERTY_HOLD_NODEREF) : null; - if (holdNodeRef != null) - { - if (!AccessStatus.ALLOWED.equals( - permissionService.hasPermission(holdNodeRef, PermissionService.READ))) - { - eventProperties.replace(PROPERTY_HOLD_NAME, I18NUtil.getMessage(HOLD_PERMISSION_DENIED_MSG)); - } - } - } - - /** - * Helper method to remove the hold node ref, if any, from the given event properties - * @param eventProperties event properties - */ - private void removeHoldNodeRefIfPresent(Map eventProperties) - { - if (eventProperties != null) - { - eventProperties.remove(PROPERTY_HOLD_NODEREF); - } - } - - /** - * Helper method to write the audit entry to file - * @param entry audit entry - */ - private void writeEntryToFile(RecordsManagementAuditEntry entry) - { - if (writer == null) - { - return; - } - try - { - if (!firstEntry) - { - if (reportFormat == ReportFormat.HTML) - { - writer.write("\n"); - } - else - { - writer.write(","); - } - } - else - { - firstEntry = false; - } - - // write the entry to the file - if (reportFormat == ReportFormat.JSON) - { - writer.write("\n\t\t"); - } - - writeAuditTrailEntry(writer, entry, reportFormat); - } - catch (IOException ioe) - { - throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, ioe); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToHoldAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToHoldAuditEvent.java deleted file mode 100644 index 34fb578d5c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToHoldAuditEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies; -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.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Add to hold audit event. - * - * @author Sara Aspery - * @since 3.3 - */ -@BehaviourBean -public class AddToHoldAuditEvent extends AuditEvent implements HoldServicePolicies.OnAddToHoldPolicy -{ - /** - * Node Service - */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnAddToHoldPolicy#onAddToHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:hold", - notificationFrequency = EVERY_EVENT - ) - public void onAddToHold(NodeRef holdNodeRef, NodeRef contentNodeRef) - { - Map auditProperties = HoldUtils.makePropertiesMap(holdNodeRef, nodeService); - auditProperties.put(ContentModel.PROP_NAME, nodeService.getProperty(contentNodeRef, ContentModel.PROP_NAME)); - - recordsManagementAuditService.auditEvent(contentNodeRef, getName(), null, auditProperties, true, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToUserGroupAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToUserGroupAuditEvent.java deleted file mode 100644 index 237e74a05f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToUserGroupAuditEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.alfresco.module.org_alfresco_module_rm.audit.event.UserGroupMembershipUtils.makePropertiesMap; -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy; -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.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Add an authority to a user group. - * - * @author Tom Page - * @since 2.7 - */ -@BehaviourBean(defaultType = "cm:authorityContainer") -public class AddToUserGroupAuditEvent extends AuditEvent implements OnCreateChildAssociationPolicy -{ - /** Node Service */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** Behaviour to audit adding an authority to a user group. */ - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION, notificationFrequency = EVERY_EVENT, assocType = "cm:member") - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - Map auditProperties = makePropertiesMap(childAssocRef, nodeService); - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), null, auditProperties, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java deleted file mode 100644 index 25a34eb20d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Class to represent an audit event - * - * @author Gavin Cornwell - * @author Roy Wetherall - * @since 1.0 - */ -@AlfrescoPublicApi -public class AuditEvent implements RecordsManagementModel, Comparable -{ - /** Name */ - private String name; - - /** Label */ - private String label; - - /** Records management audit service */ - protected RecordsManagementAuditService recordsManagementAuditService; - - /** - * @param recordsManagementAuditService records management audit service - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * Init method - */ - public void init() - { - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("label", label); - - recordsManagementAuditService.registerAuditEvent(this); - } - - /** - * Default constructor. - */ - public AuditEvent() - { - // do nothing - } - - /** - * Default constructor. - * - * @param name audit event name - * @param label audit event label (can be actual label or I18N lookup key) - */ - public AuditEvent(String name, String label) - { - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("label", label); - - setName(name); - setLabel(label); - } - - /** - * @return audit event name - */ - public String getName() - { - return this.name; - } - - /** - * @param name audit event name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @return audit event label - */ - public String getLabel() - { - String lookup = I18NUtil.getMessage(label); - if (StringUtils.isBlank(lookup)) - { - lookup = label; - } - return lookup; - } - - /** - * @param label audit event label - */ - public void setLabel(String label) - { - this.label = label; - } - - /** - * Compare by label. - * - * @param compare compare to audit event - * @return int - */ - @Override - public int compareTo(AuditEvent compare) - { - return getLabel().compareTo(compare.getLabel()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java deleted file mode 100644 index cf02199ba1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.util.Map; - -import org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy; -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; - -/** - * Copy audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class CopyToAuditEvent extends AuditEvent implements OnCopyCompletePolicy -{ - /** - * Audit copy of file plan components - * - * @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void onCopyComplete(QName classRef, - NodeRef sourceNodeRef, - NodeRef targetNodeRef, - boolean copyToNewNode, - Map copyMap) - { - if (copyToNewNode) - { - recordsManagementAuditService.auditEvent(targetNodeRef, getName()); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateHoldAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateHoldAuditEvent.java deleted file mode 100644 index 85bf2e38b8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateHoldAuditEvent.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Create hold audit event. - * This listens to the NodeServicePolicies.OnCreateNodePolicy in order to cover the create hold action from Share - * since that does not call the createHold from HoldService - * - * @author Sara Aspery - * @since 3.3 - */ -@BehaviourBean -public class CreateHoldAuditEvent extends AuditEvent implements NodeServicePolicies.OnCreateNodePolicy -{ - /** - * Node Service - */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:hold", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateNode(ChildAssociationRef childAssociationRef) - { - NodeRef holdNodeRef = childAssociationRef.getChildRef(); - - Map auditProperties = HoldUtils.makePropertiesMap(holdNodeRef, nodeService); - auditProperties.put(PROP_HOLD_REASON, nodeService.getProperty(holdNodeRef, PROP_HOLD_REASON)); - - recordsManagementAuditService.auditEvent(holdNodeRef, getName(), null, auditProperties); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java deleted file mode 100644 index 8cea669f96..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; -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; - -/** - * Audits the creation of file plan component objects - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class CreateObjectAuditEvent extends AuditEvent implements OnCreateNodePolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java deleted file mode 100644 index ccb1d60ca2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; -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.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Audits person creation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class CreatePersonAuditEvent extends AuditEvent implements OnCreateNodePolicy -{ - /** Node Service */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS, type = "cm:person") - public void onCreateNode(ChildAssociationRef childAssocRef) - { - Map auditProperties = new HashMap<>(); - auditProperties.put(ContentModel.PROP_USERNAME, - nodeService.getProperty(childAssocRef.getChildRef(), ContentModel.PROP_USERNAME)); - - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), null, auditProperties); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateUserGroupAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateUserGroupAuditEvent.java deleted file mode 100644 index e7d282d617..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateUserGroupAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; -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.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Audits user group creation. - * - * @author Tom Page - * @since 2.7 - */ -@BehaviourBean -public class CreateUserGroupAuditEvent extends AuditEvent implements OnCreateNodePolicy -{ - /** Node Service */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** Behaviour to audit user group creation. */ - @Override - @Behaviour(kind = BehaviourKind.CLASS, type = "cm:authorityContainer") - public void onCreateNode(ChildAssociationRef childAssocRef) - { - Map auditProperties = new HashMap<>(); - auditProperties.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, - nodeService.getProperty(childAssocRef.getChildRef(), ContentModel.PROP_AUTHORITY_DISPLAY_NAME)); - - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), null, auditProperties); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteHoldAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteHoldAuditEvent.java deleted file mode 100644 index 6699ff629c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteHoldAuditEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT; - -import java.io.Serializable; -import java.util.Map; - -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.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Delete hold audit event. - * This listens to the NodeServicePolicies.BeforeDeleteNodePolicy in order to cover the delete hold using nodes service - * - * @author Sara Aspery - * @since 3.3 - */ -@BehaviourBean -public class DeleteHoldAuditEvent extends AuditEvent implements NodeServicePolicies.BeforeDeleteNodePolicy -{ - /** - * Node Service - */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour ( - kind = BehaviourKind.CLASS, - type = "rma:hold", - notificationFrequency = EVERY_EVENT - ) - public void beforeDeleteNode(NodeRef holdNodeRef) - { - Map auditProperties = HoldUtils.makePropertiesMap(holdNodeRef, nodeService); - recordsManagementAuditService.auditEvent(holdNodeRef, getName(), auditProperties, null, true, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java deleted file mode 100644 index 04fb5d792d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; -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; - -/** - * Audits file plan component delete - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - recordsManagementAuditService.auditEvent(nodeRef, getName(), null, null, true, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeletePersonAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeletePersonAuditEvent.java deleted file mode 100644 index 7228bd4158..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeletePersonAuditEvent.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; -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.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Audits person deletion. - * - * @author Rodica Sutu - * @since 2.7 - */ -@BehaviourBean -public class DeletePersonAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy -{ - /** Node Service*/ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Behaviour that will audit user deletion - * - * @param nodeRef the node to be deleted - * - */ - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "cm:person" - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - //retrieve the username property to be audited - Map userName = new HashMap<>(); - userName.put(ContentModel.PROP_USERNAME, nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME)); - - //audit the property values before the delete event - recordsManagementAuditService.auditEvent(nodeRef, getName(), userName, null, true, false); - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteUserGroupAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteUserGroupAuditEvent.java deleted file mode 100644 index 78fc0f23d3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteUserGroupAuditEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; -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.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Audits user group deletion. - * - * @author Tom Page - * @since 2.7 - */ -@BehaviourBean -public class DeleteUserGroupAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy -{ - /** Node Service */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Behaviour that will audit user group deletion - * - * @param nodeRef the node to be deleted - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS, type = "cm:authorityContainer") - public void beforeDeleteNode(NodeRef nodeRef) - { - // Retrieve the authority name property to be audited - Map auditProperties = new HashMap<>(); - auditProperties.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, - nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_DISPLAY_NAME)); - - //audit the property values before the delete event - recordsManagementAuditService.auditEvent(nodeRef, getName(), auditProperties, null, true, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java deleted file mode 100644 index 0d87cd4517..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -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; - -/** - * File audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class FileToAuditEvent 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 = "rma:record" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (before.get(PROP_DATE_FILED) == null && after.get(PROP_DATE_FILED) != null) - { - // then we can assume that the record has just been filed - recordsManagementAuditService.auditEvent(nodeRef, getName()); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/HoldUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/HoldUtils.java deleted file mode 100644 index 23b225ef8c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/HoldUtils.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** - * Utility class for creating audit events about holds. - * - * @author Sara Aspery - * @since 3.3 - */ -class HoldUtils -{ - /** A QName to display for the hold name. */ - public static final QName HOLD_NAME = QName.createQName(RecordsManagementModel.RM_URI, "Hold Name"); - /** A QName to display for the hold node ref. */ - public static final QName HOLD_NODEREF = QName.createQName(RecordsManagementModel.RM_URI, "Hold NodeRef"); - - /** - * Create a properties map containing the hold name and node ref for the given hold. - * - * @param nodeRef The nodeRef of the hold. - * @param nodeService The node service. - * @return A map containing the name and noderef of the hold. - */ - static Map makePropertiesMap(NodeRef nodeRef, NodeService nodeService) - { - Map auditProperties = new HashMap<>(); - - auditProperties.put(HOLD_NAME, nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); - auditProperties.put(HOLD_NODEREF, nodeRef); - - return auditProperties; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java deleted file mode 100644 index ccf1cdae92..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy; -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.cmr.repository.NodeService; - -/** - * Link to audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class LinkToAuditEvent extends AuditEvent implements OnCreateChildAssociationPolicy -{ - /** Node Service */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - type = "rma:filePlanComponent" - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - final NodeRef parentRef = childAssocRef.getParentRef(); - // only care about linking child associations - if (!childAssocRef.isPrimary() && !nodeService.getType(parentRef).equals(TYPE_HOLD)) - { - // TODO - // add some dummy properties to indicate the details of the link? - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java deleted file mode 100644 index 7c88d72f9b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy; -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; - -/** - * Move to audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class MoveToAuditEvent extends AuditEvent implements OnMoveNodePolicy -{ - /** - * @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, - type = "rma:filePlanComponent" - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - recordsManagementAuditService.auditEvent(newChildAssocRef.getChildRef(), getName()); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java deleted file mode 100644 index 83ef983f06..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromHoldAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromHoldAuditEvent.java deleted file mode 100644 index d9e2111fa3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromHoldAuditEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Delete from hold audit event. - * - * @author Chris Shields - * @since 3.3 - */ -@BehaviourBean -public class RemoveFromHoldAuditEvent extends AuditEvent implements HoldServicePolicies.OnRemoveFromHoldPolicy -{ - /** - * Node Service - */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnRemoveFromHoldPolicy#onRemoveFromHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:hold", - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void onRemoveFromHold(NodeRef holdNodeRef, NodeRef contentNodeRef) - { - Map auditProperties = HoldUtils.makePropertiesMap(holdNodeRef, nodeService); - auditProperties.put(ContentModel.PROP_NAME, nodeService.getProperty(contentNodeRef, ContentModel.PROP_NAME)); - - recordsManagementAuditService.auditEvent(contentNodeRef, getName(), auditProperties, null, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromUserGroupAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromUserGroupAuditEvent.java deleted file mode 100644 index 1484824d51..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromUserGroupAuditEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.alfresco.module.org_alfresco_module_rm.audit.event.UserGroupMembershipUtils.makePropertiesMap; -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies.OnDeleteChildAssociationPolicy; -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.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Remove an authority from a user group. - * - * @author Tom Page - * @since 2.7 - */ -@BehaviourBean(defaultType = "cm:authorityContainer") -public class RemoveFromUserGroupAuditEvent extends AuditEvent implements OnDeleteChildAssociationPolicy -{ - /** Node Service */ - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** Behaviour to audit removing an authority from a user group. */ - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION, notificationFrequency = EVERY_EVENT, assocType = "cm:member") - public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - Map auditProperties = makePropertiesMap(childAssocRef, nodeService); - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), auditProperties, null, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java deleted file mode 100644 index f6eb0d5ef0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -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; - -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTION_COMMIT; - - -/** - * Audits file plan component property updates - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class UpdateObjectAuditEvent 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 = "rma:filePlanComponent", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, false, true); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UserGroupMembershipUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UserGroupMembershipUtils.java deleted file mode 100644 index d27bfc34f4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UserGroupMembershipUtils.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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; - -/** - * Utility class for creating audit events about user group membership. - * - * @author Tom Page - * @since 2.7 - */ -public class UserGroupMembershipUtils -{ - /** A QName to display for the parent group's name. */ - public static final QName PARENT_GROUP = QName.createQName(RecordsManagementModel.RM_URI, "Parent Group"); - /** A QName to display for a child group's name. */ - private static final QName CHILD_GROUP = QName.createQName(RecordsManagementModel.RM_URI, "Child Group"); - - /** - * Create a properties map from the given cm:member association. - * - * @param childAssocRef The association to use. - * @param nodeService The node service. - * @return A map containing the names of the parent and child. - */ - public static Map makePropertiesMap(ChildAssociationRef childAssocRef, NodeService nodeService) - { - Map auditProperties = new HashMap<>(); - // Set exactly one of the child group property or the child user name property. - String childGroupName = getUserGroupName(childAssocRef.getChildRef(), nodeService); - if (!isBlank(childGroupName)) - { - auditProperties.put(CHILD_GROUP, childGroupName); - } - String childUserName = (String) nodeService.getProperty(childAssocRef.getChildRef(), ContentModel.PROP_USERNAME); - if (!isBlank(childUserName)) - { - auditProperties.put(ContentModel.PROP_USERNAME, childUserName); - } - // Set the parent group name. - auditProperties.put(PARENT_GROUP, getUserGroupName(childAssocRef.getParentRef(), nodeService)); - return auditProperties; - } - - /** Get a name that can be displayed for the user group. */ - private static String getUserGroupName(NodeRef nodeRef, NodeService nodeService) - { - String groupName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_DISPLAY_NAME); - if (isBlank(groupName)) - { - groupName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_NAME); - } - return groupName; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java deleted file mode 100644 index ce6707f0d2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.extractor; - -import java.io.Serializable; -import java.util.Objects; -import java.util.Set; - -import org.alfresco.model.ContentModel; -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.audit.extractor.AbstractDataExtractor; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * An extractor that uses a node context to determine the currently-authenticated - * user's RM roles. This is not a data generator because it can only function in - * the context of a given node. - * - * @author Derek Hulley - * @since 3.2 - */ -public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - private FilePlanService filePlanService; - private FilePlanRoleService filePlanRoleService; - private DictionaryService dictionaryService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @return Returns true if the data is a NodeRef and it represents either a fileplan component or - * a subtype of content - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - NodeRef nodeRef = (NodeRef) data; - return nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) || - dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT); - } - - /** - * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) - */ - public Serializable extractData(Serializable value) - { - NodeRef nodeRef = (NodeRef) value; - String user = AuthenticationUtil.getFullyAuthenticatedUser(); - if (user == null) - { - // No-one is authenticated - return null; - } - - StringBuilder sb = new StringBuilder(100); - - // Get the rm root - NodeRef rmRootNodeRef = filePlanService.getFilePlan(nodeRef); - - // if we don't have an rm root and the given node is a subtype of content - if (rmRootNodeRef == null && - dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT)) - { - // use the default file plan - rmRootNodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - - if (rmRootNodeRef != null) - { - Set roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user); - for (Role role : roles) - { - if (sb.length() > 0) - { - sb.append(", "); - } - sb.append(role.getDisplayLabel()); - } - } - - // Done - return sb.toString(); - } - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - AuthenticatedUserRolesDataExtractor that = (AuthenticatedUserRolesDataExtractor) o; - return Objects.equals(nodeService, that.nodeService) && Objects.equals(filePlanService, that.filePlanService) - && Objects.equals(filePlanRoleService, that.filePlanRoleService); - } - - @Override - public int hashCode() - { - return Objects.hash(nodeService, filePlanService, filePlanRoleService); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java deleted file mode 100644 index 314d4a06d7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.extractor; - -import java.io.Serializable; -import java.util.Objects; - -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; - -/** - * An extractor that gets a node's {@link RecordsManagementModel#PROP_IDENTIFIER identifier} property. - * This will only extract data if the node is a - * {@link RecordsManagementModel#ASPECT_RECORD_COMPONENT_ID Record component identifier}. - * - * @author Derek Hulley - * @since 3.2 - */ -public final class FilePlanIdentifierDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @return Returns true if the data is a NodeRef and it represents - * a fileplan component - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID); - } - - public Serializable extractData(Serializable value) - { - NodeRef nodeRef = (NodeRef) value; - - String identifier = (String) nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER); - - // Done - return identifier; - } - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - FilePlanIdentifierDataExtractor that = (FilePlanIdentifierDataExtractor) o; - return Objects.equals(nodeService, that.nodeService); - } - - @Override - public int hashCode() - { - return Objects.hash(nodeService); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java deleted file mode 100644 index 070c026b7f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.extractor; - -import java.io.Serializable; -import java.util.List; -import java.util.Objects; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -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 - * - and including - the node itself. This will only extract data if the - * node is a {@link RecordsManagementModel#ASPECT_FILE_PLAN_COMPONENT fileplan component}. - * - * @see FilePlanService#getNodeRefPath(NodeRef) - * - * @author Derek Hulley - * @since 1.0 - */ -public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - private FilePlanService filePlanService; - private RuleService ruleService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - 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 - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - } - - public Serializable extractData(Serializable value) - { - Serializable extractedData = null; - - ruleService.disableRules(); - try - { - NodeRef nodeRef = (NodeRef) value; - - // Get path from the RM root - List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - - // Done - extractedData = (Serializable) nodeRefPath; - } - finally - { - ruleService.enableRules(); - } - - return extractedData; - } - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - FilePlanNodeRefPathDataExtractor that = (FilePlanNodeRefPathDataExtractor) o; - return Objects.equals(nodeService, that.nodeService) && Objects.equals(filePlanService, that.filePlanService) - && Objects.equals(ruleService, that.ruleService); - } - - @Override - public int hashCode() - { - return Objects.hash(nodeService, filePlanService, ruleService); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java deleted file mode 100644 index 07d54fa19b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/NamePathDataExtractor.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.extractor; - -import java.io.Serializable; -import java.util.List; -import java.util.Objects; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.audit.extractor.AbstractDataExtractor; -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.Path; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * An extractor that extracts the cm:name path from the RM root down to - * - and including - the node's own name. This will only extract data if the - * node is a {@link RecordsManagementModel#ASPECT_FILE_PLAN_COMPONENT fileplan component} - * or is a subtype of content. - * - * @see FilePlanService#getNodeRefPath(NodeRef) - * - * @author Derek Hulley - * @since 3.2 - * @author Sara Aspery - * @since AGS 3.3 - */ -public final class NamePathDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - private FilePlanService filePlanService; - private RuleService ruleService; - private PermissionService permissionService; - private DictionaryService dictionaryService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - 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; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @return Returns true if the data is a NodeRef and it either represents - * a fileplan component or is frozen - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - NodeRef nodeRef = (NodeRef) data; - return nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) || - dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT); - } - - /** - * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) - */ - public Serializable extractData(Serializable value) - { - String extractedData; - - 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); - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - nodeRefPath.add(0, nodeService.getPrimaryParent(filePlan).getParentRef()); - for (NodeRef pathNodeRef : nodeRefPath) - { - String name = (String) nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME); - sb.append("/").append(name); - } - } - else if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT)) - { - // Get path from the DM root - Path nodeRefPath = nodeService.getPath(nodeRef); - sb.append(nodeRefPath.toDisplayPath(nodeService, permissionService)); - // Get node name - String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - sb.append("/").append(name); - } - - // Done - extractedData = sb.toString(); - } - finally - { - ruleService.enableRules(); - } - - return extractedData; - } - - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - if (!super.equals(o)) - { - return false; - } - NamePathDataExtractor that = (NamePathDataExtractor) o; - return Objects.equals(nodeService, that.nodeService) && Objects.equals(filePlanService, that.filePlanService) - && Objects.equals(ruleService, that.ruleService); - } - - @Override - public int hashCode() - { - return Objects.hash(nodeService, filePlanService, ruleService); - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java deleted file mode 100644 index e49917cda7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter; -import org.alfresco.repo.module.ImporterModuleComponent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; - -/** - * Custom implementation of module component importer - * - * @author Roy Wetherall - * @since 2.0 - */ -public class BootstrapImporterModuleComponent extends ImporterModuleComponent -{ - /** rm config folder name */ - private static final String CONFIG_NODEID = "rm_config_folder"; - - /** node service */ - private NodeService nodeService; - - /** module patch executer */ - private ModulePatchExecuter modulePatchExecuter; - - /** record contributors group bootstrap component */ - private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param modulePatchExecuter module patch executer - */ - public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter) - { - 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. - * - * @see org.alfresco.repo.module.ImporterModuleComponent#executeInternal() - */ - @Override - protected void executeInternal() throws Throwable - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); - if (!nodeService.exists(nodeRef)) - { - super.executeInternal(); - - // Bootstrap creation of initial data. - recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); - - // init module schema number - modulePatchExecuter.initSchemaVersion(); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java deleted file mode 100644 index b9f66001df..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode; -import org.alfresco.service.cmr.module.ModuleService; -import org.alfresco.service.descriptor.DescriptorService; -import org.alfresco.service.license.LicenseDescriptor; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationListener; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Module compatibility component. - *

- * Checks that the currently installed RM AMP licence mode matches that of the - * underlying repository. - * - * @author Roy Wetherall - * @since 2.4 - */ -public class ModuleCompatibilityComponent implements ApplicationListener -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class); - - // TODO get this from somewhere - private static final String RM_ENT_MODULE_ID = "alfresco-rm-enterprise-repo"; - - /** descriptor service */ - private DescriptorService descriptorService; - - /** module service */ - private ModuleService moduleService; - - /** - * @param descriptorService descriptor service - */ - public void setDescriptorService(DescriptorService descriptorService) - { - this.descriptorService = descriptorService; - } - - /** - * @param moduleService module service - */ - public void setModuleService(ModuleService moduleService) - { - this.moduleService = moduleService; - } - - /** - * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) - */ - @Override - public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) - { - // license mode - LicenseMode licenseMode = LicenseMode.UNKNOWN; - - // grab the application context - ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext(); - - // get the license mode - LicenseDescriptor license = descriptorService.getLicenseDescriptor(); - if (license != null) - { - licenseMode = license.getLicenseMode(); - } - - // determine whether RM Enterprise is installed or not - boolean isRMEnterprise = isRMEnterprise(); - - // debug log - if (logger.isDebugEnabled()) - { - logger.debug("Module compatibility information:"); - logger.debug(" Repository licence mode = " + licenseMode.toString()); - logger.debug(" RM Enterprise installed = " + isRMEnterprise); - } - - if (LicenseMode.ENTERPRISE.equals(licenseMode) && !isRMEnterprise) - { - // running enterprise rm on community core so close application - // context - closeApplicationContext(applicationContext, - "Running Community Records Management Module on Enterprise Alfresco One is not a supported configuration."); - - } - else if (!LicenseMode.ENTERPRISE.equals(licenseMode) && isRMEnterprise) - { - // running community rm on enterprise core so close application - // context - closeApplicationContext(applicationContext, - "Running Enterprise Records Management module on Community Alfresco One is not a supported configuration."); - } - } - - /** - * Indicates whether RM Enterprise module is installed or not. - * - * @return boolean true if RM Enterprise is installed, false otherwise - */ - private boolean isRMEnterprise() - { - return (moduleService.getModule(RM_ENT_MODULE_ID) != null); - } - - /** - * Close application context, logging message. - * - * @param applicationContext application context - * @param message closure message - */ - private void closeApplicationContext(ApplicationContext applicationContext, String message) - { - // log closure message - if (logger.isErrorEnabled()) - { - logger.error(message); - } - - // close the application context! - ((ConfigurableApplicationContext) applicationContext).close(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java deleted file mode 100644 index 845894bfa2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java deleted file mode 100644 index 176815adcd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -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; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.context.ApplicationEvent; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; - - -/** - * RM module bootstrap - * - * @author janv - */ -public class RecordsManagementBootstrap extends AbstractLifecycleBean -{ - private TransactionService transactionService; - private RMCaveatConfigService caveatConfigService; - private CustomEmailMappingService customEmailMappingService; - private NodeParameterSuggesterBootstrap suggesterBootstrap; - - public NodeParameterSuggesterBootstrap getSuggesterBootstrap() - { - return suggesterBootstrap; - } - - public void setSuggesterBootstrap(NodeParameterSuggesterBootstrap suggesterBootstrap) - { - this.suggesterBootstrap = suggesterBootstrap; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) - { - this.caveatConfigService = caveatConfigService; - } - - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - public CustomEmailMappingService getCustomEmailMappingService() - { - return customEmailMappingService; - } - - @Override - protected void onBootstrap(ApplicationEvent event) - { - // run as System on bootstrap - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - // initialise caveat config - caveatConfigService.init(); - - // 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"); - action.bootstrap(); - - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - @Override - protected void onShutdown(ApplicationEvent event) - { - // NOOP - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java deleted file mode 100644 index b5d0ce101e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Abstract capability implementation. - * - * @author Andy Hind - * @author Roy Wetherall - */ -public abstract class AbstractCapability extends RMSecurityCommon - implements Capability, RecordsManagementModel, RMPermissionModel -{ - /** Capability service */ - protected CapabilityService capabilityService; - - /** Capability name */ - protected String name; - - /** Capability title and description */ - protected String title; - protected String description; - - /** Capability group */ - protected Group group; - - /** Capability index */ - protected int index; - - /** Indicates whether this is a private capability or not */ - protected boolean isPrivate = false; - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * Init method - */ - public void init() - { - capabilityService.registerCapability(this); - } - - /** - * @param name capability name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getName() - */ - @Override - public String getName() - { - return name; - } - - /** - * @param title capability title - */ - public void setTitle(String title) - { - this.title = title; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getTitle() - */ - @Override - public String getTitle() - { - String title = this.title; - if (StringUtils.isBlank(title)) - { - title = I18NUtil.getMessage("capability." + getName() + ".title"); - if (StringUtils.isBlank(title)) - { - title = getName(); - } - - } - return title; - } - - /** - * @param description capability description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @param descriptionId message id - */ - public void setDescriptionId(String descriptionId) - { - this.description = I18NUtil.getMessage(descriptionId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getDescription() - */ - @Override - public String getDescription() - { - return description; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#isPrivate() - */ - public boolean isPrivate() - { - return isPrivate; - } - - /** - * @param isPrivate indicates whether the capability is private or not - */ - public void setPrivate(boolean isPrivate) - { - this.isPrivate = isPrivate; - } - - /** - * Translates the vote to an AccessStatus - * - * @param vote - * @return - */ - private AccessStatus translate(int vote) - { - switch (vote) - { - case AccessDecisionVoter.ACCESS_ABSTAIN: - return AccessStatus.UNDETERMINED; - case AccessDecisionVoter.ACCESS_GRANTED: - return AccessStatus.ALLOWED; - case AccessDecisionVoter.ACCESS_DENIED: - return AccessStatus.DENIED; - default: - return AccessStatus.UNDETERMINED; - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#hasPermission(org.alfresco.service.cmr.repository.NodeRef) - */ - public AccessStatus hasPermission(NodeRef nodeRef) - { - return translate(hasPermissionRaw(nodeRef)); - } - - /** - * Determines whether the current user has permission on this capability. - *

- * Returns the raw permission value. - * - * @param nodeRef node reference - * @return raw permission value - */ - public int hasPermissionRaw(NodeRef nodeRef) - { - String prefix = "hasPermissionRaw" + getName(); - int result = getTransactionCache(prefix, nodeRef); - if (result == NOSET_VALUE) - { - if (checkRmRead(nodeRef) == AccessDecisionVoter.ACCESS_DENIED) - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - result = hasPermissionImpl(nodeRef); - } - - result = setTransactionCache(prefix, nodeRef, result); - } - - // Log information about evaluated capability - RMMethodSecurityInterceptor.reportCapabilityStatus(getName(), result); - - return result; - } - - /** - * Default implementation. Override if different behaviour required. - * - * @param nodeRef - * @return - */ - protected int hasPermissionImpl(NodeRef nodeRef) - { - return evaluate(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef source, NodeRef target) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroup() - */ - public Group getGroup() - { - return this.group; - } - - public void setGroup(Group group) - { - this.group = group; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getIndex() - */ - public int getIndex() - { - return this.index; - } - - public void setIndex(int index) - { - this.index = index; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); - return result; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - final AbstractCapability other = (AbstractCapability) obj; - if (getName() == null) - { - if (other.getName() != null) - { - return false; - } - } - else if (!getName().equals(other.getName())) - { - return false; - } - return true; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java deleted file mode 100644 index b94b74774f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Capability Interface. - * - * @author andyh - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface Capability -{ - /** - * Does this capability apply to this nodeRef? - * @param nodeRef - * @return - */ - AccessStatus hasPermission(NodeRef nodeRef); - - /** - * - * @param nodeRef - * @return - */ - int hasPermissionRaw(NodeRef nodeRef); - - /** - * Evaluates the capability. - * - * @param nodeRef - * @return - */ - int evaluate(NodeRef nodeRef); - - /** - * Evaluates the capability, taking into account a target. - * - * @param source source node reference - * @param target target node reference - * @return int permission value - */ - int evaluate(NodeRef source, NodeRef target); - - /** - * Indicates whether this is a private capability or not. Private capabilities are used internally, otherwise - * they are made available to the user to assign to roles. - * - * @return boolean true if private, false otherwise - */ - boolean isPrivate(); - - /** - * Get the name of the capability - * - * @return String capability name - */ - String getName(); - - /** - * Get the title of the capability - * - * @return String capability title - */ - String getTitle(); - - /** - * Get the description of the capability - * - * @return String capability description - */ - String getDescription(); - - /** - * Gets the group of a capability - * - * @return Group capability group - */ - Group getGroup(); - - /** - * Gets the index of a capability - * - * @return int capability index - */ - int getIndex(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java deleted file mode 100644 index f712312a59..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Capability service implementation - * - * @author Roy Wetherall - * @since 2.0 - */ -@AlfrescoPublicApi -public interface CapabilityService -{ - /** - * Register a capability - * - * @param capability capability - */ - void registerCapability(Capability capability); - - /** - * Get a named capability. - * - * @param name capability name - * @return {@link Capability} capability or null if not found - */ - Capability getCapability(String name); - - /** - * Get a list of all the assignable capabilities. - * - * @return {@link Set}<{@link Capability}> set of all the assignable capabilities - */ - Set getCapabilities(); - - /** - * Get a list of all the capabilities, optionally including those that are non-assignable. - * - * @param includePrivate indicates that the private, or non-assignable capabilities are included in the result - * @return {@link Set}<{@link Capability}> set of capabilities - */ - Set getCapabilities(boolean includePrivate); - - /** - * Get all the capabilities access state based on the current user for the assignable capabilities. - * - * @param nodeRef node reference - * @return - */ - Map getCapabilitiesAccessState(NodeRef nodeRef); - - /** - * Get all the capabilities access state based on the current user. - * - * @param nodeRef node reference - * @return - */ - Map getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate); - - /** - * - * @param nodeRef - * @param capabilityNames - * @return - */ - Map getCapabilitiesAccessState(NodeRef nodeRef, List capabilityNames); - - /** - * Helper method to get the access state for a single capability. - * - * @param nodeRef - * @param capabilityName - * @return - */ - AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName); - - /** - * Gets the list of all the capability groups (in index order) - * - * @return {@link List}<{@link Group}> List of all the capability groups (in index order) - */ - List getGroups(); - - /** - * Gets a list of capabilities for the given group id - * - * @param groupId The id of a group for which the list of capabilities should be retrieved - * @return {@link List}<{@link Capability}> List of capabilities for the given group - */ - List getCapabilitiesByGroupId(String groupId); - - /** - * Get a list of capabilities for the given group - * - * @param group The group for which the list of capabilities should be retrieved - * @return {@link List}<{@link Capability}> List of capabilities for the given group - */ - List getCapabilitiesByGroup(Group group); - - /** - * Gets a group from it's id - * - * @param groupId The id of the group which should be retrieved - * @return Group The group with the id groupId - */ - Group getGroup(String groupId); - - /** - * Adds a group to the list of groups - * - * @param group The group which should be added - */ - void addGroup(Group group); - - /** - * Removes a group from the list of groups - * - * @param group The group which should be removed - */ - void removeGroup(Group group); - - /** - * Check if the current user has the given capability. - * - * @param capabilityName - * @return - */ - boolean hasCapability(NodeRef nodeRef, String capabilityName); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java deleted file mode 100644 index f44c027ef7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.util.ParameterCheck; - -/** - * @author Roy Wetherall - * @since 2.0 - */ -public class CapabilityServiceImpl implements CapabilityService -{ - /** Capabilities */ - private Map capabilities = new HashMap<>(57); - - /** Groups */ - private Map groups = new HashMap<>(13); - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapability(java.lang.String) - */ - @Override - public Capability getCapability(String name) - { - ParameterCheck.mandatoryString("name", name); - - return capabilities.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#registerCapability(org.alfresco.module.org_alfresco_module_rm.capability.Capability) - */ - @Override - public void registerCapability(Capability capability) - { - ParameterCheck.mandatory("capability", capability); - - capabilities.put(capability.getName(), capability); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities() - */ - @Override - public Set getCapabilities() - { - return getCapabilities(true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities(boolean) - */ - @Override - public Set getCapabilities(boolean includePrivate) - { - Set result = null; - if (includePrivate) - { - result = new HashSet<>(capabilities.values()); - } - else - { - result = new HashSet<>(capabilities.size()); - for (Capability capability : capabilities.values()) - { - if (!capability.isPrivate()) - { - result.add(capability); - } - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef) - */ - public Map getCapabilitiesAccessState(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return getCapabilitiesAccessState(nodeRef, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public Map getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Set listOfCapabilites = getCapabilities(includePrivate); - HashMap answer = new HashMap<>(); - for (Capability capability : listOfCapabilites) - { - AccessStatus status = capability.hasPermission(nodeRef); - if (answer.put(capability, status) != null) - { - throw new IllegalStateException(); - } - } - return answer; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, java.util.List) - */ - public Map getCapabilitiesAccessState(NodeRef nodeRef, List capabilityNames) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("capabilityNames", capabilityNames); - - HashMap answer = new HashMap<>(); - for (String capabilityName : capabilityNames) - { - Capability capability = capabilities.get(capabilityName); - if (capability != null) - { - AccessStatus status = capability.hasPermission(nodeRef); - if (answer.put(capability, status) != null) - { - throw new IllegalStateException(); - } - } - } - return answer; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilityAccessState(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("capabilityName", capabilityName); - - AccessStatus result = AccessStatus.UNDETERMINED; - Capability capability = getCapability(capabilityName); - if (capability != null) - { - List list = Collections.singletonList(capabilityName); - Map map = getCapabilitiesAccessState(nodeRef, list); - result = map.get(capability); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroups() - */ - @Override - public List getGroups() - { - List groups = new ArrayList<>(); - for (Map.Entry entry : this.groups.entrySet()) - { - groups.add(entry.getValue()); - } - - Collections.sort(groups, new Comparator() - { - @Override - public int compare(Group g1, Group g2) - { - return g1.getIndex() - g2.getIndex(); - } - }); - - return groups; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroupId(java.lang.String) - */ - @Override - public List getCapabilitiesByGroupId(String groupId) - { - ParameterCheck.mandatoryString("groupId", groupId); - - String id = this.groups.get(groupId).getId(); - - List capabilities = new ArrayList<>(); - for (Capability capability : getCapabilities()) - { - Group group = capability.getGroup(); - if (group != null && group.getId().equalsIgnoreCase(id)) - { - capabilities.add(capability); - } - } - - Collections.sort(capabilities, new Comparator() - { - @Override - public int compare(Capability c1, Capability c2) - { - return c1.getIndex() - c2.getIndex(); - } - }); - - return capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) - */ - @Override - public List getCapabilitiesByGroup(Group group) - { - ParameterCheck.mandatory("group", group); - - return getCapabilitiesByGroupId(group.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroup(java.lang.String) - */ - @Override - public Group getGroup(String groupId) - { - ParameterCheck.mandatoryString("groupId", groupId); - - return this.groups.get(groupId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#addGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) - */ - @Override - public void addGroup(Group group) - { - ParameterCheck.mandatory("group", group); - - groups.put(group.getId(), group); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#removeGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) - */ - @Override - public void removeGroup(Group group) - { - ParameterCheck.mandatory("group", group); - - groups.remove(group.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#hasCapability(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public boolean hasCapability(NodeRef nodeRef, String capabilityName) - { - Capability capability = getCapability(capabilityName); - if (capability != null) - { - AccessStatus accessStatus = getCapabilityAccessState(nodeRef, capabilityName); - - if (accessStatus.equals(AccessStatus.ALLOWED)) - { - return true; - } - } - - return false; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java deleted file mode 100644 index 7c542e40c3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import java.util.Set; - -/** - * Composite capability Interface. - * - * @author Roy Wetherall - * @since 2.2 - */ -public interface CompositeCapability extends Capability -{ - /** - * Get set of child capabilities. - * - * @return {@link Set}<{@link Capability} > set of child capabilities. - */ - Set getCapabilities(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java deleted file mode 100644 index 7938bf3ccb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Group interface - * - * @author Tuna Aksoy - * @since 2.1 - */ -@AlfrescoPublicApi -public interface Group -{ - /** - * Gets the id of a group (Get the id of the group) - * - * @return String the group id - */ - String getId(); - - /** - * Gets the title of a group - * - * @return String the group title - */ - String getTitle(); - - /** - * Gets the index of a group - * - * @return int the group index - */ - int getIndex(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java deleted file mode 100644 index 27364aad5a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Group implementation - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class GroupImpl implements Group -{ - /** The group id */ - private String id; - - /** The group title */ - private String title; - - /** The group index */ - private int index; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * Sets the capability service - * - * @param capabilityService the capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - public void init() - { - this.capabilityService.addGroup(this); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getId() - */ - @Override - public String getId() - { - return this.id; - } - - public void setId(String id) - { - this.id = id; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getTitle() - */ - @Override - public String getTitle() - { - String title = this.title; - if (StringUtils.isBlank(title)) - { - title = I18NUtil.getMessage("capability.group." + getId() + ".title"); - } - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getIndex() - */ - @Override - public int getIndex() - { - return this.index; - } - - public void setIndex(int index) - { - this.index = index; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java deleted file mode 100644 index ebe43c9768..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; - -/** - * @author Roy Wetherall - */ -public interface PolicyRegister -{ - void registerPolicy(Policy policy); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java deleted file mode 100644 index 3ce9b81e29..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.repo.action.RuntimeActionService; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.aop.framework.ProxyFactoryBean; - -/** - * RM action proxy factory bean. - * - * @author Roy Wetherall - */ -public class RMActionProxyFactoryBean extends ProxyFactoryBean -{ - private static final long serialVersionUID = 539749542853266449L; - - /** Runtime action service */ - protected RuntimeActionService runtimeActionService; - - /** Records management action service */ - protected RecordsManagementActionService recordsManagementActionService; - - /** Records management audit service */ - protected RecordsManagementAuditService recordsManagementAuditService; - - /** transaction service */ - private TransactionService transactionService; - - /** - * Set action service - * - * @param runtimeActionService - */ - public void setRuntimeActionService(RuntimeActionService runtimeActionService) - { - this.runtimeActionService = runtimeActionService; - } - - /** - * Set records management service - * - * @param recordsManagementActionService - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * Set records management service - * - * @param recordsManagementAuditService - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * @param transactionService transaction service - * @since 2.4.a - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Register the action - */ - public void registerAction() - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - RecordsManagementAction action = (RecordsManagementAction)getObject(); - recordsManagementActionService.register(action); - - return null; - } - }); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java deleted file mode 100644 index cf5c8d36b0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import static org.alfresco.service.cmr.search.SearchService.LANGUAGE_INDEX_SQL; - -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import net.sf.acegisecurity.AccessDeniedException; -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.ConfigAttributeDefinition; -import net.sf.acegisecurity.afterinvocation.AfterInvocationProvider; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.search.SimpleResultSetMetaData; -import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet; -import org.alfresco.repo.search.impl.querymodel.QueryEngineResults; -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.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.search.LimitBy; -import org.alfresco.service.cmr.search.PermissionEvaluationMode; -import org.alfresco.service.cmr.search.ResultSet; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; - -/** - * RM After Invocation Provider - */ -@SuppressWarnings("unused") -public class RMAfterInvocationProvider extends RMSecurityCommon - implements AfterInvocationProvider, InitializingBean -{ - private static Log logger = LogFactory.getLog(RMAfterInvocationProvider.class); - - private static final String AFTER_RM = "AFTER_RM"; - - private AuthenticationUtil authenticationUtil; - private int maxPermissionChecks; - private long maxPermissionCheckTimeMillis; - - public boolean supports(ConfigAttribute configAttribute) - { - String attribute = configAttribute.getAttribute(); - return (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM)); - } - - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) - { - return (MethodInvocation.class.isAssignableFrom(clazz)); - } - - public void afterPropertiesSet() - { - //Do nothing - } - - /** - * Default constructor - */ - public RMAfterInvocationProvider() - { - super(); - maxPermissionChecks = Integer.MAX_VALUE; - maxPermissionCheckTimeMillis = Long.MAX_VALUE; - } - - /** - * Set the max number of permission checks - * - * @param maxPermissionChecks - */ - public void setMaxPermissionChecks(int maxPermissionChecks) - { - this.maxPermissionChecks = maxPermissionChecks; - } - - /** - * Set the max time for permission checks - * - * @param maxPermissionCheckTimeMillis - */ - public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis) - { - this.maxPermissionCheckTimeMillis = maxPermissionCheckTimeMillis; - } - - /** - * Sets the authentication util - * - * @param authenticationUtil The authentication util to set - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - @SuppressWarnings("rawtypes") - public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object returnedObject) - { - if (logger.isDebugEnabled()) - { - MethodInvocation mi = (MethodInvocation) object; - if (mi == null) - { - logger.debug("Method is null."); - } - else - { - logger.debug("Method: " + mi.getMethod().toString()); - } - } - try - { - if (authenticationUtil.isRunAsUserTheSystemUser()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Allowing system user access"); - } - return returnedObject; - } - else if (returnedObject == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Allowing null object access"); - } - return null; - } - else if (PermissionCheckedValue.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (PermissionCheckedValue) returnedObject); - } - else if (PermissionCheckValue.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (PermissionCheckValue) returnedObject); - } - else if (StoreRef.class.isAssignableFrom(returnedObject.getClass())) - { - NodeRef rootNodeRef = decide(authentication, object, config, nodeService.getRootNode((StoreRef) returnedObject)); - if (rootNodeRef == null) - { - throw new AlfrescoRuntimeException("Root node reference of '" + returnedObject + "' is null."); - } - return rootNodeRef.getStoreRef(); - } - else if (NodeRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (NodeRef) returnedObject); - } - else if (ChildAssociationRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (ChildAssociationRef) returnedObject); - } - else if (AssociationRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (AssociationRef) returnedObject); - } - else if (PagingLuceneResultSet.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (PagingLuceneResultSet) returnedObject); - } - else if (ResultSet.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (ResultSet) returnedObject); - } - else if (QueryEngineResults.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (QueryEngineResults) returnedObject); - } - else if (Collection.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (Collection) returnedObject); - } - else if (returnedObject.getClass().isArray()) - { - return decide(authentication, object, config, (Object[]) returnedObject); - } - else - { - if (logger.isDebugEnabled() && object != null) - { - logger.debug("Uncontrolled object - access allowed for " + object.getClass().getName()); - } - return returnedObject; - } - } - catch (AccessDeniedException ade) - { - if (logger.isDebugEnabled()) - { - logger.debug("Access denied: " + ade.getMessage()); - } - throw ade; - } - catch (RuntimeException re) - { - if (logger.isDebugEnabled()) - { - logger.debug("Access denied by runtime exception: " + re.getMessage()); - } - throw re; - } - - } - - private PermissionCheckedValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckedValue returnedObject) - { - // This passes as it has already been filtered - // TODO: Get the filter that was applied and double-check - return returnedObject; - } - - private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject) - { - // Get the wrapped value - NodeRef nodeRef = returnedObject.getNodeRef(); - decide(authentication, object, config, nodeRef); - // This passes - return returnedObject; - } - - private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject) - { - if (returnedObject == null) - { - return null; - } - - if (isUnfiltered(returnedObject)) - { - return returnedObject; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - int parentResult = checkRead(nodeService.getPrimaryParent(returnedObject).getParentRef()); - int childResult = checkRead(returnedObject); - checkSupportedDefinitions(supportedDefinitions, parentResult, childResult); - - return returnedObject; - } - - private void checkSupportedDefinitions(List supportedDefinitions, int parentResult, int childResult) - { - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - if ((cad.parent && parentResult == AccessDecisionVoter.ACCESS_DENIED) - || (!cad.parent && childResult == AccessDecisionVoter.ACCESS_DENIED)) - { - throw new AccessDeniedException("Access Denied"); - } - } - } - - private boolean isUnfiltered(NodeRef nodeRef) - { - return !nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - - } - - @SuppressWarnings("rawtypes") - private List extractSupportedDefinitions(ConfigAttributeDefinition config) - { - List definitions = new ArrayList<>(); - Iterator iter = config.getConfigAttributes(); - - while (iter.hasNext()) - { - ConfigAttribute attr = (ConfigAttribute) iter.next(); - - if (this.supports(attr)) - { - definitions.add(new ConfigAttributeDefintion(attr)); - } - - } - return definitions; - } - - private ChildAssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ChildAssociationRef returnedObject) - { - if (returnedObject == null) - { - return null; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - int parentReadCheck = checkRead(returnedObject.getParentRef()); - int childReadCheck = checkRead(returnedObject.getChildRef()); - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - NodeRef testNodeRef = null; - - if (cad.parent) - { - testNodeRef = returnedObject.getParentRef(); - } - else - { - testNodeRef = returnedObject.getChildRef(); - } - - // Enforce Read Policy - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - if ((cad.parent && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED) - || (childReadCheck != AccessDecisionVoter.ACCESS_GRANTED)) - { - throw new AccessDeniedException("Access Denied"); - } - } - - return returnedObject; - } - - private AssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, AssociationRef returnedObject) - { - if (returnedObject == null) - { - return null; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - NodeRef testNodeRef = null; - - if (cad.parent) - { - testNodeRef = returnedObject.getSourceRef(); - } - else - { - testNodeRef = returnedObject.getTargetRef(); - } - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - if (checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED) - { - throw new AccessDeniedException("Access Denied"); - } - - } - - return returnedObject; - } - - private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PagingLuceneResultSet returnedObject) - { - ResultSet raw = ((FilteringResultSet) returnedObject.getWrapped()).getUnFilteredResultSet(); - ResultSet filteredForPermissions = decide(authentication, object, config, raw); - PagingLuceneResultSet plrs = new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService); - plrs.setTrimmedResultSet(true); - return plrs; - } - - private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) - { - if (returnedObject == null) - { - return null; - } - - // FIXME see: RM-6895 - if (returnedObject.getResultSetMetaData().getSearchParameters().getLanguage().equalsIgnoreCase(LANGUAGE_INDEX_SQL)) - { - return returnedObject; - } - - class RMFilteringResultSet extends FilteringResultSet - { - private long numberFound; - - public RMFilteringResultSet(ResultSet unfiltered, BitSet inclusionMask) - { - super(unfiltered, inclusionMask); - } - - @Override - public long getNumberFound() - { - return numberFound; - } - - private void setNumberFound(long numberFound) - { - this.numberFound = numberFound; - } - } - - BitSet inclusionMask = new BitSet(returnedObject.length()); - RMFilteringResultSet filteringResultSet = new RMFilteringResultSet(returnedObject, inclusionMask); - - List supportedDefinitions = extractSupportedDefinitions(config); - - Integer maxSize = null; - if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems() >= 0) - { - maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems()); - } - if ((maxSize == null) && (returnedObject.getResultSetMetaData().getSearchParameters().getLimitBy() == LimitBy.FINAL_SIZE)) - { - maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getLimit()); - } - // Allow for skip - if ((maxSize != null) && (returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount() >= 0)) - { - maxSize = Integer.valueOf(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount()); - } - - if (supportedDefinitions.size() == 0) - { - if (maxSize == null) - { - return returnedObject; - } - else if (returnedObject.length() > maxSize.intValue()) - { - for (int i = 0; i < maxSize.intValue(); i++) - { - inclusionMask.set(i, true); - } - filteringResultSet.setResultSetMetaData( - new SimpleResultSetMetaData( - returnedObject.getResultSetMetaData().getLimitedBy(), - PermissionEvaluationMode.EAGER, - returnedObject.getResultSetMetaData().getSearchParameters())); - filteringResultSet.setNumberFound(returnedObject.getNumberFound()); - return filteringResultSet; - } - else - { - for (int i = 0; i < returnedObject.length(); i++) - { - inclusionMask.set(i, true); - } - filteringResultSet.setResultSetMetaData( - new SimpleResultSetMetaData( - returnedObject.getResultSetMetaData().getLimitedBy(), - PermissionEvaluationMode.EAGER, - returnedObject.getResultSetMetaData().getSearchParameters())); - filteringResultSet.setNumberFound(returnedObject.getNumberFound()); - return filteringResultSet; - } - } - - // record the start time - long startTimeMillis = System.currentTimeMillis(); - - // set the default, unlimited resultset type - filteringResultSet.setResultSetMetaData( - new SimpleResultSetMetaData( - returnedObject.getResultSetMetaData().getLimitedBy(), - PermissionEvaluationMode.EAGER, - returnedObject.getResultSetMetaData().getSearchParameters())); - - for (int i = 0; i < returnedObject.length(); i++) - { - long currentTimeMillis = System.currentTimeMillis(); - - // All permission checks must pass - inclusionMask.set(i, true); - - if (!nodeService.exists(returnedObject.getNodeRef(i))) - { - inclusionMask.set(i, false); - } - else - { - int parentCheckRead = checkRead(returnedObject.getChildAssocRef(i).getParentRef()); - int childCheckRead = checkRead(returnedObject.getNodeRef(i)); - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - NodeRef testNodeRef = returnedObject.getNodeRef(i); - int checkRead = childCheckRead; - if (cad.parent) - { - testNodeRef = returnedObject.getChildAssocRef(i).getParentRef(); - checkRead = parentCheckRead; - } - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - if (inclusionMask.get(i) && (testNodeRef != null) && (checkRead != AccessDecisionVoter.ACCESS_GRANTED)) - { - inclusionMask.set(i, false); - } - } - } - - // Bug out if we are limiting by size - if ((maxSize != null) && (filteringResultSet.length() > maxSize.intValue())) - { - // Remove the last match to fix the correct size - inclusionMask.set(i, false); - filteringResultSet.setResultSetMetaData(new SimpleResultSetMetaData(LimitBy.FINAL_SIZE, PermissionEvaluationMode.EAGER, returnedObject.getResultSetMetaData() - .getSearchParameters())); - break; - } - } - - if (maxSize != null) - { - LimitBy limitBy = returnedObject.length() > maxSize ? LimitBy.FINAL_SIZE : LimitBy.UNLIMITED; - filteringResultSet.setResultSetMetaData(new SimpleResultSetMetaData(limitBy, - PermissionEvaluationMode.EAGER, returnedObject.getResultSetMetaData().getSearchParameters())); - } - - filteringResultSet.setNumberFound(returnedObject.getNumberFound()); - - return filteringResultSet; - } - - private QueryEngineResults decide(Authentication authentication, Object object, ConfigAttributeDefinition config, QueryEngineResults returnedObject) - { - Map, ResultSet> map = returnedObject.getResults(); - Map, ResultSet> answer = new HashMap<>(map.size(), 1.0f); - - for (Map.Entry, ResultSet> entry : map.entrySet()) - { - ResultSet raw = entry.getValue(); - ResultSet permed; - if (PagingLuceneResultSet.class.isAssignableFrom(raw.getClass())) - { - permed = decide(authentication, object, config, (PagingLuceneResultSet) raw); - } - else - { - permed = decide(authentication, object, config, raw); - } - answer.put(entry.getKey(), permed); - } - - return new QueryEngineResults(answer); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private Collection decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Collection returnedObject) - { - if (returnedObject == null) - { - return null; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - if (logger.isDebugEnabled()) - { - logger.debug("Entries are " + supportedDefinitions); - } - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - // Default to the system-wide values and we'll see if they need to be reduced - long targetResultCount = returnedObject.size(); - int maxPermissionChecks = Integer.MAX_VALUE; - long maxPermissionCheckTimeMillis = this.maxPermissionCheckTimeMillis; - if (returnedObject instanceof PermissionCheckCollection) - { - PermissionCheckCollection permissionCheckCollection = (PermissionCheckCollection) returnedObject; - // Get values - targetResultCount = permissionCheckCollection.getTargetResultCount(); - if (permissionCheckCollection.getCutOffAfterCount() > 0) - { - maxPermissionChecks = permissionCheckCollection.getCutOffAfterCount(); - } - if (permissionCheckCollection.getCutOffAfterTimeMs() > 0) - { - maxPermissionCheckTimeMillis = permissionCheckCollection.getCutOffAfterTimeMs(); - } - } - - // Start timer and counter for cut-off - boolean cutoff = false; - long startTimeMillis = System.currentTimeMillis(); - int count = 0; - - // Keep values explicitly - List keepValues = new ArrayList<>(returnedObject.size()); - - for (Object nextObject : returnedObject) - { - // if the maximum result size or time has been exceeded, then we have to remove only - long currentTimeMillis = System.currentTimeMillis(); - - // NOTE: for reference - the "maxPermissionChecks" has never been honoured by this loop (since previously the count was not being incremented) - if (count >= targetResultCount) - { - // We have enough results. We stop without cutoff. - break; - } - else if (count >= maxPermissionChecks) - { - // We have been cut off by count - cutoff = true; - if (logger.isDebugEnabled()) - { - logger.debug("decide (collection) cut-off: " + count + " checks exceeded " + maxPermissionChecks + " checks"); - } - break; - } - else if ((currentTimeMillis - startTimeMillis) > maxPermissionCheckTimeMillis) - { - // We have been cut off by time - cutoff = true; - if (logger.isDebugEnabled()) - { - logger.debug("decide (collection) cut-off: " + (currentTimeMillis - startTimeMillis) + "ms exceeded " + maxPermissionCheckTimeMillis + "ms"); - } - break; - } - - boolean allowed = true; - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - if (cad.mode.equalsIgnoreCase("FilterNode")) - { - NodeRef testNodeRef = null; - if (cad.parent) - { - if (StoreRef.class.isAssignableFrom(nextObject.getClass())) - { - // Will be allowed - testNodeRef = null; - } - else if (NodeRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = nodeService.getPrimaryParent((NodeRef) nextObject).getParentRef(); - } - else if (ChildAssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((ChildAssociationRef) nextObject).getParentRef(); - } - else if (AssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((AssociationRef) nextObject).getSourceRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(nextObject.getClass())) - { - NodeRef nodeRef = ((PermissionCheckValue) nextObject).getNodeRef(); - testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + nextObject.getClass()); - } - } - else - { - if (StoreRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = nodeService.getRootNode((StoreRef) nextObject); - } - else if (NodeRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = (NodeRef) nextObject; - } - else if (ChildAssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((ChildAssociationRef) nextObject).getChildRef(); - } - else if (AssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((AssociationRef) nextObject).getTargetRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((PermissionCheckValue) nextObject).getNodeRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + nextObject.getClass()); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("\t" + cad.typeString + " test on " + testNodeRef + " from " + nextObject.getClass().getName()); - } - - // Null allows - if (isUnfiltered(testNodeRef)) - { - // Continue to next ConfigAttributeDefintion - continue; - } - - if (allowed && - testNodeRef != null && - checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED) - { - allowed = false; - // No point evaluating more ConfigAttributeDefintions - break; - } - } - } - - // Failure or success, increase the count - count++; - - if (allowed) - { - keepValues.add(nextObject); - } - } - // Work out how many were left unchecked (for whatever reason) - int sizeOriginal = returnedObject.size(); - int checksRemaining = sizeOriginal - count; - // Note: There are use-cases where unmodifiable collections are passing through. - // So make sure that the collection needs modification at all - if (keepValues.size() < sizeOriginal) - { - // There are values that need to be removed. We have to modify the collection. - try - { - returnedObject.clear(); - returnedObject.addAll(keepValues); - } - catch (UnsupportedOperationException e) - { - throw new AccessDeniedException("Permission-checked list must be modifiable", e); - } - } - - // Attach the extra permission-check data to the collection - return PermissionCheckedCollectionMixin.create(returnedObject, cutoff, checksRemaining, sizeOriginal); - } - - private Object[] decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object[] returnedObject) - { - // Assumption: value is not null - BitSet incudedSet = new BitSet(returnedObject.length); - - List supportedDefinitions = extractSupportedDefinitions(config); - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - for (int i = 0, l = returnedObject.length; i < l; i++) - { - Object current = returnedObject[i]; - - int parentReadCheck = checkRead(getParentReadCheckNode(current)); - int childReadChek = checkRead(getChildReadCheckNode(current)); - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - incudedSet.set(i, true); - NodeRef testNodeRef = null; - if (cad.parent) - { - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = null; - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getPrimaryParent((NodeRef) current).getParentRef(); - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getParentRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - NodeRef nodeRef = ((PermissionCheckValue) current).getNodeRef(); - testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + current.getClass()); - } - } - else - { - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getRootNode((StoreRef) current); - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = (NodeRef) current; - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getChildRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((PermissionCheckValue) current).getNodeRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + current.getClass()); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("\t" + cad.typeString + " test on " + testNodeRef + " from " + current.getClass().getName()); - } - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - int readCheck = childReadChek; - if (cad.parent) - { - readCheck = parentReadCheck; - } - - if (incudedSet.get(i) && (testNodeRef != null) && (readCheck != AccessDecisionVoter.ACCESS_GRANTED)) - { - incudedSet.set(i, false); - } - - } - } - - if (incudedSet.cardinality() == returnedObject.length) - { - return returnedObject; - } - else - { - Object[] answer = new Object[incudedSet.cardinality()]; - for (int i = incudedSet.nextSetBit(0), p = 0; i >= 0; i = incudedSet.nextSetBit(++i), p++) - { - answer[p] = returnedObject[i]; - } - return answer; - } - } - - private NodeRef getParentReadCheckNode(Object current) - { - NodeRef testNodeRef = null; - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = null; - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getPrimaryParent((NodeRef) current).getParentRef(); - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getParentRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - NodeRef nodeRef = ((PermissionCheckValue) current).getNodeRef(); - testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - } - else - { - throw new ACLEntryVoterException("The specified array is not of NodeRef or ChildAssociationRef"); - } - return testNodeRef; - } - - private NodeRef getChildReadCheckNode(Object current) - { - NodeRef testNodeRef = null; - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getRootNode((StoreRef) current); - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = (NodeRef) current; - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getChildRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((PermissionCheckValue) current).getNodeRef(); - } - else - { - throw new ACLEntryVoterException("The specified array is not of NodeRef or ChildAssociationRef"); - } - return testNodeRef; - } - - private class ConfigAttributeDefintion - { - - String typeString; - - String mode; - - boolean parent = false; - - ConfigAttributeDefintion(ConfigAttribute attr) - { - - StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false); - typeString = st.nextToken(); - if (!(typeString.equals(AFTER_RM))) - { - throw new ACLEntryVoterException("Invalid type: must be AFTER_RM"); - } - mode = st.nextToken(); - - if (st.hasMoreElements()) - { - parent = true; - } - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java deleted file mode 100644 index bfddcf6986..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java +++ /dev/null @@ -1,422 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -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.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespacePrefixResolver; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; - -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Records managment entry voter. - * - * @author Roy Wetherall, Andy Hind - */ -public class RMEntryVoter extends RMSecurityCommon - implements AccessDecisionVoter, InitializingBean, PolicyRegister -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RMEntryVoter.class); - - /** Namespace resolver */ - private NamespacePrefixResolver nspr; - - /** 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<>(); - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param nspr namespace prefix resolver - */ - public void setNamespacePrefixResolver(NamespacePrefixResolver nspr) - { - 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 - * - * @param policy policy - */ - public void registerPolicy(Policy policy) - { - policies.put(policy.getName(), policy); - } - - /** - * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(net.sf.acegisecurity.ConfigAttribute) - */ - @Override - public boolean supports(ConfigAttribute configAttribute) - { - boolean supports = false; - String attribute = configAttribute.getAttribute(); - if (StringUtils.isNotBlank(attribute) && - (attribute.equals(ConfigAttributeDefinition.RM_ABSTAIN) || - attribute.equals(ConfigAttributeDefinition.RM_QUERY) || - attribute.equals(ConfigAttributeDefinition.RM_ALLOW) || - attribute.equals(ConfigAttributeDefinition.RM_DENY) || - attribute.startsWith(ConfigAttributeDefinition.RM_CAP) || - attribute.startsWith(ConfigAttributeDefinition.RM))) - { - supports = true; - } - return supports; - } - - /** - * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(java.lang.Class) - */ - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) - { - return (MethodInvocation.class.isAssignableFrom(clazz)); - } - - /** - * @see net.sf.acegisecurity.vote.AccessDecisionVoter#vote(net.sf.acegisecurity.Authentication, java.lang.Object, net.sf.acegisecurity.ConfigAttributeDefinition) - */ - @SuppressWarnings("rawtypes") - public int vote(Authentication authentication, Object object, net.sf.acegisecurity.ConfigAttributeDefinition config) - { - // logging - RMMethodSecurityInterceptor.isRMSecurityChecked(true); - - MethodInvocation mi = (MethodInvocation)object; - - if (transactionalResourceHelper.isResourcePresent("voting")) - { - if (logger.isDebugEnabled()) - { - logger.debug(" .. grant access already voting: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); - } - return AccessDecisionVoter.ACCESS_GRANTED; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Method: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); - } - - alfrescoTransactionSupport.bindResource("voting", true); - try - { - // The system user can do anything - if (authenticationUtil.isRunAsUserTheSystemUser()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Access granted for the system user"); - } - return AccessDecisionVoter.ACCESS_GRANTED; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - - // No RM definitions so we do not vote - if (supportedDefinitions.size() == 0) - { - 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(); - - // If there are only capability (RM_CAP) and policy (RM) entries non must deny - // If any abstain we deny - // All present must vote to allow unless an explicit direction comes first (e.g. RM_ALLOW) - - for (ConfigAttributeDefinition cad : supportedDefinitions) - { - // Whatever is found first takes precedence - if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_DENY)) - { - // log message - RMMethodSecurityInterceptor.addMessage("RM_DENY: check that a security policy has been set for this method"); - - return AccessDecisionVoter.ACCESS_DENIED; - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ABSTAIN)) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ALLOW)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - // RM_QUERY is a special case - the entry is allowed and filtering sorts out the results - // It is distinguished from RM_ALLOW so query may have additional behaviour in the future - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_QUERY)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - // Ignore config that references method arguments that do not exist - // Arguably we should deny here but that requires a full impact analysis - // These entries effectively abstain - else if (((cad.getParameters().get(0) != null) && (cad.getParameters().get(0) >= invocation.getArguments().length)) || - ((cad.getParameters().get(1) != null) && (cad.getParameters().get(1) >= invocation.getArguments().length))) - { - continue; - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_CAP)) - { - switch (checkCapability(invocation, params, cad)) - { - case AccessDecisionVoter.ACCESS_DENIED: - { - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_ABSTAIN: - { - if (logger.isDebugEnabled()) - { - if (logger.isTraceEnabled()) - { - logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException()); - } - else - { - logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod()); - } - } - // abstain denies - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_GRANTED: - { - break; - } - default: - { - //do nothing - } - } - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM)) - { - switch (checkPolicy(invocation, params, cad)) - { - case AccessDecisionVoter.ACCESS_DENIED: - { - // log message - RMMethodSecurityInterceptor.addMessage("Policy " + cad.getPolicyName() + " denied."); - - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_ABSTAIN: - { - if (logger.isDebugEnabled()) - { - if (logger.isTraceEnabled()) - { - logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException()); - } - else - { - logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod()); - } - } - // abstain denies - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_GRANTED: - { - break; - } - default: - { - //do nothing - } - } - } - } - } - finally - { - alfrescoTransactionSupport.unbindResource("voting"); - } - - // all voted to allow - return AccessDecisionVoter.ACCESS_GRANTED; - } - - /** - * Check the capability - * - * @param invocation method invocation - * @param params parameters - * @param cad config definition - * @return int evaluation result - */ - @SuppressWarnings("rawtypes") - private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) - { - NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - if (testNodeRef == null) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - 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 capability.hasPermissionRaw(testNodeRef); - - } - - /** - * Evaluate policy to determine access - * - * @param invocation invocation information - * @param params parameters - * @param cad configuration attribute definition - * @return int policy evaluation - */ - @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."); - } - else - { - // evaluate the policy - return policy.evaluate(invocation, params, cad); - } - } - - /** - * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() - */ - public void afterPropertiesSet() - { - //Do nothing - } - - /** - * - * @param config - * @return - */ - @SuppressWarnings("rawtypes") - private List extractSupportedDefinitions(net.sf.acegisecurity.ConfigAttributeDefinition config) - { - List definitions = new ArrayList<>(2); - Iterator iter = config.getConfigAttributes(); - - while (iter.hasNext()) - { - ConfigAttribute attr = (ConfigAttribute) iter.next(); - - if (this.supports(attr)) - { - definitions.add(new ConfigAttributeDefinition(attr, nspr)); - } - - } - return definitions; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java deleted file mode 100644 index a2b5fe2fbf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; - -/** - * Capability constants for the RM Permission Model - * - * @author andyh - */ -public interface RMPermissionModel -{ - // Assignment of Filing - String FILING = "Filing"; - String READ_RECORDS = "ReadRecords"; - String FILE_RECORDS = "FileRecords"; - - // Roles - /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService#ROLE_USER} instead - */ - @Deprecated - 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; - /** - * @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; - /** - * @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; - /** - * @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(); - - // 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"; -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java deleted file mode 100644 index 58c8e64533..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import java.util.Map; - -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; -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.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.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.Pair; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - - -/** - * Common security functions. - * - * TODO move methods to the appropriate services - * - * @author Roy Wetherall - * @since 2.0 - */ -public class RMSecurityCommon implements ApplicationContextAware -{ - /** No set value */ - protected static final int NOSET_VALUE = -100; - - /** Logger */ - private static Log logger = LogFactory.getLog(RMSecurityCommon.class); - - /** Services */ - //This is the internal NodeService -- no permission checks - protected NodeService nodeService; - protected PermissionService permissionService; - protected RMCaveatConfigComponent caveatConfigComponent; - private FilePlanService filePlanService; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param caveatConfigComponent caveat config service - */ - public void setCaveatConfigComponent(RMCaveatConfigComponent caveatConfigComponent) - { - this.caveatConfigComponent = caveatConfigComponent; - } - - /** - * @return FilePlanService file plan service - */ - protected FilePlanService getFilePlanService() - { - if (filePlanService == null) - { - filePlanService = (FilePlanService)applicationContext.getBean("filePlanService"); - } - return filePlanService; - } - - /** - * Sets a value into the transaction cache - * - * @param prefix - * @param nodeRef - * @param value - * @return - */ - protected int setTransactionCache(String prefix, NodeRef nodeRef, int value) - { - String user = AuthenticationUtil.getRunAsUser(); - AlfrescoTransactionSupport.bindResource(prefix + nodeRef.toString() + user, Integer.valueOf(value)); - return value; - } - - /** - * Gets a value from the transaction cache - * - * @param prefix - * @param nodeRef - * @return - */ - protected int getTransactionCache(String prefix, NodeRef nodeRef) - { - int result = NOSET_VALUE; - StringBuffer key = new StringBuffer(prefix) - .append(nodeRef) - .append(AuthenticationUtil.getRunAsUser()); - - Integer value = (Integer)AlfrescoTransactionSupport.getResource(key); - if (value != null) - { - result = value.intValue(); - } - return result; - } - - /** - * Check for RM read - * - * @param nodeRef - * @return - */ - public int checkRead(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - if (nodeRef != null) - { - // now we know the node - we can abstain for certain types and aspects (eg, rm) - result = checkRead(nodeRef, false); - } - - return result; - } - - /** - * Check for RM read - * - * @param nodeRef - * @param allowDMRead - * @return - */ - public int checkRead(NodeRef nodeRef, boolean allowDMRead) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - result = checkRmRead(nodeRef); - } - else if (allowDMRead) - { - // Check DM read for copy etc - // DM does not grant - it can only deny - if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED) - { - if (logger.isDebugEnabled()) - { - logger.debug("\t\tPermission is denied"); - Thread.dumpStack(); - } - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - result = AccessDecisionVoter.ACCESS_GRANTED; - } - } - - return result; - } - - /** - * Core RM read check - * - * @param nodeRef node reference - * @return int see {@link AccessDecisionVoter} - */ - public int checkRmRead(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - Map, Integer> transactionCache = TransactionalResourceHelper.getMap("rm.security.checkRMRead"); - Pair key = new Pair<>(AuthenticationUtil.getRunAsUser(), nodeRef); - - if (transactionCache.containsKey(key)) - { - result = transactionCache.get(key); - } - else - { - if (permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS) == AccessStatus.DENIED) - { - if (logger.isDebugEnabled()) - { - logger.debug("\t\tUser does not have read record permission on node, access denied. (nodeRef=" + nodeRef.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")"); - } - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - // Get the file plan for the node - NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - if (filePlan != null && - hasViewCapability(filePlan) == AccessStatus.DENIED) - { - if (logger.isDebugEnabled()) - { - logger.debug("\t\tUser does not have view records capability permission on node, access denied. (filePlan=" + filePlan.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")"); - } - result = AccessDecisionVoter.ACCESS_DENIED; - } - else if (!caveatConfigComponent.hasAccess(nodeRef)) - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - result = AccessDecisionVoter.ACCESS_GRANTED; - } - } - - // cache result - transactionCache.put(key, result); - } - - return result; - } - - /** - * Helper method to determine whether the current user has view capability on the file plan - * - * @param filePlan file plan - * @return {@link AccessStatus} - */ - private AccessStatus hasViewCapability(NodeRef filePlan) - { - Map, AccessStatus> transactionCache = TransactionalResourceHelper.getMap("rm.security.hasViewCapability"); - Pair key = new Pair<>(AuthenticationUtil.getRunAsUser(), filePlan); - - if (transactionCache.containsKey(key)) - { - return transactionCache.get(key); - } - else - { - AccessStatus result = permissionService.hasPermission(filePlan, ViewRecordsCapability.NAME); - transactionCache.put(key, result); - return result; - } - } - - @SuppressWarnings("rawtypes") - protected NodeRef getTestNode(MethodInvocation invocation, Class[] params, int position, boolean parent) - { - NodeRef testNodeRef = null; - if (position < 0) - { - if (logger.isDebugEnabled()) - { - logger.debug("\tNothing to test permission against."); - } - testNodeRef = null; - } - else if (StoreRef.class.isAssignableFrom(params[position])) - { - if (invocation.getArguments()[position] != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("\tPermission test against the store - using permissions on the root node"); - } - StoreRef storeRef = (StoreRef) invocation.getArguments()[position]; - if (nodeService.exists(storeRef)) - { - testNodeRef = nodeService.getRootNode(storeRef); - } - } - } - else if (NodeRef.class.isAssignableFrom(params[position])) - { - testNodeRef = (NodeRef) invocation.getArguments()[position]; - if (parent) - { - testNodeRef = nodeService.getPrimaryParent(testNodeRef).getParentRef(); - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test for parent on non-existing node " + testNodeRef); - } - logger.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef)); - } - } - else - { - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test on non-existing node " + testNodeRef); - } - } - } - } - else if (ChildAssociationRef.class.isAssignableFrom(params[position])) - { - if (invocation.getArguments()[position] != null) - { - if (parent) - { - testNodeRef = ((ChildAssociationRef) invocation.getArguments()[position]).getParentRef(); - } - else - { - testNodeRef = ((ChildAssociationRef) invocation.getArguments()[position]).getChildRef(); - } - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test on non-existing node " + testNodeRef); - } - } - } - } - else if (AssociationRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - if (parent) - { - testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getSourceRef(); - } - else - { - testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getTargetRef(); - } - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test on non-existing node " + testNodeRef); - } - } - } - return testNodeRef; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java deleted file mode 100644 index 1d22c0d40c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative; - -import java.util.Map; - -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; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Abstract capability condition. - * - * @author Roy Wetherall - */ -public abstract class AbstractCapabilityCondition implements CapabilityCondition, - BeanNameAware, - RecordsManagementModel -{ - /** transaction cache key */ - private static final String KEY_EVALUATE = "rm.transaction.evaluate"; - - /** Capability condition name */ - protected String name; - - /** Services */ - protected RecordService recordService; - protected PermissionService permissionService; - protected NodeService nodeService; - protected FreezeService freezeService; - protected FilePlanService filePlanService; - protected DispositionService dispositionService; - protected RecordFolderService recordFolderService; - - /** transaction resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - 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() - */ - @Override - public String getName() - { - return name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluate(NodeRef nodeRef) - { - boolean result = false; - - // check transaction cache - Map map = transactionalResourceHelper.getMap(KEY_EVALUATE); - String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); - if (map.containsKey(key)) - { - result = map.get(key); - } - else - { - result = evaluateImpl(nodeRef); - map.put(key, result); - } - - return result; - } - - public abstract boolean evaluateImpl(NodeRef nodeRef); - - /** - * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java deleted file mode 100644 index d941d257b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Capability condition. - * - * @author Roy Wetherall - * @since 2.0 - */ -public interface CapabilityCondition -{ - /** - * Get capability condition name - * - * @return {@link String} capability condition name - */ - String getName(); - - /** - * Evaluates capability condition. - * - * @param nodeRef node reference - * @return boolean true if evaluate success, false otherwise - */ - boolean evaluate(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java deleted file mode 100644 index 0bfe2c4e3e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java +++ /dev/null @@ -1,399 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; -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.security.AccessStatus; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Declarative capability implementation. - * - * @author Roy Wetherall - */ -public class DeclarativeCapability extends AbstractCapability -{ - /** Logger */ - protected static final Log LOGGER = LogFactory.getLog(DeclarativeCapability.class); - - /** Required permissions */ - protected List permissions; - - /** Map of conditions and expected evaluation result */ - protected Map conditions; - - /** List of file plan component kinds one of which must be satisfied */ - protected List kinds; - - /** Capability to be evaluated against the target node reference */ - protected Capability targetCapability; - - /** Indicates whether to return an undetermined result */ - protected boolean isUndetermined = false; - - /** List of available kinds */ - private Set availableKinds; - - /** - * @param permissions permissions - */ - public void setPermissions(List permissions) - { - this.permissions = permissions; - } - - /** - * @param conditions conditions and expected values - */ - public void setConditions(Map conditions) - { - this.conditions = conditions; - } - - /** - * @return {@link Map} <String, Boolean > conditions and expected values - */ - public Map getConditions() - { - return conditions; - } - - /** - * @param kinds list of file plan component kinds - */ - public void setKinds(List kinds) - { - this.kinds = kinds; - } - - /** - * @return {@link List} <@link String > list of expected file plan component kinds - */ - public List getKinds() - { - return kinds; - } - - /** - * Helper method to set a single kind. - * - * @param kind file plan component kind - */ - public void setKind(String kind) - { - this.kinds = Collections.singletonList(kind); - } - - /** - * Sets whether the capability will return an undetermined result when evaluating permissions - * for a single node reference or not. The default is to return grant. - * - * @param isUndetermined true if undetermined result, false otherwise - */ - public void setUndetermined(boolean isUndetermined) - { - this.isUndetermined = isUndetermined; - } - - /** - * @return - */ - public boolean isUndetermined() - { - return isUndetermined; - } - - /** - * Helper @see #setPermissions(List) - * - * @param permission permission - */ - public void setPermission(String permission) - { - List permissions = new ArrayList<>(1); - permissions.add(permission); - this.permissions = permissions; - } - - /** - * @param targetCapability target capability - */ - public void setTargetCapability(Capability targetCapability) - { - this.targetCapability = targetCapability; - } - - /** - * Check the permissions passed. - * - * @param nodeRef node reference - * @return boolean true if the permissions are present, false otherwise - */ - protected boolean checkPermissionsImpl(NodeRef nodeRef, String ... permissions) - { - boolean result = true; - NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - - if(filePlan == null) - { - return result; - } - - for (String permission : permissions) - { - if (permissionService.hasPermission(filePlan, permission) != AccessStatus.ALLOWED) - { - result = false; - break; - } - } - - return result; - } - - /** - * Checks the permissions required for the capability. - * - * @param nodeRef - * @return - */ - protected boolean checkPermissions(NodeRef nodeRef) - { - boolean result = true; - if (permissions != null && !permissions.isEmpty()) - { - result = checkPermissionsImpl(nodeRef, (String[])permissions.toArray(new String[permissions.size()])); - } - return result; - } - - /** - * Checks the passed conditions. - * - * @param nodeRef - * @return - */ - protected boolean checkConditions(NodeRef nodeRef, Map conditions) - { - boolean result = true; - if (conditions != null) - { - for (Map.Entry entry : conditions.entrySet()) - { - boolean expected = entry.getValue().booleanValue(); - String conditionName = entry.getKey(); - - CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(conditionName); - if (condition == null) - { - throw new AlfrescoRuntimeException("Capability condition " + conditionName + " does not exist. Check the configuration of the capability " + name + "."); - } - - // determine the actual value - boolean actual = condition.evaluate(nodeRef); - - // report information about condition (for exception reporting) - RMMethodSecurityInterceptor.reportCapabilityCondition(getName(), condition.getName(), expected, actual); - - if (expected != actual) - { - result = false; - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("FAIL: Condition " + condition.getName() + " failed for capability " + getName() + " on nodeRef " + nodeRef.toString()); - } - - break; - } - } - } - return result; - } - - /** - * Checks the set conditions. - * - * @param nodeRef node reference - * @return boolean true if conditions satisfied, false otherwise - */ - protected boolean checkConditions(NodeRef nodeRef) - { - return checkConditions(nodeRef, conditions); - } - - /** - * Get list of available kinds - * - * @return list of available kinds - */ - - private Set getAvailableKinds() - { - if (kinds != null && availableKinds == null) - { - availableKinds = new HashSet<>(kinds.size()); - for (String kindString : kinds) - { - FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString); - availableKinds.add(kind); - } - } - - return availableKinds; - } - - /** - * Checks that the node ref is of the expected kind - * - * @param nodeRef - * @return - */ - protected boolean checkKinds(NodeRef nodeRef) - { - boolean result = false; - - FilePlanComponentKind actualKind = getFilePlanService().getFilePlanComponentKind(nodeRef); - - if (actualKind != null) - { - Set availableKinds = getAvailableKinds(); - if (availableKinds == null || availableKinds.contains(actualKind)) - { - result = true; - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - // check transaction cache - Map map = TransactionalResourceHelper.getMap("rm.declarativeCapability"); - String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); - if (map.containsKey(key)) - { - result = map.get(key); - } - else - { - // Check we are dealing with a file plan component - if (getFilePlanService().isFilePlanComponent(nodeRef)) - { - // Check the kind of the object, the permissions and the conditions - if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef)) - { - // Opportunity for child implementations to extend - result = evaluateImpl(nodeRef); - } - else - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - } - - // Last chance for child implementations to veto/change the result - result = onEvaluate(nodeRef, result); - - // log access denied to help with debug - if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result) - { - LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString()); - } - - map.put(key, result); - } - - return result; - } - - @Override - public int evaluate(NodeRef source, NodeRef target) - { - int result = evaluate(source); - if (targetCapability != null && result != AccessDecisionVoter.ACCESS_DENIED) - { - result = targetCapability.evaluate(target); - } - return result; - } - - /** - * Default implementation. Given extending classes a hook point for further checks. - * - * @param nodeRef node reference - * @return - */ - protected int evaluateImpl(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_GRANTED; - if (isUndetermined) - { - result = AccessDecisionVoter.ACCESS_ABSTAIN; - } - return result; - } - - /** - * Default implementation. - * - * Called before evaluate completes. The result returned overwrites the already discovered result. - * Provides a hook point for child implementations that wish to veto the result. - * - * @param nodeRef - * @param result - * @return - */ - protected int onEvaluate(NodeRef nodeRef, int result) - { - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java deleted file mode 100644 index ad3c7d8bb1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Generic implementation of a composite capability - * - * @author Roy Wetherall - */ -public class DeclarativeCompositeCapability extends DeclarativeCapability - implements CompositeCapability -{ - /** set of capabilities */ - private Set capabilities; - - /** - * @param capabilities set of capabilities - */ - public void setCapabilities(Set capabilities) - { - this.capabilities = capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability#getCapabilities() - */ - @Override - public Set getCapabilities() - { - return this.capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluateImpl(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_DENIED; - - // Check each capability using 'OR' logic - for (Capability capability : capabilities) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Evaluating child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name); - } - - int capabilityResult = capability.evaluate(nodeRef); - if (capabilityResult != AccessDecisionVoter.ACCESS_DENIED) - { - result = AccessDecisionVoter.ACCESS_ABSTAIN; - if (!isUndetermined() && capabilityResult == AccessDecisionVoter.ACCESS_GRANTED) - { - result = AccessDecisionVoter.ACCESS_GRANTED; - } - break; - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Access denied for child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name); - } - } - } - - return result; - } - - /** - * If a target capability is specified then we evaluate that. Otherwise we combine the results of the provided capabilities. - * - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef source, NodeRef target) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - // Check we are dealing with a file plan component - if (getFilePlanService().isFilePlanComponent(source) && - getFilePlanService().isFilePlanComponent(target)) - { - // Check the kind of the object, the permissions and the conditions - if (checkKinds(source) && checkPermissions(source) && checkConditions(source)) - { - if (targetCapability != null) - { - result = targetCapability.evaluate(target); - } - - if (AccessDecisionVoter.ACCESS_DENIED != result) - { - // Check each capability using 'OR' logic - for (Capability capability : capabilities) - { - result = capability.evaluate(source, target); - if (result == AccessDecisionVoter.ACCESS_GRANTED) - { - break; - } - } - - } - } - else - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java deleted file mode 100644 index 4048bad4e0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Composite capability condition implementation that required at least one of the - * capability conditions to be true. - * - * @author Roy Wetherall - */ -public class AtLeastOneCondition extends AbstractCapabilityCondition -{ - /** capability conditions */ - private List conditions; - - /** - * @param conditions capability conditions - */ - public void setConditions(List conditions) - { - this.conditions = conditions; - } - - /** - * Don't use the transaction cache for the composite condition - * - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluate(NodeRef nodeRef) - { - return evaluateImpl(nodeRef); - } - - /** - * @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; - - if (conditions != null) - { - for (CapabilityCondition condition : conditions) - { - if (condition.evaluate(nodeRef)) - { - result = true; - break; - } - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java deleted file mode 100644 index 98f7e909e0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -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; - -/** - * @author Roy Wetherall - */ -public class ClosedCapabilityCondition 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; - if (recordFolderService.isRecordFolder(nodeRef)) - { - result = recordFolderService.isRecordFolderClosed(nodeRef); - } - else if (recordService.isRecord(nodeRef)) - { - final List assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - - result = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Boolean doWork() - { - for (ChildAssociationRef assoc : assocs) - { - NodeRef parent = assoc.getParentRef(); - if (recordFolderService.isRecordFolder(parent) && recordFolderService.isRecordFolderClosed(parent)) - { - return true; - } - } - return false; - } - }); - - } - return result; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java deleted file mode 100644 index e0559cd6dd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cut off capability condition. - * - * @author Roy Wetherall - */ -public class CutoffCapabilityCondition 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) - { - // determine whether the item is already cutt off - return dispositionService.isDisposableItemCutoff(nodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java deleted file mode 100644 index 4e24739cf7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class DeclaredCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - if (FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef))) - { - result = recordService.isDeclared(nodeRef); - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java deleted file mode 100644 index e130851a5f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Destroyed capability condition. - * - * @author Roy Wetherall - */ -public class DestroyedCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, ASPECT_GHOSTED); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java deleted file mode 100644 index 219402dd69..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Helper condition that always fails. Useful for deprecation of - * old capabilities. - * - * @author Roy Wetherall - */ -public class FailCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return false; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java deleted file mode 100644 index 12243b1860..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Fileable capability condition. Indicates whether a node is 'fileable', namely if it extends cm:content - * or extends rma:nonElectronicDocument - * - * @author Roy Wetherall - */ -public class FileableCapabilityCondition extends AbstractCapabilityCondition -{ - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - QName type = nodeService.getType(nodeRef); - // TODO and not already a record? - return (dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) || - dictionaryService.isSubClass(type, TYPE_NON_ELECTRONIC_DOCUMENT)); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java deleted file mode 100644 index 4594acf802..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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 condition. - * - * @author Roy Wetherall - */ -public class FillingCapabilityCondition 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; - - if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED) - { - result = true; - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java deleted file mode 100644 index 68d59db5ff..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java deleted file mode 100644 index 26f3ef33d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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; - - /** - * @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)) - { - result = true; - } - else - { - result = freezeService.isFrozen(nodeRef); - if (!result && checkChildren) - { - result = freezeService.hasFrozenChildren(nodeRef); - } - } - return result; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java deleted file mode 100644 index 20ad9fe1f5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the node is either frozen or is a hold object - * - * @author Roy Wetherall - */ -public class FrozenOrHoldCondition 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) - { - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - return (freezeService.isFrozen(nodeRef) || - (kind != null && kind.equals(FilePlanComponentKind.HOLD))); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java deleted file mode 100644 index 3d567b8dbb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public class HasAspectCapabilityCondition extends AbstractCapabilityCondition -{ - private String aspectName; - - private NamespaceService namespaceService; - - public void setAspectName(String aspectName) - { - this.aspectName = aspectName; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @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; - if (aspectName != null) - { - QName aspect = QName.createQName(aspectName, namespaceService); - result = nodeService.hasAspect(nodeRef, aspect); - } - - return result; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java deleted file mode 100644 index cc113efded..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether a disposable item currently has a disposition date or not. - * - * @author Roy Wetherall - */ -public class HasDispositionDateCapabilityCondition 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; - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (dispositionAction != null) - { - if (dispositionAction.getAsOfDate() != null) - { - result = true; - } - } - else if (filePlanService.isFilePlanComponent(nodeRef) && nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null) - { - result = true; - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java deleted file mode 100644 index 509844d9d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether a scheduled record or folder has events or not. - * - * @author Roy Wetherall - */ -public class HasEventsCapabilityCondition 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; - - if (dispositionService.isDisposableItem(nodeRef)) - { - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - result = (!da.getEventCompletionDetails().isEmpty()); - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java deleted file mode 100644 index 5ebb1c3899..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -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; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Add to hold evaluator. - *

- * Determines whether the current user has access to any holds. - * - * @author Roy Wetherall - */ -public class HoldCapabilityCondition extends AbstractCapabilityCondition -{ - /** indicates whether to evaluate holds that the node is within or not within */ - private boolean includedInHold = false; - - /** hold service */ - private HoldService holdService; - - /** - * @param includedInHold true if holds node within, false otherwise - */ - public void setIncludedInHold(boolean includedInHold) - { - this.includedInHold = includedInHold; - } - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (holdService.isHold(nodeRef)) - { - 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))) - { - result = true; - break; - } - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java deleted file mode 100644 index 94bc9ea067..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the given node has an associated disposition schedule - * - * @author Craig Tan - * @since 2.1 - */ -public class IsClassifiedCapabilityCondition 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; - - DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); - if (dispositionSchedule != null) - { - result = true; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java deleted file mode 100644 index 0887e3eb4b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether a property is set or not. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class IsPropertySetCondition extends AbstractCapabilityCondition -{ - /** property name (eg: rma:location) */ - private String propertyName; - private QName propertyQName; - - /** namespace service */ - private NamespaceService namespaceService; - - /** - * @param propertyName property name (eg: rma:location) - */ - public void setPropertyName(String propertyName) - { - this.propertyName = propertyName; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @return QName property qname - */ - protected QName getPropertyQName() - { - if (propertyQName == null) - { - propertyQName = QName.createQName(propertyName, namespaceService); - } - return propertyQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean result = false; - - if (nodeService.getProperty(nodeRef, getPropertyQName()) != null) - { - result = true; - } - - return result; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java deleted file mode 100644 index 5e39e7912a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether the given node is a record category or not. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class IsRecordCategoryCondition 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) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return filePlanService.isRecordCategory(nodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java deleted file mode 100644 index 8958b0afe1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether the given node is a record or not. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class IsRecordCondition 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) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return recordService.isRecord(nodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java deleted file mode 100644 index 49e875fbe4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether the given node is a record folder or not. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class IsRecordFolderCondition 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) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return recordFolderService.isRecordFolder(nodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java deleted file mode 100644 index fecc0e15bd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the given disposition action is scheduled next - * - * @author Roy Wetherall - */ -public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition action */ - private String dispositionAction; - - /** - * @param dispositionAction disposition action - */ - public void setDispositionAction(String dispositionAction) - { - this.dispositionAction = dispositionAction; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (nextDispositionAction != null) - { - // Get the disposition actions name - String actionName = nextDispositionAction.getName(); - if (actionName.equals(dispositionAction) && - dispositionService.isNextDispositionActionEligible(nodeRef)) - { - result = true; - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java deleted file mode 100644 index d8d5059dd0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class IsTransferAccessionCapabilityCondition 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; - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.TRANSFER.equals(kind)) - { - Boolean value = (Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR); - if (value != null) - { - result = value.booleanValue(); - } - } - return result; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java deleted file mode 100644 index 155036ac77..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Last disposition action condition. - * - * @author Roy Wetherall - */ -public class LastDispositionActionCondition extends AbstractCapabilityCondition -{ - - private String dispositionActionName; - - public void setDispositionActionName(String dispositionActionName) - { - this.dispositionActionName = dispositionActionName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef); - if (dispositionAction != null && - dispositionActionName.equals(dispositionAction.getName())) - { - result = true; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java deleted file mode 100644 index 446396bf99..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the given disposition action 'may' be scheduled in the future - * - * @author Roy Wetherall - */ -public class MayBeScheduledCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition action */ - private String dispositionAction; - - /** - * @param dispositionAction disposition action - */ - public void setDispositionAction(String dispositionAction) - { - this.dispositionAction = dispositionAction; - } - - /** - * @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; - - DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); - if (dispositionSchedule != null && checkDispositionLevel(nodeRef, dispositionSchedule)) - { - for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) - { - if (dispositionActionDefinition.getName().equals(dispositionAction)) - { - result = true; - break; - } - } - } - return result; - } - - /** - * Checks the disposition level - * - * @param nodeRef - * @param dispositionSchedule - * @return - */ - private boolean checkDispositionLevel(NodeRef nodeRef, DispositionSchedule dispositionSchedule) - { - boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition(); - return (recordService.isRecord(nodeRef) && isRecordLevelDisposition) - || (recordFolderService.isRecordFolder(nodeRef) && !isRecordLevelDisposition); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableRecordFolderCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableRecordFolderCapabilityCondition.java deleted file mode 100644 index 4c8f40527e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableRecordFolderCapabilityCondition.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Movable capability condition. - * - * @author Roxana Dina - * @since 2.4.1 - * - */ -public class MovableRecordFolderCapabilityCondition extends AbstractCapabilityCondition -{ - - /** - * A record folder should not be moved when it is cut off, but it should be possible to move it when it is destroyed. - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - if (nodeService.hasAspect(nodeRef, ASPECT_GHOSTED) && dispositionService.isDisposableItemCutoff(nodeRef)) - return true; - return !(dispositionService.isDisposableItemCutoff(nodeRef) || recordFolderService.isRecordFolderClosed(nodeRef)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java deleted file mode 100644 index c2f0456ee4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether a record is unfiled or not. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordFiledCapabilityCondition 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) - { - return recordService.isFiled(nodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java deleted file mode 100644 index b67b5cfb8a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class TransferredCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRED); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java deleted file mode 100644 index 60b3e4f43c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (recordService.isRecord(nodeRef)) - { - // Check the record for the vital record aspect - result = nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD); - } - else if (recordFolderService.isRecordFolder(nodeRef)) - { - // Check the folder for the vital record indicator - Boolean value = (Boolean)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_VITAL_RECORD_INDICATOR); - if (value != null) - { - result = value.booleanValue(); - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java deleted file mode 100644 index ca6237f61f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Change or delete references capability - * - * @author Roy Wetherall - */ -public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef source, NodeRef target) - { - if (getFilePlanService().isFilePlanComponent(source)) - { - if (target != null) - { - if (getFilePlanService().isFilePlanComponent(target) && - checkConditions(source) && - checkConditions(target) && - checkPermissions(source) && - checkPermissions(target)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - else - { - if (checkConditions(source) && - checkPermissions(source)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - - return AccessDecisionVoter.ACCESS_DENIED; - } - else - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java deleted file mode 100644 index 76c34d4dad..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Create group capability implementation - * - * @author Andy Hind - */ -public class CreateCapability extends DeclarativeCapability -{ - /** record service */ - private RecordService recordService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef nodeRef) - { - return evaluate(nodeRef, null, null); - } - - /** - * Evaluate capability. - * - * @param destination destination node reference - * @param linkee linkee node reference, can be null - * @param assocType association type, can be null - * @return - */ - public int evaluate(NodeRef destination, NodeRef linkee, QName assocType) - { - if (linkee != null) - { - int state = checkRead(linkee, true); - if (state != AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - if (getFilePlanService().isFilePlanComponent(destination)) - { - if ((assocType == null) || !assocType.equals(ContentModel.ASSOC_CONTAINS)) - { - if (linkee == null) - { - if (recordService.isRecord(destination) && - !recordService.isDeclared(destination) && - permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - else - { - if (recordService.isRecord(linkee) && - recordService.isRecord(destination) && - !recordService.isDeclared(destination) && - permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - - } - - // Build the conditions map - Map conditions = new HashMap<>(5); - conditions.put("capabilityCondition.filling", Boolean.TRUE); - conditions.put("capabilityCondition.frozen", Boolean.FALSE); - 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) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - - conditions.put("capabilityCondition.closed", Boolean.TRUE); - if (checkConditions(destination, conditions) && - recordFolderService.isRecordFolder(destination) && - permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - - conditions.remove("capabilityCondition.closed"); - conditions.put("capabilityCondition.cutoff", Boolean.TRUE); - if (checkConditions(destination, conditions) && - recordFolderService.isRecordFolder(destination) && - permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FILEPLAN_METADATA).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_HOLD).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (((ChangeOrDeleteReferencesCapability)capabilityService.getCapability(RMPermissionModel.CHANGE_OR_DELETE_REFERENCES)).evaluate(destination, linkee) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - return AccessDecisionVoter.ACCESS_DENIED; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java deleted file mode 100644 index 7a329f17d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Delete links capability. - * - * @author Roy Wetherall - */ -public class DeleteLinksCapability extends DeclarativeCapability -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef nodeRef) - { - // no way to know ... - 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) - */ - public int evaluate(NodeRef source, NodeRef target) - { - if (getFilePlanService().isFilePlanComponent(source) && - getFilePlanService().isFilePlanComponent(target)) - { - if (checkConditions(source) && - checkConditions(target) && - checkPermissions(source) && - checkPermissions(target)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - return AccessDecisionVoter.ACCESS_DENIED; - } - else - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java deleted file mode 100644 index ce34067616..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -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; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * 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); - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java deleted file mode 100644 index 8f1f43e262..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCompositeCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Update capability implementation. - * - * @author andyh - */ -public class UpdateCapability extends DeclarativeCompositeCapability -{ - /** - * Evaluate capability - * - * @param nodeRef node reference - * @param aspectQName aspect qname - * @param properties property values - * @return - */ - public int evaluate(NodeRef nodeRef, QName aspectQName, Map properties) - { - return evaluate(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java deleted file mode 100644 index 15a3995240..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -public final class ViewRecordsCapability extends DeclarativeCapability -{ - /** capability name */ - public static final String NAME = "ViewRecords"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef nodeRef) - { - if (nodeRef != null) - { - if (getFilePlanService().isFilePlanComponent(nodeRef)) - { - return checkRmRead(nodeRef); - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("View Records capability abstains, because node is not a file plan component. (nodeRef=" + nodeRef.toString() + ")"); - } - } - } - - return AccessDecisionVoter.ACCESS_ABSTAIN; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java deleted file mode 100644 index 413ce0c2d8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.PolicyRegister; -import org.alfresco.module.org_alfresco_module_rm.capability.RMSecurityCommon; -import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.aopalliance.intercept.MethodInvocation; - -/** - * Abstract base policy implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class AbstractBasePolicy extends RMSecurityCommon - implements Policy -{ - /** Capability service */ - private CapabilityService capabilityService; - - /** Policy register */ - private PolicyRegister policyRegister; - - /** Policy name */ - private String name; - - /** - * @param name policy name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy#getName() - */ - @Override - public String getName() - { - return name; - } - - /** - * @return Capability service - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * @return Policy register - */ - protected PolicyRegister getPolicyRegister() - { - return this.policyRegister; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param policyRegister policy register - */ - public void setPolicyRegister(PolicyRegister policyRegister) - { - this.policyRegister = policyRegister; - } - - /** - * Init method - */ - public void init() - { - getPolicyRegister().registerPolicy(this); - } - - /** - * - * @param invocation - * @param params - * @param position - * @param parent - * @return - */ - @SuppressWarnings("rawtypes") - protected QName getType(MethodInvocation invocation, Class[] params, int position, boolean parent) - { - if (QName.class.isAssignableFrom(params[position])) - { - if (invocation.getArguments()[position] != null) - { - return (QName) invocation.getArguments()[position]; - } - } - else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - NodeRef nodeRef = (NodeRef) invocation.getArguments()[position]; - return nodeService.getType(nodeRef); - } - - return null; - } - - /** - * - * @param invocation - * @param params - * @param position - * @return - */ - @SuppressWarnings("rawtypes") - protected QName getQName(MethodInvocation invocation, Class[] params, int position) - { - if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - return (QName) invocation.getArguments()[position]; - } - throw new ACLEntryVoterException("Unknown type"); - } - - /** - * - * @param invocation - * @param params - * @param position - * @return - */ - @SuppressWarnings("rawtypes") - protected Serializable getProperty(MethodInvocation invocation, Class[] params, int position) - { - if (invocation.getArguments()[position] == null) - { - return null; - } - if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - return (Serializable) invocation.getArguments()[position]; - } - throw new ACLEntryVoterException("Unknown type"); - } - - /** - * - * @param invocation - * @param params - * @param position - * @return - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected Map getProperties(MethodInvocation invocation, Class[] params, int position) - { - if (invocation.getArguments()[position] == null) - { - return null; - } - if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - return (Map) invocation.getArguments()[position]; - } - throw new ACLEntryVoterException("Unknown type"); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java deleted file mode 100644 index 819ea65a84..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -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.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.aopalliance.intercept.MethodInvocation; - -public class AssocPolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef source = null; - if (cad.getParameters().get(0) > -1) - { - source = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - } - - NodeRef target = null; - if (cad.getParameters().get(1) > -1) - { - target = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); - } - - if (source != null && target != null) - { - // check the source node ref is a file plan component - if (nodeService.hasAspect(source, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(source); - } - else - { - final boolean isFilePlanComponent = nodeService.hasAspect(target, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - final boolean hasViewRecordCapability = getCapabilityService().hasCapability(target, ViewRecordsCapability.NAME); - // allow association between a source non rm node and an rm node if the user - // has ViewRecordsCapability on the RM target node and write properties on the dm node - if ( isFilePlanComponent && - hasViewRecordCapability && - permissionService.hasPermission(source, PermissionService.WRITE_PROPERTIES).equals(AccessStatus.ALLOWED)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - -} - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java deleted file mode 100644 index 59ca1f7c4b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import java.util.HashMap; -import java.util.Map; -import java.util.StringTokenizer; - -import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; -import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; -import org.alfresco.service.namespace.NamespacePrefixResolver; -import org.alfresco.service.namespace.QName; - -import net.sf.acegisecurity.ConfigAttribute; - -/** - * RM security configuration definition. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ConfigAttributeDefinition -{ - /** allowable RM security configurations */ - public static final String RM = "RM"; - public static final String RM_ALLOW = "RM_ALLOW"; - public static final String RM_DENY = "RM_DENY"; - public static final String RM_CAP = "RM_CAP"; - public static final String RM_ABSTAIN = "RM_ABSTAIN"; - public static final String RM_QUERY = "RM_QUERY"; - - /** security type */ - private String typeString; - - /** policy name */ - private String policyName; - - /** simple permission reference */ - private SimplePermissionReference required; - - /** parameter position map */ - private Map parameters = new HashMap<>(2, 1.0f); - - /** is parent */ - private boolean parent = false; - - /** - * Default constructor - * - * @param attr configuration attribute instance - * @param namespacePrefixResolver namespace prefix resolver - */ - public ConfigAttributeDefinition(ConfigAttribute attr, NamespacePrefixResolver namespacePrefixResolver) - { - // tokenize configuration string - StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false); - if (st.countTokens() < 1) - { - throw new ACLEntryVoterException("There must be at least one token in a config attribute"); - } - typeString = st.nextToken(); - - // check that the configuration is valid - if (!(typeString.equals(RM) || - typeString.equals(RM_ALLOW) || - typeString.equals(RM_CAP) || - typeString.equals(RM_DENY) || - typeString.equals(RM_QUERY) || - typeString.equals(RM_ABSTAIN))) - { - throw new ACLEntryVoterException("Invalid type: must be ACL_NODE, ACL_PARENT or ACL_ALLOW"); - } - - if (typeString.equals(RM)) - { - policyName = st.nextToken(); - int position = 0; - while (st.hasMoreElements()) - { - String numberString = st.nextToken(); - Integer value = Integer.parseInt(numberString); - parameters.put(position, value); - position++; - } - } - else if (typeString.equals(RM_CAP)) - { - String numberString = st.nextToken(); - String qNameString = st.nextToken(); - String permissionString = st.nextToken(); - - Integer value = Integer.parseInt(numberString); - parameters.put(0, value); - - QName qName = QName.createQName(qNameString, namespacePrefixResolver); - - required = SimplePermissionReference.getPermissionReference(qName, permissionString); - - if (st.hasMoreElements()) - { - parent = true; - } - } - } - - public String getTypeString() - { - return typeString; - } - - public String getPolicyName() - { - return policyName; - } - - public SimplePermissionReference getRequired() - { - return required; - } - - public Map getParameters() - { - return parameters; - } - - public boolean isParent() - { - return parent; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java deleted file mode 100644 index cab80fa030..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.CreateCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.aopalliance.intercept.MethodInvocation; - -public class CreatePolicy extends AbstractBasePolicy -{ - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef linkee = null; - QName assocType = null; - - // get the destination node - NodeRef destination = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - - if (cad.getParameters().size() > 1) - { - // get the linkee when present - linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); - - // get the assoc type - if(cad.getParameters().size() > 2) - { - assocType = getType(invocation, params, cad.getParameters().get(2), cad.isParent()); - } - } - - return ((CreateCapability) getCapabilityService().getCapability("Create")).evaluate(destination, linkee, assocType); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java deleted file mode 100644 index 7b333ed101..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class DeclarePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef declaree = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability("Declare").evaluate(declaree); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java deleted file mode 100644 index d9f2f740e8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -public class DeletePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef deletee = null; - if (cad.getParameters().get(0) > -1) - { - deletee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - } - if (deletee != null) - { - - return getCapabilityService().getCapability("Delete").evaluate(deletee); - - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java deleted file mode 100644 index c2cae7caff..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.aopalliance.intercept.MethodInvocation; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -public class MovePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - - NodeRef movee = null; - if (cad.getParameters().get(0) > -1) - { - movee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - } - - NodeRef destination = null; - if (cad.getParameters().get(1) > -1) - { - destination = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); - } - - if ((movee != null) && (destination != null)) - { - // check that we aren't trying to move something from the DM into RM - if (nodeService.hasAspect(movee, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - return getCapabilityService().getCapability("Move").evaluate(movee, destination); - } - else - { - if (nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && - permissionService.hasPermission(destination, RMPermissionModel.FILING).equals(AccessStatus.ALLOWED)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java deleted file mode 100644 index 6bf66db2af..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.aopalliance.intercept.MethodInvocation; - -/** - * Policy interface - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface Policy -{ - /** - * @return policy name - */ - String getName(); - - /** - * Evaluate the policy - * - * @param invocation - * @param params - * @param cad - * @return - */ - @SuppressWarnings("rawtypes") - int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java deleted file mode 100644 index 4c3f05e530..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -/** - * Read method security policy. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ReadPolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java deleted file mode 100644 index 0545c146d8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.UpdateCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.aopalliance.intercept.MethodInvocation; - -public class UpdatePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - QName aspectQName = null; - if (cad.getParameters().size() > 1 && cad.getParameters().get(1) > -1) - { - aspectQName = getQName(invocation, params, cad.getParameters().get(1)); - } - Map properties = null; - if (cad.getParameters().size() > 2 && cad.getParameters().get(2) > -1) - { - properties = getProperties(invocation, params, cad.getParameters().get(2)); - } - - UpdateCapability updateCapability = (UpdateCapability) getCapabilityService().getCapability("Update"); - return updateCapability.evaluate(updatee, aspectQName, properties); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java deleted file mode 100644 index 081a6c93b5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class UpdatePropertiesPolicy extends AbstractBasePolicy -{ - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability("UpdateProperties").evaluate(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java deleted file mode 100644 index d797925fb5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class WriteContentPolicy extends AbstractBasePolicy -{ - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability("WriteContent").evaluate(updatee); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java deleted file mode 100644 index a9ee934e70..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.content; - -import java.io.Serializable; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.util.ContentBinDuplicationUtility; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Content destruction component. - * - * @author Roy Wetherall - * @since 2.4.a - */ -@BehaviourBean -public class ContentDestructionComponent -{ - /** eager content store cleaner */ - private EagerContentStoreCleaner eagerContentStoreCleaner; - - /** dictionary service */ - private DictionaryService dictionaryService; - - /** node service */ - private NodeService nodeService; - - /** behaviour filter */ - private BehaviourFilter behaviourFilter; - - /** Utility class for duplicating content */ - private ContentBinDuplicationUtility contentBinDuplicationUtility; - - /** indicates whether cleansing is enabled or not */ - private boolean cleansingEnabled = false; - - /** - * @return the eagerContentStoreCleaner - */ - protected EagerContentStoreCleaner getEagerContentStoreCleaner() - { - return this.eagerContentStoreCleaner; - } - - /** - * @return the dictionaryService - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * @return the nodeService - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * @return the behaviourFilter - */ - protected BehaviourFilter getBehaviourFilter() - { - return this.behaviourFilter; - } - - /** - * @return true if cleansing is enabled, false otherwise - */ - public boolean isCleansingEnabled() - { - return cleansingEnabled; - } - - /** - * @param eagerContentStoreCleaner eager content store cleaner - */ - public void setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner) - { - this.eagerContentStoreCleaner = eagerContentStoreCleaner; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * Setter for content duplication utility class - * @param contentBinDuplicationUtility ContentBinDuplicationUtility - */ - public void setContentBinDuplicationUtility(ContentBinDuplicationUtility contentBinDuplicationUtility) - { - this.contentBinDuplicationUtility = contentBinDuplicationUtility; - } - - /** - * @param cleansingEnabled true if cleansing enabled, false otherwise - */ - public void setCleansingEnabled(boolean cleansingEnabled) - { - this.cleansingEnabled = cleansingEnabled; - } - - /** - * Destroy content - * - * @param nodeRef - */ - public void destroyContent(NodeRef nodeRef) - { - destroyContent(nodeRef, true); - } - - /** - * Destroy content - * - * @param nodeRef - * @param includeRenditions - */ - @SuppressWarnings("deprecation") - public void destroyContent(NodeRef nodeRef, boolean includeRenditions) - { - // destroy the nodes content properties - registerAllContentForDestruction(nodeRef, true); - - // Remove the renditioned aspect (and its properties and associations) if it is present. - // - // From Alfresco 3.3 it is the rn:renditioned aspect which defines the - // child-association being considered in this method. - // Note also that the cm:thumbnailed aspect extends the rn:renditioned aspect. - // - // 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 (includeRenditions - && (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) - || getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED))) - { - // get the rendition assoc types - Set childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet(); - for (ChildAssociationRef child : getNodeService().getChildAssocs(nodeRef)) - { - if (childAssocTypes.contains(child.getTypeQName())) - { - // destroy renditions content - destroyContent(child.getChildRef(), false); - - //delete the rendition node - getNodeService().deleteNode(child.getChildRef()); - } - } - } - } - - /** - * Registers all content on the given node for destruction. - * - * @param nodeRef node reference - * @param clearContentProperty if true then clear content property, otherwise false - */ - protected void registerAllContentForDestruction(NodeRef nodeRef, boolean clearContentProperty) - { - Map properties = getNodeService().getProperties(nodeRef); - - for (Map.Entry entry : properties.entrySet()) - { - if (entry.getValue() instanceof ContentData) - { - // get content data - ContentData dataContent = (ContentData)entry.getValue(); - - if (!contentBinDuplicationUtility.hasAtLeastOneOtherReference(nodeRef)) - { - // if enabled cleanse content - if (isCleansingEnabled()) - { - // register for cleanse then immediate destruction - getEagerContentStoreCleaner().registerOrphanedContentUrlForCleansing(dataContent.getContentUrl()); - } - else - { - // register for immediate destruction - getEagerContentStoreCleaner().registerOrphanedContentUrl(dataContent.getContentUrl(), true); - } - } - - // clear the property - if (clearContentProperty) - { - // disable behaviours to ensure no side effects - behaviourFilter.disableBehaviour(); - try - { - getNodeService().removeProperty(nodeRef, entry.getKey()); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java deleted file mode 100644 index 033cb83f66..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.content; - -import java.io.File; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.repo.content.ContentStore; -import org.alfresco.repo.content.filestore.FileContentReader; -import org.alfresco.service.cmr.repository.ContentReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Eager content store cleaner that allows content to be registered for cleansing before - * destruction. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class EagerContentStoreCleaner extends org.alfresco.repo.content.cleanup.EagerContentStoreCleaner -{ - /** transaction resource key */ - protected static final String KEY_POST_COMMIT_CLEANSING_URLS = "postCommitCleansingUrls"; - - /** logger */ - private static Log logger = LogFactory.getLog(EagerContentStoreCleaner.class); - - /** transactional resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** content cleanser */ - private ContentCleanser contentCleanser; - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * @param contentCleanser content cleanser - */ - public void setContentCleanser(ContentCleanser contentCleanser) - { - this.contentCleanser = contentCleanser; - } - - /** - * Registers orphaned content URLs for cleansing - * - * @param contentUrl content url - */ - public void registerOrphanedContentUrlForCleansing(String contentUrl) - { - // make note of content that needs cleansing - Set cleansingUrls = transactionalResourceHelper.getSet(KEY_POST_COMMIT_CLEANSING_URLS); - cleansingUrls.add(contentUrl); - - // register as usual - registerOrphanedContentUrl(contentUrl, true); - } - - /** - * @see org.alfresco.repo.content.cleanup.EagerContentStoreCleaner#deleteFromStore(java.lang.String, org.alfresco.repo.content.ContentStore) - */ - @Override - protected boolean deleteFromStore(String contentUrl, ContentStore store) - { - // determine if the content requires cleansing or not - Set cleansingUrls = transactionalResourceHelper.getSet(KEY_POST_COMMIT_CLEANSING_URLS); - if (cleansingUrls.contains(contentUrl)) - { - // cleanse content before delete - cleanseContent(contentUrl, store); - } - - // delete from store - return super.deleteFromStore(contentUrl, store); - } - - /** - * Cleanse content - * - * @param contentUrl content url - * @param store content store - */ - private void cleanseContent(String contentUrl, ContentStore store) - { - if (contentCleanser == null) - { - logger.error( - "No content cleanser specified. Unable to cleanse: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store); - } - else - { - // First check if the content is present at all - ContentReader reader = store.getReader(contentUrl); - if (reader != null && reader.exists()) - { - // Call to implementation's shred - if (logger.isDebugEnabled()) - { - logger.debug( - "About to cleanse: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store); - } - try - { - if (reader instanceof FileContentReader) - { - // get file content - FileContentReader fileReader = (FileContentReader) reader; - File file = fileReader.getFile(); - - // cleanse content - contentCleanser.cleanse(file); - } - } - catch (Exception e) - { - logger.error( - "Content cleansing failed: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store + "\n" + - " Reader: " + reader, - e); - } - } - else - { - logger.error( - "Content no longer exists. Unable to cleanse: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store); - } - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java deleted file mode 100644 index 25aa545612..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.content.cleanser; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Random; - -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * Content cleanser base implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public abstract class ContentCleanser -{ - /** - * Cleanse file - * - * @param file file to cleanse - */ - public abstract void cleanse(File file); - - /** - * Overwrite files bytes with provided overwrite operation - * - * @param file file - * @param overwriteOperation overwrite operation - */ - protected void overwrite(File file, OverwriteOperation overwriteOperation) - { - // get the number of bytes - long bytes = file.length(); - try - { - // get an output stream - try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) - { - for (int i = 0; i < bytes; i++) - { - // overwrite byte - overwriteOperation.operation(os); - } - } - } - catch (IOException ioException) - { - // re-throw - throw new AlfrescoRuntimeException("Unable to overwrite file", ioException); - } - } - - /** - * Overwrite operation - */ - protected abstract class OverwriteOperation - { - public abstract void operation(OutputStream os) throws IOException; - } - - /** - * Overwrite with zeros operation - */ - protected OverwriteOperation overwriteZeros = new OverwriteOperation() - { - public void operation(OutputStream os) throws IOException - { - os.write(0); - } - }; - - /** - * Overwrite with ones operation - */ - protected OverwriteOperation overwriteOnes = new OverwriteOperation() - { - public void operation(OutputStream os) throws IOException - { - os.write(0xff); - } - }; - - /** - * Overwrite with random operation - */ - protected OverwriteOperation overwriteRandom = new OverwriteOperation() - { - private Random random = new Random(); - - public void operation(OutputStream os) throws IOException - { - byte[] randomByte = new byte[1]; - random.nextBytes(randomByte); - os.write(randomByte[0]); - } - }; -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java deleted file mode 100644 index 049494a810..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.content.cleanser; - -import java.io.File; - -import org.alfresco.service.cmr.repository.ContentIOException; - -/** - * DoD 5220-22M data cleansing implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class ContentCleanser522022M extends ContentCleanser -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) - */ - @Override - public void cleanse(File file) - { - // Double check - if (!file.exists() || !file.canWrite()) - { - throw new ContentIOException("Unable to write to file: " + file); - } - - // Overwite file - overwrite(file, overwriteOnes); - overwrite(file, overwriteZeros); - overwrite(file, overwriteRandom); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java deleted file mode 100644 index 542d85b5de..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dataset; - -public interface DataSet -{ - - /** - * Gets the label of the data set - * - * @return String the label of the data set - */ - String getLabel(); - - /** - * Gets the id of the data set - * - * @return String the id of the data set - */ - String getId(); - - /** - * Gets the path of the data set - * - * @return String the path of the data set - */ - String getPath(); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java deleted file mode 100644 index 7ff6cf7591..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dataset; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -public class DataSetBase implements DataSet -{ - - /** Data set service */ - private DataSetService dataSetService; - - /** Data set label */ - private String label; - - /** Data set id */ - private String id; - - /** Data set path */ - private String path; - - /** - * Sets the data set service - * - * @param dataSetService the data set service - */ - public void setDataSetService(DataSetService dataSetService) - { - this.dataSetService = dataSetService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getLabel() - */ - public String getLabel() - { - String label = this.label; - if (StringUtils.isBlank(label)) - { - String propertyKey = "dataset." + getId() + ".label"; - label = I18NUtil.getMessage(propertyKey); - if (StringUtils.isBlank(label)) - { - label = propertyKey; - } - } - return label; - } - - /** - * Sets the label of the data set service - * - * @param label the label - */ - public void setLabel(String label) - { - this.label = label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getId() - */ - public String getId() - { - return this.id; - } - - /** - * Sets the id of the data set service - * - * @param id the id - */ - public void setId(String id) - { - this.id = id; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getPath() - */ - public String getPath() - { - return this.path; - } - - /** - * Sets the path of the data set service - * - * @param path the path - */ - public void setPath(String path) - { - this.path = path; - } - - /** - * Registers the data set implementation with the data set service. - */ - public void register() - { - this.dataSetService.register(this); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java deleted file mode 100644 index a53bd7e1d2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dataset; - -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; - -public interface DataSetService -{ - - /** - * Register a data set implementation with the service - * - * @param dataSet the data set - */ - void register(DataSet dataSet); - - /** - * Gets the details of all available data sets. - * - * @return the Map<String, DataSet> with details of all available data sets - */ - Map getDataSets(); - - /** - * Gets the details of all available data sets for a file plan depending on - * the parameter "excludeLoaded". - * - * @param filePlan the file plan for which the details should be retrieved - * @param excludeLoaded if true only data sets will be retrieved which has - * not been loaded - * @return Map<String, DataSet> with details of the available data sets for a - * specified file plan depending on the parameter "excludeLoaded". - * The result could also be an empty map - */ - Map getDataSets(NodeRef filePlan, boolean excludeLoaded); - - /** - * Gets the details of all loaded data sets for a specified file plan - * - * @param filePlan the file plan for which the loaded data sets should be - * retrieved - * @return Map<String, DataSet> details of all loaded data sets or an empty - * map if there has not been any data sets loaded for the specified - * file plan - */ - Map getLoadedDataSets(NodeRef filePlan); - - /** - * Loads the data set with the specified id into the specified file plan - * - * @param filePlan the file plan which the data set will load into - * @param dataSetId the id of the data set which will be imported - */ - void loadDataSet(NodeRef filePlan, String dataSetId); - - /** - * Checks if a data set exists with the given data set id - * - * @param dataSetId the id of the data set which will be checked - * @return true if the data set exists, false otherwise - */ - boolean existsDataSet(String dataSetId); - - /** - * Checks if a data set with the id "dataSetId" has been loaded into the - * specified file plan - * - * @param filePlan the file plan for which the check should be done - * @param dataSetId the id of the data set which should be checked if it has - * been loaded to the file plan - * @return true if the data set with the specified id has been loaded into - * the specified file plan, false otherwise - */ - boolean isLoadedDataSet(NodeRef filePlan, String dataSetId); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java deleted file mode 100644 index a0730b97ea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java +++ /dev/null @@ -1,524 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dataset; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -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.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.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.RMAuthority; -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.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class DataSetServiceImpl implements DataSetService, RecordsManagementModel -{ - - /** Logger */ - private static Log logger = LogFactory.getLog(DataSetServiceImpl.class); - - /** Registered data set implementations */ - private Map dataSets = new HashMap<>(); - - /** Spaces store */ - private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - /** Charset name */ - private static final String CHARSET_NAME = "UTF-8"; - - /** Importer service */ - private ImporterService importerService; - - /** Search service */ - private SearchService searchService; - - /** Node service */ - private NodeService nodeService; - - /** File plan service service */ - private FilePlanService filePlanService; - - /** Permission service */ - private PermissionService permissionService; - - /** Authority service */ - private AuthorityService authorityService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** Records management search behaviour */ - private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** - * Set importer service - * - * @param importerService the importer service - */ - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } - - /** - * Set search service - * - * @param searchService the search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * Set node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set file plan service - * - * @param filePlanService the file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Set permission service - * - * @param permissionService the permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * Set authority service - * - * @param authorityService the authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * Set records management search behaviour - * - * @param recordsManagementSearchBehaviour the records management search - * behaviour - */ - public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour recordsManagementSearchBehaviour) - { - this.recordsManagementSearchBehaviour = recordsManagementSearchBehaviour; - } - - /** - * Set disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Set record folder service - * - * @param recordFolderService the record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#register(org.alfresco.module.org_alfresco_module_rm.dataset.DataSet) - */ - @Override - public void register(DataSet dataSet) - { - ParameterCheck.mandatory("dataSet", dataSet); - - this.dataSets.put(dataSet.getId(), dataSet); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getDataSets() - */ - @Override - public Map getDataSets() - { - return this.dataSets; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getDataSets(NodeRef, - * boolean) - */ - @Override - public Map getDataSets(NodeRef filePlan, boolean excludeLoaded) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("excludeLoaded", excludeLoaded); - - // Get the list of all available data sets - Map dataSets = new HashMap<>(getDataSets()); - - // Should the list of unloaded data sets be retrieved - if (excludeLoaded) - { - dataSets.keySet().removeAll(getLoadedDataSets(filePlan).keySet()); - } - - // Return the (filtered) list of data sets - return dataSets; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#loadDataSet( - *org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void loadDataSet(NodeRef filePlan, String dataSetId) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatoryString("dataSetId", dataSetId); - - // Get the data set - DataSet dataSet = getDataSets().get(dataSetId); - - // Import the RM test data ACP into the the provided file plan node - // reference - InputStream is = null; - try - { - is = getClass().getClassLoader().getResourceAsStream(dataSet.getPath()); - if (is == null) { throw new AlfrescoRuntimeException("The '" + dataSet.getLabel() - + "' import file could not be found!"); } - - // Import view - Reader viewReader = new InputStreamReader(is, CHARSET_NAME); - Location location = new Location(filePlan); - importerService.importView(viewReader, location, null, null); - - // Patch data - patchLoadedData(); - - // Set the data set id into the file plan's custom aspect - setDataSetIdIntoFilePlan(dataSetId, filePlan); - } - catch (Exception ex) - { - throw new AlfrescoRuntimeException("Unexpected exception thrown. Please refer to the log files for details.", ex); - } - finally - { - if (is != null) - { - try - { - is.close(); - is = null; - } - catch (IOException ex) - { - throw new AlfrescoRuntimeException("Failed to close the input stream!", ex); - } - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#existsDataSet(java.lang.String) - */ - @Override - public boolean existsDataSet(String dataSetId) - { - ParameterCheck.mandatoryString("dataSetId", dataSetId); - - return getDataSets().containsKey(dataSetId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getLoadedDataSets(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Map getLoadedDataSets(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - - // Get the list of available data sets - Map availableDataSets = new HashMap<>(getDataSets()); - - // Get the property value of the aspect - Serializable dataSetIds = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - // Check if any data has been loaded before - if (dataSetIds != null) - { - // Filter the data sets which have already been loaded - @SuppressWarnings("unchecked") - ArrayList loadedDataSetIds = (ArrayList) dataSetIds; - Iterator> iterator = availableDataSets.entrySet().iterator(); - while (iterator.hasNext()) - { - Entry entry = iterator.next(); - String key = entry.getKey(); - if (!loadedDataSetIds.contains(key)) - { - iterator.remove(); - } - } - return availableDataSets; - } - - return new HashMap<>(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#isLoadedDataSet(org.alfresco.service.cmr.repository.NodeRef, - * java.lang.String) - */ - @Override - public boolean isLoadedDataSet(NodeRef filePlan, String dataSetId) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("dataSetId", dataSetId); - - return getLoadedDataSets(filePlan).containsKey(dataSetId); - } - - /** - * Temp method to patch AMP'ed data - */ - private void patchLoadedData() - { - AuthenticationUtil.RunAsWork runAsWork = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - Set rmRoots = filePlanService.getFilePlans(); - logger.info("Bootstraping " + rmRoots.size() + " rm roots ..."); - for (NodeRef rmRoot : rmRoots) - { - if (permissionService.getInheritParentPermissions(rmRoot)) - { - logger.info("Updating permissions for rm root: " + rmRoot); - permissionService.setInheritParentPermissions(rmRoot, false); - } - - String allRoleShortName = RMAuthority.ALL_ROLES_PREFIX + rmRoot.getId(); - String allRoleGroupName = authorityService.getName(AuthorityType.GROUP, allRoleShortName); - - if (!authorityService.authorityExists(allRoleGroupName)) - { - logger.info("Creating all roles group for root node: " + rmRoot.toString()); - - // Create "all" role group for root node - String allRoles = authorityService.createAuthority(AuthorityType.GROUP, allRoleShortName, - RMAuthority.ALL_ROLES_DISPLAY_NAME, new HashSet<>(Arrays.asList(RMAuthority.ZONE_APP_RM))); - - // Put all the role groups in it - Set roles = filePlanRoleService.getRoles(rmRoot); - for (Role role : roles) - { - logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); - authorityService.addAuthority(allRoles, role.getRoleGroupName()); - } - - // Set the permissions - permissionService.setPermission(rmRoot, allRoles, RMPermissionModel.READ_RECORDS, true); - } - } - - // Make sure all the containers do not inherit permissions - ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, - "TYPE:\"rma:recordsManagementContainer\""); - try - { - logger.info("Bootstraping " + rs.length() + " record containers ..."); - - for (NodeRef container : rs.getNodeRefs()) - { - String containerName = (String) nodeService.getProperty(container, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(container)) - { - logger.info("Updating permissions for record container: " + containerName); - permissionService.setInheritParentPermissions(container, false); - } - } - } - finally - { - rs.close(); - } - - // fix up the test dataset to fire initial events for - // disposition - // schedules - rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); - try - { - logger.info("Bootstraping " + rs.length() + " record folders ..."); - - for (NodeRef recordFolder : rs.getNodeRefs()) - { - String folderName = (String) nodeService.getProperty(recordFolder, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(recordFolder)) - { - logger.info("Updating permissions for record folder: " + folderName); - permissionService.setInheritParentPermissions(recordFolder, false); - } - - if (!nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)) - { - // See if the folder has a disposition schedule that - // needs - // to be applied - DispositionSchedule ds = dispositionService.getDispositionSchedule(recordFolder); - if (ds != null) - { - // Fire action to "set-up" the folder correctly - logger.info("Setting up bootstraped record folder: " + folderName); - recordFolderService.setupRecordFolder(recordFolder); - } - } - - // fixup the search behaviour aspect for the record - // folder - logger.info("Setting up search aspect for record folder: " + folderName); - recordsManagementSearchBehaviour.fixupSearchAspect(recordFolder); - } - } - finally - { - rs.close(); - } - - return null; - } - }; - - AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); - - } - - /** - * Helper method for setting the id of the imported data set into the file - * plan's aspect - * - * @param dataSetId The id of the imported data set - * @param filePlan The file plan into which the data set has been imported - */ - @SuppressWarnings("unchecked") - private void setDataSetIdIntoFilePlan(String dataSetId, NodeRef filePlan) - { - ArrayList loadedDataSetIds; - Serializable dataSetIds = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - - // Check if any data set has been imported - if (dataSetIds == null) - { - Map aspectProperties = new HashMap<>(1); - aspectProperties.put(PROP_LOADED_DATA_SET_IDS, (Serializable) new ArrayList()); - nodeService.addAspect(filePlan, ASPECT_LOADED_DATA_SET_ID, aspectProperties); - loadedDataSetIds = (ArrayList) nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - } - else - { - loadedDataSetIds = (ArrayList) dataSetIds; - } - - // Add the new loaded data set id - loadedDataSetIds.add(dataSetId); - Map aspectProperties = new HashMap<>(1); - aspectProperties.put(PROP_LOADED_DATA_SET_IDS, (Serializable) loadedDataSetIds); - nodeService.addAspect(filePlan, ASPECT_LOADED_DATA_SET_ID, aspectProperties); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java deleted file mode 100644 index cb306b0042..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.Date; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Disposition action interface. - * - * @author Roy Wetherall - * @since 1.0 - */ -public interface DispositionAction -{ - /** - * @return the node reference - */ - NodeRef getNodeRef(); - - /** - * @return the disposition action definition - */ - DispositionActionDefinition getDispositionActionDefinition(); - - /** - * @return the id of the action - */ - String getId(); - - /** - * @return the name of the action - */ - String getName(); - - /** - * @return the display label for the action - */ - String getLabel(); - - /** - * @return the dispostion action as of eligibility date - */ - Date getAsOfDate(); - - /** - * @return true if the events are complete (ie: enough events have been completed to make the disposition - * action - */ - boolean isEventsEligible(); - - /** - * @return the user that started the action - */ - String getStartedBy(); - - /** - * @return when the action was started - */ - Date getStartedAt(); - - /** - * @return the user that completed the action - */ - String getCompletedBy(); - - /** - * @return when the action was completed - */ - Date getCompletedAt(); - - /** - * @return List of events that need to be completed for the action - */ - List getEventCompletionDetails(); - - /** - * Get the event completion details for a named event. - * - * @param eventName event name - * @return {@link EventCompletionDetails} event completion details - * @since 2.2 - */ - EventCompletionDetails getEventCompletionDetails(String eventName); - - /** - * Add new completion details to the disposition action based on the provided - * event. - * - * @param event records management event - * @since 2.2 - */ - void addEventCompletionDetails(RecordsManagementEvent event); - - /** - * Complete an event. - *

- * If null is provided, the complete at date will be take as 'now' and the completed by user - * as the fully authenticated user. - * - * @param eventName event name - * @param completedAt completed at 'date', now if null - * @param completedBy completed by user, authenticated user if null - * @since 2.2 - */ - void completeEvent(String eventName, Date completedAt, String completedBy); - - /** - * Undo the completion of an event. - * - * @param eventName event name - * @since 2.2 - */ - void undoEvent(String eventName); - - /** - * Refresh events against current disposition action definition. - *

- * Called when disposition action definition has changed. - * - * @since 2.2 - */ - void refreshEvents(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java deleted file mode 100644 index b455e2284b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; - -/** - * Disposition action interface - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi because it depends on Period which is not part of the public API. -public interface DispositionActionDefinition -{ - /** - * Get the NodeRef that represents the disposition action definition - * - * @return NodeRef of disposition action definition - */ - NodeRef getNodeRef(); - - /** - * Get disposition action id - * - * @return String id - */ - String getId(); - - /** - * Get the index of the action within the disposition instructions - * - * @return int disposition action index - */ - int getIndex(); - - /** - * Get the name of disposition action - * - * @return String name - */ - String getName(); - - /** - * Get the display label of the disposition action - * - * @return String name's display label - */ - String getLabel(); - - /** - * Get the description of the disposition action - * - * @return String description - */ - String getDescription(); - - /** - * Get the period for the disposition action - * - * @return Period disposition period - */ - Period getPeriod(); - - /** - * Property to which the period is relative to - * - * @return QName property name - */ - QName getPeriodProperty(); - - /** - * List of events for the disposition - * - * @return List list of events - */ - List getEvents(); - - /** - * Indicates whether the disposition action is eligible when the earliest - * event is complete, otherwise all events must be complete before - * eligibility. - * - * @return boolean true if eligible on first action complete, false - * otherwise - */ - boolean eligibleOnFirstCompleteEvent(); - - /** - * Get the location of the disposition (can be null) - * - * @return String disposition location - */ - String getLocation(); - - /** - * Get the ghost on destroy from the disposition - * - * @return boolean the gost on destroy flag (on applicable to destroy - * actions) - */ - String getGhostOnDestroy(); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java deleted file mode 100644 index 8c70fabb8b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; - -/** - * Disposition action implementation - * - * @author Roy Wetherall - */ -public class DispositionActionDefinitionImpl implements DispositionActionDefinition, RecordsManagementModel -{ - /** Name */ - private String name; - - /** Description */ - private String description; - - /** Label */ - private String label; - - /** Node service */ - private NodeService nodeService; - - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** Disposition action node reference */ - private NodeRef dispositionActionNodeRef; - - /** Action index */ - private int index; - - /** Ghost on detroy */ - private String ghostOnDestroy; - - /** - * Constructor - * - * @param recordsManagementEventService records management event service - * @param recordsManagementActionService records management action service - * @param nodeService node service - * @param nodeRef disposition action node reference - * @param index index of disposition action - */ - public DispositionActionDefinitionImpl(RecordsManagementEventService recordsManagementEventService, RecordsManagementActionService recordsManagementActionService, NodeService nodeService, NodeRef nodeRef, int index) - { - this.recordsManagementEventService = recordsManagementEventService; - this.recordsManagementActionService = recordsManagementActionService; - this.nodeService = nodeService; - this.dispositionActionNodeRef = nodeRef; - this.index = index; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getNodeRef() - */ - @Override - public NodeRef getNodeRef() - { - return this.dispositionActionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getIndex() - */ - @Override - public int getIndex() - { - return this.index; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getId() - */ - @Override - public String getId() - { - return this.dispositionActionNodeRef.getId(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getDescription() - */ - @Override - public String getDescription() - { - if (description == null) - { - description = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_DESCRIPTION); - } - return description; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getName() - */ - @Override - public String getName() - { - if (name == null) - { - name = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_ACTION_NAME); - } - return name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLabel() - */ - @Override - public String getLabel() - { - if (label == null) - { - String name = getName(); - label = name; - - // get the disposition action from the RM action service - RecordsManagementAction action = recordsManagementActionService.getDispositionAction(name); - if (action != null) - { - label = action.getLabel(); - } - } - - return label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getPeriod() - */ - @Override - public Period getPeriod() - { - return (Period)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getPeriodProperty() - */ - @Override - public QName getPeriodProperty() - { - QName result = null; - String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD_PROPERTY); - if (value != null) - { - result = QName.createQName(value); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getEvents() - */ - @Override - @SuppressWarnings("unchecked") - public List getEvents() - { - List events = null; - Collection eventNames = (Collection)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT); - if (eventNames != null) - { - events = new ArrayList<>(eventNames.size()); - for (String eventName : eventNames) - { - RecordsManagementEvent event = recordsManagementEventService.getEvent(eventName); - events.add(event); - } - } - else - { - events = java.util.Collections.EMPTY_LIST; - } - return events; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#eligibleOnFirstCompleteEvent() - */ - @Override - public boolean eligibleOnFirstCompleteEvent() - { - boolean result = true; - String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT_COMBINATION); - if (value != null && value.equals("and")) - { - result = false; - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLocation() - */ - @Override - public String getLocation() - { - return (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_LOCATION); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getGhostOnDestroy() - */ - @Override - public String getGhostOnDestroy() - { - if (ghostOnDestroy == null) - { - ghostOnDestroy = (String) nodeService.getProperty(this.dispositionActionNodeRef, - PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY); - } - return ghostOnDestroy; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java deleted file mode 100644 index 0987cd5f97..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java +++ /dev/null @@ -1,561 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -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.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RMSearchGet; -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.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Disposition action implementation. - * - * @author Roy Wetherall - * @since 1.0 - */ -public class DispositionActionImpl implements DispositionAction, - RecordsManagementModel -{ - /** logger */ - private static Log logger = LogFactory.getLog(DispositionActionImpl.class); - - /** records management service registry */ - private RecordsManagementServiceRegistry services; - - /** disposition node reference */ - private NodeRef dispositionNodeRef; - - /** disposition action definition */ - private DispositionActionDefinition dispositionActionDefinition; - - /** - * Constructor - * - * @param services records management service registry - * @param dispositionActionNodeRef disposition action node reference - */ - public DispositionActionImpl(RecordsManagementServiceRegistry services, NodeRef dispositionActionNodeRef) - { - this.services = services; - this.dispositionNodeRef = dispositionActionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getDispositionActionDefinition() - */ - public DispositionActionDefinition getDispositionActionDefinition() - { - if (dispositionActionDefinition == null) - { - // Get the current action - String id = (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID); - - // Get the disposition instructions for the owning node - NodeRef recordNodeRef = services.getNodeService().getPrimaryParent(this.dispositionNodeRef).getParentRef(); - if (recordNodeRef != null) - { - DispositionSchedule ds = services.getDispositionService().getDispositionSchedule(recordNodeRef); - - if (ds != null) - { - // Get the disposition action definition - dispositionActionDefinition = ds.getDispositionActionDefinition(id); - } - } - } - - return dispositionActionDefinition; - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getNodeRef() - */ - public NodeRef getNodeRef() - { - return this.dispositionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getLabel() - */ - public String getLabel() - { - String name = getName(); - String label = name; - - // get the disposition action from the RM action service - RecordsManagementAction action = services.getRecordsManagementActionService().getDispositionAction(name); - if (action != null) - { - label = action.getLabel(); - } - - return label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getId() - */ - public String getId() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getName() - */ - public String getName() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getAsOfDate() - */ - public Date getAsOfDate() - { - return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_AS_OF); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#isEventsEligible() - */ - public boolean isEventsEligible() - { - return ((Boolean)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_EVENTS_ELIGIBLE)).booleanValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getCompletedAt() - */ - public Date getCompletedAt() - { - return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getCompletedBy() - */ - public String getCompletedBy() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getStartedAt() - */ - public Date getStartedAt() - { - return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getStartedBy() - */ - public String getStartedBy() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getEventCompletionDetails() - */ - public List getEventCompletionDetails() - { - List assocs = services.getNodeService().getChildAssocs( - this.dispositionNodeRef, - ASSOC_EVENT_EXECUTIONS, - RegexQNamePattern.MATCH_ALL); - List result = new ArrayList<>(assocs.size()); - for (ChildAssociationRef assoc : assocs) - { - result.add(getEventCompletionDetailsFromNodeRef(assoc.getChildRef())); - } - - return result; - } - - /** - * Helper method to create object representation of event completed details from - * node reference. - * - * @param nodeRef node reference - * @return {@link EventCompletionDetails} event completion details - */ - private EventCompletionDetails getEventCompletionDetailsFromNodeRef(NodeRef nodeRef) - { - // get the properties - Map props = this.services.getNodeService().getProperties(nodeRef); - - // get the event name - String eventName = (String)props.get(PROP_EVENT_EXECUTION_NAME); - - // create event completion details - return new EventCompletionDetails( - nodeRef, - eventName, - services.getRecordsManagementEventService().getEvent(eventName).getDisplayLabel(), - getBooleanValue(props.get(PROP_EVENT_EXECUTION_AUTOMATIC), false), - getBooleanValue(props.get(PROP_EVENT_EXECUTION_COMPLETE), false), - (Date) props.get(PROP_EVENT_EXECUTION_COMPLETED_AT), - (String) props.get(PROP_EVENT_EXECUTION_COMPLETED_BY)); - } - - /** - * Helper method to deal with boolean values - * - * @param value - * @param defaultValue - * @return - */ - private boolean getBooleanValue(Object value, boolean defaultValue) - { - boolean result = defaultValue; - if (value instanceof Boolean) - { - result = ((Boolean)value).booleanValue(); - } - return result; - } - - /** - * Gets the event completion details for the named event. - *

- * Returns null if event can not be found. - * - * @param eventName name of the event - * @return {@link EventCompletionDetails} event completion details for named event, null otherwise - * - * @since 2.2 - */ - @Override - public EventCompletionDetails getEventCompletionDetails(String eventName) - { - EventCompletionDetails result = null; - List assocs = services.getNodeService().getChildAssocsByPropertyValue(dispositionNodeRef, PROP_EVENT_EXECUTION_NAME, eventName); - - if (!assocs.isEmpty()) - { - if (assocs.size() != 1) - { - throw new AlfrescoRuntimeException("Unable to get event completion details, because more than one child was found for event " + eventName); - } - - result = getEventCompletionDetailsFromNodeRef(assocs.get(0).getChildRef()); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#completeEvent(java.lang.String, java.util.Date, java.lang.String) - */ - @Override - public void completeEvent(final String eventName, final Date completedAt, final String completedBy) - { - final EventCompletionDetails event = getEventCompletionDetails(eventName); - if (event != null && !event.isEventComplete()) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // use "now" if no completed date set - Date completedAtValue = completedAt; - if (completedAt == null) - { - completedAtValue = new Date(); - } - - // use the currently authenticated user if none set - String completedByValue = completedBy; - if (completedBy == null) - { - completedByValue = AuthenticationUtil.getFullyAuthenticatedUser(); - } - - // Update the event so that it is complete - NodeRef eventNodeRef = event.getNodeRef(); - Map props = services.getNodeService().getProperties(eventNodeRef); - props.put(PROP_EVENT_EXECUTION_COMPLETE, true); - props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, completedAtValue); - props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, completedByValue); - services.getNodeService().setProperties(eventNodeRef, props); - - // check a specific event from rmEventConfigBootstrap.json - if (eventName.equals("declassification_review")) - { - setDeclassificationReview(eventNodeRef, completedAtValue, completedByValue); - } - - // Check to see if the events eligible property needs to be updated - updateEventEligible(); - - return null; - } - }); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#undoEvent(java.lang.String) - */ - @Override - public void undoEvent(final String eventName) - { - final EventCompletionDetails event = getEventCompletionDetails(eventName); - if (event != null && event.isEventComplete()) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Update the event so that it is undone - NodeRef eventNodeRef = event.getNodeRef(); - Map props = services.getNodeService().getProperties(eventNodeRef); - props.put(PROP_EVENT_EXECUTION_COMPLETE, false); - props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, null); - props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, null); - services.getNodeService().setProperties(eventNodeRef, props); - - // Check to see if the events eligible property needs to be updated - updateEventEligible(); - - return null; - } - }); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#refreshEvents() - */ - @SuppressWarnings("unchecked") - @Override - public void refreshEvents() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // go through the current events on the next action and remove any that are not present any more - List stepEvents = (List) services.getNodeService().getProperty(getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT); - - List eventsList = getEventCompletionDetails(); - List nextActionEvents = new ArrayList<>(eventsList.size()); - - for (EventCompletionDetails event : eventsList) - { - // take note of the event names present on the next action - String eventName = event.getEventName(); - nextActionEvents.add(eventName); - - // if the event has been removed delete from next action - if (stepEvents != null && !stepEvents.contains(event.getEventName())) - { - // remove the child association representing the event - services.getNodeService().removeChild(getNodeRef(), event.getNodeRef()); - - if (logger.isDebugEnabled()) - { - logger.debug("Removed '" + eventName + "' from next action '" + getName() + - "' (" + getNodeRef() + ")"); - } - } - } - - // go through the disposition action definition step events and add any new ones - if (stepEvents != null) - { - for (String eventName : stepEvents) - { - if (!nextActionEvents.contains(eventName)) - { - // add the details of the new event - addEventCompletionDetails(services.getRecordsManagementEventService().getEvent(eventName)); - - if (logger.isDebugEnabled()) - { - logger.debug("Added '" + eventName + "' to next action '" + getName() + - "' (" + getNodeRef() + ")"); - } - } - } - } - - // NOTE: eventsList contains all the events that have been updated! - // TODO: manually update the search properties for the parent node! - - // finally since events may have changed re-calculate the events eligible flag - boolean eligible = updateEventEligible(); - - if (logger.isDebugEnabled()) - { - logger.debug("Set events eligible flag to '" + eligible + "' for next action '" + getName() + - "' (" + getNodeRef() + ")"); - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#addEventCompletionDetails(org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent) - */ - @Override - public void addEventCompletionDetails(RecordsManagementEvent event) - { - Map eventProps = new HashMap<>(7); - eventProps.put(PROP_EVENT_EXECUTION_NAME, event.getName()); - // TODO display label - eventProps.put(PROP_EVENT_EXECUTION_AUTOMATIC, event.getRecordsManagementEventType().isAutomaticEvent()); - eventProps.put(PROP_EVENT_EXECUTION_COMPLETE, false); - - // Create the event execution object - services.getNodeService().createNode(getNodeRef(), - ASSOC_EVENT_EXECUTIONS, - ASSOC_EVENT_EXECUTIONS, - TYPE_EVENT_EXECUTION, - eventProps); - } - - - /** - * Calculates and updates the rma:dispositionEventsEligible - * property for the given next disposition action. - * - * @param nextAction The next disposition action - * @return The result of calculation - * - * @since 2.2 - */ - private boolean updateEventEligible() - { - boolean eligible = false; - - // get the events for the next disposition action - List events = getEventCompletionDetails(); - - if (!events.isEmpty()) - { - // get the disposition action definition - DispositionActionDefinition dispositionActionDefinition = getDispositionActionDefinition(); - if (dispositionActionDefinition != null) - { - if (!dispositionActionDefinition.eligibleOnFirstCompleteEvent()) - { - // if one event is complete then the disposition action is eligible - eligible = true; - for (EventCompletionDetails event : events) - { - if (!event.isEventComplete()) - { - eligible = false; - break; - } - } - } - else - { - // all events must be complete for the disposition action to be eligible - for (EventCompletionDetails event : events) - { - if (event.isEventComplete()) - { - eligible = true; - break; - } - } - } - } - } - - // Update the property with the eligible value - services.getNodeService().setProperty(getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE, eligible); - - return eligible; - } - - /** - * Sets declassification review authority and date on records and record folder - * - * @param eventNodeRef Declassification review event node ref - * @param completedAtValue Declassification review authority - * @param completedByValue Declassification review date - */ - private void setDeclassificationReview(NodeRef eventNodeRef, Date completedAtValue, String completedByValue) - { - NodeRef nextDispositionActionNodeRef = services.getNodeService().getPrimaryParent(eventNodeRef).getParentRef(); - NodeRef nodeRef = services.getNodeService().getPrimaryParent(nextDispositionActionNodeRef).getParentRef(); - setPropsOnContent(nodeRef, completedAtValue, completedByValue); - - // check if the node is a record folder then set the declassification review on the records also - if (services.getNodeService().getType(nodeRef).equals(RecordsManagementModel.TYPE_RECORD_FOLDER)) - { - // get all the records inside the record folder - List records = services.getNodeService().getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : records) - { - NodeRef recordNodeRef = child.getChildRef(); - setPropsOnContent(recordNodeRef, completedAtValue, completedByValue); - } - } - } - - private void setPropsOnContent(NodeRef nodeRef, Date completedAtValue, String completedByValue) - { - Map nodeProps = services.getNodeService().getProperties(nodeRef); - nodeProps.put(PROP_RS_DECLASSIFICATION_REVIEW_COMPLETED_AT, completedAtValue); - nodeProps.put(PROP_RS_DECLASSIFICATION_REVIEW_COMPLETED_BY, completedByValue); - services.getNodeService().setProperties(nodeRef, nodeProps); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java deleted file mode 100644 index e8ba82e9e8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Disposition schedule interface - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi because it depends on DispositionActionDefinition which is not part of the public API. -public interface DispositionSchedule -{ - /** - * Get the NodeRef that represents the disposition schedule - * - * @return {@link NodeRef} of disposition schedule - */ - NodeRef getNodeRef(); - - /** - * Get the disposition authority - * - * @return {@link String} disposition authority - */ - String getDispositionAuthority(); - - /** - * Get the disposition instructions - * - * @return {@link String} disposition instructions - */ - String getDispositionInstructions(); - - /** - * Indicates whether the disposal occurs at record level or not - * - * @return boolean true if at record level, false otherwise - */ - boolean isRecordLevelDisposition(); - - /** - * Gets all the disposition action definitions for the schedule - * - * @return List<{@link DispositionActionDefinition}> disposition action definitions - */ - List getDispositionActionDefinitions(); - - /** - * Get the disposition action definition - * - * @param id the action definition id - * @return {@link DispositionActionDefinition} disposition action definition - */ - DispositionActionDefinition getDispositionActionDefinition(String id); - - /** - * Get the disposition action definition by the name of the disposition action - * - * @param name disposition action name - * @return {@link DispositionActionDefinition} disposition action definition, null if none - */ - DispositionActionDefinition getDispositionActionDefinitionByName(String name); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java deleted file mode 100644 index e18177b349..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -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.RegexQNamePattern; - -/** - * Disposition instructions implementation - * - * @author Roy Wetherall - */ -public class DispositionScheduleImpl implements DispositionSchedule, - RecordsManagementModel -{ - private NodeService nodeService; - private RecordsManagementServiceRegistry services; - private NodeRef dispositionDefinitionNodeRef; - /** authentication helper */ - private AuthenticationUtil authenticationUtil; - - - private List actions; - private Map actionsById; - - //If name is not the same as node-uuid, then action will be stored here too - //Fix for ALF-2588 - private Map actionsByName; - - /** Map of disposition definitions by disposition action name */ - private Map actionsByDispositionActionName; - - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - public DispositionScheduleImpl(RecordsManagementServiceRegistry services, NodeService nodeService, NodeRef nodeRef) - { - // TODO check that we have a disposition definition node reference - - this.dispositionDefinitionNodeRef = nodeRef; - this.nodeService = nodeService; - this.services = services; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getNodeRef() - */ - public NodeRef getNodeRef() - { - return this.dispositionDefinitionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionAuthority() - */ - public String getDispositionAuthority() - { - return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_AUTHORITY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionInstructions() - */ - public String getDispositionInstructions() - { - return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_INSTRUCTIONS); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#isRecordLevelDisposition() - */ - public boolean isRecordLevelDisposition() - { - return authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Boolean doWork() throws Exception - { - Boolean value = (Boolean)nodeService.getProperty(dispositionDefinitionNodeRef, PROP_RECORD_LEVEL_DISPOSITION); - if (value != null) - { - return value; - } - return false; - } - }); - } - - /** - * Get disposition action definition - * - * @param id action definition identifier - * @return DispositionActionDefinition disposition action definition - */ - public DispositionActionDefinition getDispositionActionDefinition(String id) - { - if (this.actions == null) - { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - getDispositionActionsImpl(); - return null; - } - }); - } - - DispositionActionDefinition actionDef = this.actionsById.get(id); - if (actionDef == null) - { - actionDef = this.actionsByName.get(id); - } - return actionDef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitionByName(java.lang.String) - */ - @Override - public DispositionActionDefinition getDispositionActionDefinitionByName(String name) - { - if (this.actionsByDispositionActionName == null) - { - getDispositionActionsImpl(); - } - return actionsByDispositionActionName.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitions() - */ - public List getDispositionActionDefinitions() - { - if (this.actions == null) - { - getDispositionActionsImpl(); - } - - return this.actions; - } - - /** - * Get the disposition actions into the local cache - */ - private void getDispositionActionsImpl() - { - List assocs = this.nodeService.getChildAssocs( - this.dispositionDefinitionNodeRef, - ASSOC_DISPOSITION_ACTION_DEFINITIONS, - RegexQNamePattern.MATCH_ALL); - this.actions = new ArrayList<>(assocs.size()); - this.actionsById = new HashMap<>(assocs.size()); - this.actionsByName = new HashMap<>(assocs.size()); - this.actionsByDispositionActionName = new HashMap<>(assocs.size()); - int index = 0; - for (ChildAssociationRef assoc : assocs) - { - DispositionActionDefinition da = new DispositionActionDefinitionImpl(services.getRecordsManagementEventService(), services.getRecordsManagementActionService(), nodeService, assoc.getChildRef(), index); - actions.add(da); - actionsById.put(da.getId(), da); - index++; - - String actionNodeName = (String) nodeService.getProperty(assoc.getChildRef(), ContentModel.PROP_NAME); - if (!actionNodeName.equals(da.getId())) - { - //It was imported and now has new ID. Old ID may present in old files. - actionsByName.put(actionNodeName, da); - } - - String actionDefintionName = (String)nodeService.getProperty(assoc.getChildRef(), PROP_DISPOSITION_ACTION_NAME); - if (actionDefintionName != null) - { - actionsByDispositionActionName.put(actionDefintionName, da); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java deleted file mode 100644 index 324d64e36a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -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.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This class offers the default implementation of a strategy for selection of - * disposition schedule for a record when there is more than one which is applicable. - * An example of where this strategy might be used would be in the case of a record - * which was multiply filed. - * - * @author neilm - */ -public class DispositionSelectionStrategy implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(DispositionSelectionStrategy.class); - - /** Disposition service */ - private DispositionService dispositionService; - - /** - * Set the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Select the disposition schedule to use given there is more than one - * - * @param recordFolders - * @return - */ - public NodeRef selectDispositionScheduleFrom(List recordFolders) - { - if (recordFolders == null || recordFolders.isEmpty()) - { - return null; - } - else - { - // 46 CHAPTER 2 - // Records assigned more than 1 disposition must be retained and linked to the record folder (category) with the longest - // retention period. - - // Assumption: an event-based disposition action has a longer retention - // period than a time-based one - as we cannot know when an event will occur - // TODO Automatic events? - - NodeRef recordFolder = null; - if (recordFolders.size() == 1) - { - recordFolder = recordFolders.get(0); - } - else - { - SortedSet sortedFolders = new TreeSet<>(new DispositionableNodeRefComparator()); - sortedFolders.addAll(recordFolders); - recordFolder = sortedFolders.first(); - } - - DispositionSchedule dispSchedule = dispositionService.getDispositionSchedule(recordFolder); - - if (logger.isDebugEnabled()) - { - logger.debug("Selected retention schedule: " + dispSchedule); - } - - NodeRef result = null; - if (dispSchedule != null) - { - result = dispSchedule.getNodeRef(); - } - return result; - } - } - - /** - * This class defines a natural comparison order between NodeRefs that have - * the dispositionLifecycle aspect applied. - * This order has the following meaning: NodeRefs with a 'lesser' value are considered - * to have a shorter retention period, although the actual retention period may - * not be straightforwardly determined in all cases. - */ - class DispositionableNodeRefComparator implements Comparator - { - public int compare(final NodeRef f1, final NodeRef f2) - { - // Run as admin user - return AuthenticationUtil.runAs(new RunAsWork() - { - public Integer doWork() - { - return compareImpl(f1, f2); - } - }, AuthenticationUtil.getAdminUserName()); - } - - private int compareImpl(NodeRef f1, NodeRef f2) - { - // quick check to see if the node references are the same - if (f1.equals(f2)) - { - return 0; - } - - // get the disposition schedules for the folders - DispositionSchedule ds1 = dispositionService.getDispositionSchedule(f1); - DispositionSchedule ds2 = dispositionService.getDispositionSchedule(f2); - - // make sure each folder has a disposition schedule - if (ds1 == null && ds2 != null) - { - return 1; - } - else if (ds1 != null && ds2 == null) - { - return -1; - } - else if (ds1 == null && ds2 == null) - { - return 0; - } - - // TODO this won't work correctly if we are trying to compare schedules that are record based!! - DispositionAction da1 = dispositionService.getNextDispositionAction(f1); - DispositionAction da2 = dispositionService.getNextDispositionAction(f2); - - if (da1 != null && da2 != null) - { - Date asOfDate1 = da1.getAsOfDate(); - Date asOfDate2 = da2.getAsOfDate(); - // If both record(Folder)s have asOfDates, then use these to compare - if (asOfDate1 != null && asOfDate2 != null) - { - return asOfDate1.compareTo(asOfDate2); - } - // If one has a date and the other doesn't, the one with the date is "less". - // (Defined date is 'shorter' than undefined date as an undefined date means it may be retained forever - theoretically) - else if (asOfDate1 != null || asOfDate2 != null) - { - return asOfDate1 == null ? +1 : -1; - } - else - { - // Neither has an asOfDate. (Somewhat arbitrarily) we'll use the number of events to compare now. - DispositionActionDefinition dad1 = da1.getDispositionActionDefinition(); - DispositionActionDefinition dad2 = da2.getDispositionActionDefinition(); - int eventsCount1 = 0; - int eventsCount2 = 0; - - if (dad1 != null) - { - eventsCount1 = dad1.getEvents().size(); - } - if (dad2 != null) - { - eventsCount2 = dad2.getEvents().size(); - } - return Integer.valueOf(eventsCount1).compareTo(eventsCount2); - } - } - - return 0; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java deleted file mode 100644 index ce5ff5bc7d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Disposition service interface. - * - * @author Roy Wetherall - * @since 2.0 - */ -// Not @AlfrescoPublicApi because it depends on DispositionSchedule which is not part of the public API. -public interface DispositionService -{ - /** ========= Disposition Property Methods ========= */ - - /** - * Register a disposition property. - * - * @param dispositionProperty disposition property - */ - void registerDispositionProperty(DispositionProperty dispositionProperty); - - /** - * Returns the list of disposition period properties that apply given the context provided. - * - * @return filtered list of disposition period properties - */ - Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction); - Collection getDispositionProperties(); - - - /** ========= Disposition Schedule Methods ========= */ - - /** - * Get the disposition schedule for a given record management node. Traverses the hierarchy to - * find the first disposition schedule in the primary hierarchy. - * - * @param nodeRef node reference to record category, record folder or record - * @return {@link DispositionSchedule} disposition schedule - */ - DispositionSchedule getDispositionSchedule(NodeRef nodeRef); - - // Gets all the disposition schedules, not just the first in the primary parent path. - // TODO List getAllDispositionSchedules(NodeRef nodeRef); - - /** - * Get the disposition schedule directly associated with the node specified. Returns - * null if none. - * - * @param nodeRef node reference - * @return {@link DispositionSchedule} disposition schedule directly associated with the node reference, null if none - */ - DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef); - - /** - * Gets the records management container that is directly associated with the disposition schedule. - * - * @param dispositionSchedule disposition schedule - * @return {@link NodeRef} node reference of the associated container - */ - NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule); - - /** - * Indicates whether a disposition schedule has any disposable items under its management - * - * @param dispositionSchdule disposition schedule - * @return boolean true if there are disposable items being managed by, false otherwise - */ - boolean hasDisposableItems(DispositionSchedule dispositionSchdule); - - /** - * Gets a list of all the disposable items (records, record folders) that are under the control of - * the disposition schedule. - * - * @param dispositionSchedule disposition schedule - * @return {@link List} <{@link NodeRef}> list of disposable items - */ - List getDisposableItems(DispositionSchedule dispositionSchedule); - - /** - * Indicates whether the node is a disposable item or not (ie is under the control of a disposition schedule) - * - * @param nodeRef node reference - * @return boolean true if node is a disposable item, false otherwise - */ - boolean isDisposableItem(NodeRef nodeRef); - - /** - * Creates a disposition schedule on the given record category. - * - * @param recordCategory - * @param props - * @return {@link DispositionSchedule} - */ - DispositionSchedule createDispositionSchedule(NodeRef recordCategory, Map props); - - // TODO DispositionSchedule updateDispositionSchedule(DispositionScedule, Map props) - - // TODO void removeDispositionSchedule(NodeRef nodeRef); - can only remove if no disposition items - - /** ========= Disposition Action Definition Methods ========= */ - - /** - * Adds a new disposition action definition to the given disposition schedule. - * - * @param schedule The DispositionSchedule to add to - * @param actionDefinitionParams Map of parameters to use to create the action definition - */ - DispositionActionDefinition addDispositionActionDefinition( - DispositionSchedule schedule, - Map actionDefinitionParams); - - /** - * Removes the given disposition action definition from the given disposition - * schedule. - * - * @param schedule The DispositionSchedule to remove from - * @param actionDefinition The DispositionActionDefinition to remove - */ - void removeDispositionActionDefinition( - DispositionSchedule schedule, - DispositionActionDefinition actionDefinition); - - /** - * Updates the given disposition action definition belonging to the given disposition - * schedule. - * - * @param actionDefinition The DispositionActionDefinition to update - * @param actionDefinitionParams Map of parameters to use to update the action definition - * @return The updated DispositionActionDefinition - */ - DispositionActionDefinition updateDispositionActionDefinition( - DispositionActionDefinition actionDefinition, - Map actionDefinitionParams); - - - /** ========= Disposition Action Methods ========= */ - - /** - * Indicates whether the next disposition action is eligible or not. - * - * @param nodeRef node reference to disposable item - * @return boolean true if next disposition action is eligible, false otherwise - */ - boolean isNextDispositionActionEligible(NodeRef nodeRef); - - /** - * Gets the next disposition action for a given node - * - * @param nodeRef node reference to disposable item - * @return DispositionAction next disposition action, null if none - */ - DispositionAction getNextDispositionAction(NodeRef nodeRef); - - // TODO void startNextDispositionAction(NodeRef nodeRef); - - // TODO void completeNextDispositionAction(NodeRef nodeRef); - - - /** ========= Disposition Action History Methods ========= */ - - /** - * Gets a list of all the completed disposition action in the order they occured. - * - * @param nodeRef record/record folder - * @return List list of completed disposition actions - */ - List getCompletedDispositionActions(NodeRef nodeRef); - - /** - * Helper method to get the last completed disposition action. Returns null - * if there is none. - * - * @param nodeRef record/record folder - * @return DispositionAction last completed disposition action, null if none - */ - DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef); - - /** - * Indicates whether the disposable item (records, record folders) is cutoff or not. - * - * @param nodeRef node reference - * @return boolean true if the disposable item is cutoff, false otherwise - * - * @since 2.0 - */ - boolean isDisposableItemCutoff(NodeRef nodeRef); - - /** - * Marks the disposable item (record or record folder) as cut off, calculating the cut off date - * - * @param nodeRef node reference - * - * @since 2.2 - */ - void cutoffDisposableItem(NodeRef nodeRef); - - /** - * Updates the next disposition action - * - * @param nodeRef node reference - */ - void updateNextDispositionAction(NodeRef nodeRef); - - /** - * Updates the next disposition action - * - * @param nodeRef node reference - * @param dispositionSchedule the schedule to be applied - */ - void updateNextDispositionAction(NodeRef nodeRef, DispositionSchedule dispositionSchedule); - - /** - * Refreshes the disposition action details of the given node. - * - * @param nodeRef node reference - */ - void refreshDispositionAction(NodeRef nodeRef); - - /** - * Gets date of the disposition action for the given - * disposition schedule with the given action name - * - * @param record - * @param dispositionSchedule nodeRef - * @param dispositionActionName - * @return date - */ - Date getDispositionActionDate(NodeRef record, NodeRef dispositionSchedule, String dispositionActionName); - - /** - * Compute the "disposition as of" date (if necessary) for a disposition action and a node. - * - * @param nodeRef The node which the schedule applies to. - * @param dispositionActionDefinition The definition of the disposition action. - * @return The new "disposition as of" date. - */ - Date calculateAsOfDate(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition); - - /** - * Gets the origin disposition schedule for the record, not the calculated one - * in case of multiple dispositions applied to record - * - * @param nodeRef record - * @return the initial disposition - */ - DispositionSchedule getOriginDispositionSchedule(NodeRef nodeRef); - - /** - * Updates disposition action step when linking or unlinking - * the given record to/from a record folder - * - * @param record - */ - void recalculateNextDispositionStep(NodeRef record); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java deleted file mode 100644 index f4ee94b739..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java +++ /dev/null @@ -1,1492 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import static org.apache.commons.lang3.BooleanUtils.isNotTrue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -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.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -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.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.ServiceBaseImpl; -import org.alfresco.repo.dictionary.types.period.Immediately; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.cmr.repository.Period; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Disposition service implementation. - * - * @author Roy Wetherall - */ -@BehaviourBean -public class DispositionServiceImpl extends ServiceBaseImpl - implements DispositionService, - RecordsManagementModel, - RecordsManagementPolicies.OnFileRecord -{ - /** Logger */ - private static final Logger LOGGER = LoggerFactory.getLogger(DispositionServiceImpl.class); - - /** Transaction mode for setting next action */ - public enum WriteMode - { - /** Do not update any data. */ - READ_ONLY, - /** Only set the "disposition as of" date. */ - DATE_ONLY, - /** - * Set the "disposition as of" date and the name of the next action. This only happens during the creation of a - * disposition schedule impl node under a record or folder. - */ - DATE_AND_NAME - } - - /** Behaviour filter */ - private BehaviourFilter behaviourFilter; - - /** Records management service registry */ - private RecordsManagementServiceRegistry serviceRegistry; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Record Folder Service */ - private RecordFolderService recordFolderService; - - /** Record Service */ - private RecordService recordService; - - /** Freeze Service */ - private FreezeService freezeService; - - /** Transaction service */ - private TransactionService transactionService; - - /** Disposition properties */ - private Map dispositionProperties = new HashMap<>(4); - - /** - * Set node service - * - * @param nodeService the node service - */ - @Override - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the dictionary service - * - * @param dictionaryService the dictionary service - */ - @Override - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Set the behaviour filter. - * - * @param behaviourFilter the behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * Set the records management service registry - * - * @param serviceRegistry records management registry service - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry) - { - this.serviceRegistry = serviceRegistry; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Behavior to initialize the disposition schedule of a newly filed record. - * - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour(kind=BehaviourKind.CLASS, type="rma:record") - public void onFileRecord(NodeRef nodeRef) - { - // initialise disposition details - if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - DispositionSchedule di = getDispositionSchedule(nodeRef); - if (di != null && di.isRecordLevelDisposition()) - { - nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#refreshDispositionAction(NodeRef) - */ - @Override - public void refreshDispositionAction(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // get this disposition instructions for the node - DispositionSchedule di = getDispositionSchedule(nodeRef); - if (di != null) - { - List dispositionActionDefinitions = di.getDispositionActionDefinitions(); - if (!dispositionActionDefinitions.isEmpty()) - { - // get the first disposition action definition - DispositionActionDefinition nextDispositionActionDefinition = dispositionActionDefinitions.get(0); - - // initialise the details of the next disposition action - initialiseDispositionAction(nodeRef, nextDispositionActionDefinition); - } - } - } - - /** ========= Disposition Property Methods ========= */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#registerDispositionProperty(org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty) - */ - @Override - public void registerDispositionProperty(DispositionProperty dispositionProperty) - { - dispositionProperties.put(dispositionProperty.getQName(), dispositionProperty); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties(boolean, java.lang.String) - */ - @Override - public Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction) - { - Collection values = dispositionProperties.values(); - List result = new ArrayList<>(values.size()); - for (DispositionProperty dispositionProperty : values) - { - boolean test = dispositionProperty.applies(isRecordLevel, dispositionAction); - if (test) - { - result.add(dispositionProperty); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties() - */ - @Override - public Collection getDispositionProperties() - { - return dispositionProperties.values(); - } - - /** ========= Disposition Schedule Methods ========= */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionSchedule getDispositionSchedule(final NodeRef nodeRef) - { - DispositionSchedule ds = null; - NodeRef dsNodeRef = null; - if (isRecord(nodeRef)) - { - // calculate disposition schedule without taking into account the user - DispositionSchedule originDispositionSchedule = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public DispositionSchedule doWork() - { - return getOriginDispositionSchedule(nodeRef); - } - }); - // if the initial disposition schedule of the record is folder based - if (originDispositionSchedule == null || - isNotTrue(originDispositionSchedule.isRecordLevelDisposition())) - { - return null; - } - - final NextActionFromDisposition dsNextAction = getDispositionActionByNameForRecord(nodeRef); - - if (dsNextAction != null) - { - final NodeRef action = dsNextAction.getNextActionNodeRef(); - if (isNotTrue((Boolean)nodeService.getProperty(action, PROP_MANUALLY_SET_AS_OF))) - { - if (!dsNextAction.getWriteMode().equals(WriteMode.READ_ONLY)) - { - final String dispositionActionName = dsNextAction.getNextActionName(); - final Date dispositionActionDate = dsNextAction.getNextActionDateAsOf(); - - // check if current transaction is a READ ONLY one and if true set the property on the node - // in a READ WRITE transaction - if (AlfrescoTransactionSupport.getTransactionReadState().equals(TxnReadState.TXN_READ_ONLY)) - { - transactionService.getRetryingTransactionHelper().doInTransaction((RetryingTransactionCallback) () -> { - getInternalNodeService().setProperty(action, PROP_DISPOSITION_AS_OF, dispositionActionDate); - return null; - }, false, true); - } - else - { - getInternalNodeService().setProperty(action, PROP_DISPOSITION_AS_OF, dispositionActionDate); - } - - if (dsNextAction.getWriteMode().equals(WriteMode.DATE_AND_NAME)) - { - nodeService.setProperty(action, PROP_DISPOSITION_ACTION_NAME, dispositionActionName); - } - } - } - - dsNodeRef = dsNextAction.getDispositionNodeRef(); - } - } - else - { - // Get the disposition instructions for the node reference provided - dsNodeRef = getDispositionScheduleImpl(nodeRef); - } - - if (dsNodeRef != null) - { - ds = new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); - } - - return ds; - } - - /** - * This method returns a NodeRef - * Gets the disposition instructions - * - * @param nodeRef - * @return - */ - private NodeRef getDispositionScheduleImpl(NodeRef nodeRef) - { - NodeRef result = getAssociatedDispositionScheduleImpl(nodeRef); - - if (result == null) - { - NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef(); - if (parent != null && filePlanService.isRecordCategory(parent)) - { - result = getDispositionScheduleImpl(parent); - } - } - return result; - } - - public DispositionSchedule getOriginDispositionSchedule(NodeRef nodeRef) - { - NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef(); - if (parent != null) - { - if (filePlanService.isRecordCategory(parent)) - { - NodeRef result = getAssociatedDispositionScheduleImpl(parent); - if (result == null) - { - return getOriginDispositionSchedule(parent); - } - return new DispositionScheduleImpl(serviceRegistry, nodeService, result); - } - else - { - return getOriginDispositionSchedule(parent); - } - } - return null; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getAssociatedDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef) - { - DispositionSchedule ds = null; - - // Check the noderef parameter - ParameterCheck.mandatory("nodeRef", nodeRef); - if (nodeService.exists(nodeRef)) - { - // Get the associated disposition schedule node reference - NodeRef dsNodeRef = getAssociatedDispositionScheduleImpl(nodeRef); - if (dsNodeRef != null) - { - // Create disposition schedule object - ds = new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); - } - } - - return ds; - } - - /** - * Gets the node reference of the disposition schedule associated with the container. - * - * @param nodeRef node reference of the container - * @return {@link NodeRef} node reference of the disposition schedule, null if none - */ - private NodeRef getAssociatedDispositionScheduleImpl(NodeRef nodeRef) - { - NodeRef result = null; - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Make sure we are dealing with an RM node - if (!filePlanService.isFilePlanComponent(nodeRef)) - { - throw new AlfrescoRuntimeException("Can not find the associated retention schedule for a non records management component. (nodeRef=" + nodeRef.toString() + ")"); - } - if (getInternalNodeService().hasAspect(nodeRef, ASPECT_SCHEDULED)) - { - List childAssocs = getInternalNodeService().getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); - if (!childAssocs.isEmpty()) - { - ChildAssociationRef firstChildAssocRef = childAssocs.get(0); - result = firstChildAssocRef.getChildRef(); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getAssociatedRecordsManagementContainer(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) - */ - @Override - public NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule) - { - ParameterCheck.mandatory("dispositionSchedule", dispositionSchedule); - NodeRef result = null; - - NodeRef dsNodeRef = dispositionSchedule.getNodeRef(); - if (nodeService.exists(dsNodeRef)) - { - List assocs = this.nodeService.getParentAssocs(dsNodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); - if (!assocs.isEmpty()) - { - if (assocs.size() != 1) - { - // TODO in the future we should be able to support disposition schedule reuse, but for now just warn that - // only the first disposition schedule will be considered - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Retention schedule has more than one associated records management container. " + - "This is not currently supported so only the first container will be considered. " + - "(dispositionScheduleNodeRef=" + dispositionSchedule.getNodeRef().toString() + ")"); - } - } - - // Get the container reference - ChildAssociationRef assoc = assocs.get(0); - result = assoc.getParentRef(); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#hasDisposableItems(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) - */ - @Override - public boolean hasDisposableItems(DispositionSchedule dispositionSchdule) - { - ParameterCheck.mandatory("dispositionSchedule", dispositionSchdule); - - // Get the associated container - NodeRef rmContainer = getAssociatedRecordsManagementContainer(dispositionSchdule); - - return hasDisposableItemsImpl(dispositionSchdule.isRecordLevelDisposition(), rmContainer); - } - - /** - * Method that provides a boolean if given Records Management Container has disposable items. - * This method is similar to getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) but with improved performance: - * For RecordLevelDisposition it will limit Record retrieval to 1. - * Early returns once the first occurrence is found. - * @param isRecordLevelDisposition - * @param rmContainer - * @return - */ - private boolean hasDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) - { - List items = filePlanService.getAllContained(rmContainer); - for (NodeRef item : items) - { - if (recordFolderService.isRecordFolder(item)) - { - if (isRecordLevelDisposition) - { - List assocs = nodeService.getChildAssocs(item, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL, 1, true); - if (!assocs.isEmpty()) - { - return true; - } - } - else - { - return true; - } - } - else if (filePlanService.isRecordCategory(item) && getAssociatedDispositionScheduleImpl(item) == null) - { - if (hasDisposableItemsImpl(isRecordLevelDisposition, item)); - { - return true; - } - } - } - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDisposableItems(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) - */ - @Override - public List getDisposableItems(DispositionSchedule dispositionSchedule) - { - ParameterCheck.mandatory("dispositionSchedule", dispositionSchedule); - - // Get the associated container - NodeRef rmContainer = getAssociatedRecordsManagementContainer(dispositionSchedule); - - // Return the disposable items - return getDisposableItemsImpl(dispositionSchedule.isRecordLevelDisposition(), rmContainer); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isDisposableItem(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isDisposableItem(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE); - } - - /** - * - * @param isRecordLevelDisposition - * @param rmContainer - * @return - */ - private List getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) - { - List items = filePlanService.getAllContained(rmContainer); - List result = new ArrayList<>(items.size()); - for (NodeRef item : items) - { - if (recordFolderService.isRecordFolder(item)) - { - if (isRecordLevelDisposition) - { - result.addAll(recordService.getRecords(item)); - } - else - { - result.add(item); - } - } - else if (filePlanService.isRecordCategory(item) && getAssociatedDispositionScheduleImpl(item) == null) - { - result.addAll(getDisposableItemsImpl(isRecordLevelDisposition, item)); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#createDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef, java.util.Map) - */ - @Override - public DispositionSchedule createDispositionSchedule(NodeRef nodeRef, Map props) - { - NodeRef dsNodeRef = null; - - // Check mandatory parameters - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Check exists - if (!nodeService.exists(nodeRef)) - { - throw new AlfrescoRuntimeException("Unable to create retention schedule, because node does not exist. (nodeRef=" + nodeRef.toString() + ")"); - } - - // Check is sub-type of rm:recordCategory - QName nodeRefType = nodeService.getType(nodeRef); - if (!TYPE_RECORD_CATEGORY.equals(nodeRefType) && - !dictionaryService.isSubClass(nodeRefType, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException("Unable to create retention schedule on a node that is not a records management container."); - } - - behaviourFilter.disableBehaviour(nodeRef, ASPECT_SCHEDULED); - try - { - // Add the schedules aspect if required - if (!nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED)) - { - nodeService.addAspect(nodeRef, ASPECT_SCHEDULED, null); - } - - // Check whether there is already a disposition schedule object present - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); - if (assocs.isEmpty()) - { - DispositionSchedule currentDispositionSchdule = getDispositionSchedule(nodeRef); - if (currentDispositionSchdule != null) - { - List items = getDisposableItemsImpl(currentDispositionSchdule.isRecordLevelDisposition(), nodeRef); - if (!items.isEmpty()) - { - throw new AlfrescoRuntimeException("Can not create a retention schedule if there are disposable items already under the control of an other retention schedule"); - } - } - - // Create the disposition schedule object - dsNodeRef = nodeService.createNode( - nodeRef, - ASSOC_DISPOSITION_SCHEDULE, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("dispositionSchedule")), - TYPE_DISPOSITION_SCHEDULE, - props).getChildRef(); - } - else - { - // Error since the node already has a disposition schedule set - throw new AlfrescoRuntimeException("Unable to create retention schedule on node that already has a retention schedule."); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, ASPECT_SCHEDULED); - } - - // Create the return object - return new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); - } - - /** ========= Disposition Action Definition Methods ========= */ - - /** - * - */ - @Override - public DispositionActionDefinition addDispositionActionDefinition( - DispositionSchedule schedule, - Map actionDefinitionParams) - { - // make sure at least a name has been defined - String name = (String)actionDefinitionParams.get(PROP_DISPOSITION_ACTION_NAME); - if (name == null || name.length() == 0) - { - throw new IllegalArgumentException("'name' parameter is mandatory when creating a disposition action definition"); - } - - // TODO: also check the action name is valid? - - // create the child association from the schedule to the action definition - NodeRef actionNodeRef = this.nodeService.createNode(schedule.getNodeRef(), - RecordsManagementModel.ASSOC_DISPOSITION_ACTION_DEFINITIONS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(name)), - RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION, actionDefinitionParams).getChildRef(); - - // get the updated disposition schedule and retrieve the new action definition - NodeRef scheduleParent = this.nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef(); - DispositionSchedule updatedSchedule = this.getDispositionSchedule(scheduleParent); - return updatedSchedule.getDispositionActionDefinition(actionNodeRef.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#removeDispositionActionDefinition(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule, org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition) - */ - @Override - public void removeDispositionActionDefinition(DispositionSchedule schedule, DispositionActionDefinition actionDefinition) - { - // check first whether action definitions can be removed - if (hasDisposableItems(schedule)) - { - throw new AlfrescoRuntimeException("Can not remove action definitions from schedule '" + - schedule.getNodeRef() + "' as one or more record or record folders are present."); - } - - // remove the child node representing the action definition - this.nodeService.removeChild(schedule.getNodeRef(), actionDefinition.getNodeRef()); - } - - /** - * Updates the given disposition action definition belonging to the given disposition - * schedule. - * - * @param actionDefinition The DispositionActionDefinition to update - * @param actionDefinitionParams Map of parameters to use to update the action definition - * @return The updated DispositionActionDefinition - */ - @Override - public DispositionActionDefinition updateDispositionActionDefinition( - DispositionActionDefinition actionDefinition, - Map actionDefinitionParams) - { - // update the node with properties - this.nodeService.addProperties(actionDefinition.getNodeRef(), actionDefinitionParams); - - // get the updated disposition schedule and retrieve the updated action definition - NodeRef ds = this.nodeService.getPrimaryParent(actionDefinition.getNodeRef()).getParentRef(); - DispositionSchedule updatedSchedule = new DispositionScheduleImpl(serviceRegistry, nodeService, ds); - return updatedSchedule.getDispositionActionDefinition(actionDefinition.getId()); - } - - /** ========= Disposition Action Methods ========= */ - - /** - * Initialises the details of the next disposition action based on the details of a disposition - * action definition. - * - * @param nodeRef node reference - * @param dispositionActionDefinition disposition action definition - */ - private DispositionAction initialiseDispositionAction(final NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition) - { - List childAssocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION, 1, true); - if (childAssocs != null && !childAssocs.isEmpty()) - { - return new DispositionActionImpl(serviceRegistry, childAssocs.get(0).getChildRef()); - } - - // Create the properties - final Map props = new HashMap<>(10); - - Date asOfDate = calculateAsOfDate(nodeRef, dispositionActionDefinition); - - // Set the property values - props.put(PROP_DISPOSITION_ACTION_ID, dispositionActionDefinition.getId()); - props.put(PROP_DISPOSITION_ACTION, dispositionActionDefinition.getName()); - if (asOfDate != null) - { - props.put(PROP_DISPOSITION_AS_OF, asOfDate); - } - - DispositionAction da; - // check if current transaction is a READ ONLY one and if true create the node in a READ WRITE transaction - if (AlfrescoTransactionSupport.getTransactionReadState().equals(TxnReadState.TXN_READ_ONLY)) - { - da = - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public DispositionAction execute() throws Throwable - { - return createDispositionAction(nodeRef, props); - } - }, false, true); - } - else - { - da = createDispositionAction(nodeRef, props); - } - - // Create the events - List events = dispositionActionDefinition.getEvents(); - for (RecordsManagementEvent event : events) - { - // For every event create an entry on the action - da.addEventCompletionDetails(event); - } - return da; - } - - /** Creates a new disposition action object - * - * @param nodeRef node reference - * @param props properties of the disposition action to be created - * @return the disposition action object - */ - private DispositionAction createDispositionAction(final NodeRef nodeRef, Map props) - { - NodeRef dispositionActionNodeRef = nodeService.createNode( - nodeRef, - ASSOC_NEXT_DISPOSITION_ACTION, - ASSOC_NEXT_DISPOSITION_ACTION, - TYPE_DISPOSITION_ACTION, - props).getChildRef(); - - return new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); - } - - /** - * Compute the "disposition as of" date (if necessary) for a disposition action and a node. - * - * @param nodeRef The node which the schedule applies to. - * @param dispositionActionDefinition The definition of the disposition action. - * @return The new "disposition as of" date. - */ - @Override - public Date calculateAsOfDate(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition) - { - // Calculate the asOf date - Date asOfDate = null; - Period period = dispositionActionDefinition.getPeriod(); - if (period != null) - { - Date contextDate = null; - - // Get the period properties value - QName periodProperty = dispositionActionDefinition.getPeriodProperty(); - if (periodProperty != null) - { - if (RecordsManagementModel.PROP_DISPOSITION_AS_OF.equals(periodProperty)) - { - DispositionAction lastCompletedDispositionAction = getLastCompletedDispostionAction(nodeRef); - if (lastCompletedDispositionAction != null) - { - contextDate = lastCompletedDispositionAction.getCompletedAt(); - } - else - { - contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty); - } - - } - else - { - // doesn't matter if the period property isn't set ... the asOfDate will get updated later - // when the value of the period property is set - contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty); - } - } - else - { - if (period.getPeriodType().equals(Immediately.PERIOD_TYPE)) - { - contextDate = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED); - } - else - { - // for now use 'NOW' as the default context date - // TODO set the default period property ... cut off date or last disposition date depending on context - contextDate = new Date(); - } - } - - // Calculate the as of date - if (contextDate != null) - { - asOfDate = period.getNextDate(contextDate); - } - } - return asOfDate; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isNextDispositionActionEligible(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isNextDispositionActionEligible(NodeRef nodeRef) - { - boolean result = false; - // Get the disposition instructions - DispositionSchedule di = getDispositionSchedule(nodeRef); - DispositionAction nextDa = getNextDispositionAction(nodeRef); - - if (di != null && - nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) && - nextDa != null) - { - // for accession step we can have also AND between step conditions - boolean combineSteps = false; - if (nextDa.getName().equals("accession")) - { - NodeRef accessionNodeRef = di.getDispositionActionDefinitionByName("accession").getNodeRef(); - if (accessionNodeRef != null) - { - Boolean combineStepsProp = (Boolean) getInternalNodeService().getProperty(accessionNodeRef, PROP_COMBINE_DISPOSITION_STEP_CONDITIONS); - if (combineStepsProp != null) - { - combineSteps = combineStepsProp; - } - } - } - Date asOf = (Date) getInternalNodeService().getProperty(nextDa.getNodeRef(), PROP_DISPOSITION_AS_OF); - boolean asOfDateInPast = false; - if (asOf != null) - { - asOfDateInPast = asOf.before(new Date()); - } - if (asOfDateInPast && !combineSteps) - { - return true; - } - else if (!asOfDateInPast && combineSteps) - { - return false; - } - DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa.getNodeRef()); - DispositionActionDefinition dad = da.getDispositionActionDefinition(); - if (dad != null) - { - boolean firstComplete = authenticationUtil.runAsSystem(() -> dad.eligibleOnFirstCompleteEvent()); - - List assocs = getInternalNodeService().getChildAssocs(nextDa.getNodeRef(), ASSOC_EVENT_EXECUTIONS, - RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef eventExecution = assoc.getChildRef(); - Boolean isCompleteValue = (Boolean) getInternalNodeService().getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE); - boolean isComplete = false; - if (isCompleteValue != null) - { - isComplete = isCompleteValue.booleanValue(); - - // implement AND and OR combination of event completions - if (isComplete) - { - result = true; - if (firstComplete) - { - break; - } - } - else - { - result = false; - if (!firstComplete) - { - break; - } - } - } - } - } - } - return result; - } - - /** - * Get the next disposition action node. Null if none present. - * - * @param nodeRef the disposable node reference - * @return NodeRef the next disposition action, null if none - */ - private NodeRef getNextDispositionActionNodeRef(NodeRef nodeRef) - { - NodeRef result = null; - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION, 1, true); - if (!assocs.isEmpty()) - { - result = assocs.get(0).getChildRef(); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getNextDispositionAction(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionAction getNextDispositionAction(NodeRef nodeRef) - { - DispositionAction result = null; - NodeRef dispositionActionNodeRef = getNextDispositionActionNodeRef(nodeRef); - - if (dispositionActionNodeRef != null) - { - result = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); - } - return result; - } - - - /** ========= Disposition Action History Methods ========= */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getCompletedDispositionActions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getCompletedDispositionActions(NodeRef nodeRef) - { - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_ACTION_HISTORY, RegexQNamePattern.MATCH_ALL); - List result = new ArrayList<>(assocs.size()); - for (ChildAssociationRef assoc : assocs) - { - NodeRef dispositionActionNodeRef = assoc.getChildRef(); - result.add(new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef)); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getLastCompletedDispostionAction(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef) - { - DispositionAction result = null; - List list = getCompletedDispositionActions(nodeRef); - if (!list.isEmpty()) - { - // Get the last disposition action in the list - result = list.get(list.size()-1); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isDisposableItemCutoff(NodeRef) - */ - @Override - public boolean isDisposableItemCutoff(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - return nodeService.hasAspect(nodeRef, ASPECT_CUT_OFF); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#updateNextDispositionAction(NodeRef) - */ - @Override - public void updateNextDispositionAction(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - RunAsWork runAsWork = new RunAsWork() - { - /** - * @see org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork#doWork() - */ - @Override - public Void doWork() - { - // Get this disposition instructions for the node - DispositionSchedule dispositionSchedule = getDispositionSchedule(nodeRef); - - updateNextDispositionAction(nodeRef, dispositionSchedule); - - return null; - } - - }; - - AuthenticationUtil.runAsSystem(runAsWork); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#updateNextDispositionAction(NodeRef) - */ - @Override - public void updateNextDispositionAction(final NodeRef nodeRef, final DispositionSchedule dispositionSchedule) - { - - - RunAsWork runAsWork = new RunAsWork() - { - /** - * @see org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork#doWork() - */ - @Override - public Void doWork() - { - - if (dispositionSchedule != null) - { - // Get the current action node - NodeRef currentDispositionAction = null; - if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); - if (!assocs.isEmpty()) - { - currentDispositionAction = assocs.get(0).getChildRef(); - } - } - - if (currentDispositionAction != null) - { - // Move it to the history association - nodeService.moveNode(currentDispositionAction, nodeRef, ASSOC_DISPOSITION_ACTION_HISTORY, ASSOC_DISPOSITION_ACTION_HISTORY); - } - - List dispositionActionDefinitions = dispositionSchedule.getDispositionActionDefinitions(); - DispositionActionDefinition currentDispositionActionDefinition = null; - DispositionActionDefinition nextDispositionActionDefinition = null; - - if (currentDispositionAction == null) - { - if (!dispositionActionDefinitions.isEmpty()) - { - // The next disposition action is the first action - nextDispositionActionDefinition = dispositionActionDefinitions.get(0); - } - } - else - { - // Get the current action - String currentADId = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION_ID); - currentDispositionActionDefinition = dispositionSchedule.getDispositionActionDefinition(currentADId); - - // When the record has multiple disposition schedules the current disposition action may not be found by id - // In this case it will be searched by name - if(currentDispositionActionDefinition == null) - { - String currentADName = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION); - currentDispositionActionDefinition = dispositionSchedule.getDispositionActionDefinitionByName(currentADName); - } - - // Get the next disposition action - int index = currentDispositionActionDefinition.getIndex(); - index++; - if (index < dispositionActionDefinitions.size()) - { - nextDispositionActionDefinition = dispositionActionDefinitions.get(index); - } - } - - if (nextDispositionActionDefinition != null) - { - if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Add the disposition life cycle aspect - nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); - } - - initialiseDispositionAction(nodeRef, nextDispositionActionDefinition); - } - } - - return null; - } - }; - - AuthenticationUtil.runAsSystem(runAsWork); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#cutoffDisposableItem(NodeRef) - */ - @Override - public void cutoffDisposableItem(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // check that the node ref is a filed record or record folder - if (FilePlanComponentKind.RECORD_FOLDER.equals(filePlanService.getFilePlanComponentKind(nodeRef)) || - FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef))) - { - if (!isDisposableItemCutoff(nodeRef) && !isFrozenOrHasFrozenChildren(nodeRef)) - { - if (recordFolderService.isRecordFolder(nodeRef)) - { - // cut off all the children first - for (NodeRef record : recordService.getRecords(nodeRef)) - { - applyCutoff(record); - } - } - - // apply cut off - applyCutoff(nodeRef); - - // remove uncut off aspect if applied - if(nodeService.hasAspect(nodeRef, ASPECT_UNCUT_OFF)) - { - nodeService.removeAspect(nodeRef, ASPECT_UNCUT_OFF); - } - - // close the record folder if it isn't already closed! - 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; - } - }); - } - } - else - { - throw new AlfrescoRuntimeException("unable to perform cutoff, because node is frozen or has frozen children"); - } - } - else - { - throw new AlfrescoRuntimeException("Unable to peform cutoff, because node is not a disposible item. (nodeRef=" + nodeRef.toString() + ")"); - } - } - - public Date getDispositionActionDate(NodeRef record, NodeRef dispositionSchedule, String dispositionActionName) - { - DispositionSchedule ds = new DispositionScheduleImpl(serviceRegistry, nodeService, dispositionSchedule); - List assocs = getInternalNodeService().getChildAssocs(dispositionSchedule); - - if (assocs != null && !assocs.isEmpty()) - { - for (ChildAssociationRef assoc : assocs) - { - if (assoc != null && assoc.getQName().getLocalName().contains(dispositionActionName)) - { - DispositionActionDefinition actionDefinition = ds.getDispositionActionDefinition(assoc.getChildRef().getId()); - - return authenticationUtil.runAsSystem(() -> calculateAsOfDate(record, actionDefinition)); - } - } - } - return null; - } - - public void recalculateNextDispositionStep(NodeRef record) - { - List recordFolders = recordFolderService.getRecordFolders(record); - - DispositionAction nextDispositionAction = getNextDispositionAction(record); - - if (nextDispositionAction != null) - { - NextActionFromDisposition dsNextAction = getNextDispositionAction(record, recordFolders, nextDispositionAction); - if (dsNextAction != null) - { - final NodeRef action = dsNextAction.getNextActionNodeRef(); - final Date dispositionActionDate = dsNextAction.getNextActionDateAsOf(); - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - nodeService.setProperty(action, PROP_DISPOSITION_AS_OF, dispositionActionDate); - return null; - } - }); - } - } - } - - /** - * Helper method to determine if a node is frozen or has frozen children - * - * @param nodeRef Node to be checked - * @return true if the node is frozen or has frozen children, false otherwise - */ - private boolean isFrozenOrHasFrozenChildren(NodeRef nodeRef) - { - boolean result = false; - - if (recordFolderService.isRecordFolder(nodeRef)) - { - result = freezeService.isFrozen(nodeRef) || freezeService.hasFrozenChildren(nodeRef); - } - else if (recordService.isRecord(nodeRef)) - { - result = freezeService.isFrozen(nodeRef); - } - else - { - throw new AlfrescoRuntimeException("The nodeRef '" + nodeRef + "' is neither a record nor a record folder."); - } - - return result; - } - - /** - * Helper method to apply the cut off - * - * @param nodeRef node to cut off - */ - private void applyCutoff(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Apply the cut off aspect and set cut off date - Map cutOffProps = new HashMap<>(1); - cutOffProps.put(PROP_CUT_OFF_DATE, new Date()); - nodeService.addAspect(nodeRef, ASPECT_CUT_OFF, cutOffProps); - - return null; - } - }); - } - - - - /** - * Calculate next disposition action for a record - * - * @param record - * @return next disposition action (name, date) and the disposition associated - */ - - protected NextActionFromDisposition getDispositionActionByNameForRecord(NodeRef record) - { - List recordFolders = recordFolderService.getRecordFolders(record); - DispositionAction nextDispositionAction = getNextDispositionAction(record); - - if (nextDispositionAction == null) - { - DispositionAction lastCompletedDispositionAction = getLastCompletedDispostionAction(record); - if (lastCompletedDispositionAction != null) - { - // all disposition actions upon the given record were completed - return null; - } - - return getFirstDispositionAction(record, recordFolders); - } - else - { - return getNextDispositionAction(record, recordFolders, nextDispositionAction); - } - } - - /** - * Calculate next disposition action when the record already has one - * @param recordFolders - * @param nextDispositionAction - * @return next disposition action and the associated disposition schedule - */ - private NextActionFromDisposition getNextDispositionAction(NodeRef record, List recordFolders, DispositionAction nextDispositionAction) - { - String recordNextDispositionActionName = nextDispositionAction.getName(); - Date recordNextDispositionActionDate = nextDispositionAction.getAsOfDate(); - // We're looking for the latest date, so initially start with a very early one. - Date nextDispositionActionDate = new Date(Long.MIN_VALUE); - NodeRef dispositionNodeRef = null; - - // Find the latest "disposition as of" date from all the schedules this record is subject to. - for (NodeRef folder : recordFolders) - { - NodeRef dsNodeRef = getDispositionScheduleImpl(folder); - if (dsNodeRef != null) - { - Date dispActionDate = getDispositionActionDate(record, dsNodeRef, recordNextDispositionActionName); - if (dispActionDate == null || (nextDispositionActionDate != null - && nextDispositionActionDate.before(dispActionDate))) - { - nextDispositionActionDate = dispActionDate; - dispositionNodeRef = dsNodeRef; - if (dispActionDate == null) - { - // Treat null as the latest date possible (so stop searching further). - break; - } - } - } - } - if (dispositionNodeRef == null) - { - return null; - } - WriteMode mode = determineWriteMode(recordNextDispositionActionDate, nextDispositionActionDate); - - return new NextActionFromDisposition(dispositionNodeRef, nextDispositionAction.getNodeRef(), - recordNextDispositionActionName, nextDispositionActionDate, mode); - } - - /** - * Determine what should be updated for an existing disposition schedule impl. We only update the date if the - * existing date is earlier than the calculated one. - * - * @param recordNextDispositionActionDate The next action date found on the record node (or folder node). - * @param nextDispositionActionDate The next action date calculated from the current disposition schedule(s) - * affecting the node. - * @return READ_ONLY if nothing should be updated, or DATE_ONLY if the date needs updating. - */ - private WriteMode determineWriteMode(Date recordNextDispositionActionDate, Date nextDispositionActionDate) - { - // Treat null dates as being the latest possible date. - Date maxDate = new Date(Long.MAX_VALUE); - Date recordDate = (recordNextDispositionActionDate != null ? recordNextDispositionActionDate : maxDate); - Date calculatedDate = (nextDispositionActionDate != null ? nextDispositionActionDate : maxDate); - - // We only need to update the date if the current one is too early. - if (recordDate.before(calculatedDate)) - { - return WriteMode.DATE_ONLY; - } - else - { - return WriteMode.READ_ONLY; - } - } - - /** - * Calculate first disposition action when the record doesn't have one - * @param recordFolders - * @return next disposition action and the associated disposition schedule - */ - private NextActionFromDisposition getFirstDispositionAction(NodeRef record, List recordFolders) - { - NodeRef newAction = null; - String newDispositionActionName = null; - // We're looking for the latest date, so start with a very early one. - Date newDispositionActionDateAsOf = new Date(Long.MIN_VALUE); - NodeRef dispositionNodeRef = null; - for (NodeRef folder : recordFolders) - { - NodeRef folderDS = getDispositionScheduleImpl(folder); - if (folderDS != null) - { - DispositionSchedule ds = new DispositionScheduleImpl(serviceRegistry, nodeService, folderDS); - List dispositionActionDefinitions = ds.getDispositionActionDefinitions(); - - if (dispositionActionDefinitions != null && dispositionActionDefinitions.size() > 0) - { - DispositionActionDefinition firstDispositionActionDef = dispositionActionDefinitions.get(0); - dispositionNodeRef = folderDS; - - if (newAction == null) - { - NodeRef recordOrFolder = record; - if (!ds.isRecordLevelDisposition()) - { - recordOrFolder = folder; - } - DispositionAction firstDispositionAction = initialiseDispositionAction(recordOrFolder, firstDispositionActionDef); - newAction = firstDispositionAction.getNodeRef(); - newDispositionActionName = (String)nodeService.getProperty(newAction, PROP_DISPOSITION_ACTION_NAME); - newDispositionActionDateAsOf = firstDispositionAction.getAsOfDate(); - } - else if (firstDispositionActionDef.getPeriod() != null) - { - Date firstActionDate = calculateAsOfDate(record, firstDispositionActionDef); - if (firstActionDate == null || (newDispositionActionDateAsOf != null - && newDispositionActionDateAsOf.before(firstActionDate))) - { - newDispositionActionName = firstDispositionActionDef.getName(); - newDispositionActionDateAsOf = firstActionDate; - if (firstActionDate == null) - { - // Treat null as the latest date possible, so there's no point searching further. - break; - } - } - } - } - } - } - if (newDispositionActionName == null || dispositionNodeRef == null || newAction == null) - { - return null; - } - return new NextActionFromDisposition(dispositionNodeRef, newAction, - newDispositionActionName, newDispositionActionDateAsOf, WriteMode.DATE_AND_NAME); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/NextActionFromDisposition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/NextActionFromDisposition.java deleted file mode 100644 index 24d61cea6a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/NextActionFromDisposition.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionServiceImpl.WriteMode; -import org.alfresco.service.cmr.repository.NodeRef; - -public class NextActionFromDisposition -{ - public NextActionFromDisposition(NodeRef dispositionNodeRef, NodeRef nextActionNodeRef, String nextActionName, Date nextActionDateAsOf, - WriteMode writeMode) - { - super(); - this.dispositionNodeRef = dispositionNodeRef; - this.nextActionNodeRef = nextActionNodeRef; - this.nextActionName = nextActionName; - this.nextActionDateAsOf = nextActionDateAsOf; - this.writeMode = writeMode; - } - - private NodeRef dispositionNodeRef; - - private NodeRef nextActionNodeRef; - - private String nextActionName; - - private Date nextActionDateAsOf; - - private WriteMode writeMode; - - public WriteMode getWriteMode() - { - return writeMode; - } - - public void setWriteMode(WriteMode writeMode) - { - this.writeMode = writeMode; - } - - public NodeRef getNextActionNodeRef() - { - return nextActionNodeRef; - } - - public void setNextActionNodeRef(NodeRef nextActionNodeRef) - { - this.nextActionNodeRef = nextActionNodeRef; - } - - public NodeRef getDispositionNodeRef() - { - return dispositionNodeRef; - } - - public void setDispositionNodeRef(NodeRef dispositionNodeRef) - { - this.dispositionNodeRef = dispositionNodeRef; - } - - public String getNextActionName() - { - return nextActionName; - } - - public void setNextActionName(String nextActionName) - { - this.nextActionName = nextActionName; - } - - public Date getNextActionDateAsOf() - { - return nextActionDateAsOf; - } - - public void setNextActionDateAsOf(Date nextActionDateAsOf) - { - this.nextActionDateAsOf = nextActionDateAsOf; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java deleted file mode 100644 index b5610d6736..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition.property; - -import static org.apache.commons.lang3.BooleanUtils.isNotTrue; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -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.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Disposition property implementation bean. - * - * @author Roy Wetherall - */ -@BehaviourBean -public class DispositionProperty extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** Property QName */ - private QName propertyName; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Indicates whether this disposition property applies to a folder level disposition */ - private boolean appliesToFolderLevel = true; - - /** Indicates whether this disposition property applies to a record level disposition */ - private boolean appliesToRecordLevel = true; - - /** Set of disposition actions this property does not apply to */ - private Set excludedDispositionActions; - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param propertyName property name (as string) - */ - public void setName(String propertyName) - { - this.propertyName = QName.createQName(propertyName, namespaceService); - } - - /** - * @return property QName - */ - public QName getQName() - { - return this.propertyName; - } - - /** - * @return property definition - */ - public PropertyDefinition getPropertyDefinition() - { - return dictionaryService.getProperty(propertyName); - } - - /** - * @param excludedDispositionActions list of excluded disposition actions - */ - public void setExcludedDispositionActions(Set excludedDispositionActions) - { - this.excludedDispositionActions = excludedDispositionActions; - } - - /** - * @param appliesToFolderLevel - */ - public void setAppliesToFolderLevel(boolean appliesToFolderLevel) - { - this.appliesToFolderLevel = appliesToFolderLevel; - } - - /** - * @param appliesToRecordLevel - */ - public void setAppliesToRecordLevel(boolean appliesToRecordLevel) - { - this.appliesToRecordLevel = appliesToRecordLevel; - } - - /** - * Bean initialisation method - */ - public void init() - { - // register with disposition service - dispositionService.registerDispositionProperty(this); - } - - /** - * Indicates whether the disposition property applies given the context. - * - * @param isRecordLevel true if record level disposition schedule, false otherwise - * @param dispositionAction disposition action name - * @return boolean true if applies, false otherwise - */ - public boolean applies(boolean isRecordLevel, String dispositionAction) - { - boolean result = false; - - if ((isRecordLevel && appliesToRecordLevel) || - (!isRecordLevel && appliesToFolderLevel)) - { - if (excludedDispositionActions != null && excludedDispositionActions.size() != 0) - { - if (!excludedDispositionActions.contains(dispositionAction)) - { - result = true; - } - } - else - { - result = true; - } - } - - return result; - } - - /** - * @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 = "rma:dispositionLifecycle", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties( - final NodeRef nodeRef, - final Map before, - final Map after) - { - if (nodeService.exists(nodeRef)) - { - // has the property we care about changed? - if (isPropertyUpdated(before, after)) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - Date updatedDateValue = (Date)after.get(propertyName); - if (updatedDateValue != null) - { - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (dispositionAction != null) - { - DispositionActionDefinition daDefinition = dispositionAction.getDispositionActionDefinition(); - // check whether the next disposition action matches this disposition property - if (daDefinition != null && propertyName.equals(daDefinition.getPeriodProperty())) - { - Period period = daDefinition.getPeriod(); - Date updatedAsOf = period.getNextDate(updatedDateValue); - - // update asOf date on the disposition action based on the new property value - NodeRef daNodeRef = dispositionAction.getNodeRef(); - // Don't overwrite a manually set "disposition as of" date. - if (isNotTrue((Boolean) nodeService.getProperty(daNodeRef, PROP_MANUALLY_SET_AS_OF))) - { - nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf); - } - } - } - } - else - { - // throw an exception if the property is being 'cleared' - if (before.get(propertyName) != null) - { - throw new AlfrescoRuntimeException( - "Error updating property " + propertyName.toPrefixString(namespaceService) + - " to null, because property is being used to determine a disposition date."); - } - } - - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - } - } - } - - /** - * Indicates whether the property has been updated or not. - * - * @param before - * @param after - * @return - */ - private boolean isPropertyUpdated(Map before, Map after) - { - Serializable beforeValue = before.get(propertyName); - Serializable afterValue = after.get(propertyName); - - return !Objects.equals(beforeValue, afterValue); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java deleted file mode 100644 index de13faa772..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dod5015; - -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; - -/** - * Bootstrap bean that registers the dod:filePlan for creation when - * a dod:site is created. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DOD5015FilePlanTypeBootstrap implements DOD5015Model -{ - /** RM site type bean */ - private RmSiteType rmSiteType; - - /** - * @param rmSiteType RM site type bean - */ - public void setRmSiteType(RmSiteType rmSiteType) - { - this.rmSiteType = rmSiteType; - } - - /** - * Init method - */ - public void init() - { - // register dod file plan type for the dod site type - rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java deleted file mode 100644 index 6c93d62ed3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dod5015; - -import org.alfresco.service.namespace.QName; - - -/** - * Helper class containing DOD 5015 model qualified names - * - * @author Roy Wetherall - */ -public interface DOD5015Model -{ - // Namespace details - String DOD_URI = "http://www.alfresco.org/model/dod5015/1.0"; - String DOD_PREFIX = "dod"; - - // DOD Site - QName TYPE_DOD_5015_SITE = QName.createQName(DOD_URI, "site"); - - // DOD File Plan - QName TYPE_DOD_5015_FILE_PLAN = QName.createQName(DOD_URI, "filePlan"); - - // DOD Record - QName ASPECT_DOD_5015_RECORD = QName.createQName(DOD_URI, "dod5015record"); - QName PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator"); - QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization"); - QName PROP_PUBLICATION_DATE = QName.createQName(DOD_URI, "publicationDate"); - QName PROP_MEDIA_TYPE = QName.createQName(DOD_URI, "mediaType"); - QName PROP_FORMAT = QName.createQName(DOD_URI, "format"); - QName PROP_DATE_RECEIVED = QName.createQName(DOD_URI, "dateReceived"); - QName PROP_ADDRESS = QName.createQName(DOD_URI, "address"); - QName PROP_OTHER_ADDRESS = QName.createQName(DOD_URI, "otherAddress"); - - // Scanned Record - QName ASPECT_SCANNED_RECORD = QName.createQName(DOD_URI, "scannedRecord"); - QName PROP_SCANNED_FORMAT = QName.createQName(DOD_URI, "scannedFormat"); - QName PROP_SCANNED_FORMAT_VERSION = QName.createQName(DOD_URI, "scannedFormatVersion"); - QName PROP_RESOLUTION_X = QName.createQName(DOD_URI, "resolutionX"); - QName PROP_RESOLUTION_Y = QName.createQName(DOD_URI, "resolutionY"); - QName PROP_SCANNED_BIT_DEPTH = QName.createQName(DOD_URI, "scannedBitDepth"); - - // PDF Record - QName ASPECT_PDF_RECORD = QName.createQName(DOD_URI, "pdfRecord"); - QName PROP_PRODUCING_APPLICATION = QName.createQName(DOD_URI, "producingApplication"); - QName PROP_PRODUCING_APPLICATION_VERSION = QName.createQName(DOD_URI, "producingApplicationVersion"); - QName PROP_PDF_VERSION = QName.createQName(DOD_URI, "pdfVersion"); - QName PROP_CREATING_APPLICATION = QName.createQName(DOD_URI, "creatingApplication"); - QName PROP_DOCUMENT_SECURITY_SETTINGS = QName.createQName(DOD_URI, "documentSecuritySettings"); - - // Digital Photograph Record - QName ASPECT_DIGITAL_PHOTOGRAPH_RECORD = QName.createQName(DOD_URI, "digitalPhotographRecord"); - QName PROP_CAPTION = QName.createQName(DOD_URI, "caption"); - QName PROP_PHOTOGRAPHER = QName.createQName(DOD_URI, "photographer"); - QName PROP_COPYRIGHT = QName.createQName(DOD_URI, "copyright"); - QName PROP_BIT_DEPTH = QName.createQName(DOD_URI, "bitDepth"); - QName PROP_IMAGE_SIZE_X = QName.createQName(DOD_URI, "imageSizeX"); - QName PROP_IMAGE_SIZE_Y = QName.createQName(DOD_URI, "imageSizeY"); - QName PROP_IMAGE_SOURCE = QName.createQName(DOD_URI, "imageSource"); - QName PROP_COMPRESSION = QName.createQName(DOD_URI, "compression"); - QName PROP_ICC_ICM_PROFILE = QName.createQName(DOD_URI, "iccIcmProfile"); - QName PROP_EXIF_INFORMATION = QName.createQName(DOD_URI, "exifInformation"); - - // Web Record - QName ASPECT_WEB_RECORD = QName.createQName(DOD_URI, "webRecord"); - QName PROP_WEB_FILE_NAME = QName.createQName(DOD_URI, "webFileName"); - QName PROP_WEB_PLATFORM = QName.createQName(DOD_URI, "webPlatform"); - QName PROP_WEBSITE_NAME = QName.createQName(DOD_URI, "webSiteName"); - QName PROP_WEB_SITE_URL = QName.createQName(DOD_URI, "webSiteURL"); - QName PROP_CAPTURE_METHOD = QName.createQName(DOD_URI, "captureMethod"); - QName PROP_CAPTURE_DATE = QName.createQName(DOD_URI, "captureDate"); - QName PROP_CONTACT = QName.createQName(DOD_URI, "contact"); - QName PROP_CONTENT_MANAGEMENT_SYSTEM = QName.createQName(DOD_URI, "contentManagementSystem"); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java deleted file mode 100644 index 32cfb2807a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.dod5015.model.dod.aspect; - -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.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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; - -/** - * dod:dod5015record behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -public class DOD5015RecordAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnAddAspectPolicy, - DOD5015Model -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Ensure that the DOD record aspect meta-data is applied. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Behaviour - ( - kind=BehaviourKind.CLASS, - type="rma:record", - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - @Override - public void onAddAspect(NodeRef nodeRef, QName aspect) - { - if (nodeService.exists(nodeRef) && - !nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) && - isDODFilePlan(nodeRef)) - { - nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null); - } - } - - /** - * Helper method to indicate whether the records file plan is a DOD one or not. - * - * @param record record node reference - * @return boolean true if in DOD file plan, false otherwise - */ - private boolean isDODFilePlan(NodeRef record) - { - boolean result = false; - - NodeRef filePlan = filePlanService.getFilePlan(record); - if (filePlan != null && nodeService.exists(filePlan)) - { - result = TYPE_DOD_5015_FILE_PLAN.equals(nodeService.getType(filePlan)); - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java deleted file mode 100644 index 79b1dd2786..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.email; - -import java.util.List; -import java.util.Set; - -/** - * Custom EMail Mapping Service - */ -public interface CustomEmailMappingService -{ - /** - * Get the list of custom mappings - * - * @return {@link Set}<{@link CustomMapping}> - */ - Set getCustomMappings(); - - /** - * Add custom mapping - * - * @param from - * @param to - */ - void addCustomMapping(String from, String to); - - /** - * Delete custom mapping - * - * @param from - * @param to - */ - void deleteCustomMapping(String from, String to); - - /** - * Gets the list of email mapping keys - * - * @return Email mapping keys - */ - List getEmailMappingKeys(); - - /** - * Registers an email mapping key with the existing list of email mapping keys - * - * @param emailMappingKey emailMappingKey to register - */ - void registerEMailMappingKey(String emailMappingKey); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java deleted file mode 100644 index dd4bb8f1ac..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.email; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -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.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.content.metadata.RFC822MetadataExtracter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -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.NamespacePrefixResolver; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.context.ApplicationEvent; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; - -/** - * Custom Email Mapping Service - */ -public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean implements CustomEmailMappingService -{ - /** Logger */ - private static Log logger = LogFactory.getLog(CustomEmailMappingServiceImpl.class); - - /** Node reference's to configuration elements */ - private static final NodeRef CONFIG_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_emailmapping_config"); - private static final NodeRef CONFIG_FOLDER_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - /** Config file name */ - private static final String CONFIG_NAME = "imapConfig.json"; - - /** Default custom mappings (TODO move to spring config) */ - private static final CustomMapping[] DEFAULT_MAPPINGS = - { - new CustomMapping("Date", "dod:dateReceived"), - new CustomMapping("messageTo", "dod:address"), - new CustomMapping("messageFrom", "dod:originator"), - new CustomMapping("messageSent", "dod:publicationDate"), - new CustomMapping("messageCc", "dod:otherAddress") - }; - - /** Extractor */ - private RFC822MetadataExtracter extracter; - - /** Services */ - private NodeService nodeService; - private NamespacePrefixResolver nspr; - private ContentService contentService; - private TransactionService transactionService; - - /** Transient set of custom mappings */ - private Set customMappings; - - /** List of email mapping keys */ - private List emailMappingKeys; - - /** - * @param nspr namespace service - */ - public void setNamespacePrefixResolver(NamespacePrefixResolver nspr) - { - this.nspr = nspr; - } - - /** - * @param extractor extractor component - */ - public void setExtracter(RFC822MetadataExtracter extractor) - { - this.extracter = extractor; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * @param emailMappingKeys email mapping keys - */ - public void setEmailMappingKeys(List emailMappingKeys) - { - this.emailMappingKeys = emailMappingKeys; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getCustomMappings() - */ - public Set getCustomMappings() - { - if (customMappings == null) - { - // if we have a config file - if (nodeService.exists(CONFIG_NODE_REF)) - { - // load the contents of the config file - customMappings = loadConfig(); - } - else - { - customMappings = new HashSet<>(); - - // load the contents of the extractors property file - Map> currentMapping = extracter.getCurrentMapping(); - for (Map.Entry> entry : currentMapping.entrySet()) - { - Set set = entry.getValue(); - - for (QName qname : set) - { - CustomMapping value = new CustomMapping(); - value.setFrom(entry.getKey()); - QName resolvedQname = qname.getPrefixedQName(nspr); - value.setTo(resolvedQname.toPrefixString()); - customMappings.add(value); - } - } - - // if we have an old config file - NodeRef oldConfigNode = getOldConfigNode(); - if (oldConfigNode != null) - { - // load the contents of the old config file - Set oldMappings = readOldConfig(oldConfigNode); - customMappings.addAll(oldMappings); - } - - // load the hard coded mappings - for(CustomMapping mapping : DEFAULT_MAPPINGS) - { - customMappings.add(mapping); - } - - // create the config file - saveConfig(customMappings); - } - } - - return customMappings; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#addCustomMapping(java.lang.String, java.lang.String) - */ - public void addCustomMapping(String from, String to) - { - if (StringUtils.isBlank(from) || StringUtils.isBlank(to)) - { - throw new AlfrescoRuntimeException("Invalid values for from/to."); - } - - // create custom mapping - CustomMapping customMapping = new CustomMapping(from, to); - - // check whether we already have this mapping or not - Set customMappings = getCustomMappings(); - if (customMappings.contains(customMapping)) - { - throw new AlfrescoRuntimeException("Can not add custom email mapping, because duplicate mapping already exists."); - } - - // else add the custom mapping (since we have already called getCustomMapping we can be sure - // the member variable is populated) - customMappings.add(customMapping); - - // save the changes into the config file - saveConfig(customMappings); - - // update the extractors configuration - updateExtractor(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#deleteCustomMapping(java.lang.String, java.lang.String) - */ - public void deleteCustomMapping(String from, String to) - { - if (StringUtils.isBlank(from) || StringUtils.isBlank(to)) - { - throw new AlfrescoRuntimeException("Invalid values for from/to."); - } - - // create custom mapping - CustomMapping customMapping = new CustomMapping(from, to); - - // check whether we already have this mapping or not - Set customMappings = getCustomMappings(); - if (customMappings.contains(customMapping)) - { - // else remove the custom mapping (since we have already called getCustomMapping we can be sure - // the member variable is populated) - customMappings.remove(customMapping); - - // save the changes into the config file - saveConfig(customMappings); - - // update the extractors configuration - updateExtractor(); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getEmailMappingKeys() - */ - @Override - public List getEmailMappingKeys() - { - return emailMappingKeys; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#registerEMailMappingKey(java.lang.String) - */ - @Override - public void registerEMailMappingKey(String emailMappingKey) - { - ParameterCheck.mandatoryString("emailMappingKey", emailMappingKey); - - emailMappingKeys.add(emailMappingKey); - } - - /** - * Updates the extractor with the custom configuration. - */ - private void updateExtractor() - { - // convert the mapping information into the form understood by the extractor - Map> newMapping = new HashMap<>(17); - for(CustomMapping mapping : getCustomMappings()) - { - QName newQName = QName.createQName(mapping.getTo(), nspr); - Set values = newMapping.get(mapping.getFrom()); - if(values == null) - { - values = new HashSet<>(); - newMapping.put(mapping.getFrom(), values); - } - values.add(newQName); - } - - // update the metadata extracter - extracter.setMapping(newMapping); - } - - /** - * Loads the custom mappings from the configuration file. - * - * @return - */ - private Set loadConfig() - { - Set result = new HashSet<>(); - ContentReader cr = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); - if (cr != null) - { - String text = cr.getContentString(); - - try - { - JSONArray jsonArray = new JSONArray(new JSONTokener(text)); - for(int i = 0 ; i < jsonArray.length(); i++) - { - JSONObject obj = jsonArray.getJSONObject(i); - CustomMapping mapping = new CustomMapping(); - mapping.setFrom(obj.getString("from")); - mapping.setTo(obj.getString("to")); - result.add(mapping); - } - } - catch (JSONException je) - { - throw new AlfrescoRuntimeException("Unable to read custom email configuration", je); - } - } - - return result; - } - - /** - * - * @param customMappingsToSave - */ - private void saveConfig(Set customMappingsToSave) - { - if (!nodeService.exists(CONFIG_NODE_REF)) - { - // create the config node - Map properties = new HashMap<>(2); - properties.put(ContentModel.PROP_NAME, CONFIG_NAME); - properties.put(ContentModel.PROP_NODE_UUID, CONFIG_NODE_REF.getId()); - nodeService.createNode( - CONFIG_FOLDER_NODE_REF, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, CONFIG_NAME), - ContentModel.TYPE_CONTENT, - properties); - } - - // build JSON array of mappings - JSONArray jsonMappings = new JSONArray(); - try - { - for(CustomMapping mapping : customMappingsToSave) - { - JSONObject obj = new JSONObject(); - obj.put("from", mapping.getFrom()); - obj.put("to", mapping.getTo()); - jsonMappings.put(obj); - } - } - catch (JSONException je) - { - throw new AlfrescoRuntimeException("Unable to create JSON email mapping configuration during save.", je); - } - - // update the content - ContentWriter writer = this.contentService.getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(jsonMappings.toString()); - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onBootstrap(ApplicationEvent event) - { - // run as System on bootstrap - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - try - { - // update the extractor with the custom mappings - updateExtractor(); - } - catch (RuntimeException e) - { - // log a warning - if (logger.isWarnEnabled()) - { - logger.warn(e.getMessage()); - } - - // reset the mappings - customMappings = null; - - // rethrow - throw e; - } - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onShutdown(ApplicationEvent arg0) - { - // No implementation - } - - /** - * Helper method to get the old configuration node. This is used during the migration - * from 1.0 to 2.0. - *

- * Returns null if it does not exist. - * - * @return {@link NodeRef} node reference of the old configuration node, null otherwise - */ - private NodeRef getOldConfigNode() - { - NodeRef rootNode = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_EMAIL_CONFIG, CONFIG_NAME); - } - - /** - * Reads the old configuration node. This is used during the migration from 1.0 to 2.0. - * - * @param nodeRef the old configuration node reference - * @return {@link Set}<{@link CustomMapping}> set of the custom mappings stored in the old configuration - */ - private Set readOldConfig(NodeRef nodeRef) - { - Set newMappings = new HashSet<>(); - - ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - if (cr != null) - { - String text = cr.getContentString(); - - try - { - JSONArray jsonArray = new JSONArray(new JSONTokener(text)); - for(int i = 0 ; i < jsonArray.length(); i++) - { - JSONObject obj = jsonArray.getJSONObject(i); - CustomMapping mapping = new CustomMapping(); - mapping.setFrom(obj.getString("from")); - mapping.setTo(obj.getString("to")); - newMappings.add(mapping); - } - return newMappings; - } - catch (JSONException je) - { - logger.warn("unable to read custom email configuration", je); - return newMappings; - } - - } - return newMappings; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java deleted file mode 100644 index fa260738b0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.email; - -/** - * Custom EMail Mapping - */ -public class CustomMapping -{ - private String from; - private String to; - - /** - * Default constructor. - */ - public CustomMapping() - { - } - - /** - * Default constructor. - * @param from - * @param to - */ - public CustomMapping(String from, String to) - { - this.from = from; - this.to = to; - } - - public void setFrom(String from) - { - this.from = from; - } - - public String getFrom() - { - return from; - } - - public void setTo(String to) - { - this.to = to; - } - - public String getTo() - { - return to; - } - - public int hashCode() - { - if(from != null && to != null) - { - return (from + to).hashCode(); - } - else - { - return 1; - } - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - - final CustomMapping other = (CustomMapping) obj; - - if (!from.equals(other.getFrom())) - { - return false; - } - if (!to.equals(other.getTo())) - { - return false; - } - return true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java deleted file mode 100644 index 7ca25747bd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.email; - -import java.util.List; - -/** - * Bootstrap bean that indicates that the specified mappings are customisable - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class CustomisableEmailMappingKeyBootstrap -{ - /** List of mappings to register as customisable */ - private List customisable; - - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * @param customisable list of mappings to register as customisable - */ - public void setCustomisable(List customisable) - { - this.customisable = customisable; - } - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * Bean initialisation method - */ - public void init() - { - for (String customEmailMappingKey : customisable) - { - customEmailMappingService.registerEMailMappingKey(customEmailMappingKey); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java deleted file mode 100644 index 2f0f5ff428..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.email; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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.QName; - -/** - * Extended RFC822 Metadata Extractor that is sensitive to whether we are in a RM - * site or not. - * - * @author Roy Wetherall - */ -public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.RFC822MetadataExtracter -{ - /** Reference to default properties */ - private static final String PROPERTIES_URL = "alfresco/metadata/RFC822MetadataExtracter.properties"; - - /** Node service */ - private NodeService nodeService; - - /** - * Sets the node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#filterSystemProperties(java.util.Map, java.util.Map) - */ - @Override - protected void filterSystemProperties(Map systemProperties, Map targetProperties) - { - NodeRef nodeRef = getNodeRef(targetProperties); - if(nodeRef == null) - { - return; - } - - // Remove record properties from non-record nodes - if (!nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - { - // Remove all rm namespace properties from the system map - Map clone = new HashMap<>(systemProperties); - for (QName propName : clone.keySet()) - { - if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI())) - { - systemProperties.remove(propName); - } - } - } - - // Remove dod5015 properties from non-dod5015 nodes - if (!nodeService.hasAspect(nodeRef, DOD5015Model.ASPECT_DOD_5015_RECORD)) - { - // Remove all dod5015 namespace properties from the system map - Map clone = new HashMap<>(systemProperties); - for (QName propName : clone.keySet()) - { - if (DOD5015Model.DOD_URI.equals(propName.getNamespaceURI())) - { - systemProperties.remove(propName); - } - } - } - } - - /** - * @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#getDefaultMapping() - */ - protected Map> getDefaultMapping() - { - // Attempt to load the properties - return readMappingProperties(PROPERTIES_URL); - } - - /** - * Given a set of properties, try and retrieve the node reference - * @param properties node properties - * @return NodeRef null if none, otherwise valid node reference - */ - private NodeRef getNodeRef(Map properties) - { - NodeRef result = null; - - // Get the elements of the node reference - String storeProto = (String)properties.get(ContentModel.PROP_STORE_PROTOCOL); - String storeId = (String)properties.get(ContentModel.PROP_STORE_IDENTIFIER); - String nodeId = (String)properties.get(ContentModel.PROP_NODE_UUID); - - if (storeProto != null && storeProto.length() != 0 && - storeId != null && storeId.length() != 0 && - nodeId != null && nodeId.length() != 0) - - { - // Create the node reference - result = new NodeRef(new StoreRef(storeProto, storeId), nodeId); - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java deleted file mode 100644 index 8ebe6f874a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import java.util.Date; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Event completion details - * - * @author Roy Wetherall - */ -public class EventCompletionDetails -{ - /** node reference */ - private NodeRef nodeRef; - - /** event name */ - private String eventName; - private String eventLabel; - private boolean eventExecutionAutomatic; - private boolean eventComplete; - private Date eventCompletedAt; - private String eventCompletedBy; - - - /** - * Constructor - * - * @param nodeRef node reference - * @param eventName event name - * @param eventLabel event label - * @param eventExecutionAutomatic indicates whether the event is executed automatically or not - * @param eventComplete indicates whether the event is complete or not - * @param eventCompletedAt when the event was completed - * @param eventCompletedBy who completed the event - */ - public EventCompletionDetails( NodeRef nodeRef, - String eventName, - String eventLabel, - boolean eventExecutionAutomatic, - boolean eventComplete, - Date eventCompletedAt, - String eventCompletedBy) - { - this.nodeRef = nodeRef; - this.eventName = eventName; - this.eventLabel = eventLabel; - this.eventExecutionAutomatic = eventExecutionAutomatic; - this.eventComplete = eventComplete; - this.eventCompletedAt = eventCompletedAt; - this.eventCompletedBy = eventCompletedBy; - } - - /** - * @return the node reference - */ - public NodeRef getNodeRef() - { - return nodeRef; - } - - /** - * @return the eventName - */ - public String getEventName() - { - return eventName; - } - - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) - { - this.eventName = eventName; - } - - /** - * @return The display label of the event - */ - public String getEventLabel() - { - return this.eventLabel; - } - - /** - * @return the eventExecutionAutomatic - */ - public boolean isEventExecutionAutomatic() - { - return eventExecutionAutomatic; - } - - /** - * @param eventExecutionAutomatic the eventExecutionAutomatic to set - */ - public void setEventExecutionAutomatic(boolean eventExecutionAutomatic) - { - this.eventExecutionAutomatic = eventExecutionAutomatic; - } - - /** - * @return the eventComplete - */ - public boolean isEventComplete() - { - return eventComplete; - } - - /** - * @param eventComplete the eventComplete to set - */ - public void setEventComplete(boolean eventComplete) - { - this.eventComplete = eventComplete; - } - - /** - * @return the eventCompletedAt - */ - public Date getEventCompletedAt() - { - return eventCompletedAt; - } - - /** - * @param eventCompletedAt the eventCompletedAt to set - */ - public void setEventCompletedAt(Date eventCompletedAt) - { - this.eventCompletedAt = eventCompletedAt; - } - - /** - * @return the eventCompletedBy - */ - public String getEventCompletedBy() - { - return eventCompletedBy; - } - - /** - * @param eventCompletedBy the eventCompletedBy to set - */ - public void setEventCompletedBy(String eventCompletedBy) - { - this.eventCompletedBy = eventCompletedBy; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java deleted file mode 100644 index d4c8608087..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; -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.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * On reference create event type - * - * @author Roy Wetherall - */ -@BehaviourBean -public class OnReferenceCreateEventType extends SimpleRecordsManagementEventTypeImpl - implements RecordsManagementModel, - OnCreateReference -{ - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Reference */ - private QName reference; - - /** - * @param dispositionService the disposition service to set - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordsManagementActionService the recordsManagementActionService to set - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * Set the reference - * - * @param reference - */ - public void setReferenceName(String reference) - { - this.reference = QName.createQName(reference); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl#isAutomaticEvent() - */ - @Override - public boolean isAutomaticEvent() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:record", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateReference(final NodeRef fromNodeRef, final NodeRef toNodeRef, final QName reference) - { - AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // Check whether it is the reference type we care about - if (reference.equals(OnReferenceCreateEventType.this.reference)) - { - DispositionAction da = dispositionService.getNextDispositionAction(toNodeRef); - if (da != null) - { - List events = da.getEventCompletionDetails(); - for (EventCompletionDetails event : events) - { - RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName()); - if (!event.isEventComplete() && - rmEvent.getType().equals(getName())) - { - // Complete the event - Map params = new HashMap<>(3); - params.put(CompleteEventAction.PARAM_EVENT_NAME, event.getEventName()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_BY, AuthenticationUtil.getFullyAuthenticatedUser()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_AT, new Date()); - recordsManagementActionService.executeRecordsManagementAction(toNodeRef, "completeEvent", params); - - break; - } - } - } - } - - return null; - } - }; - - AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminUserName()); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java deleted file mode 100644 index 3d7ec3ec80..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import java.io.Serializable; -import java.util.Date; -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.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -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.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -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; - -/** - * Behaviour executed when a references record is actioned upon. - * - * @author Roy Wetherall - */ -@BehaviourBean -public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEventTypeImpl - implements RecordsManagementModel, - BeforeRMActionExecution - -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Node service */ - private NodeService nodeService; - - /** Record service */ - private RecordService recordService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Action name */ - private String actionName; - - /** Reference */ - private QName reference; - - /** - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordsManagementActionService the recordsManagementActionService to set - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param reference reference name - */ - public void setReferenceName(String reference) - { - this.reference = QName.createQName(reference); - } - - /** - * @param actionName action name - */ - public void setActionName(String actionName) - { - this.actionName = actionName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl#isAutomaticEvent() - */ - @Override - public boolean isAutomaticEvent() - { - return true; - } - - /** - * Before action exeuction behaviour. - * - * @param nodeRef - * @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) - { - AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - if (nodeService.exists(nodeRef) && name.equals(actionName)) - { - QName type = nodeService.getType(nodeRef); - if (TYPE_TRANSFER.equals(type)) - { - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - processRecordFolder(assoc.getChildRef()); - } - } - else - { - processRecordFolder(nodeRef); - } - } - - return null; - } - }; - - AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminUserName()); - - } - - private void processRecordFolder(NodeRef recordFolder) - { - if (recordService.isRecord(recordFolder)) - { - processRecord(recordFolder); - } - else if (recordFolderService.isRecordFolder(recordFolder)) - { - for (NodeRef record : recordService.getRecords(recordFolder)) - { - processRecord(record); - } - } - } - - private void processRecord(NodeRef record) - { - List fromAssocs = nodeService.getTargetAssocs(record, RegexQNamePattern.MATCH_ALL); - for (AssociationRef fromAssoc : fromAssocs) - { - if (reference.equals(fromAssoc.getTypeQName())) - { - NodeRef nodeRef = fromAssoc.getTargetRef(); - doEventComplete(nodeRef); - } - } - - List toAssocs = nodeService.getSourceAssocs(record, RegexQNamePattern.MATCH_ALL); - for (AssociationRef toAssoc : toAssocs) - { - if (reference.equals(toAssoc.getTypeQName())) - { - NodeRef nodeRef = toAssoc.getSourceRef(); - doEventComplete(nodeRef); - } - } - } - - private void doEventComplete(NodeRef nodeRef) - { - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - List events = da.getEventCompletionDetails(); - for (EventCompletionDetails event : events) - { - RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName()); - if (!event.isEventComplete() && - rmEvent.getType().equals(getName())) - { - // Complete the event - Map params = new HashMap<>(3); - params.put(CompleteEventAction.PARAM_EVENT_NAME, event.getEventName()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_BY, AuthenticationUtil.getFullyAuthenticatedUser()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_AT, new Date()); - recordsManagementActionService.executeRecordsManagementAction(nodeRef, "completeEvent", params); - - break; - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java deleted file mode 100644 index 8d6d66e2dc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.util.ParameterCheck; - -/** - * Records management event - * - * @author Roy Wetherall - * @since 1.0 - */ -@AlfrescoPublicApi -public class RecordsManagementEvent -{ - /** Records management event type */ - private RecordsManagementEventType type; - - /** Records management event name */ - private String name; - - /** Records management display label */ - private String displayLabel; - - /** - * Constructor - * - * @param type event type - * @param name event name - * @param displayLabel event display label - */ - public RecordsManagementEvent(RecordsManagementEventType type, String name, String displayLabel) - { - ParameterCheck.mandatory("type", type); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("displayLabel", displayLabel); - - this.type = type; - this.name = name; - this.displayLabel = displayLabel; - } - - /** - * Get records management type name - * - * @return String records management event type name - */ - public String getType() - { - return type.getName(); - } - - /** - * Get the records management event type. - * - * @return {@link RecordsManagementEventType} records management event type - * - * @since 2.2 - */ - public RecordsManagementEventType getRecordsManagementEventType() - { - return type; - } - - /** - * Event name - * - * @return String event name - */ - public String getName() - { - return this.name; - } - - /** - * - * @return - */ - public String getDisplayLabel() - { - return displayLabel; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java deleted file mode 100644 index 6cfeab1ee4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Records management event service interface - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementEventService -{ - /** - * Register an event type - * - * @param eventType event type - */ - void registerEventType(RecordsManagementEventType eventType); - - /** - * Get a list of the event types - * - * @return List list of the event types - */ - List getEventTypes(); - - /** - * Get the records management event type - * - * @param eventTypeName name - * @return RecordsManagementEventType event type - */ - RecordsManagementEventType getEventType(String eventTypeName); - - /** - * Get the list of available events - * - * @return List list of events - */ - List getEvents(); - - /** - * Get a records management event given its name. Returns null if the event name is not - * recognised. - * - * @param eventName event name - * @return RecordsManagementEvent event - */ - RecordsManagementEvent getEvent(String eventName); - - /** - * Indicates whether a particular event exists. Returns true if it does, false otherwise. - * - * @param eventName event name - * @return boolean true if event exists, false otherwise - */ - boolean existsEvent(String eventName); - - /** - * Indicates whether a particular event can be created. Returns true if it is possible, false otherwise. - * - * @param eventDisplayLabel event display label - * @param eventName event name - * @return true if the event can be created, false otherwise - */ - boolean canCreateEvent(String eventDisplayLabel, String eventName); - - /** - * Indicates whether a particular event can be edited. Returns true if it is possible, false otherwise. - * - * @param eventDisplayLabel event display label - * @param eventName event name - * @param eventType event type - * @return true if the event can be edited, false otherwise - */ - boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType); - - /** - * Add an event - * - * @param eventType event type - * @param eventName event name - * @param eventDisplayLabel event display label - */ - RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel); - - /** - * Remove an event - * - * @param eventName event name - */ - void removeEvent(String eventName); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java deleted file mode 100644 index abcea55f86..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -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.util.ParameterCheck; -import org.json.JSONArray; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Records management event service implementation - * - * @author Roy Wetherall - */ -public class RecordsManagementEventServiceImpl implements RecordsManagementEventService -{ - /** Reference to the rm event config node */ - private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private static final NodeRef CONFIG_NODE_REF = new NodeRef(SPACES_STORE, "rm_event_config"); - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** Registered event types */ - private Map eventTypes = new HashMap<>(7); - - /** Available events */ - private Map events; - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the content service - * - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#registerEventType(org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType) - */ - public void registerEventType(RecordsManagementEventType eventType) - { - this.eventTypes.put(eventType.getName(), eventType); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEventTypes() - */ - public List getEventTypes() - { - return new ArrayList<>(this.eventTypes.values()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvents() - */ - public List getEvents() - { - return new ArrayList<>(this.getEventMap().values()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvent(java.lang.String) - */ - public RecordsManagementEvent getEvent(String eventName) - { - if (!getEventMap().containsKey(eventName)) { throw new AlfrescoRuntimeException("The event " - + eventName + " does not exist."); } - return getEventMap().get(eventName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEvent(java.lang.String) - */ - public boolean existsEvent(String eventName) - { - return getEventMap().containsKey(eventName); - } - - /** - * Indicates whether a particular event display label exists. Returns true if it does, false otherwise. - * - * @param eventDisplayLabel event display label - * @return boolean true if event exists, false otherwise - */ - public boolean existsEventDisplayLabel(String eventDisplayLabel) - { - for (RecordsManagementEvent recordsManagementEvent : getEventMap().values()) - { - if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) { return true; } - } - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#canCreateEvent(java.lang.String, java.lang.String) - */ - @SuppressWarnings("rawtypes") - public boolean canCreateEvent(String eventDisplayLabel, String eventName) - { - ParameterCheck.mandatoryString("eventDisplayLabel", eventDisplayLabel); - ParameterCheck.mandatoryString("eventName", eventName); - - boolean canCreateEvent = true; - - if (existsEvent(eventName)) - { - canCreateEvent = false; - } - - if (canCreateEvent) - { - for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) - { - RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); - if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) - { - canCreateEvent = false; - break; - } - } - } - - return canCreateEvent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#canEditEvent(java.lang.String, java.lang.String, java.lang.String) - */ - @SuppressWarnings("rawtypes") - public boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType) - { - ParameterCheck.mandatoryString("eventDisplayLabel", eventDisplayLabel); - ParameterCheck.mandatoryString("eventName", eventName); - ParameterCheck.mandatoryString("eventType", eventType); - - boolean canEditEvent = true; - - if (!existsEvent(eventName)) - { - throw new AlfrescoRuntimeException("The event '" + eventName + "' does not exist."); - } - - for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) - { - RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); - if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) - { - if (recordsManagementEvent.getName().equalsIgnoreCase(eventName)) - { - if (!recordsManagementEvent.getType().equalsIgnoreCase(eventType)) - { - canEditEvent = true; - } - else - { - canEditEvent = false; - } - } - else - { - throw new AlfrescoRuntimeException("Cannot edit event. An event with the display label '" - + eventDisplayLabel + "' already exist."); - } - break; - } - } - - return canEditEvent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#addEvent(java.lang.String, java.lang.String, java.lang.String) - */ - public RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel) - { - // Check that the eventType is valid - if (!eventTypes.containsKey(eventType)) - { - throw new AlfrescoRuntimeException( - "Can not add event because event " + - eventName + - " has an undefined eventType. (" - + eventType + ")"); - } - - // Create event and add to map - RecordsManagementEvent event = new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); - getEventMap().put(event.getName(), event); - - // Persist the changes to the event list - saveEvents(); - - return new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#removeEvent(java.lang.String) - */ - public void removeEvent(String eventName) - { - // Remove the event from the map - getEventMap().remove(eventName); - - // Persist the changes to the event list - saveEvents(); - } - - /** - * Helper method to get the event map. Loads initial instance from persisted - * configuration file. - * - * @return Map map of available events by - * event name - */ - private Map getEventMap() - { - if (this.events == null) - { - loadEvents(); - } - return this.events; - } - - /** - * Load the events from the persistant storage - */ - private void loadEvents() - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - // Get the event config node - if (!nodeService.exists(CONFIG_NODE_REF)) - { - throw new AlfrescoRuntimeException("Unable to find records management event configuration node."); - } - - // Read content from config node - ContentReader reader = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); - String jsonString = reader.getContentString(); - - JSONObject configJSON = new JSONObject(jsonString); - JSONArray eventsJSON = configJSON.getJSONArray("events"); - - events = new HashMap<>(eventsJSON.length()); - - for (int i = 0; i < eventsJSON.length(); i++) - { - // Get the JSON object that represents the event - JSONObject eventJSON = eventsJSON.getJSONObject(i); - - // Get the details of the event - String eventType = eventJSON.getString("eventType"); - String eventName = eventJSON.getString("eventName"); - - String eventDisplayLabel = eventJSON.getString("eventDisplayLabel"); - String translated = I18NUtil.getMessage(eventDisplayLabel); - if (translated != null) - { - eventDisplayLabel = translated; - } - - - // Check that the eventType is valid - if (!eventTypes.containsKey(eventType)) - { - throw new AlfrescoRuntimeException( - "Can not load rm event configuration because event " + - eventName + - " has an undefined eventType. (" - + eventType + ")"); - } - - // Create event and add to map - RecordsManagementEvent event = new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); - events.put(event.getName(), event); - } - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Save the events to the peristant storage - */ - private void saveEvents() - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - // Get the event config node - if (!nodeService.exists(CONFIG_NODE_REF)) - { - throw new AlfrescoRuntimeException("Unable to find records management event configuration node."); - } - - JSONObject configJSON = new JSONObject(); - JSONArray eventsJSON = new JSONArray(); - - int index = 0; - for (RecordsManagementEvent event : events.values()) - { - JSONObject eventJSON = new JSONObject(); - eventJSON.put("eventType", event.getType()); - eventJSON.put("eventName", event.getName()); - eventJSON.put("eventDisplayLabel", event.getDisplayLabel()); - - eventsJSON.put(index, eventJSON); - index++; - } - configJSON.put("events", eventsJSON); - - // Get content writer - ContentWriter contentWriter = contentService - .getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true); - contentWriter.putContent(configJSON.toString()); - - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEventType(java.lang.String) - */ - public RecordsManagementEventType getEventType(String eventTypeName) - { - return this.eventTypes.get(eventTypeName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java deleted file mode 100644 index f2d42a7dd3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Records management event type interface - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementEventType -{ - /** - * Get the name of the records management event type - * - * @return String event type name - */ - String getName(); - - /** - * Gets the display label of the event type - * - * @return String display label - */ - String getDisplayLabel(); - - /** - * Indicates whether the event is automatic or not - * - * @return boolean true if automatic, false otherwise - */ - boolean isAutomaticEvent(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java deleted file mode 100644 index 5779e43b4a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.event; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Simple records management event type implementation - * - * @author Roy Wetherall - */ -public class SimpleRecordsManagementEventTypeImpl implements RecordsManagementEventType, BeanNameAware -{ - /** Display label lookup prefix */ - protected static final String LOOKUP_PREFIX = "rmeventservice."; - - /** Name */ - public static final String NAME = "rmEventType.simple"; - - /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** Name */ - private String name; - - /** - * @return Records management event service - */ - protected RecordsManagementEventService getRecordsManagementEventService() - { - return this.recordsManagementEventService; - } - - /** - * Set the records management event service - * - * @param recordsManagementEventService records management service - */ - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * Initialisation method - */ - public void init() - { - getRecordsManagementEventService().registerEventType(this); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#isAutomaticEvent() - */ - public boolean isAutomaticEvent() - { - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#getName() - */ - public String getName() - { - return this.name; - } - - /** - * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) - */ - public void setBeanName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#getDisplayLabel() - */ - public String getDisplayLabel() - { - return I18NUtil.getMessage(LOOKUP_PREFIX + getName()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java deleted file mode 100644 index 719bbe1176..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.fileplan; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * File plan component kind enumeration class. - *
- * Helpful when trying to determine the characteristics of a kind - * of file plan component. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public enum FilePlanComponentKind -{ - FILE_PLAN_COMPONENT, - FILE_PLAN, - RECORD_CATEGORY, - RECORD_FOLDER, - RECORD, - TRANSFER, - TRANSFER_CONTAINER, - HOLD, - HOLD_CONTAINER, - DISPOSITION_SCHEDULE, - UNFILED_RECORD_CONTAINER, - UNFILED_RECORD_FOLDER -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java deleted file mode 100644 index 72e87af340..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.fileplan; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; - -/** - * File plan service interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface FilePlanService -{ - /** - * Default RM site id. - * Can be used with {@link FilePlanService#getFilePlanBySiteId(String)} to get the file plan node. - * */ - String DEFAULT_RM_SITE_ID = "rm"; - - /** - * Indicates whether the given node is a file plan component or not. - * - * @param nodeRef node reference - * @return boolean true if a file plan component, false otherwise - */ - boolean isFilePlanComponent(NodeRef nodeRef); - - /** - * Returns the 'kind' of file plan component the node reference is. - *

- * Returns null if the given node reference is not a - * file plan component. - * - * @param nodeRef node reference - * @return FilePlanComponentKind the kind of file plan component the node is - */ - FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef); - - /** - * Returns the file plan component 'kind' that relates to the passed - * content type. - *

- * Returns null if the type does not relate to a file plan component. - * - * @param type qualified name of content type - * @return FilePlanComponentKind the kind relating to the passed type - */ - FilePlanComponentKind getFilePlanComponentKindFromType(QName type); - - /** - * Indicates whether the given node is file plan node or not. - * - * @param nodeRef node reference - * @return boolean true if node is a file plan node - */ - boolean isFilePlan(NodeRef nodeRef); - - /** - * Gets all the file plan nodes. - * Looks in the SpacesStore by default. - * - * @return Set set of file plan nodes - */ - Set getFilePlans(); - - /** - * Getse all the file plan nodes in a store. - * - * @param storeRef store reference - * @return Set set of file plan nodes - */ - Set getFilePlans(StoreRef storeRef); - - /** - * Gets the file plan the node is in. - * - * @return {@link NodeRef} file node reference, null if none - */ - NodeRef getFilePlan(NodeRef nodeRef); - - /** - * Gets a file plan by site id. Assumes the site is a RM site and that the file plan node, ie - * the document library container, has been already created. Otherwise returns null. - * - * @param siteId records management site id - * @return NodeRef file plan, null if can't be found - */ - NodeRef getFilePlanBySiteId(String siteId); - - /** - * Indicates whether the unfiled container exists for a given file plan or not. - * - * @param filePlan file plan - * @return boolean true if unfiled container exists, false otherwise - */ - boolean existsUnfiledContainer(NodeRef filePlan); - - /** - * Gets the unfiled container for a given file plan. Returns null if - * none. - * - * @param filePlan file plan - * @return {@link NodeRef} unfiled container, null if none - */ - NodeRef getUnfiledContainer(NodeRef filePlan); - - /** - * Creates, and returns, a unfiled container for a given file plan. - * - * @param filePlan file plan - * @return {@link NodeRef} unfiled container - */ - NodeRef createUnfiledContainer(NodeRef filePlan); - - /** - * Gets the hold container for a given file plan. Returns - * null if none. - * - * @param filePlan - * @return - */ - NodeRef getHoldContainer(NodeRef filePlan); - - /** - * - * @param filePlan - * @return - */ - NodeRef createHoldContainer(NodeRef filePlan); - - /** - * - * @param filePlan - * @return - */ - NodeRef getTransferContainer(NodeRef filePlan); - - /** - * - * @param filePlan - * @return - */ - NodeRef createTransferContainer(NodeRef filePlan); - - /** - * Creates a file plan as a child of the given parent node, with the name - * provided. - * - * @param parent parent node reference - * @param name file plan name - * @param type type, must be rma:filePlan or sub-type of - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name, QName type); - - /** - * Specifies the properties to be set on the created file plan. - * - * @see #createFilePlan(NodeRef, String, QName) - * - * @param parent parent node reference - * @param name file plan name - * @param type type, must be rma:filePlan or sub-type of - * @param properties file plan properties - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties); - - /** - * Creates a file plan with the default type. - * - * @see #createFilePlan(NodeRef, String, QName) - * - * @param parent parent node reference - * @param name file plan name - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name); - - /** - * Creates a file plan with the default type, specifying properties. - * - * @see #createFilePlan(NodeRef, String, QName) - * - * @param parent parent node reference - * @param name file plan name - * @param properties file plan properties - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name, Map properties); - - // TODO deleteFilePlan - - /** - * Gets the NodeRef sequence from the {@link #getFilePlan(NodeRef) root} - * down to the fileplan component given. The array will start with the NodeRef of the root - * and end with the name of the fileplan component node given. - * - * @param nodeRef a fileplan component - * @return Returns a NodeRef path starting with the file plan - */ - List getNodeRefPath(NodeRef nodeRef); - - /** - * Indicates whether the given node is a file plan container or not. - *

- * This includes file plan and record category nodes. - * - * @param nodeRef node reference - * @return boolean true if node is a file plan container, false otherwise. - */ - boolean isFilePlanContainer(NodeRef nodeRef); - - /** - * Indicates whether the given node is a record category or not. - * - * @param nodeRef node reference - * @return boolean true if records category, false otherwise - */ - boolean isRecordCategory(NodeRef nodeRef); - - /** - * Get all the items contained within a container. This will include record folders and other record categories. - * - * @param recordCategory record category node reference - * @param deep if true then return all children including sub-categories and their children in turn, if false then just - * return the immediate children - * @return {@link List}<{@link NodeRef}> list of contained node references - */ - List getAllContained(NodeRef recordCategory, boolean deep); - - /** - * Only return the immediate children. - * - * @param recordCategory record category node reference - * @return {@link List}<{@link NodeRef}> list of contained node references - */ - List getAllContained(NodeRef recordCategory); - - /** - * Get all the record categories within a record category. - * - * @param recordCategory record category node reference - * @param deep if true then return all children including sub-categories and their children in turn, if false then just - * return the immediate children - * @return {@link List}<{@link NodeRef}> list of container node references - */ - List getContainedRecordCategories(NodeRef recordCategory, boolean deep); - - /** - * Only return immediate children. - * - * @param recordCategory container node reference - * @return {@link List}<{@link NodeRef}> list of container node references - */ - List getContainedRecordCategories(NodeRef recordCategory); - - /** - * Get all the record folders contained within a container - * - * @param container container node reference - * @param deep if true then return all children including sub-containers and their children in turn, if false then just - * return the immediate children - * @return {@link List}<{@link NodeRef}> list of record folder node references - */ - List getContainedRecordFolders(NodeRef container, boolean deep); - - /** - * Only return immediate children. - * - * @param container container node reference - * @return {@link List}<{@link NodeRef}> list of record folder node references - */ - List getContainedRecordFolders(NodeRef container); - - /** - * Create a record category. - * - * @param parent parent node reference, must be a record category or file plan. - * @param name name of the new record category - * @param type type of container to create, must be a sub-type of rm:recordCategory - * @return NodeRef node reference of the created record category - */ - NodeRef createRecordCategory(NodeRef parent, String name, QName type); - - /** - * - * @param parent - * @param name - * @param type - * @param properties - * @return - */ - NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties); - - /** - * Creates a record category of type rma:recordCategory - * - * @param parent parent node reference, must be a record category or file plan. - * @param name name of the record category - * @return NodeRef node reference of the created record category - */ - NodeRef createRecordCategory(NodeRef parent, String name); - - /** - * - * @param parent - * @param name - * @param properties - * @return - */ - NodeRef createRecordCategory(NodeRef parent, String name, Map properties); - -} \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java deleted file mode 100644 index 94d69984a5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java +++ /dev/null @@ -1,662 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.fileplan; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -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.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.rule.RuleModel; -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.PermissionService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * File plan service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanServiceImpl extends ServiceBaseImpl - implements FilePlanService, - RecordsManagementModel -{ - /** I18N */ - 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_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"; - private static final String MSG_CONTAINER_EXPECTED = "rm.service.container-expected"; - - /** File plan containers */ - private static final String NAME_UNFILED_CONTAINER = "Unfiled Records"; - private static final String NAME_HOLD_CONTAINER = "Holds"; - private static final String NAME_TRANSFER_CONTAINER = "Transfers"; - - /** RM site file plan container */ - private static final String FILE_PLAN_CONTAINER = "documentLibrary"; - - /** root container cache */ - private SimpleCache, NodeRef> rootContainerCache; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** Permission service */ - private PermissionService permissionService; - - /** Node DAO */ - private NodeDAO nodeDAO; - - /** Site service */ - private SiteService siteService; - - /** RM container cache manager **/ - private RMContainerCacheManager rmContainerCacheManager; - - /** - * Gets the file plan role service - * - * @return The file plan role service - */ - public FilePlanRoleService getFilePlanRoleService() - { - if (filePlanRoleService == null) - { - filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); - } - return filePlanRoleService; - } - - /** - * Gets the permission service - * - * @return The permission service - */ - public PermissionService getPermissionService() - { - if (permissionService == null) - { - permissionService = (PermissionService) applicationContext.getBean("permissionService"); - } - return permissionService; - } - - /** - * Gets the node DAO - * - * @return The node DAO - */ - public NodeDAO getNodeDAO() - { - if (nodeDAO == null) - { - nodeDAO = (NodeDAO) applicationContext.getBean("nodeDAO"); - } - return nodeDAO; - } - - /** - * Gets the site service - * - * @return The site service - */ - public SiteService getSiteService() - { - if (siteService == null) - { - siteService = (SiteService) applicationContext.getBean("SiteService"); - } - return siteService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans() - */ - @Override - public Set getFilePlans() - { - return getFilePlans(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - } - - /** - * @param rootContainerCache root container cache - */ - public void setRootContainerCache(SimpleCache, NodeRef> rootContainerCache) - { - this.rootContainerCache = rootContainerCache; - } - - /** - * @param rmContainerCacheManager RM container cache manager - * - */ - public void setRmContainerCacheManager(RMContainerCacheManager rmContainerCacheManager) - { - this.rmContainerCacheManager = rmContainerCacheManager; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans(org.alfresco.service.cmr.repository.StoreRef) - */ - @Override - public Set getFilePlans(final StoreRef storeRef) - { - ParameterCheck.mandatory("storeRef", storeRef); - - final Set results = new HashSet<>(); - Set aspects = new HashSet<>(1); - aspects.add(ASPECT_RECORDS_MANAGEMENT_ROOT); - - if (!rmContainerCacheManager.isCached(storeRef)) - { - getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback() - { - @Override - public boolean handle(Pair nodePair) - { - NodeRef nodeRef = nodePair.getSecond(); - if (storeRef.equals(nodeRef.getStoreRef())) - { - results.add(nodeRef); - rmContainerCacheManager.add(nodeRef); - } - - return true; - } - }); - } - else - { - return rmContainerCacheManager.get(storeRef); - } - - return results; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlanBySiteId(java.lang.String) - */ - @Override - public NodeRef getFilePlanBySiteId(String siteId) - { - NodeRef filePlan = null; - - SiteInfo siteInfo = getSiteService().getSite(siteId); - if (siteInfo != null && getSiteService().hasContainer(siteId, FILE_PLAN_CONTAINER)) - { - NodeRef nodeRef = getSiteService().getContainer(siteId, FILE_PLAN_CONTAINER); - if (instanceOf(nodeRef, TYPE_FILE_PLAN)) - { - filePlan = nodeRef; - } - } - - return filePlan; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#existsUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean existsUnfiledContainer(NodeRef filePlan) - { - return (getUnfiledContainer(filePlan) != null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef getUnfiledContainer(NodeRef filePlan) - { - return getFilePlanRootContainer(filePlan, NAME_UNFILED_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getHoldContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef getHoldContainer(NodeRef filePlan) - { - return getFilePlanRootContainer(filePlan, NAME_HOLD_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getTransferContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef getTransferContainer(NodeRef filePlan) - { - return getFilePlanRootContainer(filePlan, NAME_TRANSFER_CONTAINER); - } - - /** - * Get the file root container for the given type. - * - * @param filePlan file plan - * @param containerName container type - * @return {@link NodeRef} file plan container - */ - private NodeRef getFilePlanRootContainer(NodeRef filePlan, String containerName) - { - ParameterCheck.mandatory("filePlan", filePlan); - if (!isFilePlan(filePlan)) - { - throw new AlfrescoRuntimeException("Unable to get the container " + containerName + ", because passed node is not a file plan."); - } - - NodeRef result = null; - Pair key = new Pair<>(filePlan, containerName); - - if (!rootContainerCache.contains(key)) - { - // try and get the unfiled record container - List assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, containerName)); - if (assocs.size() > 1) - { - throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + "."); - } - else if (assocs.size() == 1) - { - result = assocs.get(0).getChildRef(); - rootContainerCache.put(key, result); - } - } - else - { - result = rootContainerCache.get(key); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - public NodeRef createUnfiledContainer(NodeRef filePlan) - { - return createFilePlanRootContainer(filePlan, TYPE_UNFILED_RECORD_CONTAINER, NAME_UNFILED_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createHoldContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createHoldContainer(NodeRef filePlan) - { - return createFilePlanRootContainer(filePlan, TYPE_HOLD_CONTAINER, NAME_HOLD_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createTransferContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createTransferContainer(NodeRef filePlan) - { - return createFilePlanRootContainer(filePlan, TYPE_TRANSFER_CONTAINER, NAME_TRANSFER_CONTAINER); - } - - /** - * - * @param filePlan - * @param containerType - * @param containerName - * @param inheritPermissions - * @return - */ - private NodeRef createFilePlanRootContainer(NodeRef filePlan, QName containerType, String containerName) - { - ParameterCheck.mandatory("filePlan", filePlan); - if (!isFilePlan(filePlan)) - { - throw new AlfrescoRuntimeException("Unable to create file plan root container, because passed node is not a file plan."); - } - - String allRoles = getFilePlanRoleService().getAllRolesContainerGroup(filePlan); - - // create the properties map - Map properties = new HashMap<>(1); - properties.put(ContentModel.PROP_NAME, containerName); - - // create the unfiled container - NodeRef container = nodeService.createNode( - filePlan, - ContentModel.ASSOC_CONTAINS, - QName.createQName(RM_URI, containerName), - containerType, - properties).getChildRef(); - - // set inheritance to false - getPermissionService().setInheritParentPermissions(container, false); - getPermissionService().setPermission(container, allRoles, RMPermissionModel.READ_RECORDS, true); - - // prevent inheritance of rules - nodeService.addAspect(container, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - - return container; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map) - */ - public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties) - { - ParameterCheck.mandatory("parent", parent); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("type", type); - - // Check the parent is not already an RM component node - // ie: you can't create a rm root in an existing rm hierarchy - if (isFilePlanComponent(parent)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DUP_ROOT)); - } - - // Check that the passed type is a sub-type of rma:filePlan - if (!TYPE_FILE_PLAN.equals(type) && - !dictionaryService.isSubClass(type, TYPE_FILE_PLAN)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ROOT_TYPE, type.toString())); - } - - // Build map of properties - Map rmRootProps = new HashMap<>(1); - if (properties != null && properties.size() != 0) - { - rmRootProps.putAll(properties); - } - rmRootProps.put(ContentModel.PROP_NAME, name); - - // Create the root - ChildAssociationRef assocRef = nodeService.createNode( - parent, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), - type, - rmRootProps); - - // TODO do we need to create role and security groups or is this done automatically? - - return assocRef.getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - public NodeRef createFilePlan(NodeRef parent, String name, Map properties) - { - return createFilePlan(parent, name, TYPE_FILE_PLAN, properties); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public NodeRef createFilePlan(NodeRef parent, String name) - { - return createFilePlan(parent, name, TYPE_FILE_PLAN, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName) - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, QName type) - { - return createFilePlan(parent, name, type, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getNodeRefPath(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getNodeRefPath(NodeRef nodeRef) - { - LinkedList nodeRefPath = new LinkedList<>(); - try - { - getNodeRefPathRecursive(nodeRef, nodeRefPath); - } - catch (RuntimeException e) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e); - } - return nodeRefPath; - } - - /** - * Helper method to build a NodeRef path from the node to the RM root - */ - private void getNodeRefPathRecursive(NodeRef nodeRef, Deque nodeRefPath) - { - if (isFilePlanComponent(nodeRef)) - { - // 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) - { - // We hit the top of the store - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT)); - } - // Recurse - nodeRef = assocRef.getParentRef(); - getNodeRefPathRecursive(nodeRef, nodeRefPath); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map) - */ - public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties) - { - ParameterCheck.mandatory("parent", parent); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("type", type); - - // Check that the parent is a container - QName parentType = nodeService.getType(parent); - if (!TYPE_RECORDS_MANAGEMENT_CONTAINER.equals(parentType) && - !dictionaryService.isSubClass(parentType, TYPE_RECORDS_MANAGEMENT_CONTAINER)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_PARENT_TYPE, parentType.toString())); - } - - // Check that the the provided type is a sub-type of rm:recordCategory - if (!TYPE_RECORD_CATEGORY.equals(type) && - !dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_TYPE, type.toString())); - } - - // Set the properties for the record category - Map props = new HashMap<>(1); - if (properties != null && properties.size() != 0) - { - props.putAll(properties); - } - props.put(ContentModel.PROP_NAME, name); - - return nodeService.createNode( - parent, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, (name.length() > QName.MAX_LENGTH ? name.substring(0, QName.MAX_LENGTH) : name)), - type, - props).getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public NodeRef createRecordCategory(NodeRef parent, String name) - { - return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - public NodeRef createRecordCategory(NodeRef parent, String name, Map properties) - { - return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY, properties); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName) - */ - public NodeRef createRecordCategory(NodeRef parent, String name, QName type) - { - return createRecordCategory(parent, name, type, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getAllContained(NodeRef container) - { - return getAllContained(container, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public List getAllContained(NodeRef container, boolean deep) - { - return getContained(container, null, deep); - } - - /** - * Get contained nodes of a particular type. If null return all. - * - * @param container container node reference - * @param typeFilter type filter, null if none - * @return {@link List}<{@link NodeRef> list of contained node references - */ - private List getContained(NodeRef container, QName typeFilter, boolean deep) - { - // Parameter check - ParameterCheck.mandatory("container", container); - - // Check we have a container in our hands - if (!isRecordCategory(container)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_EXPECTED)); - } - - List result = new ArrayList<>(1); - List assocs = this.nodeService.getChildAssocs(container, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - QName childType = nodeService.getType(child); - if (typeFilter == null || - typeFilter.equals(childType) || - dictionaryService.isSubClass(childType, typeFilter)) - { - result.add(child); - } - - // Inspect the containers and add children if deep - if (deep && - (TYPE_RECORD_CATEGORY.equals(childType) || - dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY))) - { - result.addAll(getContained(child, typeFilter, deep)); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getContainedRecordCategories(NodeRef container) - { - return getContainedRecordCategories(container, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public List getContainedRecordCategories(NodeRef container, boolean deep) - { - return getContained(container, TYPE_RECORD_CATEGORY, deep); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getContainedRecordFolders(NodeRef container) - { - return getContainedRecordFolders(container, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public List getContainedRecordFolders(NodeRef container, boolean deep) - { - return getContained(container, TYPE_RECORD_FOLDER, deep); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java deleted file mode 100644 index 1a3c8c3920..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.forms; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldGroup; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.FormData; -import org.alfresco.repo.forms.processor.AbstractFilter; -import org.alfresco.repo.forms.processor.node.FieldUtils; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Abstract base class for records management related form filter - * implementations. - * - * @author Gavin Cornwell - */ -public abstract class RecordsManagementFormFilter extends AbstractFilter -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementFormFilter.class); - - public static final String CUSTOM_RM_FIELD_GROUP_ID = "rm-custom"; - public static final String RM_METADATA_PREFIX = "rm-metadata-"; - - protected NamespaceService namespaceService; - protected NodeService nodeService; - protected RecordsManagementServiceRegistry rmServiceRegistry; - protected RecordsManagementAdminService rmAdminService; - protected RecordService recordService; - protected DictionaryService dictionaryService; - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Sets the node service - * - * @param nodeService The NodeService instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the RecordsManagementServiceRegistry instance - * - * @param rmServiceRegistry The RecordsManagementServiceRegistry instance - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServiceRegistry) - { - this.rmServiceRegistry = rmServiceRegistry; - } - - /** - * Sets the RecordsManagementAdminService instance - * - * @param rmAdminService The RecordsManagementAdminService instance - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Add property fields to group - * - * @param form - * @param props - * @param setId - */ - protected void addPropertyFieldsToGroup(Form form, Map props, String setId, String setLabel) - { - if (props != null) - { - for (Map.Entry entry : props.entrySet()) - { - PropertyDefinition prop = entry.getValue(); - - String id = form.getItem().getId(); - id = id.replaceFirst("/", "://"); - NodeRef nodeRef = new NodeRef(id); - Serializable value = nodeService.getProperty(nodeRef, entry.getKey()); - - FieldGroup group = new FieldGroup(setId, setLabel, false, false, null); - Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService, dictionaryService); - - form.addField(field); - - if (logger.isDebugEnabled()) - { - logger.debug("Adding custom property .. " + prop.getName().toString() + " .. with value " + value + ".. to group .. " + setId); - } - } - } - } - - /** - * @see - * org.alfresco.repo.forms.processor.Filter#beforePersist(java.lang.Object, - * org.alfresco.repo.forms.FormData) - */ - public void beforePersist(ItemType item, FormData data) - { - // ignored - } - - /** - * @see - * org.alfresco.repo.forms.processor.Filter#beforeGenerate(java.lang.Object, - * java.util.List, java.util.List, org.alfresco.repo.forms.Form, - * java.util.Map) - */ - public void beforeGenerate(ItemType item, List fields, List forcedFields, Form form, - Map context) - { - // ignored - } - - /** - * @see - * org.alfresco.repo.forms.processor.Filter#afterPersist(java.lang.Object, - * org.alfresco.repo.forms.FormData, java.lang.Object) - */ - public void afterPersist(ItemType item, FormData data, NodeRef persistedObject) - { - // ignored - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java deleted file mode 100644 index d0abb5e061..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.forms; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ImapModel; -import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl; -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.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldDefinition; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.PropertyFieldDefinition; -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; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Implementation of a form processor Filter. - *

- * The filter ensures that any custom properties defined for the records - * management type are provided as part of the Form and also assigned to the - * same field group. - *

- * - * @author Gavin Cornwell - */ -public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel, DOD5015Model -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementNodeFormFilter.class); - - protected static final String TRANSIENT_DECLARED = "rmDeclared"; - protected static final String TRANSIENT_CATEGORY_ID = "rmCategoryIdentifier"; - protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions"; - - /** Disposition service */ - private DispositionService dispositionService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** - * Returns the disposition service - * - * @return Disposition service - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - - /** - * Returns the file plan service - * - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * Sets the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map) - */ - @Override - public void afterGenerate( - NodeRef nodeRef, - List fields, - List forcedFields, - Form form, - Map context) - { - if (getFilePlanService().isFilePlanComponent(nodeRef)) - { - // add all the custom properties - addCustomPropertyFieldsToGroup(form, nodeRef); - - FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.RECORD.equals(kind)) - { - // add all the record meta-data aspect properties - addRecordMetadataPropertyFieldsToGroup(form, nodeRef); - - // add required transient properties - addTransientProperties(form, nodeRef); - - // add the supplemental marking list property - forceSupplementalMarkingListProperty(form, nodeRef); - - // protect uneditable properties - protectRecordProperties(form, nodeRef); - - // if the record is the result of an email we need to 'protect' some fields - if (this.nodeService.hasAspect(nodeRef, ImapModel.ASPECT_IMAP_CONTENT)) - { - protectEmailExtractedFields(form, nodeRef); - } - } - else if (FilePlanComponentKind.RECORD_FOLDER.equals(kind)) - { - // add the supplemental marking list property - forceSupplementalMarkingListProperty(form, nodeRef); - - // add required transient properties - addTransientProperties(form, nodeRef); - } - else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind)) - { - // use the same mechanism used to determine whether steps can be removed from the - // schedule to determine whether the disposition level can be changed i.e. record - // level or folder level. - DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef); - if (getDispositionService().hasDisposableItems(schedule)) - { - protectRecordLevelDispositionPropertyField(form); - } - } - } - } - - /** - * - * @param form - * @param nodeRef - */ - protected void addCustomPropertyFieldsToGroup(Form form, NodeRef nodeRef) - { - Set customisables = rmAdminService.getCustomisable(nodeRef); - - // Compatibility support: don't show category properties if node of type series - QName type = nodeService.getType(nodeRef); - if (CompatibilityModel.TYPE_RECORD_SERIES.equals(type)) - { - // remove record category from the list of customisable types to apply to the form - customisables.remove(TYPE_RECORD_CATEGORY); - } - - for (QName customisable : customisables) - { - addPropertyFieldsToGroup(form, rmAdminService.getCustomPropertyDefinitions(customisable), CUSTOM_RM_FIELD_GROUP_ID, null); - } - } - - /** - * - * @param form - * @param nodeRef - */ - protected void addRecordMetadataPropertyFieldsToGroup(Form form, NodeRef nodeRef) - { - Set aspects = recordService.getRecordMetadataAspects(nodeRef); - - for (QName aspect : aspects) - { - if (nodeService.hasAspect(nodeRef, aspect)) - { - String aspectName = aspect.getPrefixedQName(namespaceService).toPrefixString().replace(":", "-"); - String setId = RM_METADATA_PREFIX + aspectName; - - String setLabel = null; - AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect); - if (aspectDefinition != null) - { - setLabel = aspectDefinition.getTitle(new StaticMessageLookup()); - } - - addPropertyFieldsToGroup(form, dictionaryService.getPropertyDefs(aspect), setId, setLabel); - } - } - } - - /** - * Forces the "rmc:supplementalMarkingList" property to be present, if it is - * already on the given node this method does nothing, otherwise a property - * field definition is generated for the property. - * - * @param form The Form instance to add the property to - * @param nodeRef The node the form is being generated for - */ - protected void forceSupplementalMarkingListProperty(Form form, NodeRef nodeRef) - { - if (!this.nodeService.hasAspect(nodeRef, - RecordsManagementCustomModel.ASPECT_SUPPLEMENTAL_MARKING_LIST)) - { - PropertyDefinition propDef = this.dictionaryService.getProperty( - RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST); - - if (propDef != null) - { - Field field = FieldUtils.makePropertyField(propDef, null, null, namespaceService, dictionaryService); - form.addField(field); - } - else if (logger.isWarnEnabled()) - { - logger.warn("Could not add " + - RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST.getLocalName() + - " property as it's definition could not be found"); - } - } - } - - /** - * - * @param form - * @param nodeRef - */ - protected void addTransientProperties(final Form form, final 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. - //Need to run all block as the system user, needed for disposition instructions, recordCategory and categoryId. See RM-3077. - runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef); - - if (ds != null) - { - String instructions = ds.getDispositionInstructions(); - if (instructions != null) - { - addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, - instructions); - } - - NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds); - if (recordCategory != null) - { - String categoryId = (String) nodeService.getProperty(recordCategory, PROP_IDENTIFIER); - if (categoryId != null) - { - addTransientPropertyField(form, TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT, categoryId); - } - } - } - return null; - } - }); - } - - /** - * - * @param form - * @param name - * @param type - * @param value - */ - protected void addTransientPropertyField(Form form, String name, QName type, Object value) - { - String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + name; - PropertyFieldDefinition declaredField = new PropertyFieldDefinition(name, type.getLocalName()); - declaredField.setLabel(name); - declaredField.setDescription(name); - declaredField.setProtectedField(true); - declaredField.setDataKeyName(dataKeyName); - form.addFieldDefinition(declaredField); - form.addData(dataKeyName, value); - } - - /** - * - * @param form - * @param nodeRef - */ - protected void protectRecordProperties(Form form, NodeRef nodeRef) - { - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - if (!fieldDef.isProtectedField()) - { - String name = fieldDef.getName(); - String prefixName = null; - if ("size".equals(name) || "mimetype".equals(name) || "encoding".equals(name)) - { - prefixName = "cm:content"; - } - else - { - prefixName = fieldDef.getName(); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Checking property " + prefixName + " is editable by user " + AuthenticationUtil.getFullyAuthenticatedUser()); - } - - QName qname = QName.createQName(prefixName, namespaceService); - if (!recordService.isPropertyEditable(nodeRef, qname)) - { - if (logger.isDebugEnabled()) - { - logger.debug(" ... protected property"); - } - fieldDef.setProtectedField(true); - } - } - } - } - - /** - * Marks all the fields that contain data extracted from an email - * as protected fields. - * - * @param form The Form instance to add the property to - * @param nodeRef The node the form is being generated for - */ - protected void protectEmailExtractedFields(Form form, NodeRef nodeRef) - { - // iterate round existing fields and set email fields as protected - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - String prefixName = fieldDef.getName(); - - // check the value of the property, if empty then do not mark property - // as read only - QName qname = QName.createQName(prefixName, namespaceService); - Serializable value = nodeService.getProperty(nodeRef, qname); - if (value != null && - (prefixName.equals("cm:title") || - prefixName.equals("cm:author") || - prefixName.equals("dod:originator") || - prefixName.equals("dod:publicationDate") || - prefixName.equals("dod:dateReceived") || - prefixName.equals("dod:address") || - prefixName.equals("dod:otherAddress"))) - { - fieldDef.setProtectedField(true); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set email related fields to be protected"); - } - } - - /** - * Marks the recordLevelDisposition property as protected to disable editing - * - * @param form The Form instance - */ - protected void protectRecordLevelDispositionPropertyField(Form form) - { - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - if (fieldDef.getName().equals(RecordsManagementModel.PROP_RECORD_LEVEL_DISPOSITION.toPrefixString( - this.namespaceService))) - { - fieldDef.setProtectedField(true); - break; - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set 'rma:recordLevelDisposition' field to be protected as record folders or records are present"); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java deleted file mode 100644 index 2984e0848c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.forms; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldDefinition; -import org.alfresco.repo.forms.FieldGroup; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.FormData; -import org.alfresco.repo.forms.processor.node.FieldUtils; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Implementation of a form processor Filter. - *

- * The filter implements the afterGenerate method to ensure a - * default unique identifier is provided for the rma:identifier - * property. - *

- *

- * The filter also ensures that any custom properties defined for the records - * management type are provided as part of the Form. - *

- * - * @author Gavin Cornwell - */ -public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementTypeFormFilter.class); - - protected static final String NAME_FIELD_GROUP_ID = "name"; - protected static final String TITLE_FIELD_GROUP_ID = "title"; - protected static final String DESC_FIELD_GROUP_ID = "description"; - protected static final String OTHER_FIELD_GROUP_ID = "other"; - - protected static final FieldGroup NAME_FIELD_GROUP = new FieldGroup(NAME_FIELD_GROUP_ID, null, false, false, null); - protected static final FieldGroup TITLE_FIELD_GROUP = new FieldGroup(TITLE_FIELD_GROUP_ID, null, false, false, null); - protected static final FieldGroup DESC_FIELD_GROUP = new FieldGroup(DESC_FIELD_GROUP_ID, null, false, false, null); - protected static final FieldGroup OTHER_FIELD_GROUP = new FieldGroup(OTHER_FIELD_GROUP_ID, null, false, false, null); - - /** Identifier service */ - protected IdentifierService identifierService; - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /* - * @see - * org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, - * java.util.List, java.util.List, org.alfresco.repo.forms.Form, - * java.util.Map) - */ - public void afterGenerate( - TypeDefinition type, - List fields, - List forcedFields, - Form form, - Map context) - { - QName typeName = type.getName(); - if (rmAdminService.isCustomisable(typeName)) - { - addCustomRMProperties(typeName, form); - } - - // What about any mandatory aspects? - Set aspects = type.getDefaultAspectNames(); - for (QName aspect : aspects) - { - if (rmAdminService.isCustomisable(aspect)) - { - addCustomRMProperties(aspect, form); - } - } - - // set the id - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - String prefixName = fieldDef.getName(); - if (prefixName.equals("rma:identifier")) - { - String defaultId = identifierService.generateIdentifier(typeName, null); - fieldDef.setDefaultValue(defaultId); - } - // NOTE: we set these defaults in the form for backwards compatibility reasons (RM-753) - else if (prefixName.equals("rma:vitalRecordIndicator")) - { - fieldDef.setDefaultValue(Boolean.FALSE.toString()); - } - else if (prefixName.equals("rma:reviewPeriod")) - { - fieldDef.setDefaultValue("none|0"); - } - } - } - - /** - * Adds a property definition for each of the custom properties for the - * given RM type to the given form. - * - * @param customisableType Enum representing the RM type to add custom - * properties for - * @param form The form to add the properties to - */ - protected void addCustomRMProperties(QName customisableType, Form form) - { - ParameterCheck.mandatory("customisableType", customisableType); - ParameterCheck.mandatory("form", form); - - Map customProps = rmAdminService.getCustomPropertyDefinitions(customisableType); - - if (customProps != null && !customProps.isEmpty()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Found " + customProps.size() + " custom properties for customisable type " + customisableType); - } - - // setup field definition for each custom property - Collection properties = customProps.values(); - FieldGroup group = new FieldGroup(CUSTOM_RM_FIELD_GROUP_ID, null, false, false, null); - List fields = FieldUtils.makePropertyFields(properties, group, namespaceService, dictionaryService); - form.addFields(fields); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementFormFilter#beforePersist(java.lang.Object, org.alfresco.repo.forms.FormData) - */ - @Override - public void beforePersist(TypeDefinition item, FormData data) - { - recordService.disablePropertyEditableCheck(); - super.beforePersist(item, data); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementFormFilter#afterPersist(java.lang.Object, org.alfresco.repo.forms.FormData, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void afterPersist(TypeDefinition item, FormData data, NodeRef persistedObject) - { - super.afterPersist(item, data, persistedObject); - recordService.enablePropertyEditableCheck(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java deleted file mode 100644 index eb9f8a1c7a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.freeze; - -import java.util.Date; -import java.util.List; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze Service Interface - * - * TODO should be deprecated and methods moved to the HoldService with "hold, held, etc" style names - * - * @author Roy Wetherall - * @since 2.0 - */ -@AlfrescoPublicApi -public interface FreezeService -{ - /** - * Indicates whether the passed node reference is frozen. - * - * @param nodeRef node reference - * @return boolean true if frozen, false otherwise - */ - boolean isFrozen(NodeRef nodeRef); - - /** - * Checks whether or not the given node has frozen children - * - * @param nodeRef The nodeRef for which will be checked if it has frozen children - * @return true if the given nodeRef has frozen children, false otherwise - */ - boolean hasFrozenChildren(NodeRef nodeRef); - - /** - * Gets the date of the freeze for the given node, null if the node is not frozen - * - * @param nodeRef The nodeRef for which the date check will be performed - * @return Date The of the freeze or null - */ - Date getFreezeDate(NodeRef nodeRef); - - /** - * Gets the initiator of the freeze for the given node, null if the node is not frozen - * - * @param nodeRef The nodeRef for which the initiator check will be performed - * @return String The initiator of the freeze or null - */ - String getFreezeInitiator(NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#isHold(NodeRef)} instead. - */ - @Deprecated - boolean isHold(NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#getHeld(NodeRef)} instead. - */ - @Deprecated - Set getFrozen(NodeRef hold); - - /** - * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and {@link HoldService#addToHold(NodeRef, NodeRef)} instead. - */ - @Deprecated - NodeRef freeze(String reason, NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, NodeRef)} instead. - */ - @Deprecated - void freeze(NodeRef hold, NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and - * {@link HoldService#addToHold(NodeRef, List)} instead. - */ - @Deprecated - NodeRef freeze(String reason, Set nodeRefs); - - /** - * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, List)} instead. - */ - @Deprecated - void freeze(NodeRef hold, Set nodeRefs); - - /** - * @deprecated as of 2.2, use {@link HoldService#removeFromHold(NodeRef, NodeRef)} instead. - */ - @Deprecated - void unFreeze(NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#removeFromHolds(java.util.List, NodeRef)} instead. - */ - @Deprecated - void unFreeze(Set nodeRefs); - - /** - * @deprecated as of 2.2, use {@link HoldService#deleteHold(NodeRef)} instead. - */ - @Deprecated - void relinquish(NodeRef hold); - - /** - * @deprecated as of 2.2, use {@link HoldService#getHoldReason(NodeRef)} instead. - */ - @Deprecated - String getReason(NodeRef hold); - - /** - * @deprecated as of 2.2, use {@link HoldService#setHoldReason(NodeRef, String)} instead. - */ - @Deprecated - void updateReason(NodeRef hold, String reason); - - /** - * @deprecated as of 2.2, use {@link HoldService#getHolds(NodeRef)} instead. - */ - @Deprecated - Set getHolds(NodeRef filePlan); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java deleted file mode 100644 index 9f77ed6121..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.freeze; - -import static org.alfresco.model.ContentModel.TYPE_FOLDER; -import static org.alfresco.repo.site.SiteModel.ASPECT_SITE_CONTAINER; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -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.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.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Freeze Service Implementation - * - * @author Roy Wetherall - * @author Tuna Aksoy - * @since 2.1 - */ -public class FreezeServiceImpl extends ServiceBaseImpl - implements FreezeService, - RecordsManagementModel -{ - /** I18N */ - private static final String MSG_HOLD_NAME = "rm.hold.name"; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** Hold service */ - private HoldService holdService; - - /** - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * @return Hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#isFrozen(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isFrozen(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return nodeService.hasAspect(nodeRef, ASPECT_FROZEN); - } - - /** - * Deprecated Method Implementations - */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFrozen(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public Set getFrozen(NodeRef hold) - { - return new HashSet<>(getHoldService().getHeld(hold)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public NodeRef freeze(String reason, NodeRef nodeRef) - { - NodeRef hold = createHold(nodeRef, reason); - getHoldService().addToHold(hold, nodeRef); - return hold; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public void freeze(NodeRef hold, NodeRef nodeRef) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRef", nodeRef); - - getHoldService().addToHold(hold, nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, - * java.util.Set) - */ - @Override - @Deprecated - public NodeRef freeze(String reason, Set nodeRefs) - { - NodeRef hold = null; - if (!nodeRefs.isEmpty()) - { - final List list = new ArrayList<>(nodeRefs); - hold = createHold(list.get(0), reason); - getHoldService().addToHold(hold, list); - } - return hold; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, - * java.util.Set) - */ - @Override - @Deprecated - public void freeze(NodeRef hold, Set nodeRefs) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - freeze(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#unFreeze(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public void unFreeze(NodeRef nodeRef) - { - List holds = getHoldService().heldBy(nodeRef, true); - for (NodeRef hold : holds) - { - getHoldService().removeFromHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#unFreeze(java.util.Set) - */ - @Override - @Deprecated - public void unFreeze(Set nodeRefs) - { - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - unFreeze(nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#relinquish(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public void relinquish(NodeRef hold) - { - getHoldService().deleteHold(hold); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getReason(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public String getReason(NodeRef hold) - { - return getHoldService().getHoldReason(hold); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#updateReason(org.alfresco.service.cmr.repository.NodeRef, - * java.lang.String) - */ - @Override - @Deprecated - public void updateReason(NodeRef hold, String reason) - { - getHoldService().setHoldReason(hold, reason); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHolds(NodeRef) - */ - @Override - public Set getHolds(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - - return new HashSet<>(getHoldService().getHolds(filePlan)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#hasFrozenChildren(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean hasFrozenChildren(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean result = false; - - // check that we are dealing with a record folder or a collaboration folder - if (isRecordFolder(nodeRef) || - (instanceOf(nodeRef, TYPE_FOLDER) && !nodeService.hasAspect(nodeRef, ASPECT_SITE_CONTAINER))) - { - int heldCount = 0; - - if (nodeService.hasAspect(nodeRef, ASPECT_HELD_CHILDREN)) - { - heldCount = (Integer)getInternalNodeService().getProperty(nodeRef, PROP_HELD_CHILDREN_COUNT); - } - else - { - final TransactionService transactionService = (TransactionService)applicationContext.getBean("transactionService"); - - heldCount = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Integer doWork() - { - return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Integer execute() throws Throwable - { - int heldCount = 0; - - // NOTE: this process remains to 'patch' older systems to improve performance next time around - List childAssocs = getInternalNodeService().getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, null); - if (childAssocs != null && !childAssocs.isEmpty()) - { - for (ChildAssociationRef childAssociationRef : childAssocs) - { - final NodeRef childRef = childAssociationRef.getChildRef(); - if (childAssociationRef.isPrimary() && isFrozen(childRef)) - { - heldCount ++; - } - } - } - - // add aspect and set count - Map props = new HashMap<>(1); - props.put(PROP_HELD_CHILDREN_COUNT, heldCount); - getInternalNodeService().addAspect(nodeRef, ASPECT_HELD_CHILDREN, props); - - return heldCount; - } - }, - false, true); - } - }); - } - - // true if more than one child held - result = (heldCount > 0); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeDate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Date getFreezeDate(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (isFrozen(nodeRef)) - { - Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_AT); - if (property != null) { return (Date) property; } - } - - return null; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeInitiator(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String getFreezeInitiator(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (isFrozen(nodeRef)) - { - Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_BY); - if (property != null) { return (String) property; } - } - - return null; - } - - /** - * Helper Methods - */ - - /** - * Creates a hold using the given nodeRef and reason - * - * @param nodeRef the nodeRef which will be frozen - * @param reason the reason why the record will be frozen - * @return NodeRef of the created hold - */ - private NodeRef createHold(NodeRef nodeRef, String reason) - { - // get the hold container - final NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - NodeRef holdContainer = getFilePlanService().getHoldContainer(filePlan); - - // calculate the hold name - int nextCount = getNextCount(holdContainer); - String holdName = I18NUtil.getMessage(MSG_HOLD_NAME) + " " + StringUtils.leftPad(Integer.toString(nextCount), 10, "0"); - - // create hold - return getHoldService().createHold(filePlan, holdName, reason, null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java deleted file mode 100644 index 999ddf151e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.hold; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hold service interface. - * - * @author Tuna Aksoy - * @since 2.2 - */ -@AlfrescoPublicApi -public interface HoldService -{ - /** - * Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze - * reason. - * - * @param nodeRef hold node reference - * @return boolean true if hold, false otherwise - */ - boolean isHold(NodeRef nodeRef); - - /** - * Gets the list of all the holds within the holds container in the given file plan - * - * @param filePlan The {@link NodeRef} of the file plan - * @return List of hold node references - */ - List getHolds(NodeRef filePlan); - - /** - * Gets the node reference for the hold with the given name in the given file plan - * - * @param name {@link String} The name of the hold - * @return {@link NodeRef} of the hold with the given name - */ - NodeRef getHold(NodeRef filePlan, String name); - - /** - * Gets the list of all the holds within the holds container for the given node reference - * - * @param nodeRef The {@link NodeRef} of the record / record folder /active content - * @param includedInHold true to retrieve the list of hold node references which will include the node reference - * false to get a list of node references which will not have the given node reference - * @return List of hold node references - */ - List heldBy(NodeRef nodeRef, boolean includedInHold); - - /** - * Gets the list of item node references which are in the given hold - * - * @param hold {@link NodeRef} of the hold - * @return Lost of item {@link NodeRef}s which are in the given hold - */ - List getHeld(NodeRef hold); - - /** - * Creates a hold with the given name, reason and description for the given file plan - * - * @param filePlan The {@link NodeRef} of the file plan - * @param name {@link String} The name of the hold - * @param reason {@link String} The reason of the hold - * @param description {@link String} The description of the hold - * @return The {@link NodeRef} of the created hold - */ - NodeRef createHold(NodeRef filePlan, String name, String reason, String description); - - /** - * Gets the hold reason for the given hold node reference - * - * @param hold The {@link NodeRef} of the hold - * @return {@link String} The reason of the hold - */ - String getHoldReason(NodeRef hold); - - /** - * Sets the hold reason - * - * @param hold The {@link NodeRef} of the hold - * @param reason {@link String} The reason for the hold - */ - void setHoldReason(NodeRef hold, String reason); - - /** - * Deletes the hold - * - * @param hold The {@link NodeRef} of the hold - */ - void deleteHold(NodeRef hold); - - /** - * Adds the item to the given hold - * - * @param hold The {@link NodeRef} of the hold - * @param nodeRef The {@link NodeRef} of the record / record folder / active content which will be added to the given hold - */ - void addToHold(NodeRef hold, NodeRef nodeRef); - - /** - * Adds the items to the the given hold - * - * @param hold The {@link NodeRef} of the hold to which the items will be added - * @param nodeRefs The item {@link NodeRef}s which will be added to the hold - */ - void addToHold(NodeRef hold, List nodeRefs); - - /** - * Adds the item to the given list of holds - * - * @param holds The list of {@link NodeRef}s of the holds - * @param nodeRef The {@link NodeRef} of the record / record folder / active content which will be added to the given holds - */ - void addToHolds(List holds, NodeRef nodeRef); - - /** - * Adds the given items to the given list of holds - * - * @param holds List of holds to which the given items will be added - * @param nodeRefs The list of items which will be added to the given holds - */ - void addToHolds(List holds, List nodeRefs); - - /** - * Removes the record from the given hold - * - * @param hold The {@link NodeRef} of the hold - * @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given hold - */ - void removeFromHold(NodeRef hold, NodeRef nodeRef); - - /** - * Removes the given items from the given hold - * - * @param hold The hold {@link NodeRef} from which the given items will be removed - * @param nodeRefs The list of items which will be removed from the given holds - */ - void removeFromHold(NodeRef hold, List nodeRefs); - - /** - * Removes the item from the given list of hold - * - * @param holds The list {@link NodeRef}s of the holds - * @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given holds - */ - void removeFromHolds(List holds, NodeRef nodeRef); - - /** - * Removes the items from the given holds - * - * @param holds List of hold {@link NodeRef}s from which the items will be removed - * @param nodeRefs List of item {@link NodeRef}s which will be removed from the given holds - */ - void removeFromHolds(List holds, List nodeRefs); - - /** - * Removes the given {@link NodeRef} from all the holds - * - * @param nodeRef The {@link NodeRef} of item which will be removed from all the holds - */ - void removeFromAllHolds(NodeRef nodeRef); - - /** - * Removes the given list of {@link NodeRef}s from all the holds - * - * @param nodeRefs The list of item {@link NodeRef}s which will be removed from all the holds - */ - void removeFromAllHolds(List nodeRefs); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java deleted file mode 100644 index 8b35902600..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java +++ /dev/null @@ -1,985 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.hold; - -import static org.alfresco.model.ContentModel.ASPECT_LOCKABLE; -import static org.alfresco.model.ContentModel.ASSOC_CONTAINS; -import static org.alfresco.model.ContentModel.PROP_NAME; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Stream; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -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.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeAddToHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeCreateHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeDeleteHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeRemoveFromHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnAddToHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnCreateHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnDeleteHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnRemoveFromHoldPolicy; -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.ServiceBaseImpl; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -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; -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.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.ListUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Hold service implementation - * - * @author Tuna Aksoy - * @since 2.2 - */ -@BehaviourBean -public class HoldServiceImpl extends ServiceBaseImpl - implements HoldService, - NodeServicePolicies.BeforeDeleteNodePolicy, - RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(HoldServiceImpl.class); - - /** I18N */ - private static final String MSG_ERR_ACCESS_DENIED = "permissions.err_access_denied"; - private static final String MSG_ERR_HOLD_PERMISSION_GENERIC_ERROR = "rm.hold.generic-permission-error"; - private static final String MSG_ERR_HOLD_PERMISSION_DETAILED_ERROR = "rm.hold.detailed-permission-error"; - - /** Maximum number of held items to display in error message */ - private static final int MAX_HELD_ITEMS_LIST_SIZE = 5; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** Record Service */ - private RecordService recordService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Permission service */ - private PermissionService permissionService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Policy component */ - private PolicyComponent policyComponent; - - /** - * Set the file plan service - * - * @param filePlanService the file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Set the record service - * - * @param recordService the record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Set the record folder service - * - * @param recordFolderService the record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Set the permission service - * - * @param permissionService the permission services - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * Gets the policy component instance - * - * @return The policy component instance - */ - protected 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 beforeCreateHoldPolicyDelegate; - private ClassPolicyDelegate onCreateHoldPolicyDelegate; - private ClassPolicyDelegate beforeDeleteHoldPolicyDelegate; - private ClassPolicyDelegate onDeleteHoldPolicyDelegate; - private ClassPolicyDelegate beforeAddToHoldPolicyDelegate; - private ClassPolicyDelegate onAddToHoldPolicyDelegate; - private ClassPolicyDelegate beforeRemoveFromHoldPolicyDelegate; - private ClassPolicyDelegate onRemoveFromHoldPolicyDelegate; - - /** - * Initialise hold service - */ - public void init() - { - // Register the policies - beforeCreateHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(BeforeCreateHoldPolicy.class); - onCreateHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(OnCreateHoldPolicy.class); - beforeDeleteHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(BeforeDeleteHoldPolicy.class); - onDeleteHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(OnDeleteHoldPolicy.class); - beforeAddToHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(BeforeAddToHoldPolicy.class); - onAddToHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(OnAddToHoldPolicy.class); - beforeRemoveFromHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(BeforeRemoveFromHoldPolicy.class); - onRemoveFromHoldPolicyDelegate = getPolicyComponent().registerClassPolicy(OnRemoveFromHoldPolicy.class); - - } - - /** - * Behaviour unfreezes node's that will no longer he held after delete. - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Behaviour(kind=BehaviourKind.CLASS, type="rma:hold", notificationFrequency=NotificationFrequency.EVERY_EVENT) - @Override - public void beforeDeleteNode(final NodeRef hold) - { - if (nodeService.exists(hold) && isHold(hold)) - { - checkPermissionsForDeleteHold(hold); - - RunAsWork work = new RunAsWork() - { - @Override - public Void doWork() - { - List frozenNodes = getHeld(hold); - for (NodeRef frozenNode : frozenNodes) - { - //set in transaction cache in order not to trigger update policy when removing the child association - transactionalResourceHelper.getSet("frozen").add(frozenNode); - removeFreezeAspect(frozenNode, 1); - } - return null; - } - }; - - // run as system user - authenticationUtil.runAsSystem(work); - } - } - - /** - * Helper method removes the freeze aspect from the record and record folder if it is no longer - * in a hold. - * - * @param nodeRef - */ - private void removeFreezeAspect(NodeRef nodeRef, int index) - { - List otherHolds = heldBy(nodeRef, true); - if (otherHolds.size() == index) - { - if (nodeService.hasAspect(nodeRef, ASPECT_FROZEN)) - { - // remove the freeze aspect from the node - //set in transaction cache in order not to trigger update policy when removing the aspect - transactionalResourceHelper.getSet("frozen").add(nodeRef); - nodeService.removeAspect(nodeRef, ASPECT_FROZEN); - } - - if (isRecordFolder(nodeRef)) - { - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - if (nodeService.hasAspect(record, ASPECT_FROZEN)) - { - List recordsOtherHolds = heldBy(record, true); - if (recordsOtherHolds.size() == index) - { - // remove the freeze aspect from the node - //set in transaction cache in order not to trigger update policy when removing the aspect - transactionalResourceHelper.getSet("frozen").add(record); - nodeService.removeAspect(record, ASPECT_FROZEN); - } - } - } - } - } - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHolds(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getHolds(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - - List holds = new ArrayList<>(); - - // get the root hold container - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - - if (holdContainer != null) - { - // get the children of the root hold container - List holdsAssocs = nodeService.getChildAssocs(holdContainer, ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef holdAssoc : holdsAssocs) - { - NodeRef hold = holdAssoc.getChildRef(); - if (isHold(hold)) - { - // add to list of holds - holds.add(hold); - } - } - } - - return holds; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#heldBy(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @SuppressWarnings("unchecked") - @Override - public List heldBy(NodeRef nodeRef, boolean includedInHold) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - List result = new ArrayList<>(); - - // get all the immediate parent holds - final Set holdsIncludingNodeRef = getParentHolds(nodeRef); - - // check whether the record is held by virtue of it's record folder - if (isRecord(nodeRef)) - { - final List recordFolders = recordFolderService.getRecordFolders(nodeRef); - for (final NodeRef recordFolder : recordFolders) - { - holdsIncludingNodeRef.addAll(getParentHolds(recordFolder)); - } - } - - if (!includedInHold) - { - final Set filePlans = filePlanService.getFilePlans(); - if (!CollectionUtils.isEmpty(filePlans)) - { - final List holdsNotIncludingNodeRef = new ArrayList<>(); - filePlans.forEach(filePlan -> - { - // invert list to get list of holds that do not contain this node - final List allHolds = getHolds(filePlan); - holdsNotIncludingNodeRef.addAll(ListUtils.subtract(allHolds, new ArrayList<>(holdsIncludingNodeRef))); - }); - result = holdsNotIncludingNodeRef; - } - } - else - { - result = new ArrayList<>(holdsIncludingNodeRef); - } - - return result; - } - - /** - * Helper method to get holds that are direct parents of the given node. - * - * @param nodeRef node reference - * @return Set<{@link NodeRef}> set of parent holds - */ - private Set getParentHolds(NodeRef nodeRef) - { - List holdsAssocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - Set holds = new HashSet<>(holdsAssocs.size()); - for (ChildAssociationRef holdAssoc : holdsAssocs) - { - holds.add(holdAssoc.getParentRef()); - } - - return holds; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHold(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public NodeRef getHold(NodeRef filePlan, String name) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("name", name); - - // get the root hold container - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - - // get the hold by name - NodeRef hold = nodeService.getChildByName(holdContainer, ASSOC_CONTAINS, name); - if (hold != null && !isHold(hold)) - { - throw new AlfrescoRuntimeException("Can not get hold, because the named node reference isn't a hold."); - } - - return hold; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHeld(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getHeld(NodeRef hold) - { - ParameterCheck.mandatory("hold", hold); - List children = new ArrayList<>(); - - if (!isHold(hold)) - { - throw new AlfrescoRuntimeException("Can't get the node's held, because passed node reference isn't a hold. (hold=" + hold.toString() + ")"); - } - - List childAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL); - if (childAssocs != null && !childAssocs.isEmpty()) - { - for (ChildAssociationRef childAssociationRef : childAssocs) - { - children.add(childAssociationRef.getChildRef()); - } - } - - return children; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#createHold(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public NodeRef createHold(NodeRef filePlan, String name, String reason, String description) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("reason", reason); - - // get the root hold container - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - - invokeBeforeCreateHold(holdContainer, name, reason); - - // create map of properties - Map properties = new HashMap<>(3); - properties.put(ContentModel.PROP_NAME, name); - properties.put(PROP_HOLD_REASON, reason); - if (description != null && !description.isEmpty()) - { - properties.put(ContentModel.PROP_DESCRIPTION, description); - } - - // create assoc name - QName assocName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name); - - // create hold - ChildAssociationRef childAssocRef = nodeService.createNode(holdContainer, ASSOC_CONTAINS, assocName, TYPE_HOLD, properties); - - NodeRef holdNodeRef = childAssocRef.getChildRef(); - - invokeOnCreateHold(holdNodeRef); - - return holdNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHoldReason(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String getHoldReason(NodeRef hold) - { - ParameterCheck.mandatory("hold", hold); - - String reason = null; - - if (nodeService.exists(hold) && isHold(hold)) - { - // get the reason - reason = (String)nodeService.getProperty(hold, PROP_HOLD_REASON); - } - - return reason; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#setHoldReason(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void setHoldReason(NodeRef hold, String reason) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("reason", reason); - - if (nodeService.exists(hold) && isHold(hold)) - { - nodeService.setProperty(hold, PROP_HOLD_REASON, reason); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#deleteHold(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void deleteHold(final NodeRef hold) - { - ParameterCheck.mandatory("hold", hold); - - if (!isHold(hold)) - { - throw new AlfrescoRuntimeException("Can't delete hold, because passed node is not a hold. (hold=" + hold.toString() + ")"); - } - - invokeBeforeDeleteHold(hold); - - String holdName = (String) nodeService.getProperty(hold, PROP_NAME); - Set classQNames = getTypeAndApsects(hold); - - // delete the hold node - nodeService.deleteNode(hold); - - invokeOnDeleteHold(holdName, classQNames); - } - - /** - * Helper method to check if user has correct permissions to delete hold - * - * @param hold hold to be deleted - */ - private void checkPermissionsForDeleteHold(NodeRef hold) - { - List held = AuthenticationUtil.runAsSystem(() -> getHeld(hold)); - - List heldNames = new ArrayList<>(); - for (NodeRef nodeRef : held) - { - try - { - String permission; - - if (recordService.isRecord(nodeRef) || recordFolderService.isRecordFolder(nodeRef)) - { - permission = RMPermissionModel.FILING; - } - else - { - permission = PermissionService.READ; - } - - if (permissionService.hasPermission(nodeRef, permission) == AccessStatus.DENIED) - { - heldNames.add((String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); - } - } - catch (AccessDeniedException ade) - { - throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_HOLD_PERMISSION_GENERIC_ERROR), ade); - } - } - - if (heldNames.size() > 0) - { - StringBuilder sb = new StringBuilder(); - Stream stream1 = heldNames.stream(); - stream1.limit(MAX_HELD_ITEMS_LIST_SIZE).forEach(name -> { - sb.append("\n "); - sb.append("'"); - sb.append(name); - sb.append("'"); - }); - throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_HOLD_PERMISSION_DETAILED_ERROR) + sb.toString()); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void addToHold(NodeRef hold, NodeRef nodeRef) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRef", nodeRef); - - List holds = new ArrayList<>(1); - holds.add(hold); - addToHolds(Collections.unmodifiableList(holds), nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHold(org.alfresco.service.cmr.repository.NodeRef, java.util.List) - */ - @Override - public void addToHold(NodeRef hold, List nodeRefs) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - addToHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void addToHolds(final List holds, final NodeRef nodeRef) - { - ParameterCheck.mandatoryCollection("holds", holds); - ParameterCheck.mandatory("nodeRef", nodeRef); - - checkNodeCanBeAddedToHold(nodeRef); - - for (final NodeRef hold : holds) - { - if (!isHold(hold)) - { - final String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME); - throw new IntegrityException(I18NUtil.getMessage("rm.hold.not-hold", holdName), null); - } - - if (!AccessStatus.ALLOWED.equals( - capabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD))) - { - throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED)); - } - - // check that the node isn't already in the hold - if (!getHeld(hold).contains(nodeRef)) - { - // fire before add to hold policy - invokeBeforeAddToHold(hold, nodeRef); - // run as system to ensure we have all the appropriate permissions to perform the manipulations we require - authenticationUtil.runAsSystem((RunAsWork) () -> - { - // gather freeze properties - final Map props = new HashMap<>(2); - props.put(PROP_FROZEN_AT, new Date()); - props.put(PROP_FROZEN_BY, AuthenticationUtil.getFullyAuthenticatedUser()); - - addFrozenAspect(nodeRef, props); - - // Link the record to the hold - //set in transaction cache in order not to trigger update policy when adding the association - transactionalResourceHelper.getSet("frozen").add(nodeRef); - nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - // get the documents primary parent assoc - ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); - nodeService.addChild(hold, nodeRef, ASSOC_CONTAINS, parentAssoc.getQName()); - - // Mark all the folders contents as frozen - if (isRecordFolder(nodeRef)) - { - final List records = recordService.getRecords(nodeRef); - records.forEach(record -> addFrozenAspect(record, props)); - } - - return null; - }); - - // fire on add to hold policy - invokeOnAddToHold(hold, nodeRef); - } - } - } - - /** - * Check if the given node is eligible to be added into a hold - * - * @param nodeRef the node to be checked - */ - private void checkNodeCanBeAddedToHold(NodeRef nodeRef) - { - if (!isRecordFolder(nodeRef) && !instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) - { - final String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - throw new IntegrityException(I18NUtil.getMessage("rm.hold.add-to-hold-invalid-type", nodeName), null); - } - - if (((isRecord(nodeRef) || isRecordFolder(nodeRef)) && - permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.DENIED) || - (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) && - permissionService.hasPermission(nodeRef, PermissionService.WRITE) == AccessStatus.DENIED)) - { - throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED)); - } - - if (nodeService.hasAspect(nodeRef, ASPECT_ARCHIVED)) - { - throw new IntegrityException(I18NUtil.getMessage("rm.hold.add-to-hold-archived-node"), null); - } - - if (nodeService.hasAspect(nodeRef, ASPECT_LOCKABLE)) - { - throw new IntegrityException(I18NUtil.getMessage("rm.hold.add-to-hold-locked-node"), null); - } - } - - /** - * Add Frozen aspect only if node isn't already frozen - * - * @param nodeRef node on which aspect will be added - * @param props aspect properties map - */ - private void addFrozenAspect(NodeRef nodeRef, Map props) - { - if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN)) - { - //set in transaction cache in order not to trigger update policy when adding the aspect - transactionalResourceHelper.getSet("frozen").add(nodeRef); - // add freeze aspect - nodeService.addAspect(nodeRef, ASPECT_FROZEN, props); - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Frozen aspect applied to '").append(nodeRef).append("'."); - logger.debug(msg.toString()); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, java.util.List) - */ - @Override - public void addToHolds(List holds, List nodeRefs) - { - ParameterCheck.mandatoryCollection("holds", holds); - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - addToHolds(holds, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeFromHold(NodeRef hold, NodeRef nodeRef) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRef", nodeRef); - - List holds = new ArrayList<>(1); - holds.add(hold); - removeFromHolds(Collections.unmodifiableList(holds), nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, java.util.List) - */ - @Override - public void removeFromHold(NodeRef hold, List nodeRefs) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - removeFromHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeFromHolds(List holds, final NodeRef nodeRef) - { - ParameterCheck.mandatory("holds", holds); - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (!holds.isEmpty()) - { - List removedHolds = new ArrayList<>(); - for (final NodeRef hold : holds) - { - if (!isHold(hold)) - { - final String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME); - throw new IntegrityException(I18NUtil.getMessage("rm.hold.not-hold", holdName), null); - } - - if (!AccessStatus.ALLOWED.equals( - capabilityService.getCapabilityAccessState(hold, RMPermissionModel.REMOVE_FROM_HOLD))) - { - throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_ACCESS_DENIED)); - } - - if (getHeld(hold).contains(nodeRef)) - { - // fire before remove from hold policy - invokeBeforeRemoveFromHold(hold, nodeRef); - // 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((RunAsWork) () -> - { - // remove from hold - //set in transaction cache in order not to trigger update policy when removing the child association - transactionalResourceHelper.getSet("frozen").add(nodeRef); - nodeService.removeChild(hold, nodeRef); - - return null; - }); - removedHolds.add(hold); - } - } - - // run as system as we can't be sure if have remove aspect rights on node - authenticationUtil.runAsSystem((RunAsWork) () -> - { - removeFreezeAspect(nodeRef, 0); - return null; - }); - for (NodeRef removedHold : removedHolds) - { - // fire on remove from hold policy - invokeOnRemoveFromHold(removedHold, nodeRef); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, java.util.List) - */ - @Override - public void removeFromHolds(List holds, List nodeRefs) - { - ParameterCheck.mandatoryCollection("holds", holds); - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - removeFromHolds(holds, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeFromAllHolds(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // remove the node from all the holds it's held by - List holds = heldBy(nodeRef, true); - for (NodeRef hold : holds) - { - // remove node from hold - removeFromHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(java.util.List) - */ - @Override - public void removeFromAllHolds(List nodeRefs) - { - ParameterCheck.mandatory("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - removeFromAllHolds(nodeRef); - } - } - - /** - * Invoke beforeCreateHold policy - * - * @param nodeRef node reference - * @param name hold name - * @param reason hold reason - */ - protected void invokeBeforeCreateHold(NodeRef nodeRef, String name, String reason) - { - // execute policy for node type and aspects - BeforeCreateHoldPolicy policy = beforeCreateHoldPolicyDelegate.get(getTypeAndApsects(nodeRef)); - policy.beforeCreateHold(name, reason); - } - - /** - * Invoke onCreateHold policy - * - * @param nodeRef node reference - */ - protected void invokeOnCreateHold(NodeRef nodeRef) - { - OnCreateHoldPolicy policy = onCreateHoldPolicyDelegate.get(getTypeAndApsects(nodeRef)); - policy.onCreateHold(nodeRef); - } - - /** - * Invoke beforeDeleteHold policy - * - * @param nodeRef node reference - */ - protected void invokeBeforeDeleteHold(NodeRef nodeRef) - { - BeforeDeleteHoldPolicy policy = beforeDeleteHoldPolicyDelegate.get(getTypeAndApsects(nodeRef)); - policy.beforeDeleteHold(nodeRef); - } - - /** - * Invoke onDeleteHold policy - * - * @param holdName name of the hold - * @param classQNames hold types and aspects - */ - protected void invokeOnDeleteHold(String holdName, Set classQNames) - { - // execute policy for node type and aspects - OnDeleteHoldPolicy policy = onDeleteHoldPolicyDelegate.get(classQNames); - policy.onDeleteHold(holdName); - - } - - /** - * Invoke beforeAddToHold policy - * - * @param hold hold node reference - * @param contentNodeRef content node reference - */ - protected void invokeBeforeAddToHold(NodeRef hold, NodeRef contentNodeRef) - { - BeforeAddToHoldPolicy policy = beforeAddToHoldPolicyDelegate.get(getTypeAndApsects(hold)); - policy.beforeAddToHold(hold, contentNodeRef); - } - - /** - * Invoke onAddToHold policy - * - * @param hold hold node reference - * @param contentNodeRef content node reference - */ - protected void invokeOnAddToHold(NodeRef hold, NodeRef contentNodeRef) - { - OnAddToHoldPolicy policy = onAddToHoldPolicyDelegate.get(getTypeAndApsects(hold)); - policy.onAddToHold(hold, contentNodeRef); - } - - /** - * Invoke beforeRemoveFromHold policy - * - * @param hold hold node reference - * @param contentNodeRef content node reference - */ - protected void invokeBeforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef) - { - BeforeRemoveFromHoldPolicy policy = beforeRemoveFromHoldPolicyDelegate.get(getTypeAndApsects(hold)); - policy.beforeRemoveFromHold(hold, contentNodeRef); - } - - /** - * Invoke onRemoveFromHold policy - * - * @param hold hold node reference - * @param contentNodeRef content node reference - */ - protected void invokeOnRemoveFromHold(NodeRef hold, NodeRef contentNodeRef) - { - OnRemoveFromHoldPolicy policy = onRemoveFromHoldPolicyDelegate.get(getTypeAndApsects(hold)); - policy.onRemoveFromHold(hold, contentNodeRef); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServicePolicies.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServicePolicies.java deleted file mode 100644 index d560f32b07..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServicePolicies.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.hold; - -import org.alfresco.repo.policy.ClassPolicy; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Hold Service Policies - * - * @author Ramona Popa - * @author Roxana Lucanu - * @since 3.3 - */ - -public interface HoldServicePolicies -{ - interface BeforeCreateHoldPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateHold"); - /** - * Called before a hold is created. - * - * @param name name of the hold to be created - * @param reason reason for the hold to be created - */ - void beforeCreateHold(String name, String reason); - } - - interface OnCreateHoldPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateHold"); - /** - * Called when a hold is created. - * - * @param hold node reference - */ - void onCreateHold(NodeRef hold); - } - - interface BeforeDeleteHoldPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteHold"); - /** - * Called before a hold is deleted. - * - * @param hold node reference - */ - void beforeDeleteHold(NodeRef hold); - } - - interface OnDeleteHoldPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteHold"); - - /** - * Called when a hold is deleted. - * - * @param holdname name of the deleted hold - */ - void onDeleteHold(String holdname); - } - - interface BeforeAddToHoldPolicy extends ClassPolicy - { - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeAddToHold"); - - /** - * Called before adding content to hold. - * - * @param hold the hold to be added into - * @param contentNodeRef the item to be added to hold - */ - void beforeAddToHold(NodeRef hold, NodeRef contentNodeRef); - } - - interface OnAddToHoldPolicy extends ClassPolicy - { - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onAddToHold"); - - /** - * Called when content is added to hold. - * - * @param hold the hold to be added into - * @param contentNodeRef the item to be added to hold - */ - void onAddToHold(NodeRef hold, NodeRef contentNodeRef); - } - - interface BeforeRemoveFromHoldPolicy extends ClassPolicy - { - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveFromHold"); - - /** - * Called before removing content from hold. - * - * @param hold the hold to be removed from - * @param contentNodeRef the item to be removed from hold - */ - void beforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef); - } - - interface OnRemoveFromHoldPolicy extends ClassPolicy - { - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveFromHold"); - - /** - * Called when removing content from hold. - * - * @param hold the hold to be removed from - * @param contentNodeRef the item to be removed from hold - */ - void onRemoveFromHold(NodeRef hold, NodeRef contentNodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java deleted file mode 100644 index 6bdb7da806..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.identifier; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Basic identifier generator implementation. - * - * @author Roy Wetherall - */ -public class BasicIdentifierGenerator extends IdentifierGeneratorBase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#generateId(java.util.Map) - */ - @Override - public String generateId(Map context) - { - NodeRef nodeRef = (NodeRef)context.get(IdentifierService.CONTEXT_NODEREF); - Long dbId = 0l; - if (nodeRef != null) - { - dbId = (Long)nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID); - } - else - { - dbId = System.currentTimeMillis(); - } - - Calendar fileCalendar = Calendar.getInstance(); - String year = Integer.toString(fileCalendar.get(Calendar.YEAR)); - return year + "-" + padString(dbId.toString(), 10); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java deleted file mode 100644 index b22f5c4bb9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.identifier; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -/** - * Generates an identifier for a content type from a given context. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface IdentifierGenerator -{ - /** - * The content type this generator is applicible to. - * @return QName the type - */ - QName getType(); - - /** - * Generates the next id based on the provided context. - * @param context map of context values - * @return String the next id - */ - String generateId(Map context); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java deleted file mode 100644 index 32f94f38f3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.identifier; - -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public abstract class IdentifierGeneratorBase implements IdentifierGenerator -{ - /** Identifier service */ - private IdentifierService identifierService; - - /** Node service */ - protected NodeService nodeService; - - /** Content type */ - private QName type; - - /** - * Initialisation method - */ - public void init() - { - identifierService.register(this); - } - - /** - * Set identifier service. - * - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set type. - * - * @param type content type - */ - public void setTypeAsString(String type) - { - this.type = QName.createQName(type); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#getType() - */ - @Override - public QName getType() - { - return type; - } - - /** - * Function to pad a string with zero '0' characters to the required length - * - * @param s String to pad with leading zero '0' characters - * @param len Length to pad to - * @return padded string or the original if already at >=len characters - */ - protected String padString(String s, int len) - { - String result = s; - - for (int i = 0; i < (len - s.length()); i++) - { - result = "0" + result; - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java deleted file mode 100644 index d533b6c5f2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.identifier; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management identifier service - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface IdentifierService -{ - /** Context value names */ - String CONTEXT_NODEREF = "noderef"; - String CONTEXT_PARENT_NODEREF = "parentndoeref"; - String CONTEXT_ORIG_TYPE = "origionaltype"; - - /** - * Register an identifier generator implementation with the service. - * - * @param identifierGenerator identifier generator implementation - */ - void register(IdentifierGenerator identifierGenerator); - - /** - * Generate an identifier for a node with the given type and parent. - * - * @param type type of the node - * @param parent parent of the ndoe - * @return String generated identifier - */ - String generateIdentifier(QName type, NodeRef parent); - - /** - * Generate an identifier for the given node. - * - * @param nodeRef node reference - * @return String generated identifier - */ - String generateIdentifier(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java deleted file mode 100644 index c3025dfc13..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.identifier; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Roy Wetherall - */ -public class IdentifierServiceImpl implements IdentifierService -{ - /** Logger */ - private static Log logger = LogFactory.getLog(IdentifierServiceImpl.class); - - /** Registry map */ - private Map register = new HashMap<>(5); - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the dictionary service - * - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String generateIdentifier(QName type, NodeRef parent) - { - ParameterCheck.mandatory("type", type); - - // Build the context - Map context = new HashMap<>(2); - if (parent != null) - { - context.put(CONTEXT_PARENT_NODEREF, parent); - } - context.put(CONTEXT_ORIG_TYPE, type); - - // Generate the id - return generateIdentifier(type, context); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String generateIdentifier(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Map context = new HashMap<>(3); - - // Set the original type - QName type = nodeService.getType(nodeRef); - context.put(CONTEXT_ORIG_TYPE, type); - - // Set the parent reference - ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); - if (assocRef != null && assocRef.getParentRef() != null) - { - context.put(CONTEXT_PARENT_NODEREF, assocRef.getParentRef()); - } - - // Set the node reference - context.put(CONTEXT_NODEREF, nodeRef); - - // Generate the identifier - return generateIdentifier(type, context); - - } - - /** - * Generate an identifier for a given type of object with the accompanying context. - * - * @param type content type - * @param context context - * @return String identifier - */ - private String generateIdentifier(QName type, Map context) - { - ParameterCheck.mandatory("type", type); - ParameterCheck.mandatory("context", context); - - // Get the identifier generator - IdentifierGenerator idGen = lookupGenerator(type); - if (idGen == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found."); - } - throw new AlfrescoRuntimeException("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found."); - } - - // Generate the identifier - return idGen.generateId(context); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#register(org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator) - */ - public void register(IdentifierGenerator idGen) - { - register.put(idGen.getType(), idGen); - } - - /** - * - * @param type content type (could be aspect or type) - * @return - */ - private IdentifierGenerator lookupGenerator(QName type) - { - ParameterCheck.mandatory("type", type); - - if (logger.isDebugEnabled()) - { - logger.debug("Looking for idGenerator for type " + type.toString()); - } - - // Look for the generator related to the type - IdentifierGenerator result = register.get(type); - if (result == null) - { - // Check the parent type - ClassDefinition typeDef = dictionaryService.getClass(type); - if (typeDef != null) - { - QName parentType = typeDef.getParentName(); - if (parentType != null) - { - // Recurse to find parent type generator - result = lookupGenerator(parentType); - } - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to find type definition for " + type.toString() + " when generating identifier."); - } - } - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java deleted file mode 100644 index 242bb63480..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -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.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.PersonService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * The Disposition Lifecycle Job Finds all disposition action nodes which are for disposition actions specified Where - * asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records. - * - * @author mrogers - * @author Roy Wetherall - */ -public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter -{ - /** logger */ - private static Log logger = LogFactory.getLog(DispositionLifecycleJobExecuter.class); - - /** batching properties */ - private int batchSize; - - /** list of disposition actions to automatically execute */ - private List dispositionActions; - - /** query string */ - private String query; - - /** records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** node service */ - private NodeService nodeService; - - /** search service */ - private SearchService searchService; - - /** person service */ - private PersonService personService; - - /** - * List of disposition actions to automatically execute when eligible. - * - * @param dispositionActions disposition actions - */ - public void setDispositionActions(List dispositionActions) - { - this.dispositionActions = dispositionActions; - } - - public void setBatchSize(int batchSize) - { - this.batchSize = batchSize; - } - - /** - * @param recordsManagementActionService records management action service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * Get the search query string. - * - * @return job query string - */ - protected String getQuery() - { - if (query == null) - { - StringBuilder sb = new StringBuilder(); - - sb.append("TYPE:\"rma:dispositionAction\" AND "); - sb.append("(@rma\\:dispositionAction:("); - - boolean bFirst = true; - for (String dispositionAction : dispositionActions) - { - if (bFirst) - { - bFirst = false; - } - else - { - sb.append(" OR "); - } - - sb.append("\"").append(dispositionAction).append("\""); - } - - sb.append("))"); - sb.append(" AND ISUNSET:\"rma:dispositionActionCompletedAt\" "); - sb.append(" AND ( "); - sb.append("@rma\\:dispositionEventsEligible:true "); - sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); - sb.append(") "); - - query = sb.toString(); - } - - return query; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() - */ - public void executeImpl() - { - try - { - logger.debug("Job Starting"); - - if (dispositionActions != null && !dispositionActions.isEmpty()) - { - boolean hasMore = true; - int skipCount = 0; - while (hasMore) - { - SearchParameters params = new SearchParameters(); - params.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - params.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); - params.setQuery(getQuery()); - params.setSkipCount(skipCount); - params.setMaxItems(batchSize); - - // execute search - ResultSet results = searchService.query(params); - List resultNodes = results.getNodeRefs(); - hasMore = results.hasMore(); - skipCount += resultNodes.size(); // increase by page size - results.close(); - - if (logger.isDebugEnabled()) - { - logger.debug("Processing " + resultNodes.size() + " nodes"); - } - - // process search results - if (!resultNodes.isEmpty()) - { - executeAction(resultNodes); - } - } - } - logger.debug("Job Finished"); - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug(exception); - } - } - } - - /** - * Helper method that executes a disposition action - * - * @param actionNodes - the disposition actions to execute - */ - private void executeAction(final List actionNodes) - { - RetryingTransactionCallback processTranCB = () -> { - for (NodeRef actionNode : actionNodes) - { - if (nodeService.exists(actionNode)) - { - final String dispAction = (String) nodeService - .getProperty(actionNode, RecordsManagementModel.PROP_DISPOSITION_ACTION); - - // Run disposition action - if (dispAction != null && dispositionActions.contains(dispAction)) - { - ChildAssociationRef parent = nodeService.getPrimaryParent(actionNode); - if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION)) - { - Map props = new HashMap<>(1); - props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE); - - try - { - // execute disposition action - recordsManagementActionService - .executeRecordsManagementAction(parent.getParentRef(), dispAction, props); - - if (logger.isDebugEnabled()) - { - logger.debug("Processed action: " + dispAction + "on" + parent); - } - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug(exception); - } - } - } - } - } - } - return Boolean.TRUE; - }; - retryingTransactionHelper.doInTransaction(processTranCB, false, true); - } - - public PersonService getPersonService() - { - return personService; - } - - public void setPersonService(PersonService personService) - { - this.personService = personService; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java deleted file mode 100644 index e8eaf794b0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -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.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This job finds all Vital Records which are due for review, optionally - * excluding those for which notification has already been issued. - * - * @author Neil McErlean - */ -public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJobExecuter -{ - private static Log logger = LogFactory.getLog(NotifyOfRecordsDueForReviewJobExecuter.class); - - private RecordsManagementNotificationHelper recordsManagementNotificationHelper; - - private NodeService nodeService; - - private SearchService searchService; - - public void setRecordsManagementNotificationHelper( - RecordsManagementNotificationHelper recordsManagementNotificationHelper) - { - this.recordsManagementNotificationHelper = recordsManagementNotificationHelper; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() - */ - public void executeImpl() - { - if (logger.isDebugEnabled()) - { - logger.debug("Job " + this.getClass().getSimpleName() + " starting."); - } - - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - // Query is for all records that are due for review and for which - // notification has not been sent. - StringBuilder queryBuffer = new StringBuilder(); - queryBuffer.append("ASPECT:\"rma:vitalRecord\" "); - queryBuffer.append("AND @rma\\:reviewAsOf:[MIN TO NOW] "); - // exclude destroyed electronic records and destroyed nonElectronic records with kept metadata - queryBuffer.append("AND -ASPECT:\"rma:ghosted\" "); - String query = queryBuffer.toString(); - - ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); - final List resultNodes = results.getNodeRefs(); - results.close(); - - if (logger.isDebugEnabled()) - { - logger.debug("Found " + resultNodes.size() + " nodes due for review and without notification."); - } - - //If we have something to do and a template to do it with - if(resultNodes.size() != 0) - { - //Send the email message - but we must not retry since email is not transactional - RetryingTransactionCallback txCallbackSendEmail = new RetryingTransactionCallback() - { - // Set the notification issued property. - public Void execute() - { - // Send notification - recordsManagementNotificationHelper.recordsDueForReviewEmailNotification(resultNodes); - - return null; - } - }; - - /** - * Now do the work, one action in each transaction - */ - // don't retry the send email - retryingTransactionHelper.setMaxRetries(0); - retryingTransactionHelper.doInTransaction(txCallbackSendEmail); - } - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - - if (logger.isDebugEnabled()) - { - logger.debug("Job " + this.getClass().getSimpleName() + " finished"); - } - } // end of execute method - -} - - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java deleted file mode 100644 index 0c1ef9e52b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java +++ /dev/null @@ -1,415 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job; - -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -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.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; - -/** - * Job to publish any pending updates on marked node references. - * - * @author Roy Wetherall - */ -public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter -{ - /** Logger */ - private static Log logger = LogFactory.getLog(PublishUpdatesJobExecuter.class); - - /** Node service */ - private NodeService nodeService; - - /** Search service */ - private SearchService searchService; - - /** Publish executor register */ - private PublishExecutorRegistry publishExecutorRegistry; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Behaviour filter */ - private BehaviourFilter behaviourFilter; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param publishExecutorRegistry public executor registry - */ - public void setPublishExecutorRegistry(PublishExecutorRegistry publishExecutorRegistry) - { - this.publishExecutorRegistry = publishExecutorRegistry; - } - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#executeImpl() - */ - public void executeImpl() - { - if (logger.isDebugEnabled()) - { - logger.debug("Job Starting"); - } - - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - if (rmLoaded()) - { - // Get a list of the nodes that have updates that need to be published - List nodeRefs = getUpdatedNodes(); - - // Deal with each updated disposition action in turn - for (NodeRef nodeRef : nodeRefs) - { - 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 - { - 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)); - } - } - finally - { - // Ensure the update node has either completed the publish or is marked as no longer in progress - unmarkPublishInProgress(nodeRef); - } - } - } - } - } - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - if (logger.isDebugEnabled()) - { - logger.debug("Job Finished"); - } - } - - /** - * Helper method to determine whether the RM content model has been loaded yet. - * - * @return boolean true if RM content model loaded, false otherwise - */ - private boolean rmLoaded() - { - boolean result = false; - - // ensure that the rm content model has been loaded - if (dictionaryService != null && - dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null) - { - result = true; - } - - return result; - } - - /** - * Get a list of the nodes with updates pending publish - * @return List list of node refences with updates pending publication - */ - private List getUpdatedNodes() - { - RetryingTransactionCallback> execution = - new RetryingTransactionHelper.RetryingTransactionCallback>() - { - @Override - public List execute() - { - // Build the query string - StringBuilder sb = new StringBuilder(); - sb.append("ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\""); - String query = sb.toString(); - - if (logger.isDebugEnabled()) - { - logger.debug("Executing query " + query); - } - - // Execute query to find updates awaiting publishing - List resultNodes = null; - - SearchParameters searchParameters = new SearchParameters(); - searchParameters.setQuery(query); - searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); - - try - { - ResultSet results = searchService.query(searchParameters); - try - { - resultNodes = results.getNodeRefs(); - } - finally - { - results.close(); - } - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug("Error executing query, " + exception.getMessage()); - } - throw exception; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Found " + resultNodes.size() + " disposition action definitions updates awaiting publishing."); - } - - return resultNodes; - } - }; - return retryingTransactionHelper.doInTransaction(execution, true); - } - - /** - * Mark the node as publish in progress. This is often used as a marker to prevent any further updates - * to a node. - * @param nodeRef node reference - */ - private void markPublishInProgress(final NodeRef nodeRef) - { - RetryingTransactionHelper.RetryingTransactionCallback execution = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - if (logger.isDebugEnabled()) - { - logger.debug("Marking updated node as publish in progress. (node=" + nodeRef.toString() + ")"); - } - - behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - try - { - if (nodeService.exists(nodeRef)) - { - // Mark the node as publish in progress - nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, true); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - } - return null; - } - }; - retryingTransactionHelper.doInTransaction(execution); - } - - /** - * Publish the updates made to the node. - * @param nodeRef node reference - */ - private void publishUpdates(final NodeRef nodeRef) - { - RetryingTransactionHelper.RetryingTransactionCallback execution = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - try - { - // Get the update to value for the node - String updateTo = (String)nodeService.getProperty(nodeRef, PROP_UPDATE_TO); - - if (updateTo != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Node update to " + updateTo + " (noderef=" + nodeRef.toString() + ")"); - } - - // Get the publish executor - PublishExecutor executor = publishExecutorRegistry.get(updateTo); - if (executor == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")"); - } - throw new AlfrescoRuntimeException("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")"); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Attempting to publish updates. (nodeRef=" + nodeRef.toString() + ")"); - } - - // Publish - executor.publish(nodeRef); - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to publish, because publish executor is not set."); - } - } - - // Remove the unpublished update aspect - nodeService.removeAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE); - - if (logger.isDebugEnabled()) - { - logger.debug("Publish updates complete. (nodeRef=" + nodeRef.toString() + ")"); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - } - - return null; - } - }; - retryingTransactionHelper.doInTransaction(execution); - } - - /** - * Unmark node as publish in progress, assuming publish failed. - * @param nodeRef node reference - */ - private void unmarkPublishInProgress(final NodeRef nodeRef) - { - RetryingTransactionHelper.RetryingTransactionCallback execution = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - try - { - // Assuming the node still has unpublished information, then unmark it in progress - if (nodeService.exists(nodeRef) && - nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Removing publish in progress marker from updated node, because update was not successful. (node=" + nodeRef.toString() + ")"); - } - - nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, false); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - } - - return null; - } - }; - retryingTransactionHelper.doInTransaction(execution); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java deleted file mode 100644 index 9955f06752..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.lock.JobLockService; -import org.alfresco.repo.lock.JobLockService.JobLockRefreshCallback; -import org.alfresco.repo.lock.LockAcquisitionException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -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.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -/** - * Base records management job implementation. - *

- * Delegates job execution and ensures locking is enforced. - * - * @author Roy Wetherall - */ -public class RecordsManagementJob implements Job -{ - private static Log logger = LogFactory.getLog(RecordsManagementJob.class); - - /** which user should be used to log audit */ - private String runAuditAs = AuthenticationUtil.getSystemUserName(); - - private static final long DEFAULT_TIME = 30000L; - - private JobLockService jobLockService; - - private RecordsManagementJobExecuter jobExecuter = null; - - private String jobName; - - private QName getLockQName() - { - return QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, jobName); - } - - private class LockCallback implements JobLockRefreshCallback - { - final AtomicBoolean running = new AtomicBoolean(true); - - @Override - public boolean isActive() - { - return running.get(); - } - - @Override - public void lockReleased() - { - running.set(false); - } - } - - /** - * Attempts to get the lock. If the lock couldn't be taken, then null is returned. - * - * @return Returns the lock token or null - */ - private String getLock() - { - try - { - return jobLockService.getLock(getLockQName(), DEFAULT_TIME); - } - catch (LockAcquisitionException e) - { - return null; - } - } - - /** - * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) - */ - public void execute(JobExecutionContext context) throws JobExecutionException - { - - // get the job lock service - jobLockService = (JobLockService) context.getJobDetail().getJobDataMap().get("jobLockService"); - if (jobLockService == null) { throw new AlfrescoRuntimeException("Job lock service has not been specified."); } - - // get the job executer - jobExecuter = (RecordsManagementJobExecuter) context.getJobDetail().getJobDataMap().get("jobExecuter"); - if (jobExecuter == null) { throw new AlfrescoRuntimeException("Job executer has not been specified."); } - - // get the job name - jobName = (String) context.getJobDetail().getJobDataMap().get("jobName"); - - if (jobName == null) { throw new AlfrescoRuntimeException("Job name has not been specified."); } - - if (jobName.compareTo("dispositionLifecycle") == 0) - { - //RM-3293 - set user for audit - if (jobExecuter instanceof DispositionLifecycleJobExecuter) - { - String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs"); - if (((DispositionLifecycleJobExecuter) jobExecuter).getPersonService().getPersonOrNull(auditUser) != null) - { - setRunAuditAs(auditUser); - } - else - { - setRunAuditAs(AuthenticationUtil.getSystemUserName()); - } - - } - - if (logger.isDebugEnabled()) - { - logger.debug("DispositionLifecycleJobExecuter() logged audit history with user: " + getRunAuditAs()); - - } - - } - - final LockCallback lockCallback = new LockCallback(); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() - { - // try and get the lock - String lockToken = getLock(); - if (lockToken != null) - { - try - { - jobLockService.refreshLock(lockToken, getLockQName(), DEFAULT_TIME, lockCallback); - // do work - jobExecuter.execute(); - } - finally - { - try - { - lockCallback.running.set(false); - jobLockService.releaseLock(lockToken, getLockQName()); - } - catch (LockAcquisitionException e) - { - // Ignore - if (logger.isDebugEnabled()) - { - logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "(" - + e.getMessage() + ")"); - } - } - } - } - - // return - return null; - } - }, getRunAuditAs()); - } - - public String getRunAuditAs() - { - return runAuditAs; - } - - public void setRunAuditAs(String runAuditAs) - { - - this.runAuditAs = runAuditAs; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java deleted file mode 100644 index 5108bfd86b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.admin.RepositoryState; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; - -/** - * Records management job executer base class. - * - * @author Roy Wetherall - */ -public abstract class RecordsManagementJobExecuter implements RecordsManagementModel -{ - /** Retrying transaction helper */ - protected RetryingTransactionHelper retryingTransactionHelper; - - /** Repository state helper */ - protected RepositoryState repositoryState; - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @param repositoryState repository state helper component - */ - public void setRepositoryState(RepositoryState repositoryState) - { - this.repositoryState = repositoryState; - } - - /** - * Executes the jobs work. - */ - public void execute() - { - // jobs not allowed to execute unless bootstrap is complete - if (!repositoryState.isBootstrapping()) - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() - { - executeImpl(); - - return null; - } - }, false, true); - } - } - - /** - * Jobs work implementation. - */ - public abstract void executeImpl(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java deleted file mode 100644 index 2eba605793..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job.publish; - -/** - * Base publish executor implementation - * - * @author Roy Wetherall - */ -public abstract class BasePublishExecutor implements PublishExecutor -{ - /** Publish executor registry */ - public PublishExecutorRegistry registry; - - /** - * Set publish executor registry - * @param registry publish executor registry - */ - public void setPublishExecutorRegistry(PublishExecutorRegistry registry) - { - this.registry = registry; - } - - /** - * Init method - */ - public void init() - { - registry.register(this); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java deleted file mode 100644 index c073d69bea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job.publish; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Disposition action definition publish executor - * - * @author Roy Wetherall - */ -public class DispositionActionDefinitionPublishExecutor extends BasePublishExecutor -{ - /** Node service */ - private NodeService nodeService; - - /** Records management action service */ - private RecordsManagementActionService rmActionService; - - /** - * Set node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set records management service - * @param rmActionService records management service - */ - public void setRmActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor#getName() - */ - @Override - public String getName() - { - return RecordsManagementModel.UPDATE_TO_DISPOSITION_ACTION_DEFINITION; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor#publish(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public void publish(NodeRef nodeRef) - { - List updatedProps = (List)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_UPDATED_PROPERTIES); - if (updatedProps != null) - { - Map params = new HashMap<>(); - params.put(BroadcastDispositionActionDefinitionUpdateAction.CHANGED_PROPERTIES, (Serializable)updatedProps); - rmActionService.executeRecordsManagementAction(nodeRef, BroadcastDispositionActionDefinitionUpdateAction.NAME, params); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java deleted file mode 100644 index 6f2c5a38a2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job.publish; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Publish executor interface. - * - * @author Roy Wetherall - */ -public interface PublishExecutor -{ - /** - * @return publish exector name - */ - String getName(); - - /** - * Publish changes to node. - * - * @param nodeRef node reference - */ - void publish(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java deleted file mode 100644 index b68f8752c4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job.publish; - -import java.util.HashMap; -import java.util.Map; - -/** - * Publish executor register. - * - * @author Roy Wetherall - */ -public class PublishExecutorRegistry -{ - /** Map of publish executors */ - private Map publishExectors = new HashMap<>(3); - - /** - * Register a publish executor - * - * @param publishExecutor publish executor - */ - public void register(PublishExecutor publishExecutor) - { - publishExectors.put(publishExecutor.getName(), publishExecutor); - } - - /** - * Get registered publish executor by name. - * - * @param name name - * @return {@link PublishExecutor}] - */ - public PublishExecutor get(String name) - { - return publishExectors.get(name); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java deleted file mode 100644 index 8ddb9bacd6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript; - -/** - * @author Roy Wetherall - */ -public class ScriptCapability -{ - private String name; - private String displayLabel; - private String[] actions; - - /** - * @param name - * @param displayLabel - * @param actions - */ - protected ScriptCapability(String name, String displayLabel, String[] actions) - { - this.name = name; - this.displayLabel = displayLabel; - this.actions = actions.clone(); - } - - /** - * @return the name - */ - public String getName() - { - return name; - } - - /** - * @return the displayLabel - */ - public String getDisplayLabel() - { - return displayLabel; - } - - /** - * @return the actions - */ - public String[] getActions() - { - return actions; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java deleted file mode 100644 index ebfd25dd9e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript; - -import java.util.Collections; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.repo.jscript.ScriptNode; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.mozilla.javascript.Scriptable; - -/** - * Base records management script node - * - * NOTE: this could be removed, but is being kept as a place holder for future development - * - * @author Roy Wetherall - */ -public class ScriptRecordsManagmentNode extends ScriptNode -{ - private static final long serialVersionUID = 8872385533440938353L; - - private RecordsManagementServiceRegistry rmServices; - - public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services, Scriptable scope) - { - super(nodeRef, services, scope); - rmServices = services; - } - - public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services) - { - super(nodeRef, services); - rmServices = services; - } - - public boolean hasCapability(String capabilityName) - { - boolean result = false; - - CapabilityService capabilityService = (CapabilityService)rmServices.getCapabilityService(); - Capability capability = capabilityService.getCapability(capabilityName); - if (capability != null) - { - Map map = capabilityService.getCapabilitiesAccessState(nodeRef, Collections.singletonList(capabilityName)); - if (map.containsKey(capability)) - { - AccessStatus accessStatus = map.get(capability); - if (!accessStatus.equals(AccessStatus.DENIED)) - { - result = true; - } - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java deleted file mode 100644 index 10b6b22b6f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.repo.jscript.BaseScopableProcessorExtension; -import org.alfresco.repo.jscript.ScriptNode; -import org.alfresco.scripts.ScriptException; - -/** - * Records management service - * - * @author Roy Wetherall - */ -public class ScriptRecordsManagmentService extends BaseScopableProcessorExtension - implements RecordsManagementModel -{ - /** Records management service registry */ - private RecordsManagementServiceRegistry rmServices; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** - * Set records management service registry - * - * @param rmServices records management service registry - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServices) - { - this.rmServices = rmServices; - } - - /** - * Sets the notification helper - * - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * Get records management node - * - * @param node script node - * @return ScriptRecordsManagementNode records management script node - */ - public ScriptRecordsManagmentNode getRecordsManagementNode(ScriptNode node) - { - ScriptRecordsManagmentNode result = null; - - if (rmServices.getNodeService().hasAspect(node.getNodeRef(), ASPECT_FILE_PLAN_COMPONENT)) - { - // TODO .. at this point determine what type of records management node is it and - // create the appropriate sub-type - result = new ScriptRecordsManagmentNode(node.getNodeRef(), rmServices); - } - else - { - throw new ScriptException("Node is not a records management node type."); - } - - return result; - } - - /** - * Set the RM permission - * - * @param node - * @param permission - * @param authority - */ - public void setPermission(ScriptNode node, String permission, String authority) - { - FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService(); - filePlanPermissionService.setPermission(node.getNodeRef(), authority, permission); - } - - /** - * Delete the RM permission - * - * @param node - * @param permission - * @param authority - */ - public void deletePermission(ScriptNode node, String permission, String authority) - { - FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService(); - filePlanPermissionService.deletePermission(node.getNodeRef(), authority, permission); - } - - /** - * Send superseded notification - * - * @param record superseded record - */ - public void sendSupersededNotification(ScriptNode record) - { - notificationHelper.recordSupersededEmailNotification(record.getNodeRef()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java deleted file mode 100644 index 4779698584..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -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.disposition.DispositionService; -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; -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.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.NamespaceService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Base evaluator. - * - * @author Roy Wetherall - */ -public abstract class BaseEvaluator implements RecordsManagementModel, BeanNameAware -{ - /** Name */ - protected String name; - - /** bean name */ - protected String beanName; - - /** JSON conversion component */ - protected JSONConversionComponent jsonConversionComponent; - - /** Record service */ - protected RecordService recordService; - - /** Node service */ - protected NodeService nodeService; - - /** Namespace service */ - protected NamespaceService namespaceService; - - /** Capability service */ - protected CapabilityService capabilityService; - - /** File plan component kinds */ - protected Set kinds; - - /** Capabilities */ - protected List capabilities; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** Disposition service */ - protected DispositionService dispositionService; - - /** Record folder service */ - protected RecordFolderService recordFolderService; - - /** transactional resource helper */ - protected TransactionalResourceHelper transactionalResourceHelper; - - /** - * @param beanName bean name - */ - @Override - public void setBeanName(String beanName) - { - this.beanName = beanName; - } - - /** - * @param jsonConversionComponent json conversion component - */ - public void setJsonConversionComponent(JSONConversionComponent jsonConversionComponent) - { - this.jsonConversionComponent = jsonConversionComponent; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * @param name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @return - */ - public String getName() - { - return this.name; - } - - /** - * @param kinds - */ - public void setKinds(Set kinds) - { - this.kinds = kinds; - } - - /** - * @param capabilties - */ - public void setCapabilities(List capabilties) - { - this.capabilities = capabilties; - } - - /** - * Helper method which sets on capability. - * - * @param capability capability name - */ - public void setCapability(String capability) - { - List list = new ArrayList<>(1); - list.add(capability); - this.capabilities = list; - } - - /** - * Registers this instance as an indicator (evaluator) - */ - public void registerIndicator() - { - jsonConversionComponent.registerIndicator(this); - } - - /** - * Registers this instance as an action (evaluator) - */ - public void registerAction() - { - jsonConversionComponent.registerAction(this); - } - - /** - * Executes the evaluation. - * - * @param nodeRef - * @return - */ - public boolean evaluate(NodeRef nodeRef) - { - Map results = transactionalResourceHelper.getMap("BaseEvaluator.evaluate"); - String key = new StringBuffer(nodeRef.toString()).append(AuthenticationUtil.getRunAsUser()).append(beanName).toString(); - - if (!results.containsKey(key)) - { - boolean result = false; - - // Check that we are dealing with the correct kind of RM object - if ((kinds == null || checkKinds(nodeRef)) && - // Check we have the required capabilities - (capabilities == null || checkCapabilities(nodeRef))) - { - result = evaluateImpl(nodeRef); - } - - results.put(key, result); - } - - return results.get(key); - } - - /** - * Checks the file plan component kind. - * - * @param nodeRef - * @return - */ - private boolean checkKinds(NodeRef nodeRef) - { - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - return kinds.contains(kind); - } - - /** - * Checks the capabilities. - * - * @param nodeRef - * @return - */ - private boolean checkCapabilities(NodeRef nodeRef) - { - boolean result = true; - if (capabilities != null && !capabilities.isEmpty()) - { - Map accessStatus = capabilityService.getCapabilitiesAccessState(nodeRef, capabilities); - for (AccessStatus value : accessStatus.values()) - { - if (AccessStatus.DENIED.equals(value)) - { - result = false; - break; - } - } - } - return result; - } - - /** - * Evaluation execution implementation. - * - * @param nodeRef - * @return - */ - protected abstract boolean evaluateImpl(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java deleted file mode 100644 index ea09ba8d37..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java +++ /dev/null @@ -1,698 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app; - -import static org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel.READ_RECORDS; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; - -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.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -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.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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.JavaBehaviour; -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.DictionaryService; -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.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PathUtil; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.ArrayUtils; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - -/** - * Extend JSON conversion component to include RM specifics. - * - * @author Roy Wetherall - */ -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"; - private static final String RECORD_CONTRIBUTOR_GROUP_NAME = "recordContributorGroupName"; - private static final String IS_VISIBLE_FOR_CURRENT_USER = "isVisibleForCurrentUser"; - private static final String FROZEN_ACTIVE_CONTENT = "frozencontent"; - - /** 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; - - /** File plan service */ - private FilePlanService filePlanService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** dictionary service */ - private DictionaryService dictionaryService; - - /** site service */ - private SiteService siteService; - - /** freeze service */ - private FreezeService freezeService; - - /** - * Disposition service - */ - private DispositionService dispositionService; - - /** Indicators */ - private List indicators = new ArrayList<>(); - - /** Actions */ - private List actions = new ArrayList<>(); - - /** The policy component */ - private PolicyComponent policyComponent; - - /** JSON conversion component cache */ - private SimpleCache jsonConversionComponentCache; - - /** Constants for checking the cache */ - private static final String RM_SITE_EXISTS = "rmSiteExists"; - - /** - * @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 - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @return the filePlanService - */ - protected FilePlanService getFileplanService() - { - return this.filePlanService; - } - - /** - * @return the capabilityService - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param indicator registered indicator - */ - public void registerIndicator(BaseEvaluator indicator) - { - indicators.add(indicator); - } - - /** - * @param action registered action - */ - public void registerAction(BaseEvaluator action) - { - actions.add(action); - } - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Gets the json conversion component cache - * - * @return The json conversion component cache - */ - protected SimpleCache getJsonConversionComponentCache() - { - return this.jsonConversionComponentCache; - } - - /** - * Sets the json conversion component cache - * - * @param jsonConversionComponentCache The json conversion component cache - */ - public void setJsonConversionComponentCache(SimpleCache jsonConversionComponentCache) - { - this.jsonConversionComponentCache = jsonConversionComponentCache; - } - - /** - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * - * @param freezeService - */ - public void setFreezeService(FreezeService freezeService) { this.freezeService = freezeService; } - - /** - * The initialise method - */ - public void init() - { - policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"), - RecordsManagementModel.TYPE_RM_SITE, - new JavaBehaviour(this, "onDeleteNode")); - - policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), - RecordsManagementModel.TYPE_RM_SITE, - new JavaBehaviour(this, "onCreateNode")); - } - - /** - * @see org.alfresco.repo.jscript.app.JSONConversionComponent#setRootValues(org.alfresco.service.cmr.model.FileInfo, - * org.json.simple.JSONObject, boolean) - */ - @SuppressWarnings("unchecked") - @Override - protected void setRootValues(FileInfo nodeInfo, JSONObject rootJSONObject, boolean useShortQNames) - { - if (nodeInfo != null) - { - // Set the base root values - super.setRootValues(nodeInfo, rootJSONObject, useShortQNames); - - rootJSONObject.put("uiType", getUIType(nodeInfo.getNodeRef())); - - // check the existence of the RM site - checkRmSiteExistence(rootJSONObject); - - // get the record contributor information - rootJSONObject.put(IS_RECORD_CONTRIBUTOR_GROUP_ENABLED, isRecordContributorsGroupEnabled); - rootJSONObject.put(RECORD_CONTRIBUTOR_GROUP_NAME, recordContributorsGroupName); - - // Get the node reference for convenience - NodeRef nodeRef = nodeInfo.getNodeRef(); - - if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, ViewRecordsCapability.NAME))) - { - // Indicate whether the node is a RM object or not - boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeRef); - rootJSONObject.put(IS_RM_NODE, isFilePlanComponent); - - if (isFilePlanComponent) - { - rootJSONObject.put(RM_NODE, setRmNodeValues(nodeRef, useShortQNames)); - - // FIXME: Is this the right place to add the information? - addInfo(nodeInfo, rootJSONObject); - } - } - Set filePlans = filePlanService.getFilePlans(); - if (!CollectionUtils.isEmpty(filePlans)) - { - NodeRef filePlanNodeRef = filePlans.stream().findFirst().orElse(null); - if (filePlanNodeRef != null) - { - Set roles = filePlanRoleService.getRolesByUser(filePlanNodeRef, AuthenticationUtil.getFullyAuthenticatedUser()); - boolean hasFilingPermission = !CollectionUtils.isEmpty(roles); - rootJSONObject.put(IS_VISIBLE_FOR_CURRENT_USER, hasFilingPermission); - } - } - } - } - - /** - * Checks for the existence of the RM site - * - * @param rootJSONObject the root JSON object - */ - @SuppressWarnings("unchecked") - private void checkRmSiteExistence(JSONObject rootJSONObject) - { - if (!getJsonConversionComponentCache().contains(RM_SITE_EXISTS)) - { - SiteInfo site = siteService.getSite(FilePlanService.DEFAULT_RM_SITE_ID); - if (site != null) - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); - rootJSONObject.put(IS_RM_SITE_CREATED, true); - } - else - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); - rootJSONObject.put(IS_RM_SITE_CREATED, false); - } - } - else - { - rootJSONObject.put(IS_RM_SITE_CREATED, getJsonConversionComponentCache().get(RM_SITE_EXISTS)); - } - } - - /** - * Helper method to add information about node - * - * @param nodeInfo node information - * @param rootJSONObject root JSON object - */ - @SuppressWarnings("unchecked") - private void addInfo(final FileInfo nodeInfo, JSONObject rootJSONObject) - { - String itemType = (String) rootJSONObject.get("type"); - final QName itemTypeQName = QName.createQName(itemType, namespaceService); - - NodeRef originatingLocation = AuthenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() - { - NodeRef originatingLocation = null; - - if (dictionaryService.isSubClass(itemTypeQName, ContentModel.TYPE_CONTENT)) - { - NodeRef nodeRef = nodeInfo.getNodeRef(); - List parentAssocs = nodeService.getParentAssocs(nodeRef); - - for (ChildAssociationRef parent : parentAssocs) - { - // FIXME: What if there is more than a secondary parent? - // RM-3930 - if (!parent.isPrimary()) - { - originatingLocation = parent.getParentRef(); - - // only consider the non-RM parent otherwise we can - // run into issues with frozen or transferring records - if (!nodeService.hasAspect(originatingLocation, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - // assume we have found the correct in-place location - // FIXME when we support multiple in-place locations - // See RM-3929 - break; - } - } - } - } - - return originatingLocation; - } - }); - - if (originatingLocation != null) - { - // add the originating location (if there is one) - String pathSeparator = "/"; - String displayPath = getDisplayPath(originatingLocation); - String[] displayPathElements = displayPath.split(pathSeparator); - Object[] subPath = ArrayUtils.subarray(displayPathElements, 5, displayPathElements.length); - StringBuilder originatingLocationPath = new StringBuilder(); - for (int i = 0; i < subPath.length; i++) - { - originatingLocationPath.append(pathSeparator).append(subPath[i]); - } - rootJSONObject.put("originatingLocationPath", originatingLocationPath.toString()); - } - } - - /** - * Helper method to get the display path. - * - * @param nodeRef node reference - * @return String display path - */ - private String getDisplayPath(final NodeRef nodeRef) - { - return AuthenticationUtil.runAsSystem(new RunAsWork() - { - public String doWork() throws Exception - { - return PathUtil.getDisplayPath(nodeService.getPath(nodeRef), true); - } - }); - } - - /** - * 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 - */ - @SuppressWarnings("unchecked") - private JSONObject setRmNodeValues(final NodeRef nodeRef, final boolean useShortQName) - { - JSONObject rmNodeValues = new JSONObject(); - - // UI convenience type - rmNodeValues.put("uiType", getUIType(nodeRef)); - - // Get the 'kind' of the file plan component - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - rmNodeValues.put("kind", kind.toString()); - - // set the primary parent node reference - ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); - if (assoc != null) - { - rmNodeValues.put("primaryParentNodeRef", assoc.getParentRef().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); - if (filePlan != null) - { - 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); - - // Set the actions array - setActions(rmNodeValues, nodeRef); - - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - //Add details of the next incomplete event in the disposition schedule - if (dispositionService.getNextDispositionAction(nodeRef) != null) - { - for (EventCompletionDetails details : dispositionService.getNextDispositionAction(nodeRef).getEventCompletionDetails()) - { - if (!details.isEventComplete()) - { - HashMap properties = (HashMap) rmNodeValues.get("properties"); - properties.put("combineDispositionStepConditions", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS)); - properties.put("incompleteDispositionEvent", details.getEventName()); - properties.put("dispositionEventCombination", nodeService.getProperty(dispositionService.getNextDispositionAction(nodeRef).getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT_COMBINATION)); - - break; - } - } - } - return null; - }); - - return rmNodeValues; - } - - @SuppressWarnings("unchecked") - private void setIndicators(JSONObject rmNodeValues, NodeRef nodeRef) - { - if (indicators != null && !indicators.isEmpty()) - { - JSONArray jsonIndicators = new JSONArray(); - - for (BaseEvaluator indicator : indicators) - { - if (indicator.evaluate(nodeRef)) - { - jsonIndicators.add(indicator.getName()); - } - } - - rmNodeValues.put("indicators", jsonIndicators); - } - } - - @SuppressWarnings("unchecked") - private void setActions(JSONObject rmNodeValues, NodeRef nodeRef) - { - if (actions != null && !actions.isEmpty()) - { - JSONArray jsonActions = new JSONArray(); - - for (BaseEvaluator action : actions) - { - if (action.evaluate(nodeRef)) - { - jsonActions.add(action.getName()); - } - } - - rmNodeValues.put("actions", jsonActions); - } - } - - /** - * @see org.alfresco.repo.jscript.app.JSONConversionComponent#permissionsToJSON(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - protected JSONObject permissionsToJSON(final NodeRef nodeRef) - { - JSONObject permissionsJSON = new JSONObject(); - if (!filePlanService.isFilePlanComponent(nodeRef)) - { - permissionsJSON = super.permissionsToJSON(nodeRef); - } - else - { - if (ALLOWED.equals(permissionService.hasPermission(nodeRef, READ_RECORDS))) - { - permissionsJSON.put("inherited", permissionService.getInheritParentPermissions(nodeRef)); - permissionsJSON.put("roles", allSetPermissionsToJSON(nodeRef)); - permissionsJSON.put("user", userPermissionsToJSON(nodeRef)); - } - } - return permissionsJSON; - } - - /** - * Gets the rm 'type' used as a UI convenience and compatibility flag. - */ - private String getUIType(NodeRef nodeRef) - { - String result = "unknown"; - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (kind != null) - { - switch (kind) - { - case FILE_PLAN: - { - result = "fileplan"; - break; - } - case RECORD_CATEGORY: - { - result = "record-category"; - break; - } - case RECORD_FOLDER: - { - if (recordService.isMetadataStub(nodeRef)) - { - result = "metadata-stub-folder"; - } - else - { - result = "record-folder"; - } - break; - } - case RECORD: - { - if (recordService.isMetadataStub(nodeRef)) - { - result = "metadata-stub"; - } - else - { - if (recordService.isDeclared(nodeRef)) - { - result = "record"; - } - else - { - result = "undeclared-record"; - } - } - break; - } - case HOLD: - { - result = "hold"; - break; - } - case TRANSFER: - { - result = "transfer-container"; - break; - } - case UNFILED_RECORD_FOLDER: - { - result = "unfiled-record-folder"; - break; - } - default: - { - break; - } - } - } - else if (freezeService.isFrozen(nodeRef)) - { - result = FROZEN_ACTIVE_CONTENT; - } - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java deleted file mode 100644 index b30f1e852e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cutoff indicator - * - * @author Roy Wetherall - */ -public class CutoffEvaluator extends BaseEvaluator -{ - private boolean isCutoff = true; - - public void setCutoff(boolean isCutoff) - { - this.isCutoff = isCutoff; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return (dispositionService.isDisposableItemCutoff(nodeRef) == isCutoff); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java deleted file mode 100644 index c96513025c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Additional action evaluator, disabling action if there are no record metadata aspects - * available for the node. - * - * @author Roy Wetherall - */ -public class EditRecordMetadataActionEvaluator extends BaseEvaluator -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return !recordService.getRecordMetadataAspects(nodeRef).isEmpty(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java deleted file mode 100644 index 6b3316a939..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class FolderOpenClosedEvaluator extends BaseEvaluator -{ - private boolean expected = true; - - public void setExpected(boolean expected) - { - this.expected = expected; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return (recordFolderService.isRecordFolderClosed(nodeRef) == expected); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java deleted file mode 100644 index be710d4e7f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze indicator. - *

- * Only shows as frozen if the user can 'read' the holds - * that hold the nodeRef. - * - * @author Roy Wetherall - */ -public class FrozenEvaluator extends BaseEvaluator -{ - /** hold service */ - private HoldService holdService; - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Only indicate the node is frozen if the user can 'read' at least one of the holds - * - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - List heldBy = holdService.heldBy(nodeRef, true); - return !heldBy.isEmpty(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java deleted file mode 100644 index 9440e99fe6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Transfered indicator - * - * @author Roy Wetherall - */ -public class HasAspectEvaluator extends BaseEvaluator -{ - private String prefixAspectQNameString; - - public void setAspect(String aspect) - { - prefixAspectQNameString = aspect; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - QName aspect = QName.createQName(prefixAspectQNameString, namespaceService); - return nodeService.hasAspect(nodeRef, aspect); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java deleted file mode 100644 index 47eae34e66..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -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; - -/** - * 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() - { - 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) && !nodeService.getType(parent.getParentRef()).equals(TYPE_HOLD)) - { - count++; - } - } - - // return true if more than one - return (count > 1); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java deleted file mode 100644 index 062c008e88..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public class NonElectronicEvaluator extends BaseEvaluator -{ - private DictionaryService dictionaryService; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - QName qName = nodeService.getType(nodeRef); - if (qName != null && dictionaryService.isSubClass(qName, TYPE_NON_ELECTRONIC_DOCUMENT)) - { - result = true; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java deleted file mode 100644 index f130eca602..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Split EMail action evaluator - * - * @author Roy Wetherall - */ -public class SplitEmailActionEvaluator extends BaseEvaluator -{ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - if (!recordService.isDeclared(nodeRef)) - { - ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - if (contentData != null) - { - String mimetype = contentData.getMimetype(); - if (mimetype != null && - (MimetypeMap.MIMETYPE_RFC822.equals(mimetype) || - MimetypeMap.MIMETYPE_OUTLOOK_MSG.equals(mimetype))) - { - result = true; - } - } - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java deleted file mode 100644 index 111e562b44..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -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. - * - * @author Roy Wetherall - */ -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; - - /** - * @param transferAccessionIndicator true if accession, false otherwise - */ - public void setTransferAccessionIndicator(boolean transferAccessionIndicator) - { - this.transferAccessionIndicator = transferAccessionIndicator; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - 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 + "'."); - } - } - - return result; - } - - /** - * Helper method to get the transfer node reference. - *

- * Takes into account records in tranferred record folders. - * - * @param nodeRef node reference - * @return {@link NodeRef} transfer node - */ - private NodeRef getTransferNodeRef(NodeRef nodeRef) - { - NodeRef result = null; - - List parents = nodeService.getParentAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - if (parents.size() == 1) - { - result = parents.get(0).getParentRef(); - } - else - { - if (recordService.isRecord(nodeRef)) - { - for (NodeRef recordFolder : recordFolderService.getRecordFolders(nodeRef)) - { - result = getTransferNodeRef(recordFolder); - if (result != null) - { - break; - } - } - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java deleted file mode 100644 index 359ac423e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cutoff indicator - * - * @author Roy Wetherall - */ -public class TrueEvaluator extends BaseEvaluator -{ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java deleted file mode 100644 index 2fe45664b8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class VitalRecordEvaluator extends BaseEvaluator -{ - private VitalRecordService vitalRecordService; - - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return vitalRecordService.isVitalRecord(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java deleted file mode 100644 index e3df2570a3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.google.common.collect.Sets; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.annotation.BehaviourRegistry; -import org.alfresco.service.cmr.repository.NodeRef; -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; - -/** - * Convenient base class for behaviour beans. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseBehaviourBean extends ServiceBaseImpl - implements RecordsManagementModel, - BehaviourRegistry -{ - /** Logger */ - protected static final Log LOGGER = LogFactory.getLog(BaseBehaviourBean.class); - - /** I18N */ - protected static final String UNIQUE_CHILD_TYPE_ERROR = "rm.action.unique.child.type-error-message"; - protected static final String MULTIPLE_CHILDREN_TYPE_ERROR = "rm.action.multiple.children.type-error-message"; - - /** behaviour filter */ - protected BehaviourFilter behaviourFilter; - - /** behaviour map */ - protected Map behaviours = new HashMap<>(7); - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @see org.alfresco.repo.policy.annotation.BehaviourRegistry#registerBehaviour(java.lang.String, org.alfresco.repo.policy.Behaviour) - */ - @Override - public void registerBehaviour(String name, org.alfresco.repo.policy.Behaviour behaviour) - { - if (behaviours.containsKey(name)) - { - throw new AlfrescoRuntimeException("Can not register behaviour, because name " + name + "has already been used."); - } - - behaviours.put(name, behaviour); - } - - /** - * @see org.alfresco.repo.policy.annotation.BehaviourRegistry#getBehaviour(java.lang.String) - */ - @Override - public org.alfresco.repo.policy.Behaviour getBehaviour(String name) - { - return behaviours.get(name); - } - - /** - * Helper method that checks if the newly created child association complies with the RM rules - * @param parent the parent node - * @param child the child node - * @param acceptedUniqueChildType a list of node types that are accepted as children of the provided parent only once - * @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times - * @throws IntegrityException if the child association doesn't comply with the RM rules - */ - protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List acceptedUniqueChildType, List acceptedMultipleChildType) throws IntegrityException - { - QName childType = getInternalNodeService().getType(child); - if(acceptedUniqueChildType.contains(childType)) - { - // check the user is not trying to create multiple children of a type that is only accepted once - if(nodeService.getChildAssocs(parent, Sets.newHashSet(childType)).size() > 1) - { - throw new IntegrityException(I18NUtil.getMessage(UNIQUE_CHILD_TYPE_ERROR), null); - } - } - else if(!acceptedMultipleChildType.contains(childType)) - { - throw new IntegrityException(I18NUtil.getMessage(MULTIPLE_CHILDREN_TYPE_ERROR, childType), null); - } - } - - /** - * Helper method that checks if the newly created child association is between the sub-types of accepted types. - * @param child the child node - * @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times - * @throws IntegrityException if the child association isn't between the sub-types of accepted types - */ - protected void validateNewChildAssociationSubTypesIncluded(NodeRef child, List acceptedMultipleChildType) throws IntegrityException - { - QName childType = getInternalNodeService().getType(child); - for(QName type : acceptedMultipleChildType) - { - if(instanceOf(childType, type)) - { - return; - } - } - //no match was found in sub-types of permitted types list - throw new IntegrityException(I18NUtil.getMessage(MULTIPLE_CHILDREN_TYPE_ERROR, childType), null); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java deleted file mode 100644 index aeb83a8b33..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Bootstrap bean that indicates that the specified types or aspects are - * customizable. - * - * @author Roy Wetherall - * @since 2.0 - */ -public class CustomisableTypesBootstrap -{ - /** Records management admin service */ - private RecordsManagementAdminService recordsManagementAdminService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** List of types and aspects to register as customisable */ - private List customisable; - - /** - * @param recordsManagementAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param customisable list of types and aspects to register as customisable - */ - public void setCustomisable(List customisable) - { - this.customisable = customisable; - } - - /** - * Bean initialisation method - */ - public void init() - { - for (String customType : customisable) - { - QName customTypeQName = QName.createQName(customType, namespaceService); - recordsManagementAdminService.makeCustomisable(customTypeQName); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java deleted file mode 100644 index fe45d20876..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing records management custom model qualified names - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -public interface RecordsManagementCustomModel -{ - // Namespace details - String RM_CUSTOM_URI = "http://www.alfresco.org/model/rmcustom/1.0"; - String RM_CUSTOM_PREFIX = "rmc"; - - // Model - QName RM_CUSTOM_MODEL = QName.createQName(RM_CUSTOM_URI, "rmcustom"); - - // Custom constraint for Supplemental Marking List - QName CONSTRAINT_CUSTOM_SMLIST = QName.createQName(RM_CUSTOM_URI, "smList"); - - // Custom property for for Supplemental Marking List - QName PROP_SUPPLEMENTAL_MARKING_LIST = QName.createQName(RM_CUSTOM_URI, "supplementalMarkingList"); - - // Supplemental Marking List aspect - QName ASPECT_SUPPLEMENTAL_MARKING_LIST = QName.createQName(RM_CUSTOM_URI, "customSupplementalMarkingList"); - - // Custom associations aspect - QName ASPECT_CUSTOM_ASSOCIATIONS = QName.createQName(RM_CUSTOM_URI, "customAssocs"); - - // 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java deleted file mode 100644 index 09411e593a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing records management qualified names - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementModel extends RecordsManagementCustomModel -{ - // Namespace details - String RM_URI = "http://www.alfresco.org/model/recordsmanagement/1.0"; - String RM_PREFIX = "rma"; - - // Model - QName RM_MODEL = QName.createQName(RM_URI, "recordsmanagement"); - - // RM Site - QName TYPE_RM_SITE = QName.createQName(RM_URI, "rmsite"); - - // Caveat config - QName TYPE_CAVEAT_CONFIG = QName.createQName(RM_URI, "caveatConfig"); - - QName ASPECT_CAVEAT_CONFIG_ROOT = QName.createQName(RM_URI, "caveatConfigRoot"); - QName ASSOC_CAVEAT_CONFIG = QName.createQName(RM_URI, "caveatConfigAssoc"); - - // Email config - QName TYPE_EMAIL_CONFIG = QName.createQName(RM_URI, "emailConfig"); - QName ASPECT_EMAIL_CONFIG_ROOT = QName.createQName(RM_URI, "emailConfigRoot"); - QName ASSOC_EMAIL_CONFIG = QName.createQName(RM_URI, "emailConfigAssoc"); - - // Records management container - QName TYPE_RECORDS_MANAGEMENT_CONTAINER = QName.createQName(RM_URI, "recordsManagementContainer"); - - // Record Category - QName TYPE_RECORD_CATEGORY = QName.createQName(RM_URI, "recordCategory"); - - // Records management root container - QName TYPE_FILE_PLAN = QName.createQName(RM_URI, "filePlan"); - - // Unfiled record container - QName TYPE_UNFILED_RECORD_CONTAINER = QName.createQName(RM_URI, "unfiledRecordContainer"); - - // Unfiled record folder - QName TYPE_UNFILED_RECORD_FOLDER = QName.createQName(RM_URI, "unfiledRecordFolder"); - - // Hold container - QName TYPE_HOLD_CONTAINER = QName.createQName(RM_URI, "holdContainer"); - - // Transfer container - QName TYPE_TRANSFER_CONTAINER = QName.createQName(RM_URI, "transferContainer"); - - // Disposition instructions aspect - QName ASPECT_SCHEDULED = QName.createQName(RM_URI, "scheduled"); - QName ASSOC_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule"); - - // Disposition definition type - QName TYPE_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule"); - QName PROP_DISPOSITION_AUTHORITY = QName.createQName(RM_URI, "dispositionAuthority"); - QName PROP_DISPOSITION_INSTRUCTIONS = QName.createQName(RM_URI, "dispositionInstructions"); - QName PROP_RECORD_LEVEL_DISPOSITION = QName.createQName(RM_URI, "recordLevelDisposition"); - QName ASSOC_DISPOSITION_ACTION_DEFINITIONS = QName.createQName(RM_URI, "dispositionActionDefinitions"); - - // Disposition action type - QName TYPE_DISPOSITION_ACTION_DEFINITION = QName.createQName(RM_URI, "dispositionActionDefinition"); - QName PROP_DISPOSITION_ACTION_NAME = QName.createQName(RM_URI, "dispositionActionName"); - QName PROP_DISPOSITION_DESCRIPTION = QName.createQName(RM_URI, "dispositionDescription"); - QName PROP_DISPOSITION_PERIOD = QName.createQName(RM_URI, "dispositionPeriod"); - QName PROP_DISPOSITION_PERIOD_PROPERTY = QName.createQName(RM_URI, "dispositionPeriodProperty"); - QName PROP_DISPOSITION_EVENT = QName.createQName(RM_URI, "dispositionEvent"); - QName PROP_DISPOSITION_EVENT_COMBINATION = QName.createQName(RM_URI, "dispositionEventCombination"); - QName PROP_COMBINE_DISPOSITION_STEP_CONDITIONS = QName.createQName(RM_URI, "combineDispositionStepConditions"); - QName PROP_DISPOSITION_LOCATION = QName.createQName(RM_URI, "dispositionLocation"); - QName PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY = QName.createQName(RM_URI, "dispositionActionGhostOnDestroy"); - - // Records folder - QName TYPE_RECORD_FOLDER = QName.createQName(RM_URI, "recordFolder"); - QName PROP_IS_CLOSED = QName.createQName(RM_URI, "isClosed"); - - // Declared record aspect - QName ASPECT_DECLARED_RECORD = QName.createQName(RM_URI, "declaredRecord"); - QName PROP_DECLARED_AT = QName.createQName(RM_URI, "declaredAt"); - QName PROP_DECLARED_BY = QName.createQName(RM_URI, "declaredBy"); - - // Record aspect - QName ASPECT_RECORD = QName.createQName(RM_URI, "record"); - QName PROP_DATE_FILED = QName.createQName(RM_URI, "dateFiled"); - QName PROP_ORIGIONAL_NAME = QName.createQName(RM_URI, "origionalName"); - - // Common record details - QName ASPECT_COMMON_RECORD_DETAILS = QName.createQName(RM_URI, "commonRecordDetails"); - QName PROP_LOCATION = QName.createQName(RM_URI, "location"); - - // Fileable aspect - QName ASPECT_FILABLE = QName.createQName(RM_URI, "fileable"); - - // Record component identifier aspect - QName ASPECT_RECORD_COMPONENT_ID = QName.createQName(RM_URI, "recordComponentIdentifier"); - QName PROP_IDENTIFIER = QName.createQName(RM_URI, "identifier"); - QName PROP_DB_UNIQUENESS_ID = QName.createQName(RM_URI, "dbUniquenessId"); - - // Vital record definition aspect - QName ASPECT_VITAL_RECORD_DEFINITION = QName.createQName(RM_URI, "vitalRecordDefinition"); - QName PROP_VITAL_RECORD_INDICATOR = QName.createQName(RM_URI, "vitalRecordIndicator"); - QName PROP_REVIEW_PERIOD = QName.createQName(RM_URI, "reviewPeriod"); - - // Vital record aspect - QName ASPECT_VITAL_RECORD = QName.createQName(RM_URI, "vitalRecord"); - QName PROP_REVIEW_AS_OF = QName.createQName(RM_URI, "reviewAsOf"); - - // Cut off aspect - QName ASPECT_CUT_OFF = QName.createQName(RM_URI, "cutOff"); - QName PROP_CUT_OFF_DATE = QName.createQName(RM_URI, "cutOffDate"); - - // Uncut off aspect - QName ASPECT_UNCUT_OFF = QName.createQName(RM_URI, "uncutOff"); - - // Transferred aspect - QName ASPECT_TRANSFERRED = QName.createQName(RM_URI, "transferred"); - - // Ascended aspect - QName ASPECT_ASCENDED = QName.createQName(RM_URI, "ascended"); - - // Disposition schedule aspect - QName ASPECT_DISPOSITION_LIFECYCLE = QName.createQName(RM_URI, "dispositionLifecycle"); - QName ASSOC_NEXT_DISPOSITION_ACTION = QName.createQName(RM_URI, "nextDispositionAction"); - QName ASSOC_DISPOSITION_ACTION_HISTORY = QName.createQName(RM_URI, "dispositionActionHistory"); - - // Disposition action type - QName TYPE_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); - QName PROP_DISPOSITION_ACTION_ID = QName.createQName(RM_URI, "dispositionActionId"); - QName PROP_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); - QName PROP_DISPOSITION_AS_OF = QName.createQName(RM_URI, "dispositionAsOf"); - /** A flag indicating that the "disposition as of" date has been manually set and shouldn't be changed. */ - QName PROP_MANUALLY_SET_AS_OF = QName.createQName(RM_URI, "manuallySetAsOf"); - QName PROP_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "dispositionEventsEligible"); - QName PROP_DISPOSITION_ACTION_STARTED_AT = QName.createQName(RM_URI, "dispositionActionStartedAt"); - QName PROP_DISPOSITION_ACTION_STARTED_BY = QName.createQName(RM_URI, "dispositionActionStartedBy"); - QName PROP_DISPOSITION_ACTION_COMPLETED_AT = QName.createQName(RM_URI, "dispositionActionCompletedAt"); - QName PROP_DISPOSITION_ACTION_COMPLETED_BY = QName.createQName(RM_URI, "dispositionActionCompletedBy"); - QName ASSOC_EVENT_EXECUTIONS = QName.createQName(RM_URI, "eventExecutions"); - - // Event execution type - QName TYPE_EVENT_EXECUTION = QName.createQName(RM_URI, "eventExecution"); - QName PROP_EVENT_EXECUTION_NAME = QName.createQName(RM_URI, "eventExecutionName"); - QName PROP_EVENT_EXECUTION_AUTOMATIC = QName.createQName(RM_URI, "eventExecutionAutomatic"); - QName PROP_EVENT_EXECUTION_COMPLETE = QName.createQName(RM_URI, "eventExecutionComplete"); - QName PROP_EVENT_EXECUTION_COMPLETED_BY = QName.createQName(RM_URI, "eventExecutionCompletedBy"); - QName PROP_EVENT_EXECUTION_COMPLETED_AT = QName.createQName(RM_URI, "eventExecutionCompletedAt"); - - // Custom RM data aspect - QName ASPECT_CUSTOM_RM_DATA = QName.createQName(RM_URI, "customRMData"); - - // marker aspect on all RM objercts (except caveat root) - QName ASPECT_FILE_PLAN_COMPONENT = QName.createQName(RM_URI, "filePlanComponent"); - QName PROP_ROOT_NODEREF = QName.createQName(RM_URI, "rootNodeRef"); - - // Non-electronic document - QName TYPE_NON_ELECTRONIC_DOCUMENT = QName.createQName(RM_URI, "nonElectronicDocument"); - - // Records management root aspect - QName ASPECT_RECORDS_MANAGEMENT_ROOT = QName.createQName(RM_URI, "recordsManagementRoot"); - // since 2.1 - @Deprecated - QName ASSOC_HOLDS = QName.createQName(RM_URI, "holds"); - // since 2.1 - @Deprecated - QName ASSOC_TRANSFERS = QName.createQName(RM_URI, "transfers"); - - // Hold type - QName TYPE_HOLD = QName.createQName(RM_URI, "hold"); - QName PROP_HOLD_REASON = QName.createQName(RM_URI, "holdReason"); - //since 3.2 - @Deprecated - QName ASSOC_FROZEN_RECORDS = QName.createQName(RM_URI, "frozenRecords"); - QName ASSOC_FROZEN_CONTENT = QName.createQName(RM_URI, "frozenContent"); - - // Record meta data aspect - QName ASPECT_RECORD_META_DATA = QName.createQName(RM_URI, "recordMetaData"); - - // Frozen aspect - QName ASPECT_FROZEN = QName.createQName(RM_URI, "frozen"); - QName PROP_FROZEN_AT = QName.createQName(RM_URI, "frozenAt"); - QName PROP_FROZEN_BY = QName.createQName(RM_URI, "frozenBy"); - - // Transfer aspect - QName TYPE_TRANSFER = QName.createQName(RM_URI, "transfer"); - QName PROP_TRANSFER_ACCESSION_INDICATOR = QName.createQName(RM_URI, "transferAccessionIndicator"); - QName PROP_TRANSFER_PDF_INDICATOR = QName.createQName(RM_URI, "transferPDFIndicator"); - QName PROP_TRANSFER_LOCATION = QName.createQName(RM_URI, "transferLocation"); - QName ASSOC_TRANSFERRED = QName.createQName(RM_URI, "transferred"); - - // Transferring aspect - QName ASPECT_TRANSFERRING = QName.createQName(RM_URI, "transferring"); - - // Versioned record aspect - QName ASPECT_VERSIONED_RECORD = QName.createQName(RM_URI, "versionedRecord"); - - // Unpublished update aspect - QName ASPECT_UNPUBLISHED_UPDATE = QName.createQName(RM_URI, "unpublishedUpdate"); - QName PROP_UNPUBLISHED_UPDATE = QName.createQName(RM_URI, "unpublishedUpdate"); - QName PROP_UPDATE_TO = QName.createQName(RM_URI, "updateTo"); - QName PROP_UPDATED_PROPERTIES = QName.createQName(RM_URI, "updatedProperties"); - QName PROP_PUBLISH_IN_PROGRESS = QName.createQName(RM_URI, "publishInProgress"); - String UPDATE_TO_DISPOSITION_ACTION_DEFINITION = "dispositionActionDefinition"; - - // Ghosted aspect - QName ASPECT_GHOSTED = QName.createQName(RM_URI, "ghosted"); - - // Search rollup aspect - QName ASPECT_RM_SEARCH = QName.createQName(RM_URI, "recordSearch"); - QName PROP_RS_DISPOSITION_ACTION_NAME = QName.createQName(RM_URI, "recordSearchDispositionActionName"); - QName PROP_RS_DISPOSITION_ACTION_AS_OF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf"); - QName PROP_RS_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "recordSearchDispositionEventsEligible"); - QName PROP_RS_DISPOSITION_EVENTS = QName.createQName(RM_URI, "recordSearchDispositionEvents"); - QName PROP_RS_VITAL_RECORD_REVIEW_PERIOD = QName.createQName(RM_URI, "recordSearchVitalRecordReviewPeriod"); - QName PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = QName.createQName(RM_URI, "recordSearchVitalRecordReviewPeriodExpression"); - QName PROP_RS_DISPOSITION_PERIOD = QName.createQName(RM_URI, "recordSearchDispositionPeriod"); - QName PROP_RS_DISPOSITION_PERIOD_EXPRESSION = QName.createQName(RM_URI, "recordSearchDispositionPeriodExpression"); - QName PROP_RS_HAS_DISPOITION_SCHEDULE = QName.createQName(RM_URI, "recordSearchHasDispositionSchedule"); - QName PROP_RS_DISPOITION_INSTRUCTIONS = QName.createQName(RM_URI, "recordSearchDispositionInstructions"); - QName PROP_RS_DISPOITION_AUTHORITY = QName.createQName(RM_URI, "recordSearchDispositionAuthority"); - QName PROP_RS_DECLASSIFICATION_REVIEW_COMPLETED_AT = QName.createQName(RM_URI, "declassificationReviewCompletedAt"); - QName PROP_RS_DECLASSIFICATION_REVIEW_COMPLETED_BY = QName.createQName(RM_URI, "declassificationReviewCompletedBy"); - /** @depreacted as of 2.2, because disposable items can now be in multiple holds */ - @Deprecated - QName PROP_RS_HOLD_REASON = QName.createQName(RM_URI, "recordSearchHoldReason"); - - // Loaded Data Set Ids - QName ASPECT_LOADED_DATA_SET_ID = QName.createQName(RM_URI, "loadedDataSetId"); - QName PROP_LOADED_DATA_SET_IDS = QName.createQName(RM_URI, "loadedDataSetIds"); - - // Extended security aspect - // @deprecated as of 2.5, because of performance issues - @Deprecated QName ASPECT_EXTENDED_SECURITY = QName.createQName(RM_URI, "extendedSecurity"); - @Deprecated QName PROP_READERS = QName.createQName(RM_URI, "readers"); - @Deprecated QName PROP_WRITERS = QName.createQName(RM_URI, "writers"); - - // Originating details of a record - QName ASPECT_RECORD_ORIGINATING_DETAILS = QName.createQName(RM_URI, "recordOriginatingDetails"); - QName PROP_RECORD_ORIGINATING_USER_ID = QName.createQName(RM_URI, "recordOriginatingUserId"); - QName PROP_RECORD_ORIGINATING_CREATION_DATE = QName.createQName(RM_URI, "recordOriginatingCreationDate"); - QName PROP_RECORD_ORIGINATING_LOCATION = QName.createQName(RM_URI, "recordOriginatingLocation"); - - // Rejection details of a record - QName ASPECT_RECORD_REJECTION_DETAILS = QName.createQName(RM_URI, "recordRejectionDetails"); - QName PROP_RECORD_REJECTION_USER_ID = QName.createQName(RM_URI, "recordRejectionUserId"); - QName PROP_RECORD_REJECTION_DATE = QName.createQName(RM_URI, "recordRejectionDate"); - QName PROP_RECORD_REJECTION_REASON = QName.createQName(RM_URI, "recordRejectionReason"); - - // Held children aspect - // @since 2.2 - QName ASPECT_HELD_CHILDREN = QName.createQName(RM_URI, "heldChildren"); - QName PROP_HELD_CHILDREN_COUNT = QName.createQName(RM_URI, "heldChildrenCount"); - - // Countable aspect - QName ASPECT_COUNTABLE = QName.createQName(RM_URI, "countable"); - QName PROP_COUNT = QName.createQName(RM_URI, "count"); - - QName ASPECT_SAVED_SEARCH = QName.createQName(RM_URI, "savedSearch"); - //Workaround for RM-6788 - String GL_URI = "http://www.alfresco.org/model/glacier/1.0"; - QName ASPECT_ARCHIVED = QName.createQName(GL_URI, "archived"); - - QName ASPECT_DISPOSITION_PROCESSED = QName.createQName(RM_URI, "dispositionProcessed"); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java deleted file mode 100644 index bd0d9e17dd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; - -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.BaseBehaviourBean; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Abstract disposable item, containing commonality between record and record folder. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class AbstractDisposableItem extends BaseBehaviourBean -{ - /** unwanted aspects */ - protected QName[] unwantedAspects = - { - ASPECT_VITAL_RECORD, - ASPECT_DISPOSITION_LIFECYCLE, - RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH - }; - - /** disposition service */ - protected DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Removes unwanted aspects - * - * @param nodeService - * @param nodeRef - */ - protected void cleanDisposableItem(NodeService nodeService, NodeRef nodeRef) - { - // Remove unwanted aspects - for (QName aspect : unwantedAspects) - { - if (nodeService.hasAspect(nodeRef, aspect)) - { - nodeService.removeAspect(nodeRef, aspect); - } - } - - // remove the current disposition action (if there is one) - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (dispositionAction != null) - { - nodeService.deleteNode(dispositionAction.getNodeRef()); - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java deleted file mode 100644 index 5c786b8704..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java +++ /dev/null @@ -1,1024 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.behaviour; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -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.RecordsManagementServiceRegistry; -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.DispositionActionImpl; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.FrozenAspect; -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.vital.VitalRecordDefinition; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Search behaviour class. - * - * Manages the collapse of data onto the supporting aspect on the record/record folder. - * - * @author Roy Wetherall - * @since 1.0 - */ -public class RecordsManagementSearchBehaviour implements RecordsManagementModel, - NodeServicePolicies.OnMoveNodePolicy -{ - /** logger */ - private static Log logger = LogFactory.getLog(RecordsManagementSearchBehaviour.class); - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Node service */ - private NodeService nodeService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Records management service registry */ - private RecordsManagementServiceRegistry recordsManagementServiceRegistry; - - /** Vital record service */ - private VitalRecordService vitalRecordService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Record service*/ - private RecordService recordService; - - /** - * Frozen aspect - */ - private FrozenAspect frozenAspect; - - /** - * @param nodeService the nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param policyComponent the policyComponent to set - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * @param recordsManagementServiceRegistry the records management service registry - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry recordsManagementServiceRegistry) - { - this.recordsManagementServiceRegistry = recordsManagementServiceRegistry; - } - - /** - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param frozenAspect frozen aspect - */ - public void setFrozenAspect(FrozenAspect frozenAspect) - { - this.frozenAspect = frozenAspect; - } - - - /** on add search aspect behaviour */ - private JavaBehaviour onAddSearchAspect = new JavaBehaviour(this, "rmSearchAspectAdd", NotificationFrequency.TRANSACTION_COMMIT); - - /** disposition action behaviours */ - private JavaBehaviour jbDispositionActionCreate = new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT); - private JavaBehaviour jbDispositionActionPropertiesUpdate = new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT); - - /** disposition lifecycle behaviours */ - private JavaBehaviour jbDispositionLifeCycleAspect = new JavaBehaviour(this, "onAddDispositionLifecycleAspect", NotificationFrequency.TRANSACTION_COMMIT); - - /** disposition schedule behaviours */ - private JavaBehaviour jbDispositionSchedulePropertiesUpdate = new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT); - - /** event update behaviours */ - private JavaBehaviour jbEventExecutionUpdate = new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT); - private JavaBehaviour jbEventExecutionDelete = new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT); - - /** on move record or record folder behavior */ - private JavaBehaviour jbMoveNode = new JavaBehaviour(this, "onMoveNode", NotificationFrequency.TRANSACTION_COMMIT); - - /** Array of behaviours related to disposition schedule artifacts */ - private JavaBehaviour[] jbDispositionBehaviours = - { - jbDispositionActionCreate, - jbDispositionActionPropertiesUpdate, - jbDispositionSchedulePropertiesUpdate, - jbEventExecutionUpdate, - jbEventExecutionDelete, - jbDispositionLifeCycleAspect - }; - - /** - * Initialisation method - */ - public void init() - { - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), - TYPE_DISPOSITION_ACTION, - jbDispositionActionCreate); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), - TYPE_DISPOSITION_ACTION, - jbDispositionActionPropertiesUpdate); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), - TYPE_DISPOSITION_SCHEDULE, - jbDispositionSchedulePropertiesUpdate); - - this.policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), - TYPE_DISPOSITION_ACTION, - ASSOC_EVENT_EXECUTIONS, - jbEventExecutionUpdate); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"), - TYPE_EVENT_EXECUTION, - jbEventExecutionDelete); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_RM_SEARCH, - onAddSearchAspect); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_DISPOSITION_LIFECYCLE, - jbDispositionLifeCycleAspect); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_RECORD, - new JavaBehaviour(this, "onAddRecordAspect", NotificationFrequency.TRANSACTION_COMMIT)); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), - TYPE_RECORD_FOLDER, - new JavaBehaviour(this, "recordFolderCreate", NotificationFrequency.TRANSACTION_COMMIT)); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onSetNodeType"), - TYPE_RECORD_FOLDER, - new JavaBehaviour(this, "convertedToOrFromRecordFolder", NotificationFrequency.TRANSACTION_COMMIT)); - - // Vital Records Review Details Rollup - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_VITAL_RECORD_DEFINITION, - new JavaBehaviour(this, "vitalRecordDefintionAddAspect", NotificationFrequency.TRANSACTION_COMMIT)); - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), - ASPECT_VITAL_RECORD_DEFINITION, - new JavaBehaviour(this, "vitalRecordDefintionUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT)); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"), - ASPECT_FILE_PLAN_COMPONENT, - jbMoveNode); - } - - /** - * Disabled disposition schedule behaviour - */ - public void disableDispositionScheduleBehaviour() - { - for (JavaBehaviour jb : jbDispositionBehaviours) - { - jb.disable(); - } - } - - /** - * Enables disposition schedule behaviour - */ - public void enableDispositionScheduleBehaviour() - { - for (JavaBehaviour jb : jbDispositionBehaviours) - { - jb.enable(); - } - } - - /** - * Ensures the search aspect for the given node is present, complete and correct. - * - * @param recordOrFolder node reference to record or record folder - */ - public void fixupSearchAspect(NodeRef recordOrFolder) - { - // for now only deal with record folders - if (recordFolderService.isRecordFolder(recordOrFolder)) - { - // ensure the search aspect is applied - applySearchAspect(recordOrFolder); - - // setup the properties relating to the disposition schedule - setupDispositionScheduleProperties(recordOrFolder); - - // setup the properties relating to the disposition lifecycle - DispositionAction da = dispositionService.getNextDispositionAction(recordOrFolder); - if (da != null) - { - updateDispositionActionProperties(recordOrFolder, da.getNodeRef()); - setupDispositionActionEvents(recordOrFolder, da); - } - - // setup the properties relating to the vital record indicator - setVitalRecordDefintionDetails(recordOrFolder); - } - } - - /** - * Updates the disposition action properties - * - * @param nodeRef node reference - * @param before value of properties before - * @param after value of properties after - */ - public void dispositionActionPropertiesUpdate(final NodeRef nodeRef, final Map before, final Map after) - { - if (nodeService.exists(nodeRef)) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); - if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = assoc.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - // Update disposition properties - updateDispositionActionProperties(record, nodeRef); - } - - return null; - - }}, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * Helper method to apply the search aspect - * - * @param nodeRef node reference - */ - private void applySearchAspect(NodeRef nodeRef) - { - onAddSearchAspect.disable(); - try - { - if (!nodeService.hasAspect(nodeRef, ASPECT_RM_SEARCH)) - { - nodeService.addAspect(nodeRef, ASPECT_RM_SEARCH , null); - - if (logger.isDebugEnabled()) - { - logger.debug("Added search aspect to node: " + nodeRef); - } - } - } - finally - { - onAddSearchAspect.enable(); - } - } - - /** - * On add record aspect behaviour implementation - * - * @param nodeRef node reference - * @param aspectTypeQName aspect type qname - */ - public void onAddRecordAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - - /** - * On addition of the disposition lifecycle aspect - * @param nodeRef - * @param aspectTypeQName - */ - public void onAddDispositionLifecycleAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - - /** - * On create record folder behaviour implmentation - * - * @param childAssocRef child association reference - */ - public void recordFolderCreate(final ChildAssociationRef childAssocRef) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() throws Exception - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - - /** - * On update type to or from record folder behaviour implementation - * @param nodeRef the updated node - * @param oldType the type the node had before update - * @param newType the type the node has after update - */ - public void convertedToOrFromRecordFolder(final NodeRef nodeRef, final QName oldType, final QName newType) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() throws Exception - { - // If the node has been updated to a record folder - if (newType.equals(TYPE_RECORD_FOLDER) && nodeService.exists(nodeRef)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - /** - * Helper method to setup the disposition schedule properties - * - * @param recordOrFolder node reference of record or record folder - */ - private void setupDispositionScheduleProperties(NodeRef recordOrFolder) - { - if (!methodCached("setupDispositionScheduleProperties", recordOrFolder)) - { - DispositionSchedule ds = dispositionService.getDispositionSchedule(recordOrFolder); - if (ds == null) - { - nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, false); - } - else - { - nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, true); - setDispositionScheduleProperties(recordOrFolder, ds); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchHasDispositionSchedule for node " + recordOrFolder + - " to: " + (ds != null)); - } - } - } - - /** - * On disposition action create behaviour implementation - * - * @param childAssocRef child association reference - */ - public void dispositionActionCreate(final ChildAssociationRef childAssocRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - NodeRef child = childAssocRef.getChildRef(); - if (nodeService.exists(child) && - childAssocRef.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = childAssocRef.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - // Update disposition properties - updateDispositionActionProperties(record, childAssocRef.getChildRef()); - - // Clear the events - nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, null); - } - - return null; - } - }); - } - - /** - * Helper method to determine whether a method has been called in this transaction - * already, or not. - *

- * Prevents work if we get unexpected behaviours firing. - * - * @param method method name (can be any unique string) - * @return boolean true if already called in this transaction, false otherwise - */ - private boolean methodCached(String method, NodeRef nodeRef) - { - boolean result = true; - Set methods = TransactionalResourceHelper.getSet("rm.seachrollup.methodCache"); - String key = method + "|" + nodeRef; - if (!methods.contains(key)) - { - result = false; - methods.add(key); - } - return result; - } - - /** - * On update disposition action properties behaviour implementation - * - * @param record record node reference - * @param dispositionAction disposition action - */ - private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction) - { - Map props = nodeService.getProperties(record); - - DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction); - - 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, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE)); - - DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); - if (daDefinition != null) - { - Period period = daDefinition.getPeriod(); - if (period != null) - { - props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType()); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression()); - } - else - { - props.put(PROP_RS_DISPOSITION_PERIOD, null); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null); - } - } - - try - { - //disable on properties update policy for the frozen aspect - frozenAspect.disableOnPropUpdateFrozenAspect(); - nodeService.setProperties(record, props); - } - finally - { - frozenAspect.enableOnPropUpdateFrozenAspect(); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_ACTION_NAME)); - logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); - logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); - logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_PERIOD)); - logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); - } - } - - /** - * On update of event execution information behaviour\ - * - * @param childAssocRef child association reference - * @param isNewNode true if a new node, false otherwise - */ - @SuppressWarnings("unchecked") - public void eventExecutionUpdate(ChildAssociationRef childAssocRef, boolean isNewNode) - { - NodeRef dispositionAction = childAssocRef.getParentRef(); - NodeRef eventExecution = childAssocRef.getChildRef(); - - if (nodeService.exists(dispositionAction) && - nodeService.exists(eventExecution)) - { - ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionAction); - if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = assoc.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - Collection events = (Collection)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS); - if (events == null) - { - events = new ArrayList<>(1); - } - events.add((String)nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_NAME)); - nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, (Serializable)events); - } - } - } - - /** - * On event execution delete behaviour implementation. - * - * @param childAssocRef child association reference - * @param isNodeArchived true if node is archived on delete, false otherwise - */ - public void eventExecutionDelete(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - NodeRef dispositionActionNode = childAssocRef.getParentRef(); - - if (nodeService.exists(dispositionActionNode)) - { - ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionActionNode); - if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = assoc.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - // make sure the list of events match the action definition - setupDispositionActionEvents(record, dispositionService.getNextDispositionAction(record)); - } - } - } - - /** - * Helper method to setup disposition action events. - * - * @param nodeRef node reference - * @param da disposition action - */ - private void setupDispositionActionEvents(NodeRef nodeRef, DispositionAction da) - { - if (!methodCached("setupDispositionActionEvents", nodeRef)) - { - if (da != null) - { - List eventNames = null; - List eventsList = da.getEventCompletionDetails(); - if (eventsList.size() > 0) - { - eventNames = new ArrayList<>(eventsList.size()); - for (EventCompletionDetails event : eventsList) - { - eventNames.add(event.getEventName()); - } - } - - // set the property - nodeService.setProperty(nodeRef, PROP_RS_DISPOSITION_EVENTS, (Serializable)eventNames); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchDispositionEvents for node " + nodeRef + " to: " + eventNames); - } - } - } - } - - /** - * On add search aspect behaviour implementation. - * - * @param nodeRef node reference - * @param aspectTypeQName aspect type qname - */ - public void rmSearchAspectAdd(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef)) - { - // Initialise the search parameteres as required - setVitalRecordDefintionDetails(nodeRef); - } - - return null; - } - }); - } - - /** - * On add aspect vital record defintion behaviour implementation. - * - * @param nodeRef node reference - * @param aspectTypeQName aspect tyep qname - */ - public void vitalRecordDefintionAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - // Only care about record folders - if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef)) - { - updateVitalRecordDefinitionValues(nodeRef); - } - - return null; - } - }); - } - - /** - * On update vital record definition properties behaviour implementation. - * - * @param nodeRef node reference - * @param before before properties - * @param after after properties - */ - public void vitalRecordDefintionUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - // Only care about record folders - if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef)) - { - Set props = new HashSet<>(1); - props.add(PROP_REVIEW_PERIOD); - Set changed = determineChangedProps(before, after); - changed.retainAll(props); - if (!changed.isEmpty()) - { - updateVitalRecordDefinitionValues(nodeRef); - } - } - - return null; - } - }); - } - - /** - * Helper method to update the vital record defintion values - * - * @param nodeRef node reference - */ - private void updateVitalRecordDefinitionValues(NodeRef nodeRef) - { - if (!methodCached("updateVitalRecordDefinitionValues", nodeRef)) - { - // ensure the folder itself reflects the correct details - applySearchAspect(nodeRef); - setVitalRecordDefintionDetails(nodeRef); - - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - // Apply the search aspect - applySearchAspect(record); - - // Set the vital record definition details - setVitalRecordDefintionDetails(record); - } - } - } - - /** - * Helper method to set vital record definition details. - * - * @param nodeRef node reference - */ - private void setVitalRecordDefintionDetails(NodeRef nodeRef) - { - if (!methodCached("setVitalRecordDefinitionDetails", nodeRef)) - { - VitalRecordDefinition vrd = vitalRecordService.getVitalRecordDefinition(nodeRef); - try - { - frozenAspect.disableOnPropUpdateFrozenAspect(); - if (vrd != null && vrd.isEnabled() && vrd.getReviewPeriod() != null) - { - // Set the property values - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, vrd.getReviewPeriod().getPeriodType()); - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, vrd.getReviewPeriod().getExpression()); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchVitalRecordReviewPeriod for node " + nodeRef + " to: " + - vrd.getReviewPeriod().getPeriodType()); - logger.debug("Set rma:recordSearchVitalRecordReviewPeriodExpression for node " + nodeRef + " to: " + - vrd.getReviewPeriod().getExpression()); - } - } - else - { - // Clear the vital record properties - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, null); - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, null); - } - } - finally - { - frozenAspect.enableOnPropUpdateFrozenAspect(); - - } - } - } - - /** - * Updates the disposition schedule properties - * - * @param nodeRef node reference - * @param before properties before - * @param after properties after - */ - public void dispositionSchedulePropertiesUpdate(NodeRef nodeRef, Map before, Map after) - { - if (nodeService.exists(nodeRef)) - { - // create the schedule object and get the record category for it - DispositionSchedule schedule = new DispositionScheduleImpl(recordsManagementServiceRegistry, nodeService, nodeRef); - NodeRef recordCategoryNode = nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef(); - - if (schedule.isRecordLevelDisposition()) - { - for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) - { - for (NodeRef record : recordService.getRecords(recordFolder)) - { - applySearchAspect(record); - setDispositionScheduleProperties(record, schedule); - } - } - } - else - { - for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) - { - applySearchAspect(recordFolder); - setDispositionScheduleProperties(recordFolder, schedule); - } - } - } - } - - /** - * Helper method to set disposition schedule properties - * - * @param recordOrFolder node reference - * @param schedule dispostion schedule - */ - private void setDispositionScheduleProperties(NodeRef recordOrFolder, DispositionSchedule schedule) - { - if (schedule != null) - { - try - { - frozenAspect.disableOnPropUpdateFrozenAspect(); - nodeService.setProperty(recordOrFolder, PROP_RS_DISPOITION_AUTHORITY, schedule.getDispositionAuthority()); - nodeService.setProperty(recordOrFolder, PROP_RS_DISPOITION_INSTRUCTIONS, schedule.getDispositionInstructions()); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchDispositionAuthority for node " + recordOrFolder + " to: " + schedule.getDispositionAuthority()); - logger.debug("Set rma:recordSearchDispositionInstructions for node " + recordOrFolder + " to: " + schedule.getDispositionInstructions()); - } - } - finally - { - frozenAspect.enableOnPropUpdateFrozenAspect(); - } - } - } - - /** - * This method compares the oldProps map against the newProps map and returns - * a set of QNames of the properties that have changed. Changed here means one of - *

    - *
  • the property has been removed
  • - *
  • the property has had its value changed
  • - *
  • the property has been added
  • - *
- */ - private Set determineChangedProps(Map oldProps, Map newProps) - { - Set result = new HashSet<>(); - for (Map.Entry entry : oldProps.entrySet()) - { - QName qn = entry.getKey(); - if (newProps.get(qn) == null || !newProps.get(qn).equals(entry.getValue())) - { - result.add(qn); - } - } - for (QName qn : newProps.keySet()) - { - if (oldProps.get(qn) == null) - { - result.add(qn); - } - } - - return result; - } - - /** - * Helper method to get the record folders contained in the provided record category. - * - * @param recordCategoryNode record category node reference - * @return List contained record folders - */ - private List getRecordFolders(NodeRef recordCategoryNode) - { - List results = new ArrayList<>(8); - - List folderAssocs = nodeService.getChildAssocs(recordCategoryNode, - ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef folderAssoc : folderAssocs) - { - NodeRef folder = folderAssoc.getChildRef(); - if (recordFolderService.isRecordFolder(folder)) - { - results.add(folder); - } - } - - return results; - } - - /** - * Record and record folder move behavior - * - * @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, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - // check the parent has actually changed - if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef())) - { - final NodeRef recordOrFolder = newChildAssocRef.getChildRef(); - final boolean isRecordOrFolder = recordService.isRecord(recordOrFolder) || recordFolderService.isRecordFolder(recordOrFolder); - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(recordOrFolder) && isRecordOrFolder) - { - applySearchAspect(recordOrFolder); - } - return null; - } - }); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java deleted file mode 100644 index e3286df4ec..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.compatibility; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; - -/** - * Dictionary bootstap post processor. - *

- * Ensures compatibility with 4.2 and 4.2.1 as well as 4.2.2. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DictionaryBootstrapPostProcessor implements BeanFactoryPostProcessor -{ - /** bean id's */ - private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap"; - private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap"; - - /** - * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) - */ - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) - { - // if the site service bootstrap bean and the RM dictionary bean are present in the bean factory - if (beanFactory.containsBean(BEAN_SITESERVICE_BOOTSTRAP) && - beanFactory.containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP)) - { - // get the RM dictionary bootstrap bean definition - BeanDefinition beanDef = beanFactory.getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); - - // set the dependency - beanDef.setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP}); - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java deleted file mode 100644 index cb1596c40f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:ascended behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:ascended" -) -public class AccendedAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java deleted file mode 100644 index fa644cca95..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:cutoff behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:cutOff" -) -public class CutoffAspect 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java deleted file mode 100644 index 6bdc605815..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:declaredRecord behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:declaredRecord" -) -public class DeclaredRecordAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java deleted file mode 100644 index 26c4d2c505..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -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.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.service.namespace.QName; - -/** - * rma:dispositionLifecycle behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:dispositionLifecycle" -) -public class DispositionLifecycleAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnAddAspectPolicy -{ - /** disposition service */ - protected DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Copy callback for disposition lifecycle - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspect) - { - if (nodeService.exists(nodeRef)) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - dispositionService.refreshDispositionAction(nodeRef); - return null; - } - }); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java deleted file mode 100644 index e53b019c38..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -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; - -/** - * rma:extendedSecurity behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:extendedSecurity" -) -public class ExtendedSecurityAspect extends BaseBehaviourBean -{ - /** extended security service */ - protected ExtendedSecurityService extendedSecurityService; - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * Copy callback. - * - * 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java deleted file mode 100644 index 66c657e71e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.copy.AbstractCopyBehaviourCallback; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.cmr.repository.ScriptService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PropertyMap; - -/** - * rma:filePlanComponent behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:filePlanComponent" -) -public class FilePlanComponentAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnMoveNodePolicy - - -{ - /** Well-known location of the scripts folder. */ - private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); - - /** script service */ - private ScriptService scriptService; - - /** namespace service */ - private NamespaceService namespaceService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param scriptService set script service - */ - public void setScriptService(ScriptService scriptService) - { - this.scriptService = scriptService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @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, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef)) - { - lookupAndExecuteScripts(nodeRef, before, after); - } - - return null; - } - }); - } - - /** - * This method examines the old and new property sets and for those properties which - * have changed, looks for script resources corresponding to those properties. - * Those scripts are then called via the ScriptService. - * - * @param nodeWithChangedProperties the node whose properties have changed. - * @param oldProps the old properties and their values. - * @param newProps the new properties and their values. - * - * @see #lookupScripts(Map, Map) - */ - private void lookupAndExecuteScripts(NodeRef nodeWithChangedProperties, - Map oldProps, - Map newProps) - { - List scriptRefs = lookupScripts(oldProps, newProps); - - Map objectModel = new HashMap<>(1); - objectModel.put("node", nodeWithChangedProperties); - objectModel.put("oldProperties", oldProps); - objectModel.put("newProperties", newProps); - for (NodeRef scriptRef : scriptRefs) - { - scriptService.executeScript(scriptRef, null, objectModel); - } - } - - /** - * This method determines which properties have changed and for each such property - * looks for a script resource in a well-known location. - * - * @param oldProps the old properties and their values. - * @param newProps the new properties and their values. - * @return A list of nodeRefs corresponding to the Script resources. - * - * @see org.alfresco.util.PropertyMap#getChangedProperties(Map, Map) - */ - private List lookupScripts(Map oldProps, Map newProps) - { - List result = new ArrayList<>(); - - Map changedProps = PropertyMap.getChangedProperties(oldProps, newProps); - for (QName propQName : changedProps.keySet()) - { - QName prefixedQName = propQName.getPrefixedQName(namespaceService); - - String [] splitQName = QName.splitPrefixedQName(prefixedQName.toPrefixString()); - final String shortPrefix = splitQName[0]; - final String localName = splitQName[1]; - - // This is the filename pattern which is assumed. - // e.g. a script file cm_name.js would be called for changed to cm:name - String expectedScriptName = shortPrefix + "_" + localName + ".js"; - - NodeRef nextElement = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName); - if (nextElement != null) - { - result.add(nextElement); - } - } - - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - // Check if the node exists and the aspect hasn't been removed in the same transaction (see RM-3266) - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName)) - { - // Look up the root and set on the aspect if found - NodeRef root = filePlanService.getFilePlan(nodeRef); - if (root != null) - { - nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root); - } - - // If the node has any renditions, they inherit the file plan from their source node. - List renditions = renditionService.getRenditions(nodeRef); - NodeRef rendition; - for (ChildAssociationRef chAssRef : renditions) - { - rendition = chAssRef.getChildRef(); - if (nodeService.exists(rendition)) - { - // Apply file plan component aspect to node's renditions - nodeService.addAspect(rendition, ASPECT_FILE_PLAN_COMPONENT, null); - } - } - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @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, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onMoveNode(final ChildAssociationRef oldChildAssocRef, final ChildAssociationRef newChildAssocRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(newChildAssocRef.getParentRef()) && - nodeService.exists(newChildAssocRef.getChildRef())) - { - // Look up the root and re-set the value currently stored on the aspect - NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef()); - // NOTE: set the null value if no root found - nodeService.setProperty(newChildAssocRef.getChildRef(), PROP_ROOT_NODEREF, root); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Copy behaviour call back - * - * @param classRef class reference - * @param copyDetails details of the information being copied - * @return CopyBehaviourCallback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new AbstractCopyBehaviourCallback() - { - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getChildAssociationCopyAction(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, org.alfresco.repo.copy.CopyBehaviourCallback.CopyChildAssociationDetails) - */ - public ChildAssocCopyAction getChildAssociationCopyAction( - QName classQName, - CopyDetails copyDetails, - CopyChildAssociationDetails childAssocCopyDetails) - { - // Do not copy the associations - return null; - } - - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getCopyProperties(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, java.util.Map) - */ - public Map getCopyProperties( - QName classQName, - CopyDetails copyDetails, - Map properties) - { - // Only copy the root node reference if the new value can be looked up via the parent - NodeRef root = filePlanService.getFilePlan(copyDetails.getTargetParentNodeRef()); - if (root != null) - { - properties.put(PROP_ROOT_NODEREF, root); - } - return properties; - } - - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails) - */ - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - // Ensure the aspect is copied - return true; - } - }; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java deleted file mode 100644 index 4e26577af7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import static org.alfresco.model.ContentModel.TYPE_CONTENT; -import static org.alfresco.model.ContentModel.TYPE_FOLDER; -import static org.alfresco.repo.site.SiteModel.ASPECT_SITE_CONTAINER; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.util.PropertyModificationAllowedCheck; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:frozen behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:frozen" -) -public class FrozenAspect extends BaseBehaviourBean - implements NodeServicePolicies.BeforeDeleteNodePolicy, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeMoveNodePolicy -{ - /** - * Behaviour name for on update properties for frozen aspect - */ - private static final String ON_UPDATE_PROP_FROZEN_BEHAVIOUR_NAME = "onUpdatePropertiesFrozenAspect"; - - /** freeze service */ - protected FreezeService freezeService; - - /** - * Utility class for property modification - */ - private PropertyModificationAllowedCheck propertyModificationAllowedCheck; - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * Setter for property modification check utility - * @param propertyModificationAllowedCheck Utility class for property modification - */ - public void setPropertyModificationAllowedCheck(PropertyModificationAllowedCheck propertyModificationAllowedCheck) - { - this.propertyModificationAllowedCheck = propertyModificationAllowedCheck; - } - - /** - * Disable the on update properties for frozen aspect behaviour - */ - public void disableOnPropUpdateFrozenAspect() - { - org.alfresco.repo.policy.Behaviour behaviour = getBehaviour(ON_UPDATE_PROP_FROZEN_BEHAVIOUR_NAME); - if (behaviour != null) - { - behaviour.disable(); - } - - } - - /** - * Enable the on update properties for frozen aspect - */ - public void enableOnPropUpdateFrozenAspect() - { - org.alfresco.repo.policy.Behaviour behaviour = getBehaviour(ON_UPDATE_PROP_FROZEN_BEHAVIOUR_NAME); - if (behaviour != null && !behaviour.isEnabled()) - { - behaviour.enable(); - } - } - - /** - * Ensure that no frozen node is deleted. - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeDeleteNode(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - if (nodeService.exists(nodeRef) && freezeService.isFrozen(nodeRef)) - { - // never allow to delete a frozen node - throw new PermissionDeniedException(I18NUtil.getMessage("rm.hold.delete-frozen-node")); - } - - // check children - checkChildren(nodeService.getChildAssocs(nodeRef)); - return null; - }); - } - - /** - * Checks the children for frozen nodes. Throws security error if any are - * found. - * - * @param assocs - */ - private void checkChildren(List assocs) - { - for (ChildAssociationRef assoc : assocs) - { - // we only care about primary children - if (assoc.isPrimary()) - { - NodeRef nodeRef = assoc.getChildRef(); - if (freezeService.isFrozen(nodeRef)) - { - // never allow to delete a node with a frozen child - throw new PermissionDeniedException(I18NUtil.getMessage("rm.hold.delete-node-frozen-children")); - } - - // check children - checkChildren(nodeService.getChildAssocs(nodeRef)); - } - } - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_CONTENT)) - { - // get the owning folder - final NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - // check that the aspect has been added - if (nodeService.hasAspect(parentRef, ASPECT_HELD_CHILDREN)) - { - // increment current count - int currentCount = (Integer) nodeService.getProperty(parentRef, PROP_HELD_CHILDREN_COUNT); - currentCount = currentCount + 1; - nodeService.setProperty(parentRef, PROP_HELD_CHILDREN_COUNT, currentCount); - } - else - { - if (instanceOf(parentRef, TYPE_FOLDER) && !nodeService.hasAspect(parentRef, ASPECT_SITE_CONTAINER)) - { - // add aspect and set count to 1 - final Map props = new HashMap<>(1); - props.put(PROP_HELD_CHILDREN_COUNT, 1); - getInternalNodeService().addAspect(parentRef, ASPECT_HELD_CHILDREN, props); - } - } - } - return null; - }); - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onRemoveAspect(final NodeRef nodeRef, QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - - if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_CONTENT)) - { - // get the owning folder - final NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef(); - - // check that the aspect has been added - if (nodeService.hasAspect(owningFolder, ASPECT_HELD_CHILDREN)) - { - // decrement current count - final int currentCount = (Integer) nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT); - if (currentCount > 0) - { - nodeService.setProperty(owningFolder, PROP_HELD_CHILDREN_COUNT, currentCount - 1); - } - } - } - return null; - }); - } - - /** - * Behaviour associated with moving a frozen node - *

- * Prevent frozen items being moved - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeMoveNode(ChildAssociationRef oldChildAssocRef, NodeRef newParentRef) - { - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - if (nodeService.exists(oldChildAssocRef.getChildRef()) && - freezeService.isFrozen(oldChildAssocRef.getChildRef())) - { - throw new PermissionDeniedException(I18NUtil.getMessage("rm.hold.move-frozen-node")); - } - return null; - }); - } - - /** - * Behaviour associated with updating properties - *

- * Prevents frozen items being updated - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = ON_UPDATE_PROP_FROZEN_BEHAVIOUR_NAME, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - AuthenticationUtil.runAsSystem((RunAsWork) () -> { - // check to not throw exception when the aspect is being added - if (nodeService.exists(nodeRef) && freezeService.isFrozen(nodeRef) && - !transactionalResourceHelper.getSet("frozen").contains(nodeRef) && - !propertyModificationAllowedCheck.check(before, after)) - { - throw new PermissionDeniedException(I18NUtil.getMessage("rm.hold.update-frozen-node")); - } - return null; - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java deleted file mode 100644 index f480e6b91e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.content.ContentServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:ghosted behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - // optional - defaultType = "rma:ghosted" -) -public class GhostedAspect extends BaseBehaviourBean - implements ContentServicePolicies.OnContentUpdatePolicy -{ - /** I18N */ - private static final String MSG_GHOSTED_PROP_UPDATE = "rm.action.ghosted-prop-update"; - - /** - * Ensure that the content of a ghosted node can not be updated. - * - * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - @Behaviour - ( - // required, use ASSOC for association behaviors - kind = BehaviourKind.CLASS, - // (defaults to EVERY_EVENT) - notificationFrequency = NotificationFrequency.EVERY_EVENT, - // (defaults to alf:) - policy = "alf:onContentUpdate", - // required, unless defaultType set - type = "rma:ghosted" - - // isService (default false) - // name (only needs to specified if associated behvaiour object needs to be accessed) - // assocType (defaults to cm:contains, used with BehaviourKind.ASSOC) - ) - public void onContentUpdate(NodeRef content, boolean bNew) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_GHOSTED_PROP_UPDATE)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ProtectedAspects.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ProtectedAspects.java deleted file mode 100644 index 1fa57d56e7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ProtectedAspects.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * protected aspects behaviour bean - * allow only System user to remove this aspects - * - * @author Ramona Popa - * @since 2.6 - */ - -public class ProtectedAspects implements NodeServicePolicies.OnRemoveAspectPolicy -{ - private PolicyComponent policyComponent; - private AuthenticationUtil authenticationUtil; - - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * Initialise method - */ - public void init() - { - // Watch removal of the aspect rma:record - this.policyComponent.bindClassBehaviour( - NodeServicePolicies.OnRemoveAspectPolicy.QNAME, - RecordsManagementModel.ASPECT_RECORD, - new JavaBehaviour(this, "onRemoveAspect")); - // Watch removal of the aspect rma:filePlanComponent - this.policyComponent.bindClassBehaviour( - NodeServicePolicies.OnRemoveAspectPolicy.QNAME, - RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, - new JavaBehaviour(this, "onRemoveAspect")); - // Watch removal of the aspect rma:recordComponentIdentifier - this.policyComponent.bindClassBehaviour( - NodeServicePolicies.OnRemoveAspectPolicy.QNAME, - RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID, - new JavaBehaviour(this, "onRemoveAspect")); - // Watch removal of the aspect rma:commonRecordDetails - this.policyComponent.bindClassBehaviour( - NodeServicePolicies.OnRemoveAspectPolicy.QNAME, - RecordsManagementModel.ASPECT_COMMON_RECORD_DETAILS, - new JavaBehaviour(this, "onRemoveAspect")); - - } - - @Override - public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName) - { - if (!authenticationUtil.getRunAsUser().equals(authenticationUtil.getSystemUserName())) - { - throw new IntegrityException("Operation failed. Aspect " + aspectTypeQName.toString() + " is mandatory and cannot be removed.", null); - } - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java deleted file mode 100644 index 69383f11c0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/QShareAspect.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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; - -/** - * qshare:shared aspect behaviour bean - * do not allow this aspect to be added for records - * - * @author Ramona Popa - * @since 2.5 - */ -@BehaviourBean(defaultType = "qshare:shared") -public class QShareAspect extends BaseBehaviourBean implements NodeServicePolicies.BeforeAddAspectPolicy -{ - /** - * Behaviour to prevent sharing a record - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy#beforeAddAspect(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT) - public void beforeAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - { - throw new IntegrityException("Operation failed. Aspect " + aspectTypeQName.toString() + " cannot be added for records.", null); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java deleted file mode 100644 index d7374338b0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ /dev/null @@ -1,424 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.QuickShareModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -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; -import org.alfresco.module.org_alfresco_module_rm.util.ContentBinDuplicationUtility; -import org.alfresco.repo.content.ContentServicePolicies; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.CopyServicePolicies; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.quickshare.QuickShareService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.ScriptService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:record behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:record" -) -public class RecordAspect extends AbstractDisposableItem - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.BeforeAddAspectPolicy, - RecordsManagementPolicies.OnCreateReference, - RecordsManagementPolicies.OnRemoveReference, - NodeServicePolicies.OnMoveNodePolicy, - CopyServicePolicies.OnCopyCompletePolicy, - ContentServicePolicies.OnContentPropertyUpdatePolicy -{ - /** Well-known location of the scripts folder. */ - // TODO make configurable - private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); - - /** extended security service */ - protected ExtendedSecurityService extendedSecurityService; - - /** script service */ - protected ScriptService scriptService; - - /** record service */ - protected RecordService recordService; - - /** quickShare service */ - private QuickShareService quickShareService; - - /** Utility class for duplicating content */ - private ContentBinDuplicationUtility contentBinDuplicationUtility; - - /** I18N */ - private static final String MSG_CANNOT_UPDATE_RECORD_CONTENT = "rm.service.update-record-content"; - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @param scriptService script service - */ - public void setScriptService(ScriptService scriptService) - { - this.scriptService = scriptService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * - * @param quickShareService - */ - public void setQuickShareService(QuickShareService quickShareService) - { - this.quickShareService = quickShareService; - } - - /** - * Setter for content duplication utility class - * @param contentBinDuplicationUtility ContentBinDuplicationUtility - */ - public void setContentBinDuplicationUtility(ContentBinDuplicationUtility contentBinDuplicationUtility) - { - this.contentBinDuplicationUtility = contentBinDuplicationUtility; - } - - /** - * Behaviour to ensure renditions have the appropriate extended security. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - assocType = "rn:rendition", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean bNew) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - NodeRef thumbnail = childAssocRef.getChildRef(); - - if (nodeService.exists(thumbnail)) - { - // apply file plan component aspect to thumbnail - nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null); - - // manage any extended readers - NodeRef parent = childAssocRef.getParentRef(); - Set readers = extendedSecurityService.getReaders(parent); - Set writers = extendedSecurityService.getWriters(parent); - if (readers != null && readers.size() != 0) - { - extendedSecurityService.set(thumbnail, readers, writers); - } - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - // Deal with versioned records - if (reference.equals(CUSTOM_REF_VERSIONS)) - { - // run as system, to apply the versioned aspect to the from node - // as we can't be sure if the user has add aspect rights - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); - return null; - } - }); - } - - // Execute script if for the reference event - executeReferenceScript("onCreate", reference, fromNodeRef, toNodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference#onRemoveReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onRemoveReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - // Deal with versioned records - if (reference.equals(CUSTOM_REF_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; - } - }); - } - - // Execute script if for the reference event - executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef); - } - - /** - * Record copy callback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - - @Override - public Map getCopyProperties(QName classRef, CopyDetails copyDetails, - Map properties) - { - Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); - - // Remove the Date Filed property from record properties on copy. - // It will be generated for the copy - if (sourceProperties.containsKey(PROP_DATE_FILED)) - { - sourceProperties.remove(PROP_DATE_FILED); - } - - return sourceProperties; - } - - }; - } - - /** - * Record move behaviour - * - * @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, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - // check the records parent has actually changed - if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) && - isFilePlanComponent(oldChildAssocRef.getParentRef())) - { - final NodeRef record = newChildAssocRef.getChildRef(); - authenticationUtil.runAsSystem(new RunAsWork() - { - public Object doWork() - { - if (nodeService.exists(record) && - recordService.isFiled(record)) - { - // clean record - cleanDisposableItem(nodeService, record); - - // re-file in the new folder - recordService.file(record); - } - - return null; - } - }); - } - } - - /** - * Executes a reference script if present - * - * @param policy policy - * @param reference reference - * @param from reference from - * @param to reference to - */ - private void executeReferenceScript(String policy, QName reference, NodeRef from, NodeRef to) - { - String referenceId = reference.getLocalName(); - - // This is the filename pattern which is assumed. - // e.g. a script file onCreate_superceded.js for the creation of a superseded reference - String expectedScriptName = policy + "_" + referenceId + ".js"; - - NodeRef scriptNodeRef = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName); - if (scriptNodeRef != null) - { - Map objectModel = new HashMap<>(1); - objectModel.put("node", from); - objectModel.put("toNode", to); - objectModel.put("policy", policy); - objectModel.put("reference", referenceId); - - scriptService.executeScript(scriptNodeRef, null, objectModel); - } - } - - /** - * On copy complete behaviour for record aspect. - * - * @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(QName, NodeRef, NodeRef, boolean, Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS - ) - public void onCopyComplete(QName classRef, - NodeRef sourceNodeRef, - NodeRef targetNodeRef, - boolean copyToNewNode, - Map copyMap) - { - // given the node exists and is a record - if (nodeService.exists(targetNodeRef) && - nodeService.hasAspect(targetNodeRef, ASPECT_RECORD)) - { - // then remove any extended security from the newly copied record - extendedSecurityService.remove(targetNodeRef); - - //create a new content URL for the copy - contentBinDuplicationUtility.duplicate(targetNodeRef); - } - } - - /** - * Behaviour to remove the shared link before declare a record - * and to create new bin if the node is a copy or has copies - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy#beforeAddAspect(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT) - public void beforeAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - String sharedId = (String) nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDID); - if (sharedId != null) - { - quickShareService.unshareContent(sharedId); - } - - // if the node has a copy or is a copy of an existing node - if (!nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL).isEmpty() || - !nodeService.getSourceAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL).isEmpty()) - { - contentBinDuplicationUtility.duplicate(nodeRef); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onContentPropertyUpdate(NodeRef nodeRef, QName propertyQName, ContentData beforeValue, ContentData afterValue) - { - // Allow creation of content but not update - if (beforeValue != null) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_UPDATE_RECORD_CONTENT), null); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java deleted file mode 100644 index 25514161ac..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import java.io.Serializable; -import java.util.Map; - -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.RecordsManagementModel; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.CopyServicePolicies; -import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.attributes.AttributeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:recordComponentIdentifier behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordComponentIdentifier" -) -public class RecordComponentIdentifierAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy -{ - /** I18N */ - private static final String MSG_SET_ID = "rm.service.set-id"; - - /** attribute context value */ - private static final String CONTEXT_VALUE = "rma:identifier"; - - /** file plan service */ - private FilePlanService filePlanService; - - /** attribute service */ - private AttributeService attributeService; - - /** identifier service */ - private IdentifierService identifierService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param attributeService attribute service - */ - public void setAttributeService(AttributeService attributeService) - { - this.attributeService = attributeService; - } - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * Ensures that the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property remains - * unique within the context of the parent node. - * - * @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, - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - String newIdValue = (String)after.get(PROP_IDENTIFIER); - if (newIdValue != null) - { - String oldIdValue = (String)before.get(PROP_IDENTIFIER); - if (oldIdValue != null && !oldIdValue.equals(newIdValue)) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_SET_ID, nodeRef.toString()), null); - } - - // update uniqueness - updateUniqueness(nodeRef, oldIdValue, newIdValue); - } - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet. - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void beforeDeleteNode(final NodeRef nodeRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - String beforeId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER); - updateUniqueness(nodeRef, beforeId, null); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Record component identifier aspect copy callback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } - - - /** - * Updates the uniqueness check using the values provided. If the after value is null - * then this is considered to be a removal. - * - * @param nodeRef node reference - * @param beforeId id before - * @param afterId id after - */ - private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId) - { - NodeRef contextNodeRef = filePlanService.getFilePlan(nodeRef); - - if (beforeId == null) - { - if (afterId != null) - { - // Just create it - attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId); - } - } - else if (afterId == null) - { - // The before value was not null, so remove it - attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId); - // Do a blanket removal in case this is a contextual nodes - attributeService.removeAttributes(CONTEXT_VALUE, nodeRef); - } - else if(!beforeId.equals(afterId)) - { - // This is a full update - attributeService.updateOrCreateAttribute( - CONTEXT_VALUE, contextNodeRef, beforeId, - CONTEXT_VALUE, contextNodeRef, afterId); - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java deleted file mode 100644 index cd5abf0745..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:recordOriginatingDetails behaviour bean - * - * @author Mark Hibbins - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordOriginatingDetails" -) -public class RecordOriginatingDetailsAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * Record originating details 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java deleted file mode 100644 index 63d05403f1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:recordSearch behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordSearch" -) -public class RecordSearchAspect extends BaseBehaviourBean -{ - /** - * Copy callback for record search - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java deleted file mode 100644 index 28898c60ea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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; - -/** - * Behaviour associated with the scheduled aspect - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:scheduled" -) -public class ScheduledAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnAddAspectPolicy -{ - /** disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) - { - if (nodeService.exists(nodeRef) && - dispositionService.getAssociatedDispositionSchedule(nodeRef) == null) - { - dispositionService.createDispositionSchedule(nodeRef, null); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java deleted file mode 100644 index 3e6a40b0fb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:transferred behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:transferred" -) -public class TransferredAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java deleted file mode 100644 index 67d56469d7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:transferring behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:transferring" -) -public class TransferringAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java deleted file mode 100644 index 9bd3877faf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:uncutoff behaviour bean - * - * @author Mark Hibbins - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:uncutOff" -) -public class UncutoffAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * Uncutoff 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java deleted file mode 100644 index 3998f8a016..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.util.ContentBinDuplicationUtility; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.namespace.QName; - -/** - * rmv:versionRecord behaviour bean - * - * @author Roy Wetherall - * @since 2.3.1 - */ -@BehaviourBean -( - defaultType = "rmv:versionRecord" -) -public class VersionRecordAspect extends BaseBehaviourBean - implements NodeServicePolicies.BeforeAddAspectPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy -{ - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** relationship service */ - private RelationshipService relationshipService; - - /** - * Utility class for duplicating content - */ - private ContentBinDuplicationUtility contentBinDuplicationUtility; - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * @param relationshipService relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Setter for content duplication utility class - * - * @param contentBinDuplicationUtility ContentBinDuplicationUtility - */ - public void setContentBinDuplicationUtility(ContentBinDuplicationUtility contentBinDuplicationUtility) - { - this.contentBinDuplicationUtility = contentBinDuplicationUtility; - } - - /** - * If the record is a version record then delete the associated version entry - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour (kind = BehaviourKind.CLASS) - public void beforeDeleteNode(final NodeRef nodeRef) - { - final Version version = recordableVersionService.getRecordedVersion(nodeRef); - if (version != null) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - behaviourFilter.disableBehaviour(); - try - { - // mark the associated version as destroyed - recordableVersionService.destroyRecordedVersion(version); - - // re-organise the versions relationships ... - // if there is only one "to" reference since a version can only have one predecessor - Set tos = relationshipService.getRelationshipsTo(nodeRef, RelationshipService.RELATIONSHIP_VERSIONS); - if (!tos.isEmpty() && tos.size() == 1) - { - // if there is some "from" references - Set froms = relationshipService.getRelationshipsFrom(nodeRef, RelationshipService.RELATIONSHIP_VERSIONS); - if (!froms.isEmpty()) - { - // get predecessor version relationship - Relationship to = tos.iterator().next(); - - for (Relationship from : froms) - { - // point the "to" the all the "from's" - relationshipService.addRelationship(RelationshipService.RELATIONSHIP_VERSIONS, to.getSource(), from.getTarget()); - } - } - } - } - finally - { - behaviourFilter.enableBehaviour(); - } - - return null; - } - }); - } - } - - /** - * Behaviour to duplicate the bin before declaring a version record - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy#beforeAddAspect(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT) - public void beforeAddAspect(NodeRef nodeRef, QName qName) - { - // if the node is the originating one the behaviour shouldn't be triggered - if (!nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD_ORIGINATING_DETAILS)) - { - //create a new content URL for the version record - contentBinDuplicationUtility.duplicate(nodeRef); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java deleted file mode 100644 index 5f3540b670..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -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; - -/** - * rma:vitalRecord behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:vitalRecord" -) -public class VitalRecordAspect extends BaseBehaviourBean -{ - /** - * Copy callback for vital record - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java deleted file mode 100644 index 17f8708814..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.service.namespace.QName; -import org.alfresco.util.PropertyMap; - -/** - * rma:ghosted behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:vitalRecordDefinition" -) -public class VitalRecordDefinitionAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** records management action service */ - protected RecordsManagementActionService recordsManagementActionService; - - /** - * @param recordsManagementActionService records management action service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @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, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() - { - if (nodeService.exists(nodeRef) && - nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT)) - { - // check that vital record definition has been changed in the first place - Map changedProps = PropertyMap.getChangedProperties(before, after); - if (changedProps.containsKey(PROP_VITAL_RECORD_INDICATOR) || - changedProps.containsKey(PROP_REVIEW_PERIOD)) - { - recordsManagementActionService.executeRecordsManagementAction(nodeRef, "broadcastVitalRecordDefinition"); - } - } - return null; - } - }); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java deleted file mode 100644 index 607ff6cc06..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java deleted file mode 100644 index 6aef512789..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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; -import org.alfresco.util.PropertyMap; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:dispositionActionDefinition behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:dispositionActionDefinition" -) -public class DispositionActionDefinitionType extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** I18N */ - private static final String MSG_UPDATE_DISP_ACT_DEF = "rm.service.update-disposition-action-def"; - - /** - * @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, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (nodeService.exists(nodeRef)) - { - // Determine the properties that have changed - Set changedProps = new HashSet<>(PropertyMap.getChangedProperties(before, after).keySet()); - changedProps.addAll(PropertyMap.getAddedProperties(before, after).keySet()); - - if (!nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE)) - { - // Apply the unpublished aspect - Map props = new HashMap<>(); - props.put(PROP_UPDATE_TO, UPDATE_TO_DISPOSITION_ACTION_DEFINITION); - props.put(PROP_UPDATED_PROPERTIES, (Serializable)changedProps); - nodeService.addAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE, props); - } - else - { - Map props = nodeService.getProperties(nodeRef); - - // Check that there isn't a update currently being published - if ((Boolean)props.get(PROP_PUBLISH_IN_PROGRESS).equals(Boolean.TRUE)) - { - // Can not update the disposition schedule since there is an outstanding update being published - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UPDATE_DISP_ACT_DEF)); - } - - // Update the update information - props.put(PROP_UPDATE_TO, UPDATE_TO_DISPOSITION_ACTION_DEFINITION); - props.put(PROP_UPDATED_PROPERTIES, (Serializable)changedProps); - nodeService.setProperties(nodeRef, props); - } - } - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java deleted file mode 100644 index 57303eac15..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.model.ContentModel; -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.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.rule.RuleModel; -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.QName; - -/** - * rma:filePlan behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:filePlan" -) -public class FilePlanType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnDeleteNodePolicy, - NodeServicePolicies.BeforeDeleteNodePolicy -{ - private final static List ACCEPTED_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_HOLD_CONTAINER, TYPE_TRANSFER_CONTAINER, TYPE_UNFILED_RECORD_CONTAINER); - private final static List ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_RECORD_CATEGORY); - private static final String BEHAVIOUR_NAME = "onDeleteFilePlan"; - - /** file plan service */ - private FilePlanService filePlanService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** identifier service */ - private IdentifierService identifierService; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** - * Unfiled Record Container Type behaviour bean - */ - private UnfiledRecordContainerType unfiledRecordContainerType; - - /** - * Transfer Container Type behaviour bean - */ - private TransferContainerType transferContainerType; - - /** - * Hold Container Type behaviour bean - */ - private HoldContainerType holdContainerType; - - /** - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * @return Record folder service - */ - protected RecordFolderService getRecordFolderService() - { - return this.recordFolderService; - } - - /** - * @return Identifier service - */ - protected IdentifierService getIdentifierService() - { - return this.identifierService; - } - - /** - * @return File plan role service - */ - protected FilePlanRoleService getFilePlanRoleService() - { - return this.filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param unfiledRecordContainerType - unfiled record container type behaviour bean - */ - public void setUnfiledRecordContainerType(UnfiledRecordContainerType unfiledRecordContainerType) - { - this.unfiledRecordContainerType = unfiledRecordContainerType; - } - - /** - * @param transferContainerType - transfer container type behaviour bean - */ - public void setTransferContainerType(TransferContainerType transferContainerType) - { - this.transferContainerType = transferContainerType; - } - - /** - * @param holdContainerType - hold container type behaviour bean - */ - public void setHoldContainerType(HoldContainerType holdContainerType) - { - this.holdContainerType = holdContainerType; - } - - /** - * Disable the behaviours for this transaction - * - */ - public void disable() - { - getBehaviour(BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - */ - public void enable() - { - getBehaviour(BEHAVIOUR_NAME).enable(); - } - - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION - ) - @Override - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - // We need to automatically cast the created folder to category if it is a plain folder - // This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes. - // Some modules use hidden files to store information (see RM-3283) - if (nodeService.getType(childAssocRef.getChildRef()).equals(ContentModel.TYPE_FOLDER)) - { - nodeService.setType(childAssocRef.getChildRef(), TYPE_RECORD_CATEGORY); - } - - // check the created child is of an accepted type - validateNewChildAssociation(childAssocRef.getParentRef(), childAssocRef.getChildRef(), ACCEPTED_UNIQUE_CHILD_TYPES, ACCEPTED_NON_UNIQUE_CHILD_TYPES); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - @Override - public void onCreateNode(final ChildAssociationRef childAssocRef) - { - final NodeRef filePlan = childAssocRef.getChildRef(); - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Object doWork() - { - // ensure rules are not inherited - nodeService.addAspect(filePlan, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - - // set the identifier - if (nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null) - { - String id = getIdentifierService().generateIdentifier(filePlan); - nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id); - } - - return null; - } - }); - - // setup the file plan roles - getFilePlanRoleService().setupFilePlanRoles(filePlan); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT, - name = BEHAVIOUR_NAME - ) - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean archived) - { - unfiledRecordContainerType.enable(); - transferContainerType.enable(); - holdContainerType.enable(); - throw new IntegrityException("Operation failed. Deletion of File Plan is not allowed.", null); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - unfiledRecordContainerType.disable(); - transferContainerType.disable(); - holdContainerType.disable(); - } - - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:onDeleteNode", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onDeleteNodeOnCommit(ChildAssociationRef childAssocRef, boolean archived) - { - // tear down the file plan roles - getFilePlanRoleService().tearDownFilePlanRoles(childAssocRef.getChildRef()); - unfiledRecordContainerType.enable(); - transferContainerType.enable(); - holdContainerType.enable(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java deleted file mode 100644 index d45e8a39a8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -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; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:holdContainer behaviour bean - * - * @author Mihai Cozma - * @since 2.4 - */ -@BehaviourBean(defaultType = "rma:holdContainer") -public class HoldContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnDeleteNodePolicy -{ - private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; - private final static List ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_HOLD); - private static final String DELETE_BEHAVIOUR_NAME = "onDeleteHoldContainer"; - - /** - * Disable the behaviours for this transaction - * - */ - public void disable() - { - getBehaviour(DELETE_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - */ - public void enable() - { - getBehaviour(DELETE_BEHAVIOUR_NAME).enable(); - } - - /** - * On every event - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, - * boolean) - */ - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - // check the created child is of an accepted type - validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES); - } - - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( - I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = DELETE_BEHAVIOUR_NAME - ) - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - throw new IntegrityException("Operation failed. Deletion of Hold Container is not allowed.", null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordType.java deleted file mode 100644 index 70246fff59..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordType.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.service.namespace.QName; - -/** - * rma:nonElectronicDocument behaviour bean. - * - * @author silviudinuta - * @since 2.4 - */ -@BehaviourBean(defaultType = "rma:nonElectronicDocument") -public class NonElectronicRecordType extends BaseBehaviourBean implements NodeServicePolicies.OnUpdateNodePolicy -{ - - /** record service */ - protected RecordService recordService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - @Behaviour(kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.FIRST_EVENT) - @Override - public void onUpdateNode(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - final NodeRef child = nodeRef; - if (nodeService.exists(child)) - { - NodeRef parentRef = nodeService.getPrimaryParent(child).getParentRef(); - QName parentType = nodeService.getType(parentRef); - boolean isUnfiledRecordContainer = parentType - .equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - boolean isUnfiledRecordFolder = parentType - .equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - if (isUnfiledRecordContainer || isUnfiledRecordFolder) - { - if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) - { - nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); - } - if (!nodeService.hasAspect(child, ASPECT_RECORD)) - { - recordService.makeRecord(child); - } - } - } - return null; - } - }); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java deleted file mode 100644 index 500aec6f6d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.QName; - -/** - * rma:recordCategory behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordCategory" -) -public class RecordCategoryType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy -{ - private final static List ACCEPTED_UNIQUE_CHILD_TYPES = new ArrayList<>(); - private final static List ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_RECORD_CATEGORY, TYPE_RECORD_FOLDER); - - /** vital record service */ - protected VitalRecordService vitalRecordService; - - /** file plan permission service */ - protected FilePlanPermissionService filePlanPermissionService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * @param filePlanPermissionService file plan permission service - */ - public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) - { - this.filePlanPermissionService = filePlanPermissionService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * On every event - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - QName childType = nodeService.getType(childAssocRef.getChildRef()); - - // We need to automatically cast the created folder to record folder if it is a plain folder - // This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes. - // Some modules use hidden folders to store information (see RM-3283). - if (childType.equals(ContentModel.TYPE_FOLDER)) - { - nodeService.setType(childAssocRef.getChildRef(), TYPE_RECORD_FOLDER); - } - - validateNewChildAssociation(childAssocRef.getParentRef(), childAssocRef.getChildRef(), ACCEPTED_UNIQUE_CHILD_TYPES, ACCEPTED_NON_UNIQUE_CHILD_TYPES); - - if (bNew) - { - // setup the record folder - recordFolderService.setupRecordFolder(childAssocRef.getChildRef()); - } - } - - /** - * On transaction commit - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - policy = "alf:onCreateChildAssociation", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, final boolean bNew) - { - final NodeRef child = childAssocRef.getChildRef(); - - behaviourFilter.disableBehaviour(); - try - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // setup vital record definition - if(nodeService.exists(child)) - { - vitalRecordService.setupVitalRecordDefinition(child); - } - - return null; - } - }); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateNode(final ChildAssociationRef childAssocRef) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("rma:recordCategory|alf:onCreateNode|this.onCreateNode()|TRANSATION_COMMIT"); - } - - // execute behaviour code as system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // setup record category permissions - if(nodeService.exists(childAssocRef.getChildRef())) - { - filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef()); - } - - return null; - } - }); - - } - - /** - * Copy callback for record category - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback onCopyRecordCategory(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - /** - * If the targets parent is a Record Folder -- Do Not Allow Copy - * - * @param classQName - * @param copyDetails - * @return boolean - */ - @Override - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - return !nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER); - } - }; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java deleted file mode 100644 index f9eb29dbfb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.behaviour.AbstractDisposableItem; -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.vital.VitalRecordService; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.QName; -import org.apache.commons.lang3.ArrayUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:recordFolder behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordFolder" -) -public class RecordFolderType extends AbstractDisposableItem - implements NodeServicePolicies.OnMoveNodePolicy, - NodeServicePolicies.OnCreateChildAssociationPolicy -{ - /** record service */ - private RecordService recordService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** vital record service */ - protected VitalRecordService vitalRecordService; - - /** identifier service */ - protected IdentifierService identifierService; - - /** I18N */ - private static final String MSG_CANNOT_CREATE_RECORD_FOLDER_CHILD = "rm.action.create.record.folder.child-error-message"; - - private static final String MSG_CANNOT_CREATE_CHILDREN_IN_CLOSED_RECORD_FOLDER = "rm.service.add-children-to-closed-record-folder"; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * Record folder move behaviour - * - * @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, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - if (!nodeService.getType(newChildAssocRef.getParentRef()).equals(TYPE_RECORD_FOLDER)) - { - if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef())) - { - final NodeRef newNodeRef = newChildAssocRef.getChildRef(); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // clean record folder - cleanDisposableItem(nodeService, newNodeRef); - - // re-initialise the record folder - recordFolderService.setupRecordFolder(newNodeRef); - - // sort out the child records - for (NodeRef record : recordService.getRecords(newNodeRef)) - { - // clean record - cleanDisposableItem(nodeService, record); - - // Re-initiate the records in the new folder. - recordService.file(record); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - else - { - throw new UnsupportedOperationException("Cannot move record folder into another record folder."); - } - } - - /** - * Record folder copy callback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - @Override - public Map getCopyProperties(QName classRef, CopyDetails copyDetails, Map properties) - { - Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); - - // ensure that the 'closed' status of the record folder is not copied - if (sourceProperties.containsKey(PROP_IS_CLOSED)) - { - sourceProperties.remove(PROP_IS_CLOSED); - } - - return sourceProperties; - } - - /** - * If the targets parent is a Record Folder -- Do Not Allow Copy - * - * @param classQName - * @param copyDetails - * @return boolean - */ - @Override - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - boolean targetParentIsRecordFolder = nodeService.getType(copyDetails.getTargetParentNodeRef()) - .equals(TYPE_RECORD_FOLDER); - boolean containsUnwantedAspect = ArrayUtils.contains(unwantedAspects, classQName); - return !(targetParentIsRecordFolder || containsUnwantedAspect); - } - }; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - - if (nodeService.exists(nodeRef)) - { - boolean notFolderOrRmFolderSubType = !instanceOf(nodeRef, ContentModel.TYPE_FOLDER) || - instanceOf(nodeRef, RecordsManagementModel.TYPE_RECORDS_MANAGEMENT_CONTAINER) || - instanceOf(nodeRef, RecordsManagementModel.TYPE_RECORD_FOLDER) || - instanceOf(nodeRef, RecordsManagementModel.TYPE_TRANSFER); - - if (!instanceOf(nodeRef, ContentModel.TYPE_CONTENT) && notFolderOrRmFolderSubType) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER_CHILD, nodeService.getType(nodeRef)), null); - } - // ensure nothing is being added to a closed record folder - NodeRef recordFolder = childAssocRef.getParentRef(); - Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED); - if (isClosed != null && isClosed) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_CREATE_CHILDREN_IN_CLOSED_RECORD_FOLDER), null); - } - } - } - - /** - * On transaction commit - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - policy = "alf:onCreateChildAssociation", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew) - { - final NodeRef child = childAssocRef.getChildRef(); - - if(!nodeService.exists(child)) - { - return; - } - - // only records can be added in a record folder or hidden folders(is the case of e-mail attachments) - if (instanceOf(child, ContentModel.TYPE_FOLDER) && !nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN)) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER_CHILD, nodeService.getType(child)), null); - } - - behaviourFilter.disableBehaviour(); - try - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // setup vital record definition - vitalRecordService.setupVitalRecordDefinition(child); - - return null; - } - }); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java deleted file mode 100644 index 5073a0d466..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import org.alfresco.model.ContentModel; -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.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.RMContainerCacheManager; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.QName; - -/** - * rma:recordsManagementContainer behaviour bean. - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordsManagementContainer" -) -public class RecordsManagementContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnDeleteChildAssociationPolicy -{ - /** behaviour name */ - private static final String BEHAVIOUR_NAME = "onCreateContainerType"; - - /** identifier service */ - protected IdentifierService identifierService; - - /** record service */ - protected RecordService recordService; - - /** record folder service */ - protected RecordFolderService recordFolderService; - - /** RM container cache manager **/ - private RMContainerCacheManager rmContainerCacheManager; - - /** I18N */ - private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type"; - - /** - * @param rmContainerCacheManager RM container cache manager - * - */ - public void setRmContainerCacheManager(RMContainerCacheManager rmContainerCacheManager) - { - this.rmContainerCacheManager = rmContainerCacheManager; - } - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - 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.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation - * (ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - policy = "alf:onCreateChildAssociation", - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateChildAssoiationFirstEvent(final ChildAssociationRef childAssocRef, final boolean bNew) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - QName parentType = nodeService.getType(childAssocRef.getParentRef()); - boolean isContentSubType = dictionaryService.isSubClass(nodeService.getType(childAssocRef.getChildRef()), ContentModel.TYPE_CONTENT); - boolean parentIsUnfiledRecordContainer = parentType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - boolean parentIsUnfiledRecordFolder = parentType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - - NodeRef child = childAssocRef.getChildRef(); - if((parentIsUnfiledRecordContainer || parentIsUnfiledRecordFolder) && isContentSubType && !recordService.isRecord(child)) - { - if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) - { - nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); - } - if (!nodeService.hasAspect(child, ASPECT_RECORD)) - { - recordService.makeRecord(child); - } - } - return null; - } - }); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(ChildAssociationRef, boolean) - * - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT, - name = BEHAVIOUR_NAME - ) - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Get the elements of the created association - final NodeRef child = childAssocRef.getChildRef(); - if (nodeService.exists(child)) - { - QName childType = convertNodeToFileplanComponent(childAssocRef); - - // We only care about "folder" or sub-types that are not hidden. - // Some modules use hidden files to store information (see RM-3283) - if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) && - !nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN)) - { - if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER)) - { - // this is a rule container, make sure it is an file plan component - nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); - } - else - { - // Catch all to generate the rm id (assuming it doesn't already have one!) - setIdenifierProperty(child); - } - } - - if (rmContainerCacheManager != null) - { - rmContainerCacheManager.add(child); - } - } - - return null; - } - }); - } - - /** - * Attempts to remove a deleted node from records management root cache - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy#onDeleteAssociation(org.alfresco.service.cmr.repository.AssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Get the elements of the deleted association - final NodeRef child = childAssocRef.getChildRef(); - - if (rmContainerCacheManager != null) - { - rmContainerCacheManager.remove(child); - } - - return null; - } - }); - } - - /** - * Set the identifier property - * - * @param nodeRef node reference - */ - protected void setIdenifierProperty(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Object doWork() - { - if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) && - nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null) - { - String id = identifierService.generateIdentifier(nodeRef); - nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER, id); - } - return null; - } - }); - } - - /** - * Converted the child node to a fileplan component - * The conversion is needed here to be able to generate the identifier - * If there is no conversion rule for the created type nothing happens and the current type is returned - * - * @param childAssocRef reference to the new association - * @return the new type of the child node - */ - protected QName convertNodeToFileplanComponent(final ChildAssociationRef childAssocRef) - { - NodeRef child = childAssocRef.getChildRef(); - QName childType = nodeService.getType(child); - QName parentType = nodeService.getType(childAssocRef.getParentRef()); - - if(childType.equals(ContentModel.TYPE_FOLDER)) - { - if(parentType.equals(TYPE_FILE_PLAN)) - { - nodeService.setType(child, TYPE_RECORD_CATEGORY); - return TYPE_RECORD_CATEGORY; - } - if(parentType.equals(TYPE_RECORD_CATEGORY)) - { - nodeService.setType(child, TYPE_RECORD_FOLDER); - return TYPE_RECORD_FOLDER; - } - if(parentType.equals(TYPE_UNFILED_RECORD_CONTAINER) || parentType.equals(TYPE_UNFILED_RECORD_FOLDER)) - { - nodeService.setType(child, TYPE_UNFILED_RECORD_FOLDER); - return TYPE_UNFILED_RECORD_FOLDER; - } - } - return childType; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java deleted file mode 100644 index fa34e4fbb3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -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.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -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.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityService; -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.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; - -/** - * Behaviour associated with the RM Site type - * - * @author Roy Wetherall, Silviu Dinuta - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:rmsite" -) -public class RmSiteType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy, - NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnDeleteChildAssociationPolicy -{ - /** Constant values */ - public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary"; - public static final String DEFAULT_SITE_NAME = "rm"; - public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN; - private final static List ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(ContentModel.TYPE_FOLDER); - - /** Site service */ - protected SiteService siteService; - - /** Record Management Search Service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Capability service */ - protected CapabilityService capabilityService; - - /** Authority service */ - private AuthorityService authorityService; - - private FilePlanType filePlanType; - - /** RM container cache manager **/ - private RMContainerCacheManager rmContainerCacheManager; - - /** Map of file plan type's key'ed by corresponding site types */ - protected Map mapFilePlanType = new HashMap<>(3); - - /** - * Set the site service - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public void setFilePlanType(FilePlanType filePlanType) - { - this.filePlanType = filePlanType; - } - - /** - * @param rmContainerCacheManager RM container cache manager - * - */ - public void setRmContainerCacheManager(RMContainerCacheManager rmContainerCacheManager) - { - this.rmContainerCacheManager = rmContainerCacheManager; - } - - /** - * Registers a file plan type for a specific site type. - * - * @param siteType siteType sub-type of rma:rmsite - * @param filePlanType filePlanType sub-type of rma:filePlan - * @since 2.2 - */ - public void registerFilePlanType(QName siteType, QName filePlanType) - { - ParameterCheck.mandatory("siteType", siteType); - ParameterCheck.mandatory("filePlanType", filePlanType); - - // check that the registered site type is a subtype of rma:rmsite - if (!dictionaryService.isSubClass(siteType, TYPE_RM_SITE)) - { - throw new AlfrescoRuntimeException( - "Can't register site type, because site type is not a sub type of rma:rmsite (siteType=" + siteType.toString() + ")"); - } - - // check that the registered file plan type is a sub type of rma:filePlan - if (!dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN)) - { - throw new AlfrescoRuntimeException( - "Can't register file plan type, because site type is not a sub type of rma:filePlan (filePlanType=" + filePlanType.toString() + ")"); - } - - // add site and file plan types to map - mapFilePlanType.put(siteType, filePlanType); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - final NodeRef rmSite = childAssocRef.getChildRef(); - - // Do not execute behaviour if this has been created in the archive store - if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) - { - // This is not the spaces store - probably the archive store - return; - } - - if (nodeService.exists(rmSite)) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - SiteInfo siteInfo = siteService.getSite(rmSite); - if (siteInfo != null) - { - // Create the file plan component - siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null); - - // Add the reports - recordsManagementSearchService.addReports(siteInfo.getShortName()); - } - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * Get the file plan type for the given site. - * - * @param siteInfo site info - * @return QName file plan type to create as a container - * @since 2.2 - */ - private QName getFilePlanType(SiteInfo siteInfo) - { - ParameterCheck.mandatory("siteInfo", siteInfo); - - // set default file plan - QName result = DEFAULT_FILE_PLAN_TYPE; - - // check to see if there is an 'override' for the file plan type given the site type - QName siteType = nodeService.getType(siteInfo.getNodeRef()); - if (mapFilePlanType.containsKey(siteType)) - { - result = mapFilePlanType.get(siteType); - } - - return result; - } - - /** - * Ensure that the visibility of a RM site can not be changed to anything but public. - * - * TODO support other site visibilities - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (nodeService.exists(nodeRef)) - { - Map changed = PropertyMap.getChangedProperties(before, after); - if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) && - changed.get(SiteModel.PROP_SITE_VISIBILITY) != null && - !SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY))) - { - // we do not current support non-public RM sites - throw new AlfrescoRuntimeException("The records management site must have public visibility. It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY)); - } - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - final SiteInfo siteInfo = siteService.getSite(nodeRef); - if (siteInfo != null) - { - // grab the file plan for the RM site - NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY); - } - - }); - - if (filePlan != null) - { - // determine whether the current user has delete capability on the file plan node - AccessStatus accessStatus = capabilityService.getCapabilityAccessState(filePlan, "Delete"); - if (AccessStatus.DENIED.equals(accessStatus)) - { - throw new AlfrescoRuntimeException("The records management site can not be deleted, because the user doesn't have sufficient privillages to delete the file plan."); - } - - // work around for MNT-11038 .. we want to ensure that the RM site can be created once it's been deleted since we only - // allow one short name for the RM site - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // delete the authority - String siteGroup = siteService.getSiteGroup(siteInfo.getShortName()); - authorityService.deleteAuthority(siteGroup, true); - - return null; - } - }); - filePlanType.disable(); - } - } - } - - /** - * Handles site deletion in order to reset the records management root cache - * - * @param childAssocRef - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy#onDeleteAssociation(org.alfresco.service.cmr.repository.AssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION - ) - public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Resets RM Container Cache Manager - if (rmContainerCacheManager != null) - { - rmContainerCacheManager.reset(); - } - - return null; - } - }); - } - - /** - * Add the limitation of creating only one rma:filePlan or one dod:filePlan depending on the type of rm site. - * Let multiple cm:folder type be created under rm site. - * - * - * Other than this nothing can be created under rm site nodeRef - * @since 2.6 - */ - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION) - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - final NodeRef child = childAssocRef.getChildRef(); - final NodeRef parent = childAssocRef.getParentRef(); - List acceptedUniqueChildTypes = new ArrayList<>(); - SiteInfo siteInfo = siteService.getSite(parent); - acceptedUniqueChildTypes.add(getFilePlanType(siteInfo)); - // check the created child is of an accepted type - validateNewChildAssociation(parent, child, acceptedUniqueChildTypes, ACCEPTED_NON_UNIQUE_CHILD_TYPES); - return null; - } - }); - } - - /** - * Handles the deletion node policy (alf:onDeleteNode), resetting the records management root cache - * and enabling file plan behavior as well - * - * @param childAssocRef - * @param isNodeArchived - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:onDeleteNode", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onDeleteNodeOnCommit(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - // Resets RM Container Cache Manager - if (rmContainerCacheManager != null) - { - rmContainerCacheManager.reset(); - } - - filePlanType.enable(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java deleted file mode 100644 index 0bc1db0c26..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:transferContainer behaviour bean - * - * @author Mihai Cozma - * @since 2.4 - */ -@BehaviourBean(defaultType = "rma:transferContainer") -public class TransferContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnDeleteNodePolicy - -{ - private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; - private final static String MSG_ERROR_ADD_CHILD_TO_TRANSFER_CONTAINER = "rm.action.create.transfer.container.child-error-message"; - private static final String BEHAVIOUR_NAME = "onCreateChildAssocsForTransferContainer"; - private static final String DELETE_BEHAVIOUR_NAME = "onDeleteTransferContainer"; - - /** - * Disable the behaviours for this transaction - * - */ - public void disable() - { - getBehaviour(BEHAVIOUR_NAME).disable(); - getBehaviour(DELETE_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - */ - public void enable() - { - getBehaviour(BEHAVIOUR_NAME).enable(); - getBehaviour(DELETE_BEHAVIOUR_NAME).enable(); - } - - /** - * Prevent creating a node inside transfer container, this will be possible only through internal services in a controlled manner. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, - * boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - name = BEHAVIOUR_NAME - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_ERROR_ADD_CHILD_TO_TRANSFER_CONTAINER), null); - } - - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( - I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = DELETE_BEHAVIOUR_NAME - ) - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - throw new IntegrityException("Operation failed. Deletion of Transfer Container is not allowed.", null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferType.java deleted file mode 100644 index 5c5eb366d6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferType.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -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; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:transfer behaviour bean - * - * @author Silviu Dinuta - * @since 2.6 - */ -@BehaviourBean(defaultType = "rma:transfer") -public class TransferType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy -{ - private final static String MSG_ERROR_ADD_CHILD_TO_TRANSFER = "rm.action.create.transfer.child-error-message"; - private final static String MSG_ERROR_EDIT_TRANSFER_PROPERTIES = "rm.action.transfer-non-editable"; - - private static final String CREATE_CHILD_BEHAVIOUR_NAME = "onCreateChildAssocsForTransferType"; - private static final String EDIT_PROPERTIES_BEHAVIOUR_NAME = "onEditTransferProperties"; - - /** - * Disable the behaviours for this transaction - * - */ - public void disable() - { - getBehaviour(CREATE_CHILD_BEHAVIOUR_NAME).disable(); - getBehaviour(EDIT_PROPERTIES_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - */ - public void enable() - { - getBehaviour(CREATE_CHILD_BEHAVIOUR_NAME).enable(); - getBehaviour(EDIT_PROPERTIES_BEHAVIOUR_NAME).enable(); - } - - /** - * Prevent creating a node inside transfer folder, this will be possible only through internal services in a controlled manner. - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - name = CREATE_CHILD_BEHAVIOUR_NAME - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_ERROR_ADD_CHILD_TO_TRANSFER), null); - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = EDIT_PROPERTIES_BEHAVIOUR_NAME - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if(!authenticationUtil.isRunAsUserTheSystemUser()) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_ERROR_EDIT_TRANSFER_PROPERTIES), null); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordContainerType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordContainerType.java deleted file mode 100644 index eaaf50ea37..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordContainerType.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; -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.namespace.QName; - -/** - * rma:unfiledRecordContainer behaviour bean - * - * @author Silviu Dinuta - * @since 2.6 - */ -@BehaviourBean(defaultType = "rma:unfiledRecordContainer") -public class UnfiledRecordContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnDeleteNodePolicy -{ - private static final String BEHAVIOUR_NAME = "onDeleteUnfiledRecordContainer"; - private final static List ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_UNFILED_RECORD_FOLDER, ContentModel.TYPE_CONTENT, TYPE_NON_ELECTRONIC_DOCUMENT); - - /** - * Disable the behaviours for this transaction - * - */ - public void disable() - { - getBehaviour(BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - */ - public void enable() - { - getBehaviour(BEHAVIOUR_NAME).enable(); - } - - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - // We need to automatically cast the created folder to record folder if it is a plain folder - // This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes. - // Some modules use hidden folder subtypes to store information (see RM-3283). - QName childType = nodeService.getType(childAssocRef.getChildRef()); - if (childType.equals(ContentModel.TYPE_FOLDER)) - { - nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER); - } - - // check the created child is of an accepted type - validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES); - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = BEHAVIOUR_NAME - ) - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - throw new IntegrityException("Operation failed. Deletion of Unfiled Record Container is not allowed.", null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordFolderType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordFolderType.java deleted file mode 100644 index 1183d7d2cc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordFolderType.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.namespace.QName; - -/** - * rma:unfiledRecordFolder behaviour bean - * - * @author Silviu Dinuta - * @since 2.6 - */ -@BehaviourBean(defaultType = "rma:unfiledRecordFolder") -public class UnfiledRecordFolderType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy -{ - private final static List ACCEPTED_NON_UNIQUE_CHILD_TYPES = Arrays.asList(TYPE_UNFILED_RECORD_FOLDER, ContentModel.TYPE_CONTENT, TYPE_NON_ELECTRONIC_DOCUMENT); - - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - // We need to automatically cast the created folder to record folder if it is a plain folder - // This occurs if the RM folder has been created via IMap, WebDav, etc. Don't check subtypes. - // Some modules use hidden folder subtypes to store information (see RM-3283). - QName childType = nodeService.getType(childAssocRef.getChildRef()); - if (childType.equals(ContentModel.TYPE_FOLDER)) - { - nodeService.setType(childAssocRef.getChildRef(), TYPE_UNFILED_RECORD_FOLDER); - } - - // check the created child is of an accepted type - validateNewChildAssociationSubTypesIncluded(childAssocRef.getChildRef(), ACCEPTED_NON_UNIQUE_CHILD_TYPES); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java deleted file mode 100644 index 5d6fe20149..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.security; - -import org.alfresco.repo.security.permissions.AccessDeniedException; - -/** - * Model access denied exception implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ModelAccessDeniedException extends AccessDeniedException -{ - private static final long serialVersionUID = 6796435040345714366L; - - public ModelAccessDeniedException(String msg) - { - super(msg); - } - - public ModelAccessDeniedException(String msg, Throwable cause) - { - super(msg, cause); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java deleted file mode 100644 index 07a7841208..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.security; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Model security service interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ModelSecurityService -{ - /** - * Sets whether model security is enabled globally or not. - * - * @param enabled - */ - void setEnabled(boolean enabled); - - /** - * Indicates whether model security is enabled or not. - * - * @return - */ - boolean isEnabled(); - - /** - * Disable model security checks for the current thread. - */ - void disable(); - - /** - * Enable model security checks for the current thread. - */ - void enable(); - - /** - * Registers a protected model artifact with the service. - * - * @param atrifact protected model artifact - */ - void register(ProtectedModelArtifact atrifact); - - /** - * Indicates whether a property is protected or not. - * - * @param property name of property - * @return boolean true if property is protected, false otherwise - */ - boolean isProtectedProperty(QName property); - - /** - * Get the protected properties - * - * @return {@link Set}<{@link QName} > all the protected properties - */ - Set getProtectedProperties(); - - /** - * Get the details of the protected property, returns null if property - * is not protected. - * - * @param name name of the protected property - * @return {@link ProtectedProperty} protected property details, null otherwise - */ - ProtectedProperty getProtectedProperty(QName name); - - /** - * Indicates whether the current user can edit a protected property in the context of - * a given node. - *

- * If the property is not protected then returns true. - * - * @param nodeRef node reference - * @param property name of the property - * @return boolean true if the current user can edit the protected property or the property - * is not protected, false otherwise - */ - boolean canEditProtectedProperty(NodeRef nodeRef, QName property); - - /** - * Indicates whether an aspect is protected or not. - * - * @param aspect aspect name - * @return boolean true if aspect is protected, false otherwise - */ - boolean isProtectedAspect(QName aspect); - - /** - * Get the protected aspects. - * - * @return {@link Set}<{@link QName}> all the protected aspects - */ - Set getProtectedAspects(); - - /** - * Get the details of the protected aspect, returns null if aspect is - * not protected. - * - * @param name name of the aspect - * @return {@link ProtectedAspect} protected aspect details, null otherwise - */ - ProtectedAspect getProtectedAspect(QName name); - - /** - * Indicates whether the current user can edit (ie add or remove) a protected - * aspect in the context of a given node. - *

- * If the aspect is not protected then returns true. - * - * @param nodeRef node reference - * @param aspect name of the of aspect - * @return boolean true if the current user can edit the protected aspect or the the - * aspect is not protected, false otherwise - */ - boolean canEditProtectedAspect(NodeRef nodeRef, QName aspect); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java deleted file mode 100644 index 8d9ec1377d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.security; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.EqualsHelper; - - -/** - * Model security service implementation. - *

- * This service records the protected properties and aspects, ensuring that only those with the appropriate capabilities can edit them. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class ModelSecurityServiceImpl extends BaseBehaviourBean - implements ModelSecurityService, - NodeServicePolicies.BeforeAddAspectPolicy, - NodeServicePolicies.BeforeRemoveAspectPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** Indicates whether model security is enabled or not */ - private boolean enabled = true; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Map of protected properties keyed by name */ - private Map protectedProperties = new HashMap<>(21); - - /** Map of protected aspects keyed by name */ - private Map protectedAspects= new HashMap<>(21); - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#setEnabled(boolean) - */ - public void setEnabled(boolean enabled) - { - this.enabled = enabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isEnabled() - */ - public boolean isEnabled() - { - return enabled; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#disable() - */ - @Override - public void disable() - { - getBehaviour("beforeAddAspect").disable(); - getBehaviour("beforeRemoveAspect").disable(); - getBehaviour("onUpdateProperties").disable(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#enable() - */ - @Override - public void enable() - { - getBehaviour("beforeAddAspect").enable(); - getBehaviour("beforeRemoveAspect").enable(); - getBehaviour("onUpdateProperties").enable(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#register(org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedModelArtifact) - */ - @Override - public void register(ProtectedModelArtifact artifact) - { - // TODO validate that the artifact has a valid property and has a capability set ... - - if (artifact instanceof ProtectedProperty) - { - protectedProperties.put(artifact.getQName(), (ProtectedProperty)artifact); - } - else if (artifact instanceof ProtectedAspect) - { - protectedAspects.put(artifact.getQName(), (ProtectedAspect)artifact); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isProtectedProperty(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isProtectedProperty(QName property) - { - return protectedProperties.containsKey(property); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedProperties() - */ - @Override - public Set getProtectedProperties() - { - return Collections.unmodifiableSet(protectedProperties.keySet()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedProperty(org.alfresco.service.namespace.QName) - */ - @Override - public ProtectedProperty getProtectedProperty(QName name) - { - return protectedProperties.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#canEditProtectedProperty(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public boolean canEditProtectedProperty(NodeRef nodeRef, QName property) - { - boolean result = false; - - ProtectedModelArtifact artifact = getProtectedProperty(property); - if (artifact == null) - { - result = true; - } - else - { - result = canEdit(nodeRef, artifact); - } - - return result; - } - - /** - * Indicates whether the current user can edit protected model artifact in the context - * of a given node or not. - * - * @param nodeRef node reference - * @param artifact protected model artifact - * @return boolean true if the current user can edit the protected model artifact, false otherwise - */ - private boolean canEdit(NodeRef nodeRef, ProtectedModelArtifact artifact) - { - boolean result = false; - - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - if (filePlan != null) - { - for (Capability capability : artifact.getCapabilities()) - { - if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED)) - { - result = true; - break; - } - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isProtectedAspect(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isProtectedAspect(QName aspect) - { - return protectedAspects.containsKey(aspect); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedAspects() - */ - @Override - public Set getProtectedAspects() - { - return Collections.unmodifiableSet(protectedAspects.keySet()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedAspect(org.alfresco.service.namespace.QName) - */ - @Override - public ProtectedAspect getProtectedAspect(QName name) - { - return protectedAspects.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#canEditProtectedAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public boolean canEditProtectedAspect(NodeRef nodeRef, QName aspect) - { - boolean result = false; - - ProtectedModelArtifact artifact = getProtectedAspect(aspect); - if (artifact == null) - { - result = true; - } - else - { - result = canEdit(nodeRef, artifact); - } - - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy#beforeAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - name = "beforeAddAspect" - ) - public void beforeAddAspect(NodeRef nodeRef, QName aspect) - { - if (enabled && - AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - isProtectedAspect(aspect) && - nodeService.exists(nodeRef) && - !canEditProtectedAspect(nodeRef, aspect)) - { - // the user can't edit the protected aspect - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to add the protected aspect " + aspect.toPrefixString(namespaceService) + - " to the node " + nodeRef.toString()); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy#beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - name = "beforeRemoveAspect" - ) - public void beforeRemoveAspect(NodeRef nodeRef, QName aspect) - { - if (enabled && - AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - isProtectedAspect(aspect) && - nodeService.exists(nodeRef) && - !canEditProtectedAspect(nodeRef, aspect)) - { - // the user can't edit the protected aspect - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to remove the protected aspect " + aspect.toPrefixString(namespaceService) + - " from the node " + nodeRef.toString()); - } - } - - /** - * @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, - isService = true, - name = "onUpdateProperties" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (enabled && - AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - nodeService.exists(nodeRef)) - { - for (Map.Entry entry : after.entrySet()) - { - QName property = entry.getKey(); - if (isProtectedProperty(property)) - { - // always allow if this is the first time we are setting the protected property - if (before == null || before.isEmpty() || before.get(property) == null) - { - return; - } - - if (!EqualsHelper.nullSafeEquals(before.get(property), entry.getValue()) && - !canEditProtectedProperty(nodeRef, property)) - { - // the user can't edit the protected property - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to edit the protected property " + property.toPrefixString(namespaceService) + - " on the node " + nodeRef.toString()); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java deleted file mode 100644 index c00309a78e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.security; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public class ProtectedAspect extends ProtectedModelArtifact -{ - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java deleted file mode 100644 index 260279e069..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.security; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Protected model artifact class. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public abstract class ProtectedModelArtifact -{ - /** Model security service */ - private ModelSecurityService modelSecurityService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Qualified name of the model artifact */ - private QName name; - - /** Set of capabilities */ - private Set capabilities; - - /** Capability names */ - private Set capabilityNames; - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * Init method - */ - public void init() - { - modelSecurityService.register(this); - } - - /** - * @param name artifact name (in cm:content form) - */ - public void setName(String name) - { - this.name = QName.createQName(name, namespaceService); - } - - /** - * @return artifact QName - */ - public QName getQName() - { - return name; - } - - /** - * @param capabilities capabilities - */ - public void setCapabilities(Set capabilities) - { - this.capabilities = capabilities; - } - - /** - * @return capabilities - */ - public Set getCapabilities() - { - return capabilities; - } - - /** - * @return capability names - */ - public Set getCapilityNames() - { - if (capabilityNames == null && capabilities != null) - { - capabilityNames = new HashSet<>(capabilities.size()); - for (Capability capability : capabilities) - { - capabilityNames.add(capability.getName()); - } - } - - return capabilityNames; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java deleted file mode 100644 index 9dcf0c6e3b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.security; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Protected property implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public class ProtectedProperty extends ProtectedModelArtifact -{ - /** always allow new indicator */ - private boolean allwaysAllowNew = false; - - /** - * @param allwaysAllowNew true if always allow new, false otherwise - */ - public void setAllwaysAllowNew(boolean allwaysAllowNew) - { - this.allwaysAllowNew = allwaysAllowNew; - } - - /** - * @return true if always allow new, false otherwise - */ - public boolean isAllwaysAllowNew() - { - return allwaysAllowNew; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java deleted file mode 100644 index bd594646eb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java +++ /dev/null @@ -1,480 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.notification; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -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.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.notification.EMailNotificationProvider; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.tenant.TenantAdminService; -import org.alfresco.repo.tenant.TenantUtil; -import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork; -import org.alfresco.service.cmr.notification.NotificationContext; -import org.alfresco.service.cmr.notification.NotificationService; -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.SearchService; -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; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Helper bean containing methods useful when sending records - * management notifications via the {@link NotificationService} - * - * @author Roy Wetherall - */ -public class RecordsManagementNotificationHelper implements RecordsManagementModel -{ - private static Log logger = LogFactory.getLog(RecordsManagementNotificationHelper.class); - - /** I18n */ - private static final String MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW = "notification.dueforreview.subject"; - private static final String MSG_SUBJECT_RECORD_SUPERCEDED = "notification.superseded.subject"; - private static final String MSG_SUBJECT_RECORD_REJECTED = "notification.rejected.subject"; - - /** Defaults */ - private static final String DEFAULT_SITE = "rm"; - - /** Services */ - private NotificationService notificationService; - private FilePlanRoleService filePlanRoleService; - private SearchService searchService; - private NamespaceService namespaceService; - private SiteService siteService; - private AuthorityService authorityService; - private TenantAdminService tenantAdminService; - private NodeService nodeService; - private FilePlanService filePlanService; - - /** Notification role */ - private String notificationRole; - - /** EMail notification templates */ - private NodeRef supersededTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_superseded_template"); - private NodeRef dueForReviewTemplate; - private NodeRef rejectedTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_rejected_template"); - - /** - * @param notificationService notification service - */ - public void setNotificationService(NotificationService notificationService) - { - this.notificationService = notificationService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param notificationRole rm notification role - */ - public void setNotificationRole(String notificationRole) - { - this.notificationRole = notificationRole; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param tenantAdminService tenant admin service - */ - public void setTenantAdminService(TenantAdminService tenantAdminService) - { - this.tenantAdminService = tenantAdminService; - } - - /** - * @return superseded email template - */ - public NodeRef getSupersededTemplate() - { - return supersededTemplate; - } - - /** - * @return rejected email template - */ - public NodeRef getRejectedTemplate() - { - return rejectedTemplate; - } - - /** - * @return due for review email template - */ - public NodeRef getDueForReviewTemplate() - { - if (dueForReviewTemplate == null) - { - List nodeRefs = - searchService.selectNodes( - getRootNode(), - "app:company_home/app:dictionary/cm:records_management/cm:records_management_email_templates/cm:notify-records-due-for-review-email.ftl", null, - namespaceService, - false); - if (nodeRefs.size() == 1) - { - dueForReviewTemplate = nodeRefs.get(0); - } - } - return dueForReviewTemplate; - } - - /** - * Helper method to get root node in a tenant safe way. - * - * @return NodeRef root node of spaces store - */ - private NodeRef getRootNode() - { - String tenantDomain = tenantAdminService.getCurrentUserDomain(); - return TenantUtil.runAsSystemTenant(new TenantRunAsWork() - { - public NodeRef doWork() - { - return nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - } - }, tenantDomain); - } - - /** - * Sends records due for review email notification. - * - * @param records records due for review - */ - public void recordsDueForReviewEmailNotification(final List records) - { - ParameterCheck.mandatory("records", records); - if (!records.isEmpty()) - { - if (nodeService.hasAspect(records.get(0), RecordsManagementModel.ASPECT_RECORD)) - { - NodeRef root = getRMRoot(records.get(0)); - String groupName = getGroupName(root); - - if (doesGroupContainUsers(groupName)) - { - NotificationContext notificationContext = new NotificationContext(); - notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW)); - notificationContext.setAsyncNotification(false); - notificationContext.setIgnoreNotificationFailure(true); - - notificationContext.setBodyTemplate(getDueForReviewTemplate().toString()); - Map args = new HashMap<>(1, 1.0f); - args.put("records", (Serializable) records); - args.put("site", getSiteName(root)); - notificationContext.setTemplateArgs(args); - - notificationContext.addTo(groupName); - - notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn("Unable to send record due for review email notification, because notification group was empty."); - } - - throw new AlfrescoRuntimeException( - "Unable to send record due for review email notification, because notification group was empty."); - } - } - } - } - - /** - * Sends record superseded email notification. - * - * @param record superseded record - */ - public void recordSupersededEmailNotification(final NodeRef record) - { - ParameterCheck.mandatory("record", record); - - NodeRef root = getRMRoot(record); - String groupName = getGroupName(root); - - if (doesGroupContainUsers(groupName)) - { - NotificationContext notificationContext = new NotificationContext(); - notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_SUPERCEDED)); - notificationContext.setAsyncNotification(false); - notificationContext.setIgnoreNotificationFailure(true); - - notificationContext.setBodyTemplate(supersededTemplate.toString()); - Map args = new HashMap<>(1, 1.0f); - args.put("record", record); - args.put("site", getSiteName(root)); - notificationContext.setTemplateArgs(args); - - notificationContext.addTo(groupName); - - notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn("Unable to send record superseded email notification, because notification group was empty."); - } - } - } - - /** - * Sends record rejected email notification. - * - * @param record rejected record - */ - public void recordRejectedEmailNotification(NodeRef record, String recordId, String recordCreator) - { - ParameterCheck.mandatory("record", record); - - if (canSendRejectEmail(record, recordCreator)) - { - String site = siteService.getSite(record).getShortName(); - String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON); - String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID); - Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE); - String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - - Map args = new HashMap<>(8); - args.put("record", record); - args.put("site", site); - args.put("recordCreator", recordCreator); - args.put("rejectReason", rejectReason); - args.put("rejectedPerson", rejectedPerson); - args.put("rejectDate", rejectDate); - args.put("recordId", recordId); - args.put("recordName", recordName); - - NotificationContext notificationContext = new NotificationContext(); - notificationContext.setAsyncNotification(true); - notificationContext.setIgnoreNotificationFailure(true); - notificationContext.addTo(recordCreator); - notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_REJECTED)); - notificationContext.setBodyTemplate(getRejectedTemplate().toString()); - notificationContext.setTemplateArgs(args); - - notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); - } - } - - /** - * Helper method to check if the mandatory properties are set - * - * @param record rejected record - */ - private boolean canSendRejectEmail(NodeRef record, String recordCreator) - { - boolean result = true; - - String msg1 = "Unable to send record rejected email notification, because "; - String msg2 = " could not be found!"; - - if (siteService.getSite(record) == null) - { - result = false; - logger.warn(msg1 + "the site which should contain the node '" + record.toString() + "'" + msg2); - } - if (StringUtils.isBlank(recordCreator)) - { - result = false; - logger.warn(msg1 + "the user, who created the record" + msg2); - } - if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON))) - { - result = false; - logger.warn(msg1 + "the reason for rejection" + msg2); - } - if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID))) - { - result = false; - logger.warn(msg1 + "the user, who rejected the record" + msg2); - } - if (((Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE)) == null) - { - result = false; - logger.warn(msg1 + "the date, when the record was rejected" + msg2); - } - - return result; - } - - /** - * Gets the rm root given a context node. - * - * @param context context node reference - * @return {@link NodeRef} rm root node reference - */ - private NodeRef getRMRoot(final NodeRef context) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return filePlanService.getFilePlan(context); - - } - }, AuthenticationUtil.getSystemUserName()); - - } - - /** - * Gets the group name for the notification role. - * - * @param root rm root node - * @return String notification role's group name - */ - private String getGroupName(final NodeRef root) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public String doWork() - { - // Find the authority for the given role - Role role = filePlanRoleService.getRole(root, notificationRole); - return role.getRoleGroupName(); - } - }, AuthenticationUtil.getSystemUserName()); - } - - private boolean doesGroupContainUsers(final String groupName) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Boolean doWork() throws Exception - { - Set users = authorityService.getContainedAuthorities(AuthorityType.USER, groupName, true); - return !users.isEmpty(); - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Get the site name, default if none/undetermined. - * - * @param root rm root - * @return String site name - */ - private String getSiteName(final NodeRef root) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public String doWork() - { - String result = DEFAULT_SITE; - - SiteInfo siteInfo = siteService.getSite(root); - if (siteInfo != null) - { - result = siteInfo.getShortName(); - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java deleted file mode 100644 index 9326c377f4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch; - -import java.util.concurrent.TimeUnit; - -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.transaction.TransactionService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Abstract module patch implementation. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(ModulePatch.class); - - /** module patch service */ - private ModulePatchExecuter modulePatchExecuter; - - /** transaction service */ - protected TransactionService transactionService; - - /** module patch id */ - private String id; - - /** module patch description */ - private String description; - - /** module id */ - private String moduleId; - - /** module patch fixes from module schema number */ - private int fixesFromSchema; - - /** module patch fixes to module schema number */ - private int fixesToSchema; - - /** module patch target module schema number */ - private int targetSchema; - - /** if it should use a read only transaction */ - private boolean txnReadOnly = true; - - /** if it should use a new transaction */ - private boolean txnRequiresNew = false; - - /** - * Initiialisation method - */ - public void init() - { - modulePatchExecuter.register(this); - } - - public void setTxnReadOnly(boolean txnReadOnly) - { - this.txnReadOnly = txnReadOnly; - } - - public void setTxnRequiresNew(boolean txnRequiresNew) - { - this.txnRequiresNew = txnRequiresNew; - } - - /** - * @param modulePatchExecuter module patch executer - */ - public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter) - { - this.modulePatchExecuter = modulePatchExecuter; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * @param id module patch id - */ - public void setId(String id) - { - this.id = id; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getId() - */ - @Override - public String getId() - { - return id; - } - - /** - * Convenience method to set the module patch id to the bean name (if not already specified) - */ - @Override - public void setBeanName(String beanName) - { - if (id == null) - { - id = beanName; - } - } - - /** - * @param description module patch description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getDescription() - */ - @Override - public String getDescription() - { - return description; - } - - /** - * @param moduleId module id - */ - public void setModuleId(String moduleId) - { - this.moduleId = moduleId; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getModuleId() - */ - @Override - public String getModuleId() - { - return moduleId; - } - - /** - * @param fixesFromSchema fixes from schema value - */ - public void setFixesFromSchema(int fixesFromSchema) - { - this.fixesFromSchema = fixesFromSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesFromSchema() - */ - @Override - public int getFixesFromSchema() - { - return fixesFromSchema; - } - - /** - * @param fixesToSchema fixes to schema value - */ - public void setFixesToSchema(int fixesToSchema) - { - this.fixesToSchema = fixesToSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesToSchema() - */ - @Override - public int getFixesToSchema() - { - return fixesToSchema; - } - - public void setTargetSchema(int targetSchema) - { - this.targetSchema = targetSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getTargetSchema() - */ - @Override - public int getTargetSchema() - { - return targetSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#apply() - */ - @Override - public void apply() - { - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Executing module patch \"" + description + "\""); - } - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... id=" + id + - ",moduleId=" + moduleId + - ",from=" + fixesFromSchema + - ",to=" + fixesToSchema + - ",target=" + targetSchema); - } - - long startTime = System.nanoTime(); - - // do patch in transaction - transactionService.getRetryingTransactionHelper().doInTransaction( - new ApplyCallback(), - txnReadOnly, - txnRequiresNew); - - long elapsedTime = System.nanoTime() - startTime; - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info(" ... module patch applied in " + TimeUnit.NANOSECONDS.toMillis(elapsedTime) + "ms"); - } - } - - /** - * Apply patch internal method. Implementations can assume a transaction has - * been started. - */ - public abstract void applyInternal(); - - /** - * Apply callback worker class implementation - */ - private class ApplyCallback implements RetryingTransactionCallback - { - /** - * @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute() - */ - @Override - public Void execute() - { - applyInternal(); - return null; - } - } - - /** - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(ModulePatch o) - { - int result = 0; - if (getTargetSchema() < o.getTargetSchema()) - { - result = -1; - } - else if (getTargetSchema() > o.getTargetSchema()) - { - result = 1; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java deleted file mode 100644 index f074619b2c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch; - -/** - * Module Patch Interface - * - * @author Roy Wetherall - * @since 2.2 - */ -public interface ModulePatch extends Comparable -{ - /** - * @return module patch id - */ - String getId(); - - /** - * @return module patch description - */ - String getDescription(); - - /** - * @return module id this patch applies to - */ - String getModuleId(); - - /** - * @return smallest module schema number that this patch may be applied to - */ - int getFixesFromSchema(); - - /** - * @return largest module schema number that this patch may be applied to - */ - int getFixesToSchema(); - - /** - * @return module schema number that this patch attempts to bring the repo up to - */ - int getTargetSchema(); - - /** - * Apply the module patch - */ - void apply(); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java deleted file mode 100644 index 995bbb0f92..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch; - -/** - * Module patch service interface - * - * @author Roy Wetherall - * @since 2.2 - */ -public interface ModulePatchExecuter -{ - /** - * Register module patch with the module patch executer - * - * @param modulePatch module patch - */ - void register(ModulePatch modulePatch); - - /** - * Init the schema version number - */ - void initSchemaVersion(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java deleted file mode 100644 index 91023b2129..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.module.AbstractModuleComponent; -import org.alfresco.service.cmr.attributes.AttributeService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Module patch executer base implementation - * - * @author Roy Wetherall - * @since 2.2 - */ -public class ModulePatchExecuterImpl extends AbstractModuleComponent - implements ModulePatchExecuter -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(ModulePatchExecuterImpl.class); - - /** default start schema */ - private static final int START_SCHEMA = 0; - - /** attribute key */ - private static final String KEY_MODULE_SCHEMA = "module-schema"; - - /** configured module schema version */ - protected int moduleSchema = START_SCHEMA; - - /** attribute service */ - protected AttributeService attributeService; - - /** module patches */ - protected Map modulePatches = new HashMap<>(21); - - /** - * @param attributeService attribute service - */ - public void setAttributeService(AttributeService attributeService) - { - this.attributeService = attributeService; - } - - /** - * @param moduleSchema configured module schema version - */ - public void setModuleSchema(int moduleSchema) - { - this.moduleSchema = moduleSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#register(org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch) - */ - @Override - public void register(ModulePatch modulePatch) - { - // ensure that the module patch being registered relates to the module id - if (!getModuleId().equals(modulePatch.getModuleId())) - { - throw new AlfrescoRuntimeException("Unable to register module patch, becuase module id is invalid."); - } - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Registering module patch " + modulePatch.getId() + " for module " + getModuleId()); - } - - modulePatches.put(modulePatch.getId(), modulePatch); - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executeInternal() - { - // get current schema version - int currentSchema = getCurrentSchema(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Running module patch executer (currentSchema=" + currentSchema + ", configuredSchema=" + moduleSchema + ")"); - } - - if (moduleSchema > currentSchema) - { - // determine what patches should be applied - List patchesToApply = new ArrayList<>(13); - for (ModulePatch modulePatch : modulePatches.values()) - { - if (modulePatch.getFixesFromSchema() <= currentSchema && - modulePatch.getFixesToSchema() >= currentSchema) - { - patchesToApply.add(modulePatch); - } - } - - // apply the patches in the correct order - Collections.sort(patchesToApply); - for (ModulePatch patchToApply : patchesToApply) - { - patchToApply.apply(); - } - - // update the schema - updateSchema(moduleSchema); - } - } - - /** - * Get the currently recorded schema version for the module - * - * @return int currently recorded schema version - */ - protected int getCurrentSchema() - { - Integer result = START_SCHEMA; - if (attributeService.exists(KEY_MODULE_SCHEMA, getModuleId())) - { - result = (Integer)attributeService.getAttribute(KEY_MODULE_SCHEMA, getModuleId()); - } - return result; - } - - /** - * Update the recorded schema version for the module. - * - * @param newSchema new schema version - */ - protected void updateSchema(int newSchema) - { - attributeService.setAttribute(Integer.valueOf(newSchema), KEY_MODULE_SCHEMA, getModuleId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#initSchemaVersion() - */ - @Override - public void initSchemaVersion() - { - updateSchema(moduleSchema); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java deleted file mode 100644 index 9f1f9aa4d0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.common; - -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * Abstract implementation of capability patch. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class CapabilityPatch extends AbstractModulePatch -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** authority service */ - private AuthorityService authorityService; - - /** permission service */ - private PermissionService permissionService; - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Helper method to get the file plans - * - * @return Set of file plan node references - */ - protected Set getFilePlans() - { - return filePlanService.getFilePlans(); - } - - /** - * Adds a new capability to the specified roles. - * - * @param filePlan file plan - * @param capabilityName capability name - * @param roles roles - */ - protected void addCapability(NodeRef filePlan, String capabilityName, String ... roles) - { - for (String role : roles) - { - String fullRoleName = role + filePlan.getId(); - String roleAuthority = authorityService.getName(AuthorityType.GROUP, fullRoleName); - if (roleAuthority == null) - { - throw new AlfrescoRuntimeException("Role " + role + " does not exist."); - } - else - { - permissionService.setPermission(filePlan, roleAuthority, capabilityName, true); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - Set filePlans = getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating file plan " + filePlan.toString()); - } - - // apply the capability patch to each file plan - applyCapabilityPatch(filePlan); - } - } - - @Override - public void apply() - { - setTxnReadOnly(false); - setTxnRequiresNew(true); - super.apply(); - } - - protected abstract void applyCapabilityPatch(NodeRef filePlan); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java deleted file mode 100644 index 65d25579fe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.compatibility; - -import static org.alfresco.repo.module.ModuleVersionNumber.VERSION_ZERO; - -import java.io.Serializable; - -import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuterImpl; -import org.alfresco.repo.admin.registry.RegistryKey; -import org.alfresco.repo.admin.registry.RegistryService; -import org.alfresco.repo.module.AbstractModuleComponent; -import org.alfresco.repo.module.ModuleComponentHelper; -import org.alfresco.repo.module.ModuleVersionNumber; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Module patch component base class. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public abstract class ModulePatchComponent extends AbstractModuleComponent -{ - private static final String REGISTRY_PATH_MODULES = "modules"; - private static final String REGISTRY_PROPERTY_INSTALLED_VERSION = "installedVersion"; - private static final String REGISTRY_PROPERTY_CURRENT_VERSION = "currentVersion"; - - /** logger */ - protected static final Logger LOGGER = LoggerFactory.getLogger(ModulePatchComponent.class); - - /** Retrying transaction helper */ - protected RetryingTransactionHelper retryingTransactionHelper; - - /** Behaviour filter */ - protected BehaviourFilter behaviourFilter; - - /** module patch executer */ - protected ModulePatchExecuterImpl modulePatchExecuter; - - /** Registry service */ - protected RegistryService registryService; - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @param modulePatchExecuter module patch executer - */ - public void setModulePatchExecuter(ModulePatchExecuterImpl modulePatchExecuter) - { - this.modulePatchExecuter = modulePatchExecuter; - } - - /** - * @param registryService Registry service - */ - public void setRegistryService(RegistryService registryService) - { - this.registryService = registryService; - } - - /** - * Init method - */ - @Override - public void init() - { - super.init(); - modulePatchExecuter.getDependsOn().add(this); - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executeInternal() - { - //Get the new module version - String moduleId = modulePatchExecuter.getModuleId(); - ModuleVersionNumber moduleNewVersionNumber = moduleService.getModule(moduleId).getModuleVersionNumber(); - - // Get the module details from the registry - ModuleVersionNumber moduleCurrentVersionNumber = getModuleVersionNumber(REGISTRY_PROPERTY_CURRENT_VERSION, - moduleId); - // Get the module patch component name - String moduleName = getName(); - if (moduleCurrentVersionNumber.equals(VERSION_ZERO) || - moduleCurrentVersionNumber.equals(moduleNewVersionNumber)) // No previous record of it - { - LOGGER.info("Module patch component '{}' is skipped, no previous version found.", moduleName); - } - else - { - if (isVersionLaterThan(moduleCurrentVersionNumber, moduleNewVersionNumber)) - { - LOGGER.info("Module patch component '{}' is skipped for upgrade from version {} to version {}", - moduleName, moduleCurrentVersionNumber, moduleNewVersionNumber); - } - else - { - try - { - LOGGER.info("Module patch component '{}' is executing ...", moduleName); - - // execute path within an isolated transaction - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - - { - @Override - public Void execute() - { - behaviourFilter.disableBehaviour(); - try - { - executePatch(); - } - finally - { - behaviourFilter.enableBehaviour(); - } - return null; - } - - }, false, true); - - LOGGER.info(" ... completed module patch '{}'", moduleName); - - } - catch (Exception exception) - { - // record the exception otherwise it gets swallowed - LOGGER.info(" ... error encountered. {}", exception.getMessage(), exception); - throw exception; - } - } - } - } - - /** - * Helper method to get the ModuleVersionNumber. - */ - private ModuleVersionNumber getModuleVersionNumber(String registryProperty, String moduleId) - { - RegistryKey moduleKeyVersion = new RegistryKey(ModuleComponentHelper.URI_MODULES_1_0, - new String[]{REGISTRY_PATH_MODULES, moduleId, registryProperty}); - Serializable moduleVersion = this.registryService.getProperty(moduleKeyVersion); - - if (moduleVersion == null) - { - return VERSION_ZERO; - } - else - { - return new ModuleVersionNumber(moduleVersion.toString()); - } - - } - - /** - * Helper method to determine if this is an upgrade from a version that already includes the early (v2.0, v2.1) - * patches. - * - */ - private boolean isVersionLaterThan(ModuleVersionNumber moduleCurrentVersionNumber, - ModuleVersionNumber moduleNewVersionNumber) - { - // assume that the v2.0 and v2.1 patches should be run - boolean versionLaterThan = false; - - // if this is an upgrade as opposed to a fresh install - if (moduleCurrentVersionNumber.compareTo(moduleNewVersionNumber) < 0) - { - // if the installed version is later than the minimum version number of this patch - ModuleVersionNumber minVersion = this.getAppliesFromVersionNumber(); - if (moduleCurrentVersionNumber.compareTo(minVersion) >= 0) - { - versionLaterThan = true; - } - } - // v2.0 and v2.1 patches should not be run when both the current and the new version numbers are equals - else - { - versionLaterThan =true; - } - - return versionLaterThan; - } - - /** - * Execute patch work. - */ - protected abstract void executePatch(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java deleted file mode 100644 index 2c9d36e13b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v20; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.audit.AuditService; -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.version.Version; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Notification template patch implementation - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class NotificationTemplatePatch extends ModulePatchComponent - implements BeanNameAware -{ - /** Last patch update property */ - private static final QName PROP_LAST_PATCH_UPDATE = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "lastPatchUpdate"); - - private static final String PATH_DUE_FOR_REVIEW = "alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl"; - private static final String PATH_SUPERSEDED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl"; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** Version service */ - private VersionService versionService; - - /** Audit service */ - private AuditService auditService; - - /** Bean name */ - private String name; - - /** - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @param auditService audit service - */ - public void setAuditService(AuditService auditService) - { - this.auditService = auditService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); - updateTemplate(supersededTemplate, PATH_SUPERSEDED); - - NodeRef dueForReviewTemplate = notificationHelper.getDueForReviewTemplate(); - updateTemplate(dueForReviewTemplate, PATH_DUE_FOR_REVIEW); - } - - /** - * Attempt to update the template with the updated version - * - * @param template - * @param updatedTemplate - */ - private void updateTemplate(NodeRef template, String templateUpdate) - { - if (template == null || !nodeService.exists(template)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Skipping template update, because template has not been bootstraped."); - } - } - else - { - // Check to see if this template has already been updated - String lastPatchUpdate = (String)nodeService.getProperty(template, PROP_LAST_PATCH_UPDATE); - if (lastPatchUpdate == null || !name.equals(lastPatchUpdate)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Applying update to template. (template=" + template.toString() + ", templateUpdate=" + templateUpdate + ")"); - } - - // Make sure the template is versionable - if (!nodeService.hasAspect(template, ContentModel.ASPECT_VERSIONABLE)) - { - nodeService.addAspect(template, ContentModel.ASPECT_VERSIONABLE, null); - - // Create version (before template is updated) - Map versionProperties = new HashMap<>(2); - versionProperties.put(Version.PROP_DESCRIPTION, "Initial version"); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionService.createVersion(template, versionProperties); - } - - // Update the content of the template - InputStream is = getClass().getClassLoader().getResourceAsStream(templateUpdate); - ContentWriter writer = contentService.getWriter(template, ContentModel.PROP_CONTENT, true); - writer.putContent(is); - - boolean enabled = auditService.isAuditEnabled(); - auditService.setAuditEnabled(false); - try - { - // Set the last patch update property - nodeService.setProperty(template, PROP_LAST_PATCH_UPDATE, name); - } - finally - { - auditService.setAuditEnabled(enabled); - } - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Skipping template update, because template has already been patched. (template=" + template.toString() + ")"); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java deleted file mode 100644 index 03f7ef0f1e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v20; - -import java.io.Serializable; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -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; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.0 File Plan Node Ref Patch - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - private NodeService nodeService; - private PatchDAO patchDAO; - private NodeDAO nodeDAO; - private QNameDAO qnameDAO; - private PermissionService permissionService; - private FilePlanService filePlanService; - private FilePlanRoleService filePlanRoleService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Pair aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - if (aspectPair != null) - { - List filePlanComponents = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID()); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlanComponents.size() + " items"); - } - - - for (Long filePlanComponent : filePlanComponents) - { - Pair recordPair = nodeDAO.getNodePair(filePlanComponent); - NodeRef filePlanComponentNodeRef = recordPair.getSecond(); - - NodeRef filePlan = filePlanService.getFilePlan(filePlanComponentNodeRef); - - if(filePlan != null) - { - // set the file plan node reference - if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null) - { - nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan); - } - - // only set the admin permissions on record categories, record folders and records - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef); - if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) || - FilePlanComponentKind.RECORD_FOLDER.equals(kind) || - FilePlanComponentKind.RECORD.equals(kind)) - { - // ensure the that the records management role has read and file on the node - Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator"); - if (adminRole != null) - { - permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true); - } - - // ensure that the default vital record default values have been set (RM-753) - Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR); - if (vitalRecordIndicator == null) - { - nodeService.setProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR, false); - } - Serializable reviewPeriod = nodeService.getProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD); - if (reviewPeriod == null) - { - nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0")); - } - } - } - else - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn(" ... node " + filePlanComponent.toString() + " was skiped, beacuse there was no associated file plan."); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java deleted file mode 100644 index 24e6a8ce81..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v20; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.0 Model Updates Patch - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class RMv2ModelPatch extends ModulePatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - private static final long BATCH_SIZE = 100000L; - - private PatchDAO patchDAO; - private NodeDAO nodeDAO; - private QNameDAO qnameDAO; - - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - updateQName(QName.createQName(DOD_URI, "filePlan"), TYPE_FILE_PLAN, "TYPE"); - updateQName(QName.createQName(DOD_URI, "recordCategory"), TYPE_RECORD_CATEGORY, "TYPE"); - updateQName(QName.createQName(DOD_URI, "ghosted"), ASPECT_GHOSTED, "ASPECT"); - } - - private void updateQName(QName qnameBefore, QName qnameAfter, String reindexClass) - { - Work work = new Work(qnameBefore, qnameAfter, reindexClass); - retryingTransactionHelper.doInTransaction(work, false, true); - } - - private class Work implements RetryingTransactionHelper.RetryingTransactionCallback - { - private QName qnameBefore; - private QName qnameAfter; - private String reindexClass; - - /** - * Constructor - * - * @param qnameBefore qname before - * @param qnameAfter qname after - * @param reindexClass reindex class - */ - Work(QName qnameBefore, QName qnameAfter, String reindexClass) - { - this.qnameBefore = qnameBefore; - this.qnameAfter = qnameAfter; - this.reindexClass = reindexClass; - } - - /** - * @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute() - */ - @Override - public Integer execute() throws Throwable - { - Long maxNodeId = patchDAO.getMaxAdmNodeID(); - - Pair before = qnameDAO.getQName(qnameBefore); - - if (before != null) - { - for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE) - { - if ("TYPE".equals(reindexClass)) - { - List nodeIds = patchDAO.getNodesByTypeQNameId(before.getFirst(), i, i + BATCH_SIZE); - nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds); - } - else if ("ASPECT".equals(reindexClass)) - { - List nodeIds = patchDAO.getNodesByAspectQNameId(before.getFirst(), i, i + BATCH_SIZE); - nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds); - } - } - - qnameDAO.updateQName(qnameBefore, qnameAfter); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updated qname " + qnameBefore.toString()); - } - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... no need to update qname " + qnameBefore.toString()); - } - } - - //nothing to do - return 0; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java deleted file mode 100644 index 141e6fd52d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v20; - -import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -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.site.SiteService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.0 Saved Search Patch - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class RMv2SavedSearchPatch extends ModulePatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - /** Records management search service */ - private RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - private SiteService siteService; - - /** Content service */ - private ContentService contentService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - if (siteService.getSite(DEFAULT_SITE_NAME) != null) - { - // get the saved searches - List savedSearches = recordsManagementSearchService.getSavedSearches(DEFAULT_SITE_NAME); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + savedSearches.size() + " saved searches"); - } - - for (SavedSearchDetails savedSearchDetails : savedSearches) - { - // refresh the query - String refreshedJSON = savedSearchDetails.toJSONString(); - NodeRef nodeRef = savedSearchDetails.getNodeRef(); - - if (nodeRef != null) - { - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - writer.putContent(refreshedJSON); - - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updated saved search " + savedSearchDetails.getName() + " (nodeRef=" + nodeRef.toString() + ")"); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java deleted file mode 100644 index bca39b9da5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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; - -/** - * Adds a new email template for rejected records to the existing templates - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class NotificationTemplatePatch_v21 extends RMv21PatchComponent -{ - /** Email template path */ - private static final String PATH_REJECTED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl"; - - /** Reject template config node id*/ - private static final String CONFIG_NODEID = "record_rejected_template"; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected void executePatch() - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); - // get the parent node - NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); - if (!nodeService.exists(nodeRef) && nodeService.exists(supersededTemplate)) - { - NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef(); - - // build the node properties - Map props = new HashMap<>(4); - props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template."); - props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl"); - props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl"); - props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template"); - - // get the assoc qname - QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl")); - - // create the node - ChildAssociationRef node = nodeService.createNode(parent, - ContentModel.ASSOC_CONTAINS, - assocQName, - ContentModel.TYPE_CONTENT, - props); - - // put the content - ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); - InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED); - writer.putContent(is); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java deleted file mode 100644 index 480a60af54..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import static org.apache.commons.logging.LogFactory.getLog; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -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.springframework.beans.factory.BeanNameAware; - -/** - * This patch creates a new "Records Management Behavior Scripts" folder and moves existing behavior scripts from the old "Records Management Scripts" folder to the new folder. - * This is to compensate for any non-behavior RM scripts so that they can live in the old "Records Management Scripts" folder for its intended purpose and be picked up by the - * execute script rule action. - * - * @author Craig Tan - * @since 2.1 - */ -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"); - - /** old behavior scripts folder root lookup */ - 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"); - - /** name of example script */ - protected static final String IS_CLOSED_JS = "rma_isClosed.js"; - - /** Node Service */ - private NodeService nodeService; - - /** File Folder Service */ - private FileFolderService fileFolderService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch() - */ - @Override - protected void executePatch() - { - // check that the rm config root has been correctly bootstrapped - if (!nodeService.exists(RM_CONFIG)) - { - // we don't need to do anything - return; - } - - // check that the behavior scripts folder exists - if (!nodeService.exists(newBehaviorScriptsFolder)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... creating RM Behavior Scripts folder"); - } - - String newBehaviorScriptsFolderName = "Records Management Behavior Scripts"; - String newBehaviorScriptsNodeUUID = "rm_behavior_scripts"; - String newBehaviorScriptsAssocQName = "records_management_behavior_scripts"; - - Map newBehaviorScriptsFolderProps = new HashMap<>(); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_NODE_UUID, newBehaviorScriptsNodeUUID); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_NAME, newBehaviorScriptsFolderName); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_TITLE, newBehaviorScriptsFolderName); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_DESCRIPTION, "Scripts intended for execution in response to RM events."); - - newBehaviorScriptsFolder = nodeService.createNode(RM_CONFIG, ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, newBehaviorScriptsAssocQName), - ContentModel.TYPE_FOLDER, newBehaviorScriptsFolderProps).getChildRef(); - } - - // move to the new behavior scripts folder if the old behavior scripts folder exists and contains files - if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER)) - { - // run the following code as System - AuthenticationUtil.runAs(new RunAsWork() - { - @SuppressWarnings("deprecation") - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Update the description of the old Scripts folder. - nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER, ContentModel.PROP_DESCRIPTION, "Scripts specific to RM that can also be executed by RM rules."); - - // Move files from RM Scripts folder to RM Behavior Scripts folder. - List oldBehaviorScripts = fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER); - - if (oldBehaviorScripts != null && !oldBehaviorScripts.isEmpty()) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... moving files from RM Scripts folder to RM Behavior Scripts folder"); - } - - for (FileInfo script : oldBehaviorScripts) - { - // move the old script to the new location - fileFolderService.moveFrom(script.getNodeRef(), OLD_BEHAVIOR_SCRIPTS_FOLDER, RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder, script.getName()); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ...... moved " + script.getName()); - } - } - - } - return null; - } - }; - - retryingTransactionHelper.doInTransaction(callback); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java deleted file mode 100644 index 4842a437a3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * RM v2.1 patch to updated modified capabilities. - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21CapabilityPatch extends RMv21PatchComponent -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** authority service */ - private AuthorityService authorityService; - - /** permission service */ - private PermissionService permissionService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Helper method to get the file plans - * - * @return Set of file plan node references - */ - protected Set getFilePlans() - { - return filePlanService.getFilePlans(); - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * Adds a new capability to the specified roles. - * - * @param filePlan file plan - * @param capabilityName capability name - * @param roles roles - */ - private void addCapability(NodeRef filePlan, String capabilityName, String ... roles) - { - for (String role : roles) - { - String fullRoleName = role + filePlan.getId(); - String roleAuthority = authorityService.getName(AuthorityType.GROUP, fullRoleName); - if (roleAuthority == null) - { - throw new AlfrescoRuntimeException("Role " + role + " does not exist."); - } - else - { - permissionService.setPermission(filePlan, roleAuthority, capabilityName, true); - } - } - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Set filePlans = getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating file plan " + filePlan.toString()); - } - - // add new capabilities - addCapability(filePlan, - "CreateRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "ManageRules", - FilePlanRoleService.ROLE_ADMIN); - addCapability(filePlan, - "RequestRecordInformation", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "FileDestructionReport", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "RejectRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "FileUnfiledRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "LinkToRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java deleted file mode 100644 index 5d3daf967e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.model.ContentModel; -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.dod5015.DOD5015Model; -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -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.cmr.rule.RuleService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.1 patch to support InPlace functional updates - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21InPlacePatch extends RMv21PatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - /** Extended reader and writer role details */ - private static final String ROLE_READERS_LABEL = "In-Place Readers"; - private static final String[] ROLE_READERS_CAPABILITIES = new String[] - { - "ViewRecords" - }; - private static final String ROLE_WRITERS_LABEL = "In-Place Writers"; - private static final String[] ROLE_WRITERS_CAPABILITIES = new String[] - { - "ViewRecords", - "EditNonRecordMetadata" - }; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** File plan permission service */ - private FilePlanPermissionService filePlanPermissionService; - - /** capability service */ - private CapabilityService capabilityService; - - /** rule service */ - private RuleService ruleService; - - /** node service */ - private NodeService nodeService; - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanPermissionService file plan permission service - */ - public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) - { - this.filePlanPermissionService = filePlanPermissionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param ruleService rule service - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Set filePlans = filePlanService.getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - if (filePlanService.getUnfiledContainer(filePlan) == null) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating file plan " + filePlan.toString()); - } - - ruleService.disableRules(); - try - { - // create fileplan containers - filePlanService.createHoldContainer(filePlan); - filePlanService.createTransferContainer(filePlan); - filePlanService.createUnfiledContainer(filePlan); - - // move any existing holds to new container - moveExistingHolds(filePlan); - - // move any existing transfers to new container - moveExistingTransfers(filePlan); - - // add the inplace roles - filePlanRoleService.createRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_CAPABILITIES)); - filePlanRoleService.createRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, ROLE_WRITERS_LABEL, getCapabilities(ROLE_WRITERS_CAPABILITIES)); - } - finally - { - ruleService.enableRules(); - } - } - } - } - - private Set getCapabilities(String[] capabilityNames) - { - Set capabilities = new HashSet<>(3); - for (String capabilityName : capabilityNames) - { - capabilities.add(capabilityService.getCapability(capabilityName)); - } - return capabilities; - } - - private void moveExistingHolds(NodeRef filePlan) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... moving existing holds for file plan " + filePlan.toString()); - } - - NodeRef container = filePlanService.getHoldContainer(filePlan); - - List assocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef hold = assoc.getChildRef(); - String name = (String)nodeService.getProperty(hold, ContentModel.PROP_NAME); - nodeService.moveNode(hold, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name)); - } - } - - private void moveExistingTransfers(NodeRef filePlan) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... moving existing transfers for file plan " + filePlan.toString()); - } - - NodeRef container = filePlanService.getTransferContainer(filePlan); - - List assocs = nodeService.getChildAssocs(filePlan, ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef transfer = assoc.getChildRef(); - String name = (String)nodeService.getProperty(transfer, ContentModel.PROP_NAME); - nodeService.moveNode(transfer, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name)); - } - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java deleted file mode 100644 index 3c133a991f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.repo.module.ModuleComponent; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Convenience class to ensure all V2.0 patches are executed before v2.1 - * - * @author Roy Wetherall - * @since 2.2 - */ -@SuppressWarnings("deprecation") -public abstract class RMv21PatchComponent extends ModulePatchComponent - implements ApplicationContextAware -{ - /** application context */ - private ApplicationContext applicationContext; - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * init method - */ - @Override - public void init() - { - super.init(); - - // manual addition of V20 patch dependencies - List depends = getDependsOn(); - addDependency(depends, "org_alfresco_module_rm_notificationTemplatePatch"); - addDependency(depends, "org_alfresco_module_rm_RMv2ModelPatch"); - addDependency(depends, "org_alfresco_module_rm_RMv2FilePlanNodeRefPatch"); - addDependency(depends, "org_alfresco_module_rm_RMv2SavedSearchPatch"); - } - - /** - * @param depends list of module dependencies - * @param beanName bean name - */ - private void addDependency(List depends, String beanName) - { - ModuleComponent moduleComponent = (ModuleComponent)applicationContext.getBean(beanName); - depends.add(moduleComponent); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java deleted file mode 100644 index 1b85cbec8d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionServiceImpl; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -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.util.Pair; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.1 patch to change the record inheritance of permissions. - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21RecordInheritancePatch extends RMv21PatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - /** file plan permission service */ - private FilePlanPermissionServiceImpl filePlanPermissionServiceImpl; - - /** node service */ - private NodeService nodeService; - - /** patch DAO */ - private PatchDAO patchDAO; - - /** qname DAO */ - private QNameDAO qnameDAO; - - /** node DAO */ - private NodeDAO nodeDAO; - - /** - * @param patchDAO patch DAO - */ - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - /** - * @param qnameDAO qname DAO - */ - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @param nodeDAO node DAO - */ - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - /** - * @param filePlanPermissionServiceImpl file plan permission service implementation - */ - public void setFilePlanPermissionServiceImpl(FilePlanPermissionServiceImpl filePlanPermissionServiceImpl) - { - this.filePlanPermissionServiceImpl = filePlanPermissionServiceImpl; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Pair aspectPair = qnameDAO.getQName(ASPECT_RECORD); - if (aspectPair != null) - { - List records = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID()); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + records.size() + " records"); - } - - for (Long record : records) - { - Pair recordPair = nodeDAO.getNodePair(record); - NodeRef recordNodeRef = recordPair.getSecond(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating record " + recordNodeRef.toString()); - - // get the primary parent - ChildAssociationRef assoc = nodeService.getPrimaryParent(recordNodeRef); - NodeRef parent = assoc.getParentRef(); - if (parent != null) - { - filePlanPermissionServiceImpl.setupPermissions(parent, recordNodeRef); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java deleted file mode 100644 index 10097ec55a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.content.MimetypeMap; -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.springframework.beans.factory.BeanNameAware; - -/** - * Report service patch, adding report structure in data dictionary and report templates. - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21ReportServicePatch extends RMv21PatchComponent - implements BeanNameAware -{ - private static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); - private static final NodeRef RM_CONFIG_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - private static final String PATH_DESTRUCTION_TEMPLATE = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl"; - - /** node service */ - private NodeService nodeService; - - /** content service */ - private ContentService contentService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected void executePatch() - { - // check whether report dir exists or not - if (nodeService.exists(RM_CONFIG_FOLDER) && !nodeService.exists(TEMPLATE_ROOT)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... adding template root folder"); - } - - NodeRef reportTemplates = createNode( - RM_CONFIG_FOLDER, - ContentModel.TYPE_FOLDER, - "rm_report_templates", - "Records Management Report Templates", - "rm_report_templates", - "Records Management Report Templates", - "Records Management Report Templates"); - nodeService.addAspect(reportTemplates, ContentModel.ASPECT_TITLED, null); - nodeService.addAspect(reportTemplates, ContentModel.ASPECT_AUTHOR, null); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... adding destruction report template"); - } - - // create report templates - NodeRef destructionTemplate = createNode( - TEMPLATE_ROOT, - ContentModel.TYPE_CONTENT, - "rmr_destructionReport", - "report_rmr_destructionReport.html.ftl", - "report_rmr_destructionReport.html.ftl", - "Destruction Report Template", - "Desruction report template."); - nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_TITLED, null); - nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_AUTHOR, null); - - // put the content - ContentWriter writer = contentService.getWriter(destructionTemplate, ContentModel.PROP_CONTENT, true); - InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_DESTRUCTION_TEMPLATE); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(is); - } - } - - private NodeRef createNode(NodeRef parent, QName type, String id, String name, String assocName, String title, String description) - { - Map props = new HashMap<>(4); - props.put(ContentModel.PROP_DESCRIPTION, description); - props.put(ContentModel.PROP_TITLE, title); - props.put(ContentModel.PROP_NAME, name); - props.put(ContentModel.PROP_NODE_UUID, id); - - // get the assoc qname - QName assocQName = QName.createQName( - NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(assocName)); - - // create the node - return nodeService.createNode( - parent, - ContentModel.ASSOC_CONTAINS, - assocQName, - type, - props).getChildRef(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java deleted file mode 100644 index 672c7cba95..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v21; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -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.role.Role; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Adds the existing rm roles to a new zone "APP.RM" - * - * @author Tuna Aksoy - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAware -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** authority service */ - private AuthorityService authorityService; - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch() - */ - @Override - protected void executePatch() - { - Set filePlans = filePlanService.getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - boolean parentAddedToZone = false; - Set roles = filePlanRoleService.getRoles(filePlan); - for (Role role : roles) - { - String roleGroupName = role.getRoleGroupName(); - if (!authorityService.getAuthorityZones(roleGroupName).contains(RMAuthority.ZONE_APP_RM)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + roleGroupName + " in file plan " + filePlan.toString()); - } - - addAuthorityToZone(roleGroupName); - if (!parentAddedToZone) - { - String allRolesGroupName = filePlanRoleService.getAllRolesContainerGroup(filePlan); - addAuthorityToZone(allRolesGroupName); - parentAddedToZone = true; - } - } - } - } - } - - private void addAuthorityToZone(String roleGroupName) - { - authorityService.addAuthorityToZones(roleGroupName, new HashSet<>(Arrays.asList(RMAuthority.ZONE_APP_RM))); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java deleted file mode 100644 index 47e094015d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -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.2 patch to updated modified capabilities. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class RMv22CapabilityPatch 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 capbilities - addCapability(filePlan, - "FileDestructionReport", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "CreateHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "AddToHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java deleted file mode 100644 index e9ad483f35..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.domain.qname.QNameDAO; - -/** - * DOD compliant site patch. - * - * Makes all existing sites of type dod:site to preserve their DOD compliance status. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22DODCompliantSitePatch extends AbstractModulePatch - implements RecordsManagementModel -{ - /** QName DAO */ - private QNameDAO qnameDAO; - - /** indicates whether we convert to a standard file plan or not */ - private boolean convertToStandardFilePlan = false; - - /** - * @param qnameDAO QName DAO - */ - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @param convertToStandardFilePlan convert to standard file if true, false otherwise - */ - public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan) - { - this.convertToStandardFilePlan = convertToStandardFilePlan; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (!convertToStandardFilePlan) - { - // ensure all existing sites are of the correct type - if (qnameDAO.getQName(RecordsManagementModel.TYPE_RM_SITE) != null && - qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_SITE) == null) - { - qnameDAO.updateQName(RecordsManagementModel.TYPE_RM_SITE, DOD5015Model.TYPE_DOD_5015_SITE); - } - - // ensure all the existing file plans are of the correct type - if (qnameDAO.getQName(RecordsManagementModel.TYPE_FILE_PLAN) != null && - qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_FILE_PLAN) == null) - { - qnameDAO.updateQName(RecordsManagementModel.TYPE_FILE_PLAN, DOD5015Model.TYPE_DOD_5015_FILE_PLAN); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java deleted file mode 100644 index b678b26a65..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; - -/** - * DOD model separation module patch implementation - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch - implements RecordsManagementModel -{ - /** query batch size */ - private static final long BATCH_SIZE = 100000L; - - /** indicates whether we convert to a standard file plan or not */ - private boolean convertToStandardFilePlan = false; - - /** Patch DAO */ - private PatchDAO patchDAO; - - /** Node DAO */ - private NodeDAO nodeDAO; - - /** qnames to update (switch to dod namespace) */ - private QName[] qnames = - { - DOD5015Model.PROP_ORIGINATOR, - DOD5015Model.PROP_ORIGINATING_ORGANIZATION, - DOD5015Model.PROP_PUBLICATION_DATE, - DOD5015Model.PROP_MEDIA_TYPE, - DOD5015Model.PROP_FORMAT, - DOD5015Model.PROP_DATE_RECEIVED, - DOD5015Model.PROP_ADDRESS, - DOD5015Model.PROP_OTHER_ADDRESS - }; - - /** - * @param convertToStandardFilePlan convert to standard file if true, false otherwise - */ - public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan) - { - this.convertToStandardFilePlan = convertToStandardFilePlan; - } - - /** - * @param patchDAO patch DAO - */ - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - /** - * @param nodeDAO node DAO - */ - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (!convertToStandardFilePlan) - { - Long maxNodeId = nodeDAO.getMaxNodeId(); - long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD)); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + recordCount + " records in batches of " + BATCH_SIZE); - } - - // apply the DOD record aspect to all exiting records - int completed = 0; - for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE) - { - final Long finali = i; - Integer batchCount = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - int batchCount = 0; - - public Integer execute() throws Throwable - { - nodeDAO.getNodesWithAspects(Collections.singleton(ASPECT_RECORD), finali, finali + BATCH_SIZE, new NodeDAO.NodeRefQueryCallback() - { - public boolean handle(Pair nodePair) - { - // get the records properties - Map properties = nodeDAO.getNodeProperties(nodePair.getFirst()); - boolean changed = false; - - for (QName qname : qnames) - { - // if the record has any of the moved properties - QName origional = QName.createQName(RecordsManagementModel.RM_URI, qname.getLocalName()); - if (properties.containsKey(origional)) - { - // move the property value - Serializable value = properties.get(origional); - properties.put(qname, value); - properties.remove(origional); - changed = true; - } - } - - // set properties and add aspect - if (changed) - { - nodeDAO.setNodeProperties(nodePair.getFirst(), properties); - } - nodeDAO.addNodeAspects(nodePair.getFirst(), Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD)); - batchCount ++; - - return true; - } - }); - - return batchCount; - } - } , false, true); - - if (batchCount != 0) - { - completed = completed + batchCount; - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... completed " + completed + " of " + recordCount); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java deleted file mode 100644 index f64b16ab5e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -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.2 patch to add FileHoldReport capability. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22FileHoldReportCapabilityPatch 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, - "FileHoldReport", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java deleted file mode 100644 index 5096b20ea9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -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.disposition.DispositionActionDefinition; -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.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -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; - -/** - * Sets the ghost on destroy property for existing destroy disposition actions - * to the value specified in the global properties file - * - * @author Mark Hibbins - * @since 2.2 - */ -public class RMv22GhostOnDestroyDispositionActionPatch extends AbstractModulePatch -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Node service */ - private NodeService nodeService; - - /** Ghost on destroy setting */ - private boolean ghostingEnabled; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param nodeService file plan service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param ghostingEnabled Ghost on destroy setting from - * alfresco-global.properties - */ - public void setGhostingEnabled(boolean ghostingEnabled) - { - this.ghostingEnabled = ghostingEnabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - Set filePlans = filePlanService.getFilePlans(); - for (NodeRef filePlan : filePlans) - { - processFilePlan(filePlan); - } - } - - /** - * Apply the patch to each file plan - * - * @param filePlan - */ - private void processFilePlan(NodeRef filePlan) - { - Set dispositionSchedules = new HashSet<>(); - getDispositionSchedules(filePlan, dispositionSchedules); - for (DispositionSchedule dispositionSchedule : dispositionSchedules) - { - processDispositionSchedule(dispositionSchedule); - } - } - - /** - * Add the disposition schedule associated with the node ref to the passed - * set of disposition schedule then call this method recursively for this - * node's children - * - * @param nodeRef - * @param dispositionSchedules - */ - private void getDispositionSchedules(NodeRef nodeRef, Set dispositionSchedules) - { - if (filePlanService.isRecordCategory(nodeRef)) - { - DispositionSchedule dispositionSchedule = this.dispositionService.getDispositionSchedule(nodeRef); - if (dispositionSchedule != null) - { - dispositionSchedules.add(dispositionSchedule); - } - - List children = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef childAssoc : children) - { - getDispositionSchedules(childAssoc.getChildRef(), dispositionSchedules); - } - } - } - - /** - * Patch the specified disposition schedule. To do this add the host on - * destroy to any action definition that doesn't already have it defined and - * set the value to the value set in the global properties file. Leave any - * action definitions that have this property already defined untouched. - * - * @param dispositionSchedule - */ - private void processDispositionSchedule(DispositionSchedule dispositionSchedule) - { - List actionDefinitions = dispositionSchedule.getDispositionActionDefinitions(); - for(DispositionActionDefinition actionDefinition : actionDefinitions) - { - String actionName = (String) nodeService.getProperty(actionDefinition.getNodeRef(), - RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME); - if ("destroy".equals(actionName)) - { - // we only want to add the ghost on destroy property to action - // definitions that do not already have it defined - String ghostOnDestroyValue = (String) nodeService.getProperty(actionDefinition.getNodeRef(), - RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY); - if (ghostOnDestroyValue == null) - { - Map props = new HashMap<>(1); - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, - this.ghostingEnabled ? "ghost" : "destroy"); - this.dispositionService.updateDispositionActionDefinition(actionDefinition, props); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java deleted file mode 100644 index 12a98123fd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -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.2 patch to update capabilities. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22HoldCapabilityPatch 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, - "DeleteHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "EditHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java deleted file mode 100644 index 9be081c6da..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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; - -/** - * Adds the hold report. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22HoldReportPatch extends AbstractModulePatch -{ - /** Report template path */ - private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl"; - - /** Report template config node IDs */ - private static final NodeRef REPORT_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); - private static final NodeRef REPORT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rmr_holdReport"); - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (!nodeService.exists(REPORT)) - { - // get the assoc qname - QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("report_rmr_holdReport.html.ftl")); - - // build the node properties - Map props = new HashMap<>(4); - props.put(ContentModel.PROP_DESCRIPTION, "Hold report template."); - props.put(ContentModel.PROP_TITLE, "Hold Report Template"); - props.put(ContentModel.PROP_NAME, "report_rmr_holdReport.html.ftl"); - props.put(ContentModel.PROP_NODE_UUID, "rmr_holdReport"); - - // create the node - ChildAssociationRef node = nodeService.createNode( - REPORT_FOLDER, - ContentModel.ASSOC_CONTAINS, - assocQName, - ContentModel.TYPE_CONTENT, - props); - - // put the content - ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - InputStream is = getClass().getClassLoader().getResourceAsStream(REPORT_TEMPLATE_PATH); - writer.putContent(is); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java deleted file mode 100644 index 803fa564dc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; - -/** - * Removes the in-place groups from the all roles group. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22RemoveInPlaceRolesFromAllPatch extends AbstractModulePatch -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** authority service */ - private AuthorityService authorityService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - // get all file plans - Set filePlans = filePlanService.getFilePlans(); - for (NodeRef filePlan : filePlans) - { - Role extendedReaders = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); - Role extendedWriters = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - - // remove extended readers and writers roles from the all roles group - String allRolesGroup = filePlanRoleService.getAllRolesContainerGroup(filePlan); - Set members = authorityService.getContainedAuthorities(null, allRolesGroup, true); - if (members.contains(extendedReaders.getRoleGroupName())) - { - authorityService.removeAuthority(allRolesGroup, extendedReaders.getRoleGroupName()); - } - if (members.contains(extendedWriters.getRoleGroupName())) - { - authorityService.removeAuthority(allRolesGroup, extendedWriters.getRoleGroupName()); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java deleted file mode 100644 index e7c0a3ec25..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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; - -/** - * Adds a new transfer/accession report template to the existing report templates - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class RMv22ReportTemplatePatch extends AbstractModulePatch -{ - /** Report template path */ - private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl"; - - /** Report template config node IDs */ - private static final String TRANSFER_REPORT = "rmr_transferReport"; - private static final String DESTRUCTION_REPORT = "rmr_destructionReport"; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - NodeRef transferReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TRANSFER_REPORT); - NodeRef destructionReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, DESTRUCTION_REPORT); - if (!nodeService.exists(transferReport) && nodeService.exists(destructionReport)) - { - NodeRef parent = nodeService.getPrimaryParent(destructionReport).getParentRef(); - - // get the assoc qname - QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("report_rmr_transferReport.html.ftl")); - - // build the node properties - Map props = new HashMap<>(4); - props.put(ContentModel.PROP_DESCRIPTION, "Transfer report template."); - props.put(ContentModel.PROP_TITLE, "Transfer Report Template"); - props.put(ContentModel.PROP_NAME, "report_rmr_transferReport.html.ftl"); - props.put(ContentModel.PROP_NODE_UUID, "rmr_transferReport"); - - // create the node - ChildAssociationRef node = nodeService.createNode(parent, - ContentModel.ASSOC_CONTAINS, - assocQName, - ContentModel.TYPE_CONTENT, - props); - - // put the content - ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); - InputStream is = getClass().getClassLoader().getResourceAsStream(REPORT_TEMPLATE_PATH); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(is); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java deleted file mode 100644 index 2d819c9389..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java deleted file mode 100644 index d089a9ea22..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23SavedSearchesPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23SavedSearchesPatch.java deleted file mode 100644 index 7b34c7e552..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23SavedSearchesPatch.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v23; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_SAVED_SEARCH; -import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME; - -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.site.SiteService; - -/** - * RM v2.3 patch that adds the saved search aspect. - * - * @author Ross Gale - * @since 2.3 - */ -public class RMv23SavedSearchesPatch extends AbstractModulePatch -{ - /** - * records management search service - */ - private RecordsManagementSearchService recordsManagementSearchService; - - /** - * node service - */ - private NodeService nodeService; - - /** - * Site service fundamental API. - */ - private SiteService siteService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Setter for siteService - * @param siteService Site service fundamental API. - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * Retrieves all saved searches for the records management site and adds ASPECT_SAVED_SEARCH - */ - @Override - public void applyInternal() - { - if(siteService.getSite(DEFAULT_SITE_NAME) != null) - { - for (SavedSearchDetails savedSearchDetails : recordsManagementSearchService.getSavedSearches(DEFAULT_SITE_NAME)) - { - if (nodeService.hasAspect(savedSearchDetails.getNodeRef(), ASPECT_SAVED_SEARCH)) - { - break; - } - nodeService.addAspect(savedSearchDetails.getNodeRef(), ASPECT_SAVED_SEARCH, null); - } - } - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java deleted file mode 100644 index 2c0302c28e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java deleted file mode 100644 index 0be4baee76..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v24; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.rule.RuleModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * RM v2.4 patch that ensures that file plan root containers do not inherited rules, because this is no longer enforced - * in the service code anymore. - * - * See https://issues.alfresco.com/jira/browse/RM-3154 - * - * @author Roy Wetherall - * @since 2.4 - */ -public class RMv24FilePlanContainerRuleInheritancePatch extends AbstractModulePatch -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** node service */ - private NodeService nodeService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - * - * Note that we do not break rule inheritance for the root file since this wasn't previously - * the behaviour and we don't want to prevent this from happening if the current installation - * has been setup to allow it. - */ - @Override - public void applyInternal() - { - // get all the file plans - Set filePlans = filePlanService.getFilePlans(); - for (NodeRef filePlan : filePlans) - { - // set rule inheritance for all root file plan containers - nodeService.addAspect(filePlanService.getUnfiledContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - nodeService.addAspect(filePlanService.getHoldContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - nodeService.addAspect(filePlanService.getTransferContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldChildAssocPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldChildAssocPatch.java deleted file mode 100644 index 9ce8c3135c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldChildAssocPatch.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.patch.v32; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_RECORDS; - -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.patch.AbstractModulePatch; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * Patch to replace any use of the hold child association rma:frozenRecords with rma:frozenContent - * - * See: https://issues.alfresco.com/jira/browse/RM-6992 - * - * - * @author Ross Gale - * @since 3.2 - */ -public class RMv32HoldChildAssocPatch extends AbstractModulePatch -{ - /** - * Data abstraction layer for QName and Namespace entities. - */ - private QNameDAO qnameDAO; - - /** - * File plan service interface - */ - private FilePlanService filePlanService; - - /** - * Hold service interface. - */ - private HoldService holdService; - - /** - * Interface for public and internal node and store operations. - */ - private NodeService nodeService; - - /** - * Setter for qnamedao - * @param qnameDAO Data abstraction layer for QName and Namespace entities. - */ - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * Setter for fileplanservice - * @param filePlanService File plan service interface - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Setter for hold service - * @param holdService Hold service interface. - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Setter for node service - * @param nodeService Interface for public and internal node and store operations. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - @SuppressWarnings ("deprecation") - @Override - public void applyInternal() - { - if(qnameDAO.getQName(ASSOC_FROZEN_RECORDS) != null) - { - qnameDAO.updateQName(ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_CONTENT); - for (NodeRef filePlan : filePlanService.getFilePlans()) - { - for (NodeRef hold : holdService.getHolds(filePlan)) - { - for (ChildAssociationRef ref : nodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_RECORDS)) - { - holdService.removeFromHold(hold, ref.getChildRef()); - holdService.addToHold(hold, ref.getChildRef()); - } - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldReportUpdatePatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldReportUpdatePatch.java deleted file mode 100644 index 6aacd16671..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldReportUpdatePatch.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v32; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.version.VersionModel; -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.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.cmr.version.VersionType; - -/** - * Patch to update the template for generating the hold report - * See: https://issues.alfresco.com/jira/browse/RM-7003 - * - * @author Ramona Popa - * @since 3.2 - */ -public class RMv32HoldReportUpdatePatch extends AbstractModulePatch -{ - /** - * Hold report template path - */ - private static final String HOLD_REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl"; - - /** - * Hold report template config node IDs - */ - private static final NodeRef HOLD_REPORT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rmr_holdReport"); - - /** - * Node service - */ - private NodeService nodeService; - - /** - * Content service - */ - private ContentService contentService; - - /** - * Version service - */ - private VersionService versionService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (nodeService.exists(HOLD_REPORT)) - { - - // Make sure the template is versionable - if (!nodeService.hasAspect(HOLD_REPORT, ContentModel.ASPECT_VERSIONABLE)) - { - nodeService.addAspect(HOLD_REPORT, ContentModel.ASPECT_VERSIONABLE, null); - - // Create version (before template is updated) - Map versionProperties = new HashMap<>(2); - versionProperties.put(Version.PROP_DESCRIPTION, "Template updated"); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionService.createVersion(HOLD_REPORT, versionProperties); - } - - // Update the content of the template - InputStream is = getClass().getClassLoader().getResourceAsStream(HOLD_REPORT_TEMPLATE_PATH); - ContentWriter writer = contentService.getWriter(HOLD_REPORT, ContentModel.PROP_CONTENT, true); - writer.putContent(is); - - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v33/RMv33HoldAuditEntryValuesPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v33/RMv33HoldAuditEntryValuesPatch.java deleted file mode 100644 index 3e69089adb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v33/RMv33HoldAuditEntryValuesPatch.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.patch.v33; - -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.repo.domain.propval.PropertyStringValueEntity; - -/** - * Patch to update values for addToHold and removeFromHold event types - *

- * See: https://issues.alfresco.com/jira/browse/RM-7098 - * - * @author Ramona Popa - * @since 3.3 - */ -public class RMv33HoldAuditEntryValuesPatch extends AbstractModulePatch -{ - - /** - * Services - */ - private RecordsManagementQueryDAO recordsManagementQueryDAO; - - public void setRecordsManagementQueryDAO(RecordsManagementQueryDAO recordsManagementQueryDAO) - { - this.recordsManagementQueryDAO = recordsManagementQueryDAO; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - * - * Updates the property string value entities for addToHold, removeFromHold and deleteHold audit event types - */ - @Override - public void applyInternal() - { - updatePropertyStringValueEntity("addToHold", "Add To Hold"); - updatePropertyStringValueEntity("removeFromHold", "Remove From Hold"); - updatePropertyStringValueEntity("deleteHold", "Delete Hold"); - } - - private void updatePropertyStringValueEntity(String fromStringValue, String toStringValue) - { - PropertyStringValueEntity propertyStringValueEntity = recordsManagementQueryDAO.getPropertyStringValueEntity(fromStringValue); - if (propertyStringValueEntity != null) - { - propertyStringValueEntity.setValue(toStringValue); - recordsManagementQueryDAO.updatePropertyStringValueEntity(propertyStringValueEntity); - } - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatch.java deleted file mode 100644 index c0bd756b56..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatch.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.patch.v35; - -import static org.alfresco.model.ContentModel.ASSOC_CONTAINS; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel.RM_CUSTOM_URI; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT; - -import java.util.List; - -import org.alfresco.model.ContentModel; -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.patch.AbstractModulePatch; -import org.alfresco.repo.policy.BehaviourFilter; -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; - -/** - * Patch to create new hold child association to link the record to the hold - *

- * See: https://alfresco.atlassian.net/browse/APPS-659 - * - * @since 3.5 - */ -public class RMv35HoldNewChildAssocPatch extends AbstractModulePatch -{ - /** A name for the associations created by this patch. */ - protected static final QName PATCH_ASSOC_NAME = QName.createQName(RM_CUSTOM_URI, RMv35HoldNewChildAssocPatch.class.getSimpleName()); - - /** - * File plan service interface - */ - private FilePlanService filePlanService; - - /** - * Hold service interface. - */ - private HoldService holdService; - - /** - * Interface for public and internal node and store operations. - */ - private NodeService nodeService; - - private BehaviourFilter behaviourFilter; - - /** - * Setter for fileplanservice - * - * @param filePlanService File plan service interface - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Setter for hold service - * - * @param holdService Hold service interface. - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Setter for node service - * - * @param nodeService Interface for public and internal node and store operations. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public BehaviourFilter getBehaviourFilter() - { - return behaviourFilter; - } - - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - @Override - public void applyInternal() - { - behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); - behaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - try - { - for (NodeRef filePlan : filePlanService.getFilePlans()) - { - for (NodeRef hold : holdService.getHolds(filePlan)) - { - List frozenAssoc = nodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef ref : frozenAssoc) - { - NodeRef childNodeRef = ref.getChildRef(); - // In testing we found that this was returning more than just "contains" associations. - // Possibly this is due to the code in Node2ServiceImpl.getParentAssocs not using the second parameter. - List parentAssocs = nodeService.getParentAssocs(childNodeRef, ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - boolean childContainedByHold = - parentAssocs.stream().anyMatch(entry -> entry.getParentRef().equals(hold) && entry.getTypeQName().equals(ASSOC_CONTAINS)); - if (!childContainedByHold) - { - nodeService.addChild(hold, childNodeRef, ASSOC_CONTAINS, PATCH_ASSOC_NAME); - } - } - } - } - } - finally - { - behaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); - behaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java deleted file mode 100644 index 9d4e7a26d0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.permission; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.repo.security.permissions.impl.model.PermissionModel; -import org.alfresco.repo.security.permissions.processor.impl.PermissionPostProcessorBaseImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * Records management permission post processor. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class RecordsManagementPermissionPostProcessor extends PermissionPostProcessorBaseImpl -{ - /** node service */ - private NodeService nodeService; - public void setNodeService(NodeService nodeService) {this.nodeService=nodeService;} - - /** permission service */ - private PermissionService permissionService; - public void setPermissionService(PermissionService permissionService) {this.permissionService=permissionService;} - - /** The permission model DAO. */ - private PermissionModel permissionModel; - public void setPermissionModel(PermissionModel permissionModel) {this.permissionModel=permissionModel;} - - /** - * @see org.alfresco.repo.security.permissions.processor.PermissionPostProcessor#process(AccessStatus, NodeRef, String, List, List) - */ - @Override - public AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm, - List configuredReadPermissions, List configuredFilePermissions) - { - AccessStatus result = accessStatus; - if (AccessStatus.DENIED.equals(accessStatus) && - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - // if read denied on rm artifact - if (PermissionService.READ.equals(perm) || isPermissionContained(perm, configuredReadPermissions)) - { - // check for read record - result = permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS); - } - // if write denied on rm artifact - else if (PermissionService.WRITE.equals(perm) || isPermissionContained(perm, configuredFilePermissions)) - { - // check for file record - result = permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS); - } - } - - return result; - - } - - /** - * Check if a given permission is implied by a list of permission groups. - * - * @param perm The name of the permission in question. - * @param configuredPermissions The list of permission group names. - * @return true if the permission is contained or implied by the list of permissions. - */ - private boolean isPermissionContained(String perm, List configuredPermissions) - { - // Check if the permission is explicitly in the list - if (configuredPermissions.contains(perm)) - { - return true; - } - // Check if the permission is implied by one from the list. - for (String configuredPermission : configuredPermissions) - { - // TODO: Here we are assuming the permission name is unique across all contexts (but I think we're doing that in the properties file anyway). - PermissionReference permissionReference = permissionModel.getPermissionReference(null, configuredPermission); - for (PermissionReference granteePermission : permissionModel.getGranteePermissions(permissionReference)) - { - if (granteePermission.getName().equals(perm)) - { - return true; - } - } - } - return false; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/NodeRefEntity.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/NodeRefEntity.java deleted file mode 100644 index 17c7b3d435..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/NodeRefEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.query; - -/** - * NodeRef Entity - used by {@link RecordsManagementQueryDAOImpl}. - * - * @author Tom Page - * @since 2.5.0.4 - */ -public class NodeRefEntity -{ - private Long num; - private String protocol; - private String identifier; - private String uuid; - - /** - * Default constructor. - */ - public NodeRefEntity() - { - } - - public Long getNum() - { - return num; - } - - public void setNum(Long num) - { - this.num = num; - } - - public String getProtocol() - { - return protocol; - } - - public void setProtocol(String protocol) - { - this.protocol = protocol; - } - - public String getIdentifier() - { - return identifier; - } - - public void setIdentifier(String identifier) - { - this.identifier = identifier; - } - - public String getUuid() - { - return uuid; - } - - public void setUuid(String uuid) - { - this.uuid = uuid; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/PropertyValuesOfChildrenQueryParams.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/PropertyValuesOfChildrenQueryParams.java deleted file mode 100644 index e797567c1f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/PropertyValuesOfChildrenQueryParams.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.query; - -/** - * Select parameter for select_GetStringPropertyValuesOfChildren. - * - * @author Ana Manolache - * @since 2.6 - */ -public class PropertyValuesOfChildrenQueryParams -{ - private Long parentId; - private Long propertyQnameId; - - public Long getParentId() - { - return parentId; - } - - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getPropertyQnameId() - { - return propertyQnameId; - } - - public void setPropertyQnameId(Long propertyQnameId) - { - this.propertyQnameId = propertyQnameId; - } - -} - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java deleted file mode 100644 index 8ed698960b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.query; - -import java.util.List; -import java.util.Set; - -import org.alfresco.repo.domain.propval.PropertyStringValueEntity; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - -/** - * Records management query DAO - * - * NOTE: a place holder that can be extended later when we want to enhance performance with canned queries. - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface RecordsManagementQueryDAO -{ - /** - * Get the number of objects with the given identifier value. - * - * Note: this is provided as an example and is not currently used - * - * @param identifierValue id value - * @return int count - */ - int getCountRmaIdentifier(String identifierValue); - - /** - * Returns a number of nodeRefs for record folders in the system - * that have the property recordSearchHasDispositionSchedule:true - * (used for MNT-20864) - * @param start long - the first result row to return - * @param end long - the last result row to return - * @return list of node refs - */ - List getRecordFoldersWithSchedules(Long start, Long end); - - /** - * Returns whether a given node contains children with one of the given values for the given property - * Returns distinct property values from children for the given property - * - * @param parent the parent to evaluate - * @param property the QName of the property to evaluate - * @return list of distinct property values - */ - public Set getChildrenStringPropertyValues(NodeRef parent, QName property); - - /** - * @param contentUrl the URL of the content url entity - * @return Set a set of nodes that reference the given content url - */ - Set getNodeRefsWhichReferenceContentUrl(String contentUrl); - - /** - * Get the property string value entity with the specified string value - * @return PropertyStringValueEntity the property string value entity with the specified string value - */ - PropertyStringValueEntity getPropertyStringValueEntity(String stringValue); - - /** - * Update the property string value entity - * @return int the number of rows updated - */ - int updatePropertyStringValueEntity(PropertyStringValueEntity propertyStringValueEntity); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java deleted file mode 100644 index 2207c8777c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.query; - - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.domain.contentdata.ContentUrlEntity; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.propval.PropertyStringValueEntity; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.repo.tenant.TenantService; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mybatis.spring.SqlSessionTemplate; - -/** - * Records management query DAO implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementQueryDAOImpl implements RecordsManagementQueryDAO, RecordsManagementModel -{ - /** - * logger - */ - @SuppressWarnings("unused") - private static final Log logger = LogFactory.getLog(RecordsManagementQueryDAOImpl.class); - - /** - * query names - */ - private static final String COUNT_IDENTIFIER = "alfresco.query.rm.select_CountRMIndentifier"; - private static final String GET_CHILDREN_PROPERTY_VALUES = "select_GetStringPropertyValuesOfChildren"; - private static final String SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL = "select_NodeIdsWhichReferenceContentUrl"; - private static final String SCHEDULED_FOLDERS = "alfresco.query.rm.select_RecordFoldersWithSchedules"; - private static final String SCHEDULED_FOLDERS_COUNT = "alfresco.query.rm.select_RecordFoldersWithSchedulesCount"; - private static final String GET_PROP_STRING_VALUE = "alfresco.query.rm.select_PropertyStringValue"; - private static final String UPDATE_PROP_STRING_VALUE = "alfresco.query.rm.update_PropertyStringValue"; - - /** - * SQL session template - */ - protected SqlSessionTemplate template; - - /** - * QName DAO - */ - protected QNameDAO qnameDAO; - protected NodeDAO nodeDAO; - protected TenantService tenantService; - - /** - * @param sqlSessionTemplate SQL session template - */ - public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) - { - this.template = sqlSessionTemplate; - } - - /** - * @param qnameDAO qname DAO - */ - public final void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setTenantService(TenantService tenantService) - { - this.tenantService = tenantService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO#getCountRmaIdentifier(java.lang.String) - */ - @Override - public int getCountRmaIdentifier(String identifierValue) - { - int result = 0; - - // lookup the id of the identifier property qname - Pair pair = qnameDAO.getQName(PROP_IDENTIFIER); - if (pair != null) - { - // create query params - Map params = new HashMap<>(2); - params.put("qnameId", pair.getFirst()); - params.put("idValue", identifierValue); - - // return the number of rma identifiers found that match the passed value - Integer count = (Integer) template.selectOne(COUNT_IDENTIFIER, params); - - if (count != null) - { - result = count; - } - } - - return result; - } - - @Override - public Set getChildrenStringPropertyValues(NodeRef parent, QName property) - { - PropertyValuesOfChildrenQueryParams queryParams = new PropertyValuesOfChildrenQueryParams(); - - // Set the parent node id - Pair nodePair = nodeDAO.getNodePair(tenantService.getName(parent)); - if (nodePair == null) - { - throw new InvalidNodeRefException("The parent node does not exist.", parent); - } - Long parentNodeId = nodePair.getFirst(); - queryParams.setParentId(parentNodeId); - - // Set the property qname id - Pair pair = qnameDAO.getQName(property); - if (pair == null) - { - return Collections.emptySet(); - } - queryParams.setPropertyQnameId(pair.getFirst()); - - // Perform the query - return new HashSet<>(template.selectList(GET_CHILDREN_PROPERTY_VALUES, queryParams)); - - } - - /** - * Get a set of node reference which reference the provided content URL - * - * @param String contentUrl content URL - * @return Set set of nodes that reference the provided content URL - */ - @Override - public Set getNodeRefsWhichReferenceContentUrl(String contentUrl) - { - if (logger.isDebugEnabled()) - { - logger.debug("Getting nodes that reference content URL = " + contentUrl); - } - - // create the content URL entity used to query for nodes - ContentUrlEntity contentUrlEntity = new ContentUrlEntity(); - contentUrlEntity.setContentUrl(contentUrl.toLowerCase()); - - if (logger.isDebugEnabled()) - { - logger.debug("Executing query " + SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL); - } - - // Get all the node ids which reference the given content url - List nodeIds = template.selectList(SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL, contentUrlEntity); - - if (logger.isDebugEnabled()) - { - logger.debug("Query " + SELECT_NODE_IDS_WHICH_REFERENCE_CONTENT_URL + " returned " + nodeIds.size() + " results"); - } - - // create a set of uuids which reference the content url - Set nodesReferencingContentUrl = new HashSet(nodeIds.size()); - for (Long nodeId : nodeIds) - { - StringBuilder logMessage = null; - NodeRef nodeRefToAdd; - - if (nodeId != null && nodeDAO.exists(nodeId)) - { - if (logger.isDebugEnabled()) - { - logMessage = new StringBuilder("Adding noderef "); - } - - // if the referencing node is a version2Store reference to the content url, add the version 2 frozen node ref - NodeRef version2FrozenNodeRef = (NodeRef) nodeDAO.getNodeProperty(nodeId, Version2Model.PROP_QNAME_FROZEN_NODE_REF); - if (version2FrozenNodeRef != null && nodeDAO.exists(version2FrozenNodeRef)) - { - nodeRefToAdd = version2FrozenNodeRef; - - if (logger.isDebugEnabled()) - { - logMessage.append(nodeRefToAdd) - .append(" (from version)"); - } - } - - // add the node ref of the referencing node - else - { - nodeRefToAdd = nodeDAO.getNodeIdStatus(nodeId) - .getNodeRef(); - if (logger.isDebugEnabled()) - { - logMessage.append(nodeRefToAdd); - } - } - - nodesReferencingContentUrl.add(nodeRefToAdd); - - if (logger.isDebugEnabled()) - { - logger.debug(logMessage.toString()); - } - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("Not adding " + nodeId + " (exist==false)"); - } - } - } - - return nodesReferencingContentUrl; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO#getRecordFoldersWithSchedules(Long, Long) - */ - @Override - public List getRecordFoldersWithSchedules(Long start, Long end) - { - Map params = new HashMap<>(2); - params.put("processed", qnameDAO.getQName(ASPECT_DISPOSITION_PROCESSED) - .getFirst()); - params.put("folderQnameId", qnameDAO.getQName(TYPE_RECORD_FOLDER) - .getFirst()); - params.put("start", start); - params.put("end", end); - - List entities = template.selectList(SCHEDULED_FOLDERS, params); - - List results = new ArrayList<>(); - - // convert the entities to NodeRefs - for (NodeRefEntity nodeRefEntity : entities) - { - results.add( - new NodeRef(nodeRefEntity.getProtocol(), nodeRefEntity.getIdentifier(), nodeRefEntity.getUuid())); - } - - return results; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO#getPropertyStringValueEntity(String stringValue) - */ - public PropertyStringValueEntity getPropertyStringValueEntity(String stringValue){ - - PropertyStringValueEntity propertyStringValueEntity = new PropertyStringValueEntity(); - propertyStringValueEntity.setValue(stringValue); - - return template.selectOne(GET_PROP_STRING_VALUE, propertyStringValueEntity); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO#updatePropertyStringValueEntity(PropertyStringValueEntity propertyStringValueEntity) - */ - public int updatePropertyStringValueEntity(PropertyStringValueEntity propertyStringValueEntity) - { - return template.update(UPDATE_PROP_STRING_VALUE, propertyStringValueEntity); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java deleted file mode 100644 index 54aa4b9063..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Inplace Record Service Interface. - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java deleted file mode 100644 index c48a22ff0e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import static org.alfresco.model.ContentModel.ASPECT_PENDING_DELETE; - -import java.util.List; - -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); - - if (originatingLocation != null) - { - 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.remove(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 - { - // Move the record - fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null); - - // Update the originating location property - nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef); - } - catch (FileExistsException | FileNotFoundException ex) - { - throw new AlfrescoRuntimeException("Can't move node: " + ex); - } - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java deleted file mode 100644 index f4e2d776a5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * Record creation exception class - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class RecordCreationException extends AlfrescoRuntimeException -{ - private static final long serialVersionUID = 1331453363788941681L; - - public RecordCreationException(String msgId, Throwable cause) - { - super(msgId, cause); - } - - public RecordCreationException(String msgId, Object[] msgParams, Throwable cause) - { - super(msgId, msgParams, cause); - } - - public RecordCreationException(String msgId, Object[] msgParams) - { - super(msgId, msgParams); - } - - public RecordCreationException(String msgId) - { - super(msgId); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java deleted file mode 100644 index 9b611d0628..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java deleted file mode 100644 index d591360bef..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import java.util.Map; - -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Record metadata bootstrap bean. - *

- * This method of bootstrapping record metadata aspects into the RecordService deprecates the - * previous practice of extending rma:recordMetaData. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordMetadataBootstrap -{ - /** record service */ - private RecordService recordService; - - /** namespace service */ - private NamespaceService namespaceService; - - /** map of record metadata aspects against file plan type */ - private Map recordMetadataAspects; - - /** - * @param recordMetadataAspects map of record metadata aspects against file plan types - */ - public void setRecordMetadataAspects(Map recordMetadataAspects) - { - this.recordMetadataAspects = recordMetadataAspects; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Init method - */ - public void init() - { - ParameterCheck.mandatory("recordService", recordService); - ParameterCheck.mandatory("namespaceService", namespaceService); - - if (recordMetadataAspects != null) - { - for (Map.Entry entry : recordMetadataAspects.entrySet()) - { - // convert to qname's - QName recordMetadataAspect = QName.createQName(entry.getKey(), namespaceService); - QName filePlanType = QName.createQName(entry.getValue(), namespaceService); - - // register with record service - recordService.registerRecordMetadataAspect(recordMetadataAspect, filePlanType); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMissingMetadataException.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMissingMetadataException.java deleted file mode 100644 index f77e347c2b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMissingMetadataException.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import java.io.Serializable; - -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * Record missing metadata exception class - * - * @author Sara Aspery - * @since 2.6 - */ -public class RecordMissingMetadataException extends AlfrescoRuntimeException -{ - private static final long serialVersionUID = 3437687270967611234L; - - public RecordMissingMetadataException(String msgId, Throwable cause) - { - super(msgId, cause); - } - - public RecordMissingMetadataException(String msgId, Object[] msgParams, Throwable cause) - { - super(msgId, msgParams, cause); - } - - public RecordMissingMetadataException(String msgId, Object[] msgParams) - { - super(msgId, msgParams); - } - - public RecordMissingMetadataException(String msgId) - { - super(msgId); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java deleted file mode 100644 index 5f13be8369..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Record Service Interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordService -{ - /** - * Register a record metadata aspect. - *

- * The file plan type indicates which file plan type the aspect applied to. Null indicates that - * the aspect applies to rma:filePlan. - *

- * A record metadata aspect can be registered more than once if it applies to more than one - * file plan type. - * - * @param recordMetadataAspect record metadata aspect qualified name - * @param filePlanType file plan type - * - * @since 2.2 - */ - void registerRecordMetadataAspect(QName recordMetadataAspect, QName filePlanType); - - /** - * 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 - * - * @since 2.2 - */ - void disablePropertyEditableCheck(NodeRef nodeRef); - - /** - * Enables the property editable check. By default this is always enabled. - */ - void enablePropertyEditableCheck(); - - /** - * Gets a list of all the record meta-data aspects - * - * @return {@link Set}<{@link QName}> list of record meta-data aspects - * - * @deprecated since 2.2, file plan component required to provide context - */ - @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 - * file plan component provided. - *

- * If a null context is provided all record meta-data aspects are returned, but this is not - * recommended. - * - * @param nodeRef node reference to file plan component providing context - * @return {@link Set}<{@link QName} > list of record meta-data aspects - * - * @since 2.2 - */ - Set getRecordMetadataAspects(NodeRef nodeRef); - - /** - * Gets a list of all the record metadata aspect that relate to the provided file plan type. - *

- * If null is provided for the file plan type then record metadata aspects for the default - * file plan type (rma:filePlan) are returned. - * - * @param filePlanType file plan type - * @return {@link Set} <{@link QName} > list of record meta-data aspects - * - * @since 2.2 - */ - Set getRecordMetadataAspects(QName filePlanType); - - /** - * Checks whether if the given node reference is a record or not - * - * @param nodeRef node reference to be checked - * @return boolean true if the node reference is a record, false otherwise - */ - boolean isRecord(NodeRef nodeRef); - - /** - * Indicates whether the record is declared - * - * @param nodeRef node reference of the record for which the check would be performed - * @return boolean true if record is declared, false otherwise - */ - boolean isDeclared(NodeRef nodeRef); - - /** - * Creates a new record from an existing node and files it into the specified location. - *

- * Note that the node reference of the record will be the same as the original - * document. - * - * @param filePlan The filePlan in which the record should be placed. filePlan can be null in this case the default RM site will be used. - * @param nodeRef The node from which the record will be created - * @param locationNodeRef The container in which the record will be created - * @param isLinked indicates if the newly created record is linked to it's original location or not. - */ - void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final NodeRef locationNodeRef, final boolean isLinked); - - /** - * Creates a new record from an existing node and files it into the specified location. - *

- * Note that the node reference of the record will be the same as the original - * document. - * - * @param filePlan The filePlan in which the record should be placed. filePlan can be null in this case the default RM site will be used. - * @param nodeRef The node from which the record will be created - * @param locationNodeRef The container in which the record will be created - */ - void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final NodeRef locationNodeRef); - - /** - * Creates a new unfiled record from an existing node. - *

- * Note that the node reference of the record will be the same as the original - * document. - * - * @param filePlan The filePlan in which the record should be placed. filePlan can be null in this case the default RM site will be used. - * @param nodeRef The node from which the record will be created - * @param isLinked indicates if the newly created record is linked to it's original location or not. - */ - void createRecord(NodeRef filePlan, NodeRef nodeRef, boolean isLinked); - - /** - * Links the newly created record to it's original location. - * - * @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 - * node reference otherwise the node reference will be used as the destination for the new record. - * - * @param parent parent node reference - * @param name name of the new record - * @param type content type, cm:content if null - * @param properties properties - * @param reader content reader - */ - NodeRef createRecordFromContent(NodeRef parent, String name, QName type, Map properties, ContentReader reader); - - /** - * Indicates whether the record is filed or not - * - * @param record nodeRef of record - * @return boolean true if filed, false otherwise - */ - boolean isFiled(NodeRef record); - - /** - * 'File' a new document that arrived in the file plan structure. - * - * @param record noderef of record - */ - void file(NodeRef record); - - /** - * Rejects a record with the provided reason - * - * @param nodeRef The record which will be rejected - * @param reason The reason for rejection - */ - void rejectRecord(NodeRef nodeRef, String reason); - - /** - * Indicates whether a property of a record is editable for the current user or not. - * - * @param record record - * @param property property - * @return boolean true if editable, false otherwise. - */ - boolean isPropertyEditable(NodeRef record, QName property); - - /** - * Indicates whether the given node (record or record folder) is a metadata stub or not. - * - * @param nodeRef node reference - * @return boolean true if a metadata stub, false otherwise - */ - boolean isMetadataStub(NodeRef nodeRef); - - /** - * Gets a list of all the records within a record folder - * - * @param recordFolder record folder - * @return List<NodeRef> list of records in the record folder - */ - List getRecords(NodeRef recordFolder); - - /** - * Adds the specified type to the record - * - * @param nodeRef Record node reference - * @param typeQName Type to add - */ - void addRecordType(NodeRef nodeRef, QName typeQName); - - /** - * Creates a record from the given document - * - * @param nodeRef The document node reference from which a record will be created - */ - void makeRecord(NodeRef nodeRef); - - /** - * Links a record to a record folder - * - * @param record the record to link - * @param recordFolder the record folder to link it to - */ - 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); - - /** - * Completes a record - * - * @param nodeRef Record node reference - */ - void complete(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java deleted file mode 100644 index 42a7c4e7ea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ /dev/null @@ -1,2211 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import static java.util.Arrays.asList; - -import static org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model.DOD_URI; -import static org.alfresco.module.org_alfresco_module_rm.record.RecordUtils.appendIdentifierToName; -import static org.alfresco.module.org_alfresco_module_rm.record.RecordUtils.generateRecordIdentifier; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.RMV_URI; -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.FIRST_EVENT; -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTION_COMMIT; -import static org.alfresco.repo.policy.annotation.BehaviourKind.ASSOCIATION; - -import java.io.Serializable; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -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.BeforeFileRecord; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRecordDeclaration; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRecordRejection; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRecordDeclaration; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRecordRejection; -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.freeze.FreezeService; -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.util.PoliciesUtil; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.content.ContentServicePolicies; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IncompleteNodeTagger; -import org.alfresco.repo.node.integrity.IntegrityException; -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; -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.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -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; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.RuleService; -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.Pair; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Record service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class RecordServiceImpl extends BaseBehaviourBean - implements RecordService, - RecordsManagementModel, - RecordsManagementCustomModel, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy, - ContentServicePolicies.OnContentUpdatePolicy -{ - /** Logger */ - private static final Logger LOGGER = LoggerFactory.getLogger(RecordServiceImpl.class); - - /** 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"); - - /** transation data key */ - private static final String KEY_IGNORE_ON_UPDATE = "ignoreOnUpdate"; - public static final String KEY_NEW_RECORDS = "newRecords"; - - /** 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"; - private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records"; - private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop"; - private static final String MSG_CANNOT_CREATE_CHILDREN_IN_CLOSED_RECORD_FOLDER = "rm.service.add-children-to-closed-record-folder"; - - /** Always edit property array */ - private static final QName[] ALWAYS_EDIT_PROPERTIES = new QName[] - { - ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA - }; - - /** always edit model URI's */ - private List alwaysEditURIs; - - /** - * check mandatory properties - */ - private boolean checkMandatoryPropertiesEnabled = true; - - /** - * @param alwaysEditURIs the alwaysEditURIs to set - */ - public void setAlwaysEditURIs(List alwaysEditURIs) - { - this.alwaysEditURIs = alwaysEditURIs; - } - - /** - * @return the alwaysEditURIs - */ - protected List getAlwaysEditURIs() - { - return this.alwaysEditURIs; - } - - /** record model URI's */ - private List recordModelURIs; - - /** - * @param recordModelURIs namespaces specific to records - */ - public void setRecordModelURIs(List recordModelURIs) - { - this.recordModelURIs = recordModelURIs; - } - - /** non-record model URI's */ - private static final String[] NON_RECORD_MODEL_URIS = new String[] - { - NamespaceService.AUDIO_MODEL_1_0_URI, - NamespaceService.CONTENT_MODEL_1_0_URI, - NamespaceService.EMAILSERVER_MODEL_URI, - NamespaceService.EXIF_MODEL_1_0_URI, - NamespaceService.FORUMS_MODEL_1_0_URI, - NamespaceService.LINKS_MODEL_1_0_URI, - NamespaceService.REPOSITORY_VIEW_1_0_URI - }; - - /** Indentity service */ - private IdentifierService identifierService; - - /** Extended permission service */ - private ExtendedPermissionService extendedPermissionService; - - /** Extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Ownable service */ - private OwnableService ownableService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Rule service */ - private RuleService ruleService; - - /** File folder service */ - private FileFolderService fileFolderService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** 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; - - public RecordableVersionService getRecordableVersionService() - { - return recordableVersionService; - } - - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** list of available record meta-data aspects and the file plan types the are applicable to */ - private Map> recordMetaDataAspects; - - /** Freeze service */ - private FreezeService freezeService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** policies */ - private ClassPolicyDelegate beforeFileRecord; - private ClassPolicyDelegate onFileRecord; - private ClassPolicyDelegate beforeRecordDeclarationDelegate; - private ClassPolicyDelegate onRecordDeclarationDelegate; - private ClassPolicyDelegate beforeRecordRejectionDelegate; - private ClassPolicyDelegate onRecordRejectionDelegate; - - private IncompleteNodeTagger incompleteNodeTagger; - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * @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 filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * @param ownableService ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param ruleService rule service - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - 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; - } - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - public void setIncompleteNodeTagger(IncompleteNodeTagger incompleteNodeTagger) - { - this.incompleteNodeTagger = incompleteNodeTagger; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param checkMandatoryPropertiesEnabled true if check mandatory properties is enabled, false otherwise - */ - public void setCheckMandatoryPropertiesEnabled(boolean checkMandatoryPropertiesEnabled) - { - this.checkMandatoryPropertiesEnabled = checkMandatoryPropertiesEnabled; - } - - /** - * Init method - */ - public void init() - { - // bind policies - beforeFileRecord = policyComponent.registerClassPolicy(BeforeFileRecord.class); - onFileRecord = policyComponent.registerClassPolicy(OnFileRecord.class); - beforeRecordDeclarationDelegate = policyComponent.registerClassPolicy(BeforeRecordDeclaration.class); - onRecordDeclarationDelegate = policyComponent.registerClassPolicy(OnRecordDeclaration.class); - beforeRecordRejectionDelegate = policyComponent.registerClassPolicy(BeforeRecordRejection.class); - onRecordRejectionDelegate = policyComponent.registerClassPolicy(OnRecordRejection.class); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:record", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(NodeRef nodeRef, QName aspect) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - generateRecordIdentifier(nodeService, identifierService, nodeRef); - reevaluateIncompleteTag(nodeRef); - } - return null; - } - }); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "sys:noContent" - ) - public void onRemoveAspect(NodeRef nodeRef, QName aspect) - { - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - if (ContentData.hasContent(contentData) && contentData.getSize() > 0) - { - appendIdentifierToName(nodeService, nodeRef); - reevaluateIncompleteTag(nodeRef); - } - } - } - - /** - * Behaviour executed when a new item is added to a record folder. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = ASSOCIATION, - type = "rma:recordFolder", - notificationFrequency = FIRST_EVENT - ) - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, final boolean bNew) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - try - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef) && - !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) && - !nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) && - !nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY)) - { - // 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); - // recalculate disposition schedule for the record when linking it - dispositionService.recalculateNextDispositionStep(nodeRef); - } - } - catch (RecordLinkRuntimeException e) - { - // rethrow exception - throw e; - } - catch (AlfrescoRuntimeException e) - { - // do nothing but log error - LOGGER.warn("Unable to file pending record.", e); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck() - */ - @Override - public void disablePropertyEditableCheck() - { - org.alfresco.repo.policy.Behaviour behaviour = getBehaviour("onUpdateProperties"); - if (behaviour != null) - { - getBehaviour("onUpdateProperties").disable(); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck(org.alfresco.service.cmr.repository.NodeRef) - */ - public void disablePropertyEditableCheck(NodeRef nodeRef) - { - Set ignoreOnUpdate = transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE); - ignoreOnUpdate.add(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#enablePropertyEditableCheck() - */ - @Override - public void enablePropertyEditableCheck() - { - org.alfresco.repo.policy.Behaviour behaviour = getBehaviour("onUpdateProperties"); - if (behaviour != null) - { - behaviour.enable(); - } - } - - /** - * Ensure that the user only updates record properties that they have permission to. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - name = "onUpdateProperties", - kind = BehaviourKind.CLASS, - type= "rma:record" - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - if (AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - nodeService.exists(nodeRef) && - isRecord(nodeRef) && - !transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE).contains(nodeRef)) - { - for (Map.Entry entry : after.entrySet()) - { - Serializable beforeValue = null; - QName property = entry.getKey(); - if (before != null) - { - beforeValue = before.get(property); - } - - Serializable afterValue = entry.getValue(); - boolean propertyUnchanged = false; - if (beforeValue instanceof Date && afterValue instanceof Date) - { - // deal with date values, remove the seconds and milliseconds for the - // comparison as they are removed from the submitted for data - Calendar beforeCal = Calendar.getInstance(); - beforeCal.setTime((Date)beforeValue); - Calendar afterCal = Calendar.getInstance(); - afterCal.setTime((Date)afterValue); - beforeCal.set(Calendar.SECOND, 0); - beforeCal.set(Calendar.MILLISECOND, 0); - afterCal.set(Calendar.SECOND, 0); - afterCal.set(Calendar.MILLISECOND, 0); - propertyUnchanged = (beforeCal.compareTo(afterCal) == 0); - } - else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue.equals(Boolean.FALSE))) - { - propertyUnchanged = true; - } - else - { - // otherwise - propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue); - } - - if (!propertyUnchanged && - !(ContentModel.PROP_CONTENT.equals(property) && beforeValue == null) && - !isPropertyEditable(nodeRef, property)) - { - // the user can't edit the record property - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to edit the record property " + property.toString() + - " on the node " + nodeRef.toString()); - } - } - } - } - - /** - * Get map containing record metadata aspects. - * - * @return {@link Map}<{@link QName}, {@link Set}<{@link QName} >> map containing record metadata aspects - * - * @since 2.2 - */ - protected Map> getRecordMetadataAspectsMap() - { - if (recordMetaDataAspects == null) - { - // create map - recordMetaDataAspects = new HashMap<>(); - - // init with legacy aspects - initRecordMetaDataMap(); - } - - return recordMetaDataAspects; - } - - /** - * Initialises the record meta-data map. - *

- * This is here to support backwards compatibility in case an existing - * customization (pre 2.2) is still using the record meta-data aspect. - * - * @since 2.2 - */ - private void initRecordMetaDataMap() - { - // populate the inital set of record meta-data aspects .. this is here for legacy reasons - Collection aspects = dictionaryService.getAllAspects(); - for (QName aspect : aspects) - { - AspectDefinition def = dictionaryService.getAspect(aspect); - if (def != null) - { - QName parent = def.getParentName(); - if (parent != null && ASPECT_RECORD_META_DATA.equals(parent)) - { - recordMetaDataAspects.put(aspect, Collections.singleton(TYPE_FILE_PLAN)); - } - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#registerRecordMetadataAspect(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName) - */ - @Override - public void registerRecordMetadataAspect(QName recordMetadataAspect, QName filePlanType) - { - ParameterCheck.mandatory("recordMetadataAspect", recordMetadataAspect); - ParameterCheck.mandatory("filePlanType", filePlanType); - - Set filePlanTypes = null; - - if (getRecordMetadataAspectsMap().containsKey(recordMetadataAspect)) - { - // get the current set of file plan types for this aspect - filePlanTypes = getRecordMetadataAspectsMap().get(recordMetadataAspect); - } - else - { - // create a new set for the file plan type - filePlanTypes = new HashSet<>(1); - getRecordMetadataAspectsMap().put(recordMetadataAspect, filePlanTypes); - } - - // add the file plan type - filePlanTypes.add(filePlanType); - } - - /** - * @deprecated since 2.2, file plan is required to provide context - */ - @Override - @Deprecated - public Set getRecordMetaDataAspects() - { - 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(NodeRef) - */ - @Override - public Set getRecordMetadataAspects(NodeRef nodeRef) - { - QName filePlanType = TYPE_FILE_PLAN; - - if (nodeRef != null) - { - NodeRef filePlan = getFilePlan(nodeRef); - filePlanType = nodeService.getType(filePlan); - } - - return getRecordMetadataAspects(filePlanType); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(org.alfresco.service.namespace.QName) - */ - @Override - public Set getRecordMetadataAspects(QName filePlanType) - { - Set result = new HashSet<>(getRecordMetadataAspectsMap().size()); - - for (Entry> entry : getRecordMetadataAspectsMap().entrySet()) - { - if (entry.getValue().contains(filePlanType)) - { - result.add(entry.getKey()); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void createRecord(NodeRef filePlan, NodeRef nodeRef) - { - createRecord(filePlan, nodeRef, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final boolean isLinked) - { - createRecord(filePlan, nodeRef, null, isLinked); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final NodeRef destinationNodeRef) - { - createRecord(filePlan, nodeRef, destinationNodeRef, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final NodeRef destinationNodeRef, final boolean isLinked) - { - // filePlan can be null. In this case the default RM site will be used. - // destinationNodeRef can be null. In this case the unfiled record container will be used - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("isLinked", isLinked); - - recordCreationSanityCheckOnNode(nodeRef); - final NodeRef newRecordContainer = recordCreationSanityCheckOnDestinationNode(destinationNodeRef, filePlan); - - invokeBeforeRecordDeclaration(nodeRef); - // do the work of creating the record as the system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - if (!nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - // disable delete rules - ruleService.disableRuleType("outbound"); - try - { - // get the documents readers and writers - Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); - - // get the current owner - String owner = ownableService.getOwner(nodeRef); - - // 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 - { - // move the document into the file plan - nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); - } - finally - { - behaviourFilter.enableBehaviour(); - } - - // save the information about the originating details - Map aspectProperties = new HashMap<>(3); - aspectProperties.put(PROP_RECORD_ORIGINATING_LOCATION, parentAssoc.getParentRef()); - aspectProperties.put(PROP_RECORD_ORIGINATING_USER_ID, owner); - aspectProperties.put(PROP_RECORD_ORIGINATING_CREATION_DATE, new Date()); - nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties); - - // make the document a record - makeRecord(nodeRef); - generateRecordIdentifier(nodeService, identifierService, 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 - ruleService.disableRules(); - try - { - // maintain the original primary location - nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName()); - - // set the extended security - extendedSecurityService.set(nodeRef, readersAndWriters); - } - finally - { - ruleService.enableRules(); - } - } - } - finally - { - ruleService.enableRuleType("outbound"); - } - } - - return null; - } - }); - invokeOnRecordDeclaration(nodeRef); - } - - /** - * Helper method to check the given file plan before trying to determine the unfiled records container. - * - * @param filePlan The reference of the file plan node - */ - private NodeRef recordCreationSanityCheckOnFilePlan(NodeRef filePlan) - { - NodeRef result = null; - - if (filePlan == null) - { - // TODO .. eventually make the file plan parameter required - - result = AuthenticationUtil.runAs(new 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 (result == null) - { - String msg = "Cannot create record, because the default file plan cannot be determined. Make sure at least one file plan has been created."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - } - else - { - // verify that the provided file plan is actually a file plan - if (!filePlanService.isFilePlan(filePlan)) - { - String msg = "Cannot create record, because the provided file plan node reference is not a file plan."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - - result = filePlan; - } - - return result; - } - - /** - * Helper method to check the given destination before trying to declare a record in it. - * - * @param destinationNodeRef The reference of the container in which the record will be created - * @param filePlan The reference of the file plan node - */ - private NodeRef recordCreationSanityCheckOnDestinationNode(NodeRef destinationNodeRef, final NodeRef filePlan) - { - final NodeRef checkedFilePlan = recordCreationSanityCheckOnFilePlan(filePlan); - NodeRef newRecordContainer = destinationNodeRef; - // if optional location not specified, use the unfiledContainer - if (newRecordContainer == null) - { - // get the unfiled record container node for the file plan - newRecordContainer = AuthenticationUtil.runAsSystem(() -> filePlanService.getUnfiledContainer(checkedFilePlan)); - - if (newRecordContainer == null) - { - throw new AlfrescoRuntimeException("Unable to create record, because record container could not be found."); - } - } - // if optional location supplied, check that it is a valid record folder, unfiled record container or folder - else - { - final QName nodeType = nodeService.getType(newRecordContainer); - if (!(nodeType.equals(RecordsManagementModel.TYPE_RECORD_FOLDER) || - nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER) || - nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER))) - { - throw new AlfrescoRuntimeException("Unable to create record, because container is not a valid type for new record."); - } - - Boolean isClosed = (Boolean) nodeService.getProperty(newRecordContainer, PROP_IS_CLOSED); - if (isClosed != null && isClosed) - { - throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_CREATE_CHILDREN_IN_CLOSED_RECORD_FOLDER), null); - } - - if (extendedPermissionService.hasPermission(newRecordContainer, RMPermissionModel.FILING) == AccessStatus.DENIED) - { - throw new AccessDeniedException(I18NUtil.getMessage("permissions.err_access_denied")); - } - - if (freezeService.isFrozen(newRecordContainer)) - { - throw new IntegrityException(I18NUtil.getMessage("rm.service.add-children-to-frozen-record-folder"),null); - } - } - - return newRecordContainer; - } - - /** - * Helper method to check the given node before trying to declare it as record - * - * @param nodeRef The reference of the node which will be declared as record - */ - private void recordCreationSanityCheckOnNode(NodeRef nodeRef) - { - // first we do a sanity check to ensure that the user has at least write permissions on the document - if (extendedPermissionService.hasPermission(nodeRef, PermissionService.WRITE) != AccessStatus.ALLOWED) - { - String msg = "Cannot create record from document, because the user " + - AuthenticationUtil.getRunAsUser() + - " does not have Write permissions on the doucment " + - nodeRef.toString(); - LOGGER.debug(msg); - throw new AccessDeniedException(msg); - } - - // do not create record if the node does not exist! - if (!nodeService.exists(nodeRef)) - { - String msg = "Cannot create record, because " + nodeRef.toString() + " does not exist."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - - // TODO eventually we should support other types .. either as record folders or as composite records - if (!dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT)) - { - String msg = "Cannot create record, because " + nodeRef.toString() + " is not a supported type."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - - // Do not create record if the node is already a record! - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - String msg = "Cannot create record, because " + nodeRef.toString() + " is already a record."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - - // We cannot create records from working copies - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY)) - { - String msg = "Can node create record, because " + nodeRef.toString() + " is a working copy."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - - // Cannot create a record from a previously rejected one - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS)) - { - String msg = "Cannot create record, because " + nodeRef.toString() + " has previously been rejected."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - - // can't declare the record if the node is sync'ed - if (nodeService.hasAspect(nodeRef, ASPECT_SYNCED)) - { - String msg = "Can't declare as record, because " + nodeRef.toString() + " is synched content."; - LOGGER.debug(msg); - throw new RecordCreationException(msg); - } - } - - /** - * @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 and writers - Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); - - // 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(); - } - - // if versionable, then remove without destroying version history, - // because it is being shared with the originating document - behaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - try - { - nodeService.removeAspect(record, ContentModel.ASPECT_VERSIONABLE); - } - finally - { - behaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - } - - // make record - makeRecord(record); - generateRecordIdentifier(nodeService, identifierService, 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(record, 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.set(record, readersAndWriters); - - 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; - - - recordableVersionService.createSnapshotVersion(nodeRef); - // 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 = recordableVersionService.getVersionRecord(previousVersion); - if (previousRecord != null) - { - versionRecord = previousRecord; - break; - } - } - } - - return versionRecord; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecordFromContent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map, org.alfresco.service.cmr.repository.ContentReader) - */ - @Override - public NodeRef createRecordFromContent(NodeRef parent, String name, QName type, Map properties, ContentReader reader) - { - ParameterCheck.mandatory("nodeRef", parent); - ParameterCheck.mandatory("name", name); - - NodeRef result = null; - NodeRef destination = parent; - - if (isFilePlan(parent)) - { - // get the unfiled record container for the file plan - destination = filePlanService.getUnfiledContainer(parent); - if (destination == null) - { - throw new AlfrescoRuntimeException("Unable to create record, because unfiled container could not be found."); - } - } - - // if none set the default record type is cm:content - if (type == null) - { - type = ContentModel.TYPE_CONTENT; - } - else if (!dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) - { - throw new AlfrescoRuntimeException("Record can only be created from a sub-type of cm:content."); - } - - disablePropertyEditableCheck(); - try - { - // create the new record - final NodeRef record = fileFolderService.create(destination, name, type).getNodeRef(); - - // set the properties - if (properties != null) - { - nodeService.addProperties(record, properties); - } - - // set the content - if (reader != null) - { - ContentWriter writer = fileFolderService.getWriter(record); - writer.setEncoding(reader.getEncoding()); - 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); - generateRecordIdentifier(nodeService, identifierService, record); - } - - return record; - } - - }); - } - finally - { - enablePropertyEditableCheck(); - } - - return result; - } - - /** - * Creates a record from the given document - * - * @param document the document from which a record will be created - */ - @Override - public void makeRecord(NodeRef document) - { - ParameterCheck.mandatory("document", document); - - ruleService.disableRules(); - disablePropertyEditableCheck(); - try - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - nodeService.addAspect(document, RecordsManagementModel.ASPECT_RECORD, null); - - // remove versionable aspect(s) - nodeService.removeAspect(document, RecordableVersionModel.ASPECT_VERSIONABLE); - - // remove the owner - ownableService.setOwner(document, OwnableService.NO_OWNER); - - return null; - } - }); - } - finally - { - ruleService.enableRules(); - enablePropertyEditableCheck(); - } - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isFiled(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isFiled(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean result = false; - - if (isRecord(nodeRef)) - { - result = AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Boolean doWork() throws Exception - { - return (null != nodeService.getProperty(nodeRef, PROP_DATE_FILED)); - } - }); - } - - return result; - } - - /** - * Helper method to 'file' a new document that arrived in the file plan structure. - * - * TODO atm we only 'file' content as a record .. may need to consider other types if we - * are to support the notion of composite records. - * - * @param record node reference to record (or soon to be record!) - */ - @Override - public void file(NodeRef record) - { - ParameterCheck.mandatory("item", record); - - // we only support filling of content items - // TODO composite record support needs to file containers too - QName type = nodeService.getType(record); - if (ContentModel.TYPE_CONTENT.equals(type) || - dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) - { - // fire before file record policy - beforeFileRecord.get(getTypeAndApsects(record)).beforeFileRecord(record); - - // check whether this item is already an item or not - if (!isRecord(record)) - { - // make the item a record - makeRecord(record); - } - - // set filed date - if (nodeService.getProperty(record, PROP_DATE_FILED) == null) - { - Calendar fileCalendar = Calendar.getInstance(); - nodeService.setProperty(record, PROP_DATE_FILED, fileCalendar.getTime()); - } - - // file on file record policy - onFileRecord.get(getTypeAndApsects(record)).onFileRecord(record); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void rejectRecord(final NodeRef nodeRef, final String reason) - { - ParameterCheck.mandatory("NodeRef", nodeRef); - ParameterCheck.mandatoryString("Reason", reason); - - // Save the id of the currently logged in user - final String userId = AuthenticationUtil.getFullyAuthenticatedUser(); - - // invoke policy - invokeBeforeRecordRejection(nodeRef); - - // do the work of rejecting the record as the system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - 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); - - // 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); - for (ChildAssociationRef childAssociationRef : parentAssocs) - { - if (!childAssociationRef.isPrimary() && - (childAssociationRef.getParentRef().equals(originatingLocation) || - nodeService.getType(childAssociationRef.getParentRef()).equals(TYPE_RECORD_FOLDER))) - { - nodeService.removeChildAssociation(childAssociationRef); - } - } - - removeRmAspectsFrom(nodeRef); - - // get the records primary parent association - final 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) - { - fileFolderService.rename(nodeRef, originalName); - - String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - LOGGER.debug("Rename {} to {}", name, originalName); - } - - // save the information about the rejection details - final 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); - nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties); - - // Restore the owner of the document - if (StringUtils.isBlank(documentOwner)) - { - throw new AlfrescoRuntimeException("Unable to find the creator of document."); - } - ownableService.setOwner(nodeRef, documentOwner); - - // clear the existing permissions - permissionService.clearPermission(nodeRef, null); - - // restore permission inheritance - permissionService.setInheritParentPermissions(nodeRef, true); - - // send an email to the record creator - notificationHelper.recordRejectedEmailNotification(nodeRef, recordId, documentOwner); - } - } - finally - { - ruleService.enableRules(); - } - - 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); - final List rmURIs = asList(RM_URI, DOD_URI, RM_CUSTOM_URI, RMV_URI); - for (QName aspect : aspects) - { - if (rmURIs.contains(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); - } - } - } - }); - - // invoke policy - invokeOnRecordRejection(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isPropertyEditable(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public boolean isPropertyEditable(NodeRef record, QName property) - { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("property", property); - - if (!isRecord(record)) - { - throw new AlfrescoRuntimeException("Cannot 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) - { - LOGGER.debug("Checking whether property " + property.toString() + " is editable for user " + AuthenticationUtil.getRunAsUser()); - - Set roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getRunAsUser()); - - LOGGER.debug(" ... users roles"); - - for (Role role : roles) - { - LOGGER.debug(" ... user has role " + role.getName() + " with capabilities "); - - for (Capability cap : role.getCapabilities()) - { - LOGGER.debug(" ... " + cap.getName()); - } - } - - LOGGER.debug(" ... user has the following set permissions on the file plan"); - - Set perms = permissionService.getAllSetPermissions(filePlan); - for (AccessPermission perm : perms) - { - 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"); - } - } - // END DEBUG ... - - boolean result = alwaysEditProperty(property); - if (result) - { - LOGGER.debug(" ... property marked as always editable."); - } - else - { - boolean allowRecordEdit = false; - boolean allowNonRecordEdit = false; - - AccessStatus accessNonRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_NON_RECORD_METADATA); - AccessStatus accessDeclaredRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); - AccessStatus accessRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_RECORD_METADATA); - - if (AccessStatus.ALLOWED.equals(accessNonRecord)) - { - LOGGER.debug(" ... user has edit nonrecord metadata capability"); - allowNonRecordEdit = true; - } - - if (AccessStatus.ALLOWED.equals(accessRecord) || - AccessStatus.ALLOWED.equals(accessDeclaredRecord)) - { - LOGGER.debug(" ... user has edit record or declared metadata capability"); - allowRecordEdit = true; - } - - if (allowNonRecordEdit && allowRecordEdit) - { - LOGGER.debug(" ... so all properties can be edited."); - result = true; - } - else if (allowNonRecordEdit && !allowRecordEdit) - { - // can only edit non record properties - if (!isRecordMetadata(filePlan, property)) - { - LOGGER.debug(" ... property is not considered record metadata so editable."); - result = true; - } - else - { - LOGGER.debug(" ... property is considered record metadata so not editable."); - } - } - else if (!allowNonRecordEdit && allowRecordEdit) - { - // can only edit record properties - if (isRecordMetadata(filePlan, property)) - { - LOGGER.debug(" ... property is considered record metadata so editable."); - result = true; - } - else - { - LOGGER.debug(" ... property is not considered record metadata so not editable."); - } - } - // otherwise we can't edit any properties so just return the empty set - } - return result; - } - - /** - * Helper method that indicates whether a property is considered record metadata or not. - * - * @param property property - * @return boolea true if record metadata, false otherwise - */ - private boolean isRecordMetadata(NodeRef filePlan, QName property) - { - boolean result = false; - - // grab the information about the properties parent type - ClassDefinition parent = null; - PropertyDefinition def = dictionaryService.getProperty(property); - if (def != null) - { - parent = def.getContainerClass(); - } - - // non-electronic record is considered a special case - // TODO move non-electronic record support to a separate model namespace - if (parent != null && TYPE_NON_ELECTRONIC_DOCUMENT.equals(parent.getName())) - { - result = false; - } - else - { - // check the URI's - result = recordModelURIs.contains(property.getNamespaceURI()); - - // check the custom model - if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS, property.getNamespaceURI())) - { - if (parent != null && parent.isAspect()) - { - result = getRecordMetadataAspects(filePlan).contains(parent.getName()); - } - } - } - - return result; - } - - /** - * Determines whether the property should always be allowed to be edited or not. - * - * @param property - * @return - */ - private boolean alwaysEditProperty(QName property) - { - return (getAlwaysEditURIs().contains(property.getNamespaceURI()) || - ArrayUtils.contains(ALWAYS_EDIT_PROPERTIES, property) || - isProtectedProperty(property)); - } - - /** - * Helper method to determine whether a property is protected at a dictionary definition - * level. - * - * @param property property qualified name - * @return booelan true if protected, false otherwise - */ - private boolean isProtectedProperty(QName property) - { - boolean result = false; - PropertyDefinition def = dictionaryService.getProperty(property); - if (def != null) - { - result = def.isProtected(); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isMetadataStub(NodeRef) - */ - @Override - public boolean isMetadataStub(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - return nodeService.hasAspect(nodeRef, ASPECT_GHOSTED); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecords(NodeRef) - */ - @Override - public List getRecords(NodeRef recordFolder) - { - ParameterCheck.mandatory("recordFolder", recordFolder); - - List result = new ArrayList<>(1); - if (recordFolderService.isRecordFolder(recordFolder)) - { - List assocs = nodeService.getChildAssocs(recordFolder, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - if (isRecord(child)) - { - result.add(child); - } - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#addRecordType(NodeRef, QName) - */ - @Override - public void addRecordType(NodeRef nodeRef, QName typeQName) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("typeQName", typeQName); - - if (!nodeService.hasAspect(nodeRef, typeQName)) - { - nodeService.addAspect(nodeRef, typeQName, null); - } - else - { - LOGGER.info(I18NUtil.getMessage(MSG_NODE_HAS_ASPECT, nodeRef.toString(), typeQName.toString())); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#link(NodeRef, NodeRef) - */ - @Override - public void link(NodeRef record, NodeRef recordFolder) - { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("recordFolder", recordFolder); - - // ensure we are linking a record to a record folder - if(isRecord(record) && isRecordFolder(recordFolder)) - { - // ensure that we are not linking a record to an existing location - List parents = nodeService.getParentAssocs(record); - for (ChildAssociationRef parent : parents) - { - if (parent.getParentRef().equals(recordFolder)) - { - // we cannot link a record to the same location more than once - throw new RecordLinkRuntimeException("Cannot 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)); - - // recalculate disposition schedule for the record when linking it - dispositionService.recalculateNextDispositionStep(record); - } - 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 - - // get the origin disposition schedule for the record, not the calculated one - DispositionSchedule recordDispositionSchedule = dispositionService.getOriginDispositionSchedule(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("Cannot link a record to a record folder with an incompatible retention schedule. " - + "They must either both be record level or record folder level retentions."); - } - } - } - } - - /** - * @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); - - // recalculate disposition schedule for record after unlinking it - dispositionService.recalculateNextDispositionStep(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.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:record", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onContentUpdate(NodeRef nodeRef, boolean newContent) - { - if (nodeService.exists(nodeRef) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE)) - { - generateRecordIdentifier(nodeService, identifierService, nodeRef); - reevaluateIncompleteTag(nodeRef); - } - } - - /** - * Invoke invokeBeforeRecordDeclaration policy - * - * @param nodeRef node reference - */ - protected void invokeBeforeRecordDeclaration(NodeRef nodeRef) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef); - // execute policy for node type and aspects - BeforeRecordDeclaration policy = beforeRecordDeclarationDelegate.get(qnames); - policy.beforeRecordDeclaration(nodeRef); - } - - /** - * Invoke invokeOnRecordDeclaration policy - * - * @param nodeRef node reference - */ - protected void invokeOnRecordDeclaration(NodeRef nodeRef) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef); - // execute policy for node type and aspects - OnRecordDeclaration policy = onRecordDeclarationDelegate.get(qnames); - policy.onRecordDeclaration(nodeRef); - } - - /** - * Invoke invokeBeforeRecordRejection policy - * - * @param nodeRef node reference - */ - protected void invokeBeforeRecordRejection(NodeRef nodeRef) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef); - // execute policy for node type and aspects - BeforeRecordRejection policy = beforeRecordRejectionDelegate.get(qnames); - policy.beforeRecordRejection(nodeRef); - } - - /** - * Invoke invokeOnRecordRejection policy - * - * @param nodeRef node reference - */ - protected void invokeOnRecordRejection(NodeRef nodeRef) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef); - // execute policy for node type and aspects - OnRecordRejection policy = onRecordRejectionDelegate.get(qnames); - policy.onRecordRejection(nodeRef); - } - - /** - * RM-5244 - workaround to make sure the incomplete aspect is removed - * - * @param nodeRef the node to reevaluate for - */ - private void reevaluateIncompleteTag(NodeRef nodeRef) - { - /* - * Check if the node has the aspect because the reevaluation is expensive. - * If the node doesn't have the aspect it means IncompleteNodeTagger didn't load before TransactionBehaviourQueue - * and we don't need to reevaluate. - */ - if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_INCOMPLETE)) - { - incompleteNodeTagger.beforeCommit(false); - } - } - - /** - * Completes a record - * - * @param nodeRef Record node reference - */ - @Override - public void complete(NodeRef nodeRef) - { - validateForCompletion(nodeRef); - 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()); - nodeService.addAspect(nodeRef, ASPECT_DECLARED_RECORD, declaredProps); - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // remove all owner related rights - ownableService.setOwner(nodeRef, OwnableService.NO_OWNER); - return null; - } - }); - } - finally - { - enablePropertyEditableCheck(); - } - } - - /** - * Helper method to validate whether the node is in a state suitable for completion - * - * @param nodeRef node reference - * @throws Exception if node not valid for completion - */ - private void validateForCompletion(NodeRef nodeRef) { - if (!nodeService.exists(nodeRef)) - { - LOGGER.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, nodeRef.toString())); - throw new IntegrityException("The record does not exist.", null); - } - - if (!isRecord(nodeRef)) - { - LOGGER.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, nodeRef.toString())); - throw new IntegrityException("The node is not a record.", null); - } - - if (freezeService.isFrozen(nodeRef)) - { - LOGGER.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, nodeRef.toString())); - throw new IntegrityException("The record is frozen.", null); - } - - if (isDeclared(nodeRef)) - { - throw new IntegrityException("The record is already completed.", null); - } - - // if the record is newly created make sure the record identifier is set before completing the record - Set newRecords = transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS); - if (newRecords.contains(nodeRef)) - { - generateRecordIdentifier(nodeService, identifierService, nodeRef); - } - - // Validate that all mandatory properties, if any, are present - List missingProperties = new ArrayList<>(5); - // Aspect not already defined - check mandatory properties then add - if (checkMandatoryPropertiesEnabled) - { - Map nodeRefProps = nodeService.getProperties(nodeRef); - QName nodeRefType = nodeService.getType(nodeRef); - - // check for missing mandatory metadata from type definitions - TypeDefinition typeDef = dictionaryService.getType(nodeRefType); - checkDefinitionMandatoryPropsSet(typeDef, nodeRefProps, missingProperties); - - // check for missing mandatory metadata from aspect definitions - Set aspects = nodeService.getAspects(nodeRef); - for (QName aspect : aspects) - { - AspectDefinition aspectDef = dictionaryService.getAspect(aspect); - checkDefinitionMandatoryPropsSet(aspectDef, nodeRefProps, missingProperties); - } - - // check for missing mandatory metadata from custom aspect definitions - QName customAspect = getCustomAspectImpl(nodeRefType); - AspectDefinition aspectDef = dictionaryService.getAspect(customAspect); - checkDefinitionMandatoryPropsSet(aspectDef, nodeRefProps, missingProperties); - - if (!missingProperties.isEmpty()) - { - LOGGER.debug(buildMissingPropertiesErrorString(missingProperties)); - throw new RecordMissingMetadataException("The record has missing mandatory properties."); - } - } - } - - /** - * Helper method to build single string containing list of missing properties - * - * @param missingProperties list of missing properties - * @return String of missing properties - */ - private String buildMissingPropertiesErrorString(List missingProperties) - { - StringBuilder builder = new StringBuilder(255); - builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP)); - builder.append(" "); - for (String missingProperty : missingProperties) - { - builder.append(missingProperty).append(", "); - } - return builder.toString(); - } - - /** - * Helper method to check whether all the definition mandatory properties of the node have been set - * - * @param classDef the ClassDefinition defining the properties to be checked - * @param nodeRefProps the properties of the node to be checked - * @param missingProperties the list of mandatory properties found to be missing (currently only the first one) - * @return boolean true if all mandatory properties are set, false otherwise - */ - private void checkDefinitionMandatoryPropsSet(final ClassDefinition classDef, final Map nodeRefProps, - final List missingProperties) - { - for (PropertyDefinition propDef : classDef.getProperties().values()) - { - if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) - { - if (LOGGER.isWarnEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Mandatory property missing: ").append(propDef.getName()); - LOGGER.warn(msg.toString()); - } - missingProperties.add(propDef.getName().toString()); - } - } - } - - /** - * Helper method to get the custom aspect for a given nodeRef type - * - * @param nodeRefType the node type for which to return custom aspect QName - * @return QName custom aspect - */ - private QName getCustomAspectImpl(QName nodeRefType) - { - QName aspect = ASPECT_RECORD; - if (nodeRefType.equals(TYPE_NON_ELECTRONIC_DOCUMENT)) - { - aspect = TYPE_NON_ELECTRONIC_DOCUMENT; - } - - // get customAspectImpl - String localName = aspect.toPrefixString(namespaceService).replace(":", ""); - localName = MessageFormat.format("{0}CustomProperties", localName); - return QName.createQName(RM_CUSTOM_URI, localName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordUtils.java deleted file mode 100644 index 2697f5b7db..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordUtils.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.record; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_IDENTIFIER; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_ORIGIONAL_NAME; -import static org.alfresco.module.org_alfresco_module_rm.record.RecordUtils.appendIdentifierToName; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Util class for records - * - * @author Tuna Aksoy - * @since 2.4 - */ -public class RecordUtils -{ - private RecordUtils() - { - // Will not be called - } - - /** - * Utility method that generates a record identifier and adds the new identifier to the record's name - * - * @param record the record to generate the identifier for - */ - public static void generateRecordIdentifier(NodeService nodeService, IdentifierService identifierService, NodeRef record) - { - if(nodeService.getProperty(record, PROP_IDENTIFIER) == null) - { - // get the record id - String recordId = identifierService.generateIdentifier(ASPECT_RECORD, - nodeService.getPrimaryParent(record).getParentRef()); - - // get the record name - String name = (String)nodeService.getProperty(record, ContentModel.PROP_NAME); - - // add the properties to the record - Map props = new HashMap<>(); - props.put(PROP_IDENTIFIER, recordId); - props.put(PROP_ORIGIONAL_NAME, name); - nodeService.addProperties(record, props); - } - - // append the identifier to the name even if it's been randomly generated or it was already set - appendIdentifierToName(nodeService, record); - } - - /** - * Appends the record identifier to the name of the record - * - * @param nodeRef The node reference of the record. - */ - public static void appendIdentifierToName(NodeService nodeService, NodeRef nodeRef) - { - mandatory("nodeService", nodeService); - mandatory("nodeRef", nodeRef); - - if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) - { - return; - } - - // get the record id - String recordId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER); - - if (isNotBlank(recordId)) - { - // get the record name - String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - - // skip this step if the record name already contains the identifier - if(name.contains(" (" + recordId + ")")) - { - return; - } - - // rename the record - int dotIndex = name.lastIndexOf('.'); - String prefix = name; - String postfix = ""; - if (dotIndex > 0) - { - prefix = name.substring(0, dotIndex); - postfix = name.substring(dotIndex); - } - String recordName = prefix + " (" + recordId + ")" + postfix; - - nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, recordName); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java deleted file mode 100644 index 25b4a4bf01..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.recordableversion; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; -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 - */ -@AlfrescoPublicApi -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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java deleted file mode 100644 index c36dff8ae6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.lang3.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java deleted file mode 100644 index 2ae9447d47..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.recordfolder; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Record folder service interface - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordFolderService -{ - /** - * Sets up the a record folder from a standard folder. - * - * @param nodeRef node reference of the folder to setup - * - * @since 2.2 - */ - void setupRecordFolder(NodeRef nodeRef); - - /** - * Indicates whether the given node is a record folder or not. - * - * @param nodeRef node reference - * @return boolean true if record folder, false otherwise - * - * @since 2.2 - */ - boolean isRecordFolder(NodeRef nodeRef); - - /** - * Indicates whether the contents of a record folder are all declared. - * - * @param nodeRef node reference (record folder) - * @return boolean true if record folder contents are declared, false otherwise - * - * @since 2.2 - */ - boolean isRecordFolderDeclared(NodeRef nodeRef); - - /** - * Indicates whether a record folder is closed or not. - * - * @param nodeRef node reference (record folder) - * @return boolean true if record folder is closed, false otherwise - * - * @since 2.2 - */ - boolean isRecordFolderClosed(NodeRef nodeRef); - - /** - * Create a record folder in the rm container. The record folder will take the name and type - * provided. - * - * @param rmContainer records management container - * @param name name - * @param type type - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type); - - /** - * Create a record folder in the rm container. The record folder will take the name, type and - * properties provided. - * - * @param rmContainer records management container - * @param name name - * @param type type - * @param properties properties - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties); - - /** - * Create a record folder in the rm container. The record folder will take the name provided. - * Type defaults to rm:recordFolder. - * - * @param rmContainer records management container - * @param name name - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name); - - /** - * Create a record folder in the rm container. The record folder will take the name and - * properties provided. Type defaults to rm:recordFolder. - * - * @param rmContainer records management container - * @param name name - * @param properties properties - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name, Map properties); - - /** - * Get all the record folders that a record is filed into. - * - * @param record the record node reference - * @return List list of folder record node references - * - * @since 2.2 - */ - // TODO rename to List getParentRecordFolders(NodeRef record); - List getRecordFolders(NodeRef record); - - // TODO NodeRef getRecordFolderByPath(String path); - - // TODO NodeRef getRecordFolderById(String id); - - // TODO NodeRef getRecordFolderByName(NodeRef parent, String name); - - // TODO void deleteRecordFolder(NodeRef recordFolder); - - // TODO List getParentRecordsManagementContainers(NodeRef container); // also applicable to record folders - - // TODO rename to getContainedRecords(NodeRef recordFolder); - - /** - * Closes the record folder. If the given node reference is a record the parent will be retrieved and processed. - * - * @param nodeRef the record folder node reference - * - * @since 2.2 - */ - void closeRecordFolder(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java deleted file mode 100644 index 23bd711288..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.recordfolder; - -import java.io.Serializable; -import java.util.ArrayList; -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.disposition.DispositionSchedule; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -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.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Record Folder Service Implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordFolderServiceImpl extends ServiceBaseImpl - implements RecordFolderService, - RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordFolderServiceImpl.class); - - /** I18N */ - private static final String MSG_RECORD_FOLDER_EXPECTED = "rm.service.record-folder-expected"; - private static final String MSG_PARENT_RECORD_FOLDER_ROOT = "rm.service.parent-record-folder-root"; - private static final String MSG_PARENT_RECORD_FOLDER_TYPE = "rm.service.parent-record-folder-type"; - private static final String MSG_RECORD_FOLDER_TYPE = "rm.service.record-folder-type"; - private static final String MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER = "rm.service.close-record-folder-not-folder"; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Record Service */ - private RecordService recordService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#setupRecordFolder(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupRecordFolder(NodeRef nodeRef) - { - // initialise disposition details - if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - DispositionSchedule di = dispositionService.getDispositionSchedule(nodeRef); - if (di != null && !di.isRecordLevelDisposition()) - { - nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#isRecordFolderDeclared(NodeRef) - */ - @Override - public boolean isRecordFolderDeclared(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Check we have a record folder - if (!isRecordFolder(nodeRef)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED)); - } - - boolean result = true; - - // Check that each record in the record folder in declared - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - if (!recordService.isDeclared(record)) - { - result = false; - break; - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#isRecordFolderClosed(NodeRef) - */ - @Override - public boolean isRecordFolderClosed(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Check we have a record folder - if (!isRecordFolder(nodeRef)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED)); - } - - return AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Boolean doWork() throws Exception - { - return ((Boolean) nodeService.getProperty(nodeRef, PROP_IS_CLOSED)); - } - }); - } - - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, - QName type) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatory("type", type); - - return createRecordFolder(rmContainer, name, type, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String, QName, Map) - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, - QName type, Map properties) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatory("type", type); - // "properties" is not mandatory - - // Check that we are not trying to create a record folder in a root container - if (filePlanService.isFilePlan(rmContainer)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_ROOT)); - } - - // Check that the parent is a container - QName parentType = nodeService.getType(rmContainer); - if (!TYPE_RECORD_CATEGORY.equals(parentType) && - !dictionaryService.isSubClass(parentType, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_TYPE, parentType.toString())); - } - - // Check that the the provided type is a sub-type of rm:recordFolder - if (!TYPE_RECORD_FOLDER.equals(type) && - !dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_TYPE, type.toString())); - } - - Map props = new HashMap<>(1); - if (properties != null && properties.size() != 0) - { - props.putAll(properties); - } - props.put(ContentModel.PROP_NAME, name); - - return nodeService.createNode( - rmContainer, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, (name.length() > QName.MAX_LENGTH ? name.substring(0, QName.MAX_LENGTH) : name)), - type, - props).getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String) - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - - // TODO defaults to rm:recordFolder, but in future could auto-detect sub-type of folder based on context - return createRecordFolder(rmContainer, name, TYPE_RECORD_FOLDER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String, Map) - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, - Map properties) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatory("properties", properties); - - return createRecordFolder(rmContainer, name, TYPE_RECORD_FOLDER, properties); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#getRecordFolders(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getRecordFolders(NodeRef record) - { - ParameterCheck.mandatory("record", record); - - List result = new ArrayList<>(1); - if (recordService.isRecord(record)) - { - List assocs = nodeService.getParentAssocs(record, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef parent = assoc.getParentRef(); - if (isRecordFolder(parent)) - { - result.add(parent); - } - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#closeRecordFolder(NodeRef) - */ - @Override - public void closeRecordFolder(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (isRecord(nodeRef)) - { - ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); - if (assocRef != null) - { - nodeRef = assocRef.getParentRef(); - } - } - - if (isRecordFolder(nodeRef)) - { - if (!isRecordFolderClosed(nodeRef)) - { - nodeService.setProperty(nodeRef, PROP_IS_CLOSED, true); - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER, nodeRef.toString())); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java deleted file mode 100644 index 1d9d4c4797..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Interface representing the relationship - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java deleted file mode 100644 index 8270dafbb7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Interface representing the relationship definition - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java deleted file mode 100644 index e043e747d0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java deleted file mode 100644 index fd0035a152..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * POJO representing the relationship display name - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java deleted file mode 100644 index 73ca580749..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import java.io.Serializable; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Relationship implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipImpl implements Relationship, Serializable -{ - /** serial UID */ - private static final long serialVersionUID = 9120649510198344978L; - - /** 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; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj instanceof Relationship) - { - RelationshipImpl that = (RelationshipImpl) obj; - return (this.uniqueName.equals(that.uniqueName) - && this.source.equals(that.source) - && this.target.equals(that.target)); - } - else - { - return false; - } - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - int prime = 31; - int result = prime + uniqueName.hashCode(); - result = (prime*result) + source.hashCode(); - return (prime*result) + target.hashCode(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java deleted file mode 100644 index 90ae88f064..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * The relationship service interface - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public interface RelationshipService -{ - /** System relationship names */ - static final String RELATIONSHIP_VERSIONS = "versions"; - - /** - * 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 come out from the given node reference - * that match the a given name filter. - *

- * Exact match only. - * - * @param nodeRef The node reference - * @param nameFilter Name filter for results - * @return All relationships that come out from the given node reference - * - * @since 2.3.1 - */ - Set getRelationshipsFrom(NodeRef nodeRef, String nameFilter); - - /** - * Gets all the relationships that go into the given node reference - * - * @param nodeRef The node reference - * @return All relationships that go into the given node reference - */ - Set getRelationshipsTo(NodeRef nodeRef); - - /** - * Gets all the relationships that go into the given node reference - * that match the a given name filter. - *

- * Exact match only. - * - * @param nodeRef The node reference - * @param nameFilter Name filter for results - * @return All relationships that go into the given node reference - * - * @since 2.3.1 - */ - Set getRelationshipsTo(NodeRef nodeRef, String nameFilter); - - /** - * 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java deleted file mode 100644 index 6d33b2f9f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java +++ /dev/null @@ -1,969 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.lang3.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#updateRelationshipDefinition(java.lang.String, RelationshipDisplayName) - */ - @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) - { - return getRelationshipsFrom(nodeRef, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef, String) - */ - @Override - public Set getRelationshipsFrom(NodeRef nodeRef, String nameFilter) - { - mandatory("nodeRef", nodeRef); - - Set relationships = new HashSet(); - - List customReferencesFrom = getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); - relationships.addAll(generateRelationshipFromAssociationRef(customReferencesFrom, nameFilter)); - - List customChildReferences = getNodeService().getChildAssocs(nodeRef); - relationships.addAll(generateRelationshipFromParentChildAssociationRef(customChildReferences, nameFilter)); - - 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) - { - return getRelationshipsTo(nodeRef, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef, String) - */ - @Override - public Set getRelationshipsTo(NodeRef nodeRef, String nameFilter) - { - mandatory("nodeRef", nodeRef); - - Set relationships = new HashSet(); - - List customReferencesTo = getNodeService().getSourceAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); - relationships.addAll(generateRelationshipFromAssociationRef(customReferencesTo, nameFilter)); - - List customParentReferences = getNodeService().getParentAssocs(nodeRef); - relationships.addAll(generateRelationshipFromParentChildAssociationRef(customParentReferences, nameFilter)); - - 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); - - // check the source node exists - if (!getNodeService().exists(source)) - { - throw new AlfrescoRuntimeException("Can't create relationship '" + uniqueName + "', because source node doesn't exist."); - } - - // check the target node exists - if (!getNodeService().exists(target)) - { - throw new AlfrescoRuntimeException("Can't create relationship " + uniqueName + ", because target node doesn't exist."); - } - - 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, String nameFilter) - { - Set relationships = new HashSet(); - - for (AssociationRef associationRef : associationRefs) - { - String uniqueName = associationRef.getTypeQName().getLocalName(); - if (existsRelationshipDefinition(uniqueName) && - (nameFilter == null || uniqueName.equals(nameFilter))) - { - 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, String nameFilter) - { - Set relationships = new HashSet(); - - for (ChildAssociationRef childAssociationRef : childAssociationRefs) - { - String uniqueName = childAssociationRef.getQName().getLocalName(); - if (existsRelationshipDefinition(uniqueName)&& - (nameFilter == null || uniqueName.equals(nameFilter))) - { - 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java deleted file mode 100644 index 13598a8db2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Enum representing the relationship types - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public enum RelationshipType -{ - BIDIRECTIONAL, - PARENTCHILD -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java deleted file mode 100644 index 170e1e906f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.namespace.QName; - -/** - * Report interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface Report -{ - /** - * @return {@link QName} report type - */ - QName getReportType(); - - /** - * @return {@link String} report name - */ - String getReportName(); - - /** - * @return {@link Map}<{@link QName},{@link Serializable}> report properties - */ - Map getReportProperties(); - - /** - * @return {@link ContentReader} content reader to report content - */ - ContentReader getReportContent(); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java deleted file mode 100644 index 17f0e29db6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Report generator interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ReportGenerator -{ - /** - * @return {@link QName} report type - */ - QName getReportType(); - - /** - * Generate report. - * - * @param reportedUponNodeRef - * @param mimetype - * @return - */ - Report generateReport(NodeRef reportedUponNodeRef, String mimetype); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java deleted file mode 100644 index 1e68806c6a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report; - -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing records management report qualified names - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface ReportModel -{ - /** Namespace details */ - String RMR_URI = "http://www.alfresco.org/model/recordsmanagementreport/1.0"; - String RMR_PREFIX = "rmr"; - - /** base report type */ - QName TYPE_REPORT = QName.createQName(RMR_URI, "report"); - - /** destruction report type */ - QName TYPE_DESTRUCTION_REPORT = QName.createQName(RMR_URI, "destructionReport"); - - /** transfer report type */ - QName TYPE_TRANSFER_REPORT = QName.createQName(RMR_URI, "transferReport"); - - /** - * hold report type - * @since 2.2 - */ - QName TYPE_HOLD_REPORT = QName.createQName(RMR_URI, "holdReport"); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java deleted file mode 100644 index d483126ab4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Report service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ReportService -{ - /** - * Register a report generator with the report service. - * - * @param reportGenerator report generator - */ - void registerReportGenerator(ReportGenerator reportGenerator); - - /** - * Get a list of the available report types. - * - * @return {@link Set}<{@link QName}> list of the available report types - */ - Set getReportTypes(); - - /** - * Generate a report of the given type and reported upon node reference. - * - * @param reportType report type - * @param reportedUponNodeRef reported upon node reference - * @return {@link Report} generated report - */ - Report generateReport(QName reportType, NodeRef reportedUponNodeRef); - - /** - * Generate a report for a specified mimetype. - * - * @see #generateReport(QName, NodeRef) - * - * @param reportType report type - * @param reportedUponNodeRef report upon node reference - * @param mimetype report mimetype - * @return {@link Report} generated report - */ - Report generateReport(QName reportType, NodeRef reportedUponNodeRef, String mimetype); - - /** - * File report in the given destination. If the given node reference is a file plan node - * reference the report will be filed in the unfiled records container. - * - * @param nodeRef node reference - * @param report report - * @return NodeRef node reference of the filed report - */ - NodeRef fileReport(NodeRef nodeRef, Report report); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java deleted file mode 100644 index 40f8ae377f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Report service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ReportServiceImpl extends ServiceBaseImpl - implements ReportService -{ - /** record service */ - protected RecordService recordService; - - /** report generator registry */ - private Map registry = new HashMap<>(); - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#registerReportGenerator(org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator) - */ - @Override - public void registerReportGenerator(ReportGenerator reportGenerator) - { - ParameterCheck.mandatory("reportGenerator", reportGenerator); - registry.put(reportGenerator.getReportType(), reportGenerator); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#getReportTypes() - */ - @Override - public Set getReportTypes() - { - return registry.keySet(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#generateReport(QName, NodeRef) - */ - @Override - public Report generateReport(QName reportType, NodeRef reportedUponNodeRef) - { - ParameterCheck.mandatory("reportType", reportType); - ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); - - return generateReport(reportType, reportedUponNodeRef, MimetypeMap.MIMETYPE_HTML); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#generateReport(QName, NodeRef, String) - */ - @Override - public Report generateReport(QName reportType, NodeRef reportedUponNodeRef, String mimetype) - { - ParameterCheck.mandatory("reportType", reportType); - ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); - ParameterCheck.mandatoryString("mimetype", mimetype); - - // get the generator - ReportGenerator generator = registry.get(reportType); - - // error is generator not found in registry - if (generator == null) - { - throw new AlfrescoRuntimeException("Unable to generate report, because report type " + reportType.toString() + " does not correspond to a registered report type."); - } - - // generate the report - return generator.generateReport(reportedUponNodeRef, mimetype); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#fileReport(NodeRef, org.alfresco.module.org_alfresco_module_rm.report.Report) - */ - @Override - public NodeRef fileReport(NodeRef nodeRef, Report report) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("report", report); - - return recordService.createRecordFromContent(nodeRef, - report.getReportName(), - report.getReportType(), - report.getReportProperties(), - report.getReportContent()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java deleted file mode 100644 index eedad52854..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report.generator; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator; -import org.alfresco.module.org_alfresco_module_rm.report.ReportService; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Base report generator. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class BaseReportGenerator implements ReportGenerator -{ - /** report service */ - protected ReportService reportService; - - /** namespace service */ - protected NamespaceService namespaceService; - - /** report type qualified name */ - protected QName reportType; - - /** - * @param reportService report service - */ - public void setReportService(ReportService reportService) - { - this.reportService = reportService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param reportType report type - */ - public void setReportType(QName reportType) - { - this.reportType = reportType; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#getReportType() - */ - @Override - public QName getReportType() - { - return reportType; - } - - /** - * Init method - */ - public void init() - { - // ensure required values have been set - ParameterCheck.mandatory("reportType", reportType); - - // register report generator - reportService.registerReportGenerator(this); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#generateReport(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Report generateReport(NodeRef reportedUponNodeRef, String mimetype) - { - ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); - ParameterCheck.mandatoryString("mimetype", mimetype); - - // check the applicability of the report generator for the given reported upon node - checkReportApplicability(reportedUponNodeRef); - - // generate the report name - String reportName = generateReportName(reportedUponNodeRef, mimetype); - - // generate the report meta-data - Map reportProperties = generateReportMetadata(reportedUponNodeRef); - - // generate the report content - ContentReader contentReader = generateReportContent(reportedUponNodeRef, mimetype, generateReportTemplateContext(reportedUponNodeRef)); - - // return the report information object - return new ReportInfo(reportType, reportName, reportProperties, contentReader); - } - - /** - * Checks whether the report generator is applicable given the reported upon node reference. - *

- * Throws AlfrescoRuntimeException if applicability fails, with reason. - * - * @param reportedUponNodeRef reported upon node reference - */ - protected abstract void checkReportApplicability(NodeRef reportedUponNodeRef); - - /** - * Generate the report name - */ - protected abstract String generateReportName(NodeRef reportedUponNodeRef, String mimetype); - - /** - * Generate the report template context. - */ - protected abstract Map generateReportTemplateContext(NodeRef reportedUponNodeRef); - - /** - * Generate report meta-data - */ - protected abstract Map generateReportMetadata(NodeRef reportedUponNodeRef); - - /** - * Generate report content - */ - protected abstract ContentReader generateReportContent(NodeRef reportedUponNodeRef, String mimetype, Map properties); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java deleted file mode 100644 index 81fea44292..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java +++ /dev/null @@ -1,377 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report.generator; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.admin.SysAdminParams; -import org.alfresco.repo.i18n.StaticMessageLookup; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.model.FileFolderService; -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.MimetypeService; -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.repository.TemplateService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.UrlUtil; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Declarative report generator. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DeclarativeReportGenerator extends BaseReportGenerator -{ - /** message lookups */ - protected static final String MSG_REPORT = "report.default"; - - /** template lookup root */ - protected static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); - - /** model keys */ - protected static final String KEY_NODE = "node"; - protected static final String KEY_CHILDREN = "children"; - - /** applicable reported upon types */ - protected Set applicableTypes; - - /** content service */ - protected ContentService contentService; - - /** mimetype service */ - protected MimetypeService mimetypeService; - - /** file folder service */ - protected FileFolderService fileFolderService; - - /** template service */ - protected TemplateService templateService; - - /** repository helper */ - protected Repository repository; - - /** node service */ - protected NodeService nodeService; - - /** dictionary service */ - protected DictionaryService dictionaryService; - - /** sys admin params */ - protected SysAdminParams sysAdminParams; - - /** - * @param applicableTypes applicable types - */ - public void setApplicableTypes(Set applicableTypes) - { - this.applicableTypes = applicableTypes; - } - - /** - * @param mimetypeService mimetype service - */ - public void setMimetypeService(MimetypeService mimetypeService) - { - this.mimetypeService = mimetypeService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param templateService template service - */ - public void setTemplateService(TemplateService templateService) - { - this.templateService = templateService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param repository repository helper - */ - public void setRepository(Repository repository) - { - this.repository = repository; - } - - /** - * @param sysAdminParams sys admin params - */ - public void setSysAdminParams(SysAdminParams sysAdminParams) - { - this.sysAdminParams = sysAdminParams; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef, String) - */ - @Override - protected String generateReportName(NodeRef reportedUponNodeRef, String mimetype) - { - // get the file extension based on the mimetype - String extension = mimetypeService.getExtension(mimetype); - - // get the name of the reported updon node ref - String name = (String)nodeService.getProperty(reportedUponNodeRef, ContentModel.PROP_NAME); - - // build default report name - StringBuilder builder = new StringBuilder(); - builder.append(getReportDisplayLabel()); - if (StringUtils.isNotBlank(name)) - { - builder.append(" - ").append(name); - } - builder.append(".").append(extension); - - return builder.toString(); - } - - /** - * Helper method to get the report types display label - * - * @return {@link String} report type display label - */ - private String getReportDisplayLabel() - { - String result = I18NUtil.getMessage(MSG_REPORT); - - TypeDefinition typeDef = dictionaryService.getType(reportType); - if (typeDef != null) - { - result = typeDef.getTitle(new StaticMessageLookup()); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportContent(NodeRef, String, Map) - */ - @Override - protected ContentReader generateReportContent(NodeRef reportedUponNodeRef, String mimetype, Map properties) - { - // get the template - NodeRef reportTemplateNodeRef = getReportTemplate(mimetype); - - // get the model - Map model = createTemplateModel(reportTemplateNodeRef, reportedUponNodeRef, properties); - - // run the template - String result = templateService.processTemplate("freemarker", reportTemplateNodeRef.toString(), model); - - // create the temp content - ContentWriter contentWriter = contentService.getTempWriter(); - contentWriter.setEncoding("UTF-8"); - contentWriter.setMimetype(mimetype); - contentWriter.putContent(result); - - // return the reader to the temp content - return contentWriter.getReader(); - } - - /** - * Create template model. - * - * @param templateNodeRef - * @param reportedUponNodeRef - * @param properties - * @return - */ - protected Map createTemplateModel(NodeRef templateNodeRef, NodeRef reportedUponNodeRef, Map properties) - { - Map model = new HashMap<>(); - - // build the default model - NodeRef person = repository.getPerson(); - templateService.buildDefaultModel(person, - repository.getCompanyHome(), - repository.getUserHome(person), - templateNodeRef, - null); - - // put the reported upon node reference in the model - model.put(KEY_NODE, reportedUponNodeRef); - - // context url's (handy for images and links) - model.put("url", UrlUtil.getAlfrescoUrl(sysAdminParams)); - model.put(TemplateService.KEY_SHARE_URL, UrlUtil.getShareUrl(sysAdminParams)); - - // who and when the report was generated - model.put("reportUser", AuthenticationUtil.getRunAsUser()); - Calendar now = Calendar.getInstance(I18NUtil.getContentLocale()); - model.put("reportDate", SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM).format(now.getTime())); - - // add additional properties - model.put("properties", (Serializable) properties); - - return model; - } - - /** - * Get's the report template based on the type and mimetype. - * - * @param mimetype - * @return - */ - private NodeRef getReportTemplate(String mimetype) - { - // check that the template root has been correctly bootstraped - if (!fileFolderService.exists(TEMPLATE_ROOT)) - { - throw new AlfrescoRuntimeException("Unable to get report template, because the template root folder does not exist in the data dictionary."); - } - - String reportTemplateName = getReportTemplateName(mimetype); - - NodeRef reportTemplateNodeRef = fileFolderService.searchSimple(TEMPLATE_ROOT, reportTemplateName); - if (reportTemplateNodeRef == null) - { - throw new AlfrescoRuntimeException("Unable to get report template, because report template " + reportTemplateName + " does not exist."); - } - - // get localise template - return fileFolderService.getLocalizedSibling(reportTemplateNodeRef); - } - - /** - * Gets the template name based on the type and mimetype. - * - * @param mimetype - * @return - */ - private String getReportTemplateName(String mimetype) - { - String typePrefixName = reportType.getPrefixedQName(namespaceService).getPrefixString().replace(":", "_"); - String extension = mimetypeService.getExtension(mimetype); - - StringBuilder sb = new StringBuilder(128) - .append("report_") - .append(typePrefixName) - .append(".") - .append(extension) - .append(".ftl"); - - return sb.toString(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#checkReportApplicability(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void checkReportApplicability(NodeRef reportedUponNodeRef) - { - if (applicableTypes != null && applicableTypes.size() != 0) - { - boolean isTypeApplicable = false; - QName type = nodeService.getType(reportedUponNodeRef); - - for (QName applicableType : applicableTypes) - { - if (dictionaryService.isSubClass(type, applicableType)) - { - isTypeApplicable = true; - break; - } - } - - if (!isTypeApplicable) - { - // throw an exception - throw new AlfrescoRuntimeException("Can't generate report, because the provided reported upon node reference is type " + type.toString() + - " which is not an applicable type for a " + reportType.toString() + " report."); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) - { - return Collections.EMPTY_MAP; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportMetadata(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - protected Map generateReportMetadata(NodeRef reportedUponNodeRef) - { - return Collections.EMPTY_MAP; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java deleted file mode 100644 index 6c7eca6013..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report.generator; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Report implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -/*package*/ class ReportInfo implements Report -{ - /** report type */ - private QName reportType; - - private String reportName; - - private Map reportProperties = new HashMap<>(21); - - /** content reader */ - private ContentReader reportContent; - - /** - * Default constructor. - * - * @param reportType report type - * @param reportName report name - * @param reportProperties report properties - * @param reportContent report content reader - */ - public ReportInfo(QName reportType, String reportName, Map reportProperties, ContentReader reportContent) - { - ParameterCheck.mandatory("reportType", reportType); - ParameterCheck.mandatory("reportName", reportName); - ParameterCheck.mandatory("reportContent", reportContent); - - this.reportType = reportType; - this.reportName = reportName; - this.reportProperties = reportProperties; - this.reportContent = reportContent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportType() - */ - public QName getReportType() - { - return reportType; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportName() - */ - @Override - public String getReportName() - { - return reportName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportProperties() - */ - @Override - public Map getReportProperties() - { - return reportProperties; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportContent() - */ - @Override - public ContentReader getReportContent() - { - return reportContent; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java deleted file mode 100644 index 3fce1ae288..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report.generator.transfer; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Transfer node class - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class TransferNode -{ - /** Transfer node reference */ - private NodeRef nodeRef; - - /** Transfer node properties */ - private Map properties; - - /** - * @param nodeRef - * @param properties - */ - public TransferNode(NodeRef nodeRef, Map properties) - { - this.nodeRef = nodeRef; - this.properties = properties; - } - - /** - * @return transfer node reference - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * @return transfer node properties - */ - public Map getProperties() - { - return this.properties; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java deleted file mode 100644 index dd790c7bd1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.report.generator.transfer; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGenerator; -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.apache.commons.lang3.StringUtils; - -/** - * Transfer report generator. - * - * @author Tuna Aksoy - * @author Roy Wetherall - * @since 2.2 - */ -public class TransferReportGenerator extends DeclarativeReportGenerator -{ - /** dispotion service */ - protected DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGenerator#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) - { - // Get all 'transferred' nodes - List transferNodes = getTransferNodes(reportedUponNodeRef); - - // Get the disposition authority - String dispositionAuthority = getDispositionAuthority(transferNodes); - - // Save to the properties map - Map properties = new HashMap<>(2); - properties.put("transferNodes", (ArrayList) transferNodes); - properties.put("dispositionAuthority", dispositionAuthority); - - return properties; - } - - /** - * Returns a list of transfer nodes - * - * @param nodeRef The transfer object - * @return Transfer node list - */ - private List getTransferNodes(NodeRef nodeRef) - { - List assocs = nodeService.getChildAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - List transferNodes = new ArrayList<>(assocs.size()); - for (ChildAssociationRef assoc : assocs) - { - NodeRef childRef = assoc.getChildRef(); - Map properties = getTransferNodeProperties(childRef); - transferNodes.add(new TransferNode(childRef, properties)); - } - return transferNodes; - } - - /** - * Helper method to get the properties of a transfer node - * - * @param childRef Node reference - * @return Transfer node properties - */ - private Map getTransferNodeProperties(NodeRef childRef) - { - Map transferNodeProperties = new HashMap<>(6); - - boolean isFolder = dictionaryService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER); - transferNodeProperties.put("isFolder", isFolder); - - if (isFolder) - { - Map folderProperties = getFolderProperties(childRef); - transferNodeProperties.putAll(folderProperties); - } - else - { - Map recordProperties = getRecordProperties(childRef); - transferNodeProperties.putAll(recordProperties); - } - - return transferNodeProperties; - } - - /** - * Helper method to get the list of records (with their properties) within a folder - * - * @param childRef Node reference of the folder - * @return List of records within the specified folder - */ - private List getRecords(NodeRef childRef) - { - List records = new ArrayList<>(4); - List assocs = nodeService.getChildAssocs(childRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - NodeRef record = child.getChildRef(); - if (nodeService.hasAspect(record, RecordsManagementModel.ASPECT_RECORD)) - { - Map recordProperties = getRecordProperties(record); - TransferNode transferNode = new TransferNode(record, recordProperties); - records.add(transferNode); - } - } - return records; - } - - /** - * Helper method to get the common transfer node properties - * - * @param nodeRef Node reference of the transfer node - * @return Map of the common transfer node properties - */ - private Map getCommonProperties(NodeRef nodeRef) - { - Map transferNodeProperties = new HashMap<>(3); - - Map properties = nodeService.getProperties(nodeRef); - String name = (String) properties.get(ContentModel.PROP_NAME); - String identifier = (String) properties.get(RecordsManagementModel.PROP_IDENTIFIER); - - transferNodeProperties.put("name", name); - transferNodeProperties.put("identifier", identifier); - - return transferNodeProperties; - } - - /** - * Helper method to get the folder specific properties - * - * @param folder Node reference of the folder - * @return Map of the folder specific properties - */ - private Map getFolderProperties(NodeRef folder) - { - Map transferNodeProperties = new HashMap<>(3); - - Map commonProperties = getCommonProperties(folder); - ArrayList records = (ArrayList) getRecords(folder); - transferNodeProperties.putAll(commonProperties); - transferNodeProperties.put("records", records); - - return transferNodeProperties; - } - - /** - * Helper method to get the record folder properties - * - * @param record Node reference of the record - * @return Map of the record specific properties - */ - private Map getRecordProperties(NodeRef record) - { - Map transferNodeProperties = new HashMap<>(5); - - Map properties = nodeService.getProperties(record); - String declaredBy = (String) properties.get(RecordsManagementModel.PROP_DECLARED_BY); - Date declaredOn = (Date) properties.get(RecordsManagementModel.PROP_DECLARED_AT); - boolean isDeclared = nodeService.hasAspect(record, RecordsManagementModel.ASPECT_DECLARED_RECORD); - - Map commonProperties = getCommonProperties(record); - transferNodeProperties.putAll(commonProperties); - transferNodeProperties.put("declaredBy", declaredBy); - transferNodeProperties.put("declaredOn", declaredOn); - transferNodeProperties.put("isDeclared", isDeclared); - - return transferNodeProperties; - } - - /** - * Gets the disposition authority from the list of the transfer nodes - * - * @param transferNodes The transfer nodes - * @return Disposition authority - */ - private String getDispositionAuthority(List transferNodes) - { - // use RMService to get disposition authority - String dispositionAuthority = null; - if (transferNodes.size() > 0) - { - // use the first transfer item to get to disposition schedule - NodeRef nodeRef = transferNodes.iterator().next().getNodeRef(); - DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); - if (ds != null) - { - dispositionAuthority = ds.getDispositionAuthority(); - } - } - return dispositionAuthority == null ? StringUtils.EMPTY : dispositionAuthority; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java deleted file mode 100644 index 0f9584b15c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.role; - -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Role service interface - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface FilePlanRoleService -{ - /** Default role names */ - String ROLE_USER = "User"; - String ROLE_POWER_USER = "PowerUser"; - String ROLE_SECURITY_OFFICER = "SecurityOfficer"; - String ROLE_RECORDS_MANAGER = "RecordsManager"; - String ROLE_ADMIN = "Administrator"; - String ROLE_EXTENDED_READERS = "ExtendedReaders"; - String ROLE_EXTENDED_WRITERS = "ExtendedWriters"; - - /** System roles */ - List SYSTEM_ROLES = Arrays.asList( - ROLE_EXTENDED_READERS, - ROLE_EXTENDED_WRITERS - ); - - /** - * Sets up the roles on a new file plan. - * - * @param filePlan file plan - */ - void setupFilePlanRoles(NodeRef filePlan); - - /** - * Tears down the roles on a file plan. - * - * @param filePlan file plan - */ - void tearDownFilePlanRoles(NodeRef filePlan); - - /** - * Returns the name of the container group for all roles of a specified file - * plan. - * - * @param filePlan file plan node reference - * @return String group name - */ - String getAllRolesContainerGroup(NodeRef filePlan); - - /** - * Get all the available roles for the given records management root node - * (includes also the system roles) - * - * @param filePlan file plan - * @return - */ - Set getRoles(NodeRef filePlan); - - /** - * Get all the available roles for the given records management root node. - * System roles can be filtered - * - * @param filePlan file plan - * @param includeSystemRoles system roles - * @return - */ - Set getRoles(NodeRef filePlan, boolean includeSystemRoles); - - /** - * Gets the roles for a given user - * (includes also the system roles) - * - * @param filePlan file plan - * @param user user - * @return - */ - Set getRolesByUser(NodeRef filePlan, String user); - - /** - * Gets the roles for a given user. - * System roles can be filtered - * - * @param filePlan file plan - * @param user user - * @param includeSystemRoles system roles - * @return - */ - Set getRolesByUser(NodeRef filePlan, String user, boolean includeSystemRoles); - - /** - * Get a role by name - * - * @param filePlan file plan - * @param role role - * @return - */ - Role getRole(NodeRef filePlan, String role); - - /** - * Indicate whether a role exists for a given records management root node - * @param filePlan file plan - * @param role role - * @return - */ - boolean existsRole(NodeRef filePlan, String role); - - /** - * Determines whether the given user has the RM Admin role - * - * @param filePlan filePlan - * @param user user name to check - * @return true if the user has the RM Admin role, false otherwise - */ - boolean hasRMAdminRole(NodeRef filePlan, String user); - - /** - * Create a new role - * - * @param filePlan file plan - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - */ - Role createRole(NodeRef filePlan, String role, String roleDisplayLabel, Set capabilities); - - /** - * Update an existing role - * - * @param filePlan file plan - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - */ - Role updateRole(NodeRef filePlan, String role, String roleDisplayLabel, Set capabilities); - - /** - * Delete a role - * - * @param filePlan file plan - * @param role role - */ - void deleteRole(NodeRef filePlan, String role); - - /** - * Gets all the users that have been directly assigned to a role. - * - * @param filePlan file plan - * @param role role - * @return {@link Set}<{@link String}> set of users - */ - Set getUsersAssignedToRole(NodeRef filePlan, String role); - - /** - * Gets all the groups that have been directly assigned to a role. - * - * @param filePlan file plan - * @param role role - * @return {@link Set}<{@link String}> set of groups - */ - Set getGroupsAssignedToRole(NodeRef filePlan, String role); - - /** - * Gets all the groups and users that have been directly assigned to a role. - * - * @param filePlan file plan - * @param role role - * @return {@link Set}<{@link String}> set of groups and users - */ - Set getAllAssignedToRole(NodeRef filePlan, String role); - - /** - * Assign a role to an authority - * - * @param filePlan file plan - * @param role role - * @param authorityName authority name - */ - void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName); - - - /** - * Unassign a role from an authority - * - * @param filePlan file plan - * @param role role - * @param authorityName authority name - */ - void unassignRoleFromAuthority(NodeRef filePlan, String role, String authorityName); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java deleted file mode 100644 index fda1cc84c1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java +++ /dev/null @@ -1,854 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.role; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent; -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.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.FileUtils; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; -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.security.AccessPermission; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Role service implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanRoleServiceImpl implements FilePlanRoleService, - RecordsManagementModel -{ - /** Logger for the class. */ - private static final Logger LOGGER = LoggerFactory.getLogger(FilePlanRoleServiceImpl.class); - /** I18N */ - private static final String MSG_ALL_ROLES = "rm.role.all"; - - /** 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"; - private static final String JSON_IS_ADMIN = "isAdmin"; - private static final String JSON_CAPABILITIES = "capabilities"; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Authority service */ - private AuthorityService authorityService; - - /** Permission service */ - private PermissionService permissionService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Node service */ - private NodeService nodeService; - - private BootstrapImporterModuleComponent bootstrapImporterModule; - - /** Records management role zone */ - public static final String RM_ROLE_ZONE_PREFIX = "rmRoleZone"; - - /** Records Management Config Node */ - private static final String CONFIG_NODEID = "rm_config_folder"; - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @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 bootstrapImporterModuleComponent - */ - public void setBootstrapImporterModuleComponent(BootstrapImporterModuleComponent bootstrapImporterModuleComponent) - { - this.bootstrapImporterModule = bootstrapImporterModuleComponent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#setupFilePlanRoles(NodeRef) - */ - @Override - public void setupFilePlanRoles(final NodeRef filePlan) - { - // Do not execute behaviour if this has been created in the archive store - if(filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) - { - // This is not the spaces store - probably the archive store - return; - } - - if (nodeService.exists(filePlan)) - { - List systemContainers = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork>() - { - public List doWork() - { - List systemContainers = new ArrayList<>(3); - - //In a multi tenant store we need to initialize the rm config if it has been done yet - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); - if (!nodeService.exists(nodeRef)) - { - bootstrapImporterModule.execute(); - } - - // Create "all" role group for root node - String allRoles = authorityService.createAuthority( - AuthorityType.GROUP, - getAllRolesGroupShortName(filePlan), - I18NUtil.getMessage(MSG_ALL_ROLES), - new HashSet<>(Arrays.asList(RMAuthority.ZONE_APP_RM))); - - // Set the permissions - permissionService.setInheritParentPermissions(filePlan, false); - permissionService.setPermission(filePlan, allRoles, RMPermissionModel.READ_RECORDS, true); - - // Create the transfer and hold containers - systemContainers.add(filePlanService.createHoldContainer(filePlan)); - systemContainers.add(filePlanService.createTransferContainer(filePlan)); - - // Create the unfiled record container - systemContainers.add(filePlanService.createUnfiledContainer(filePlan)); - - return systemContainers; - } - }); - - // Bootstrap in the default set of roles for the newly created root node - bootstrapDefaultRoles(filePlan, systemContainers); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#tearDownFilePlanRoles(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void tearDownFilePlanRoles(final NodeRef filePlan) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // cascade delete the 'all' roles group for the site - String allRolesGroup = authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); - Set groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, allRolesGroup, true); - for (String group : groups) - { - authorityService.deleteAuthority(group); - } - - authorityService.deleteAuthority(allRolesGroup, false); - - return null; - } - }); - } - - /** - * Get all the roles by short name - * - * @param rmRootNode - * @return - */ - private String getAllRolesGroupShortName(NodeRef rmRootNode) - { - return RMAuthority.ALL_ROLES_PREFIX + rmRootNode.getId(); - } - - /** - * Bootstraps the default roles - * - * @param filePlan file plan - * @param systemContainers system containers - */ - private void bootstrapDefaultRoles(final NodeRef filePlan, final List systemContainers) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - try - { - JSONArray array = null; - try - { - // Load up the default roles from JSON - InputStream is = getClass().getClassLoader().getResourceAsStream(BOOTSTRAP_ROLE_JSON_LOCATION); - if (is == null) - { - throw new AlfrescoRuntimeException("Could not load default bootstrap roles configuration"); - } - array = new JSONArray(FileUtils.convertStreamToString(is)); - } - catch (IOException ioe) - { - throw new AlfrescoRuntimeException("Unable to load rm-default-roles-bootstrap.json configuration file.", ioe); - } - - // Add each role to the rm root node - for (int i = 0; i < array.length(); i++) - { - JSONObject object = array.getJSONObject(i); - - // Get the name of the role - String name = null; - if (object.has(JSON_NAME)) - { - name = object.getString(JSON_NAME); - if (existsRole(filePlan, name)) - { - throw new AlfrescoRuntimeException("The bootstrap role " + name + " already exists on the rm root node " + filePlan.toString()); - } - } - else - { - throw new AlfrescoRuntimeException("No name given to default bootstrap role. Check json configuration file."); - } - - - // Get the role's display label - String displayLabel = name; - if (object.has(JSON_DISPLAY_LABEL)) - { - displayLabel = object.getString(JSON_DISPLAY_LABEL); - } - - // Determine whether the role is an admin role or not - boolean isAdmin = false; - if (object.has(JSON_IS_ADMIN)) - { - isAdmin = object.getBoolean(JSON_IS_ADMIN); - } - - // Get the roles capabilities - Set capabilities = new HashSet<>(30); - if (object.has(JSON_CAPABILITIES)) - { - JSONArray arrCaps = object.getJSONArray(JSON_CAPABILITIES); - for (int index = 0; index < arrCaps.length(); index++) - { - String capName = arrCaps.getString(index); - Capability capability = capabilityService.getCapability(capName); - if (capability == null) - { - throw new AlfrescoRuntimeException("The capability '" + capName + "' configured for the deafult boostrap role '" + name + "' is invalid."); - } - capabilities.add(capability); - } - } - - // Create the role - Role role = createRole(filePlan, name, displayLabel, capabilities); - - // Add any additional admin permissions - if (isAdmin) - { - // Admin has filing - permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true); - if (systemContainers != null) - { - for (NodeRef systemContainer : systemContainers) - { - permissionService.setPermission(systemContainer, role.getRoleGroupName(), RMPermissionModel.FILING, true); - } - } - - // Add the creating user to the administration group - String user = AuthenticationUtil.getFullyAuthenticatedUser(); - authorityService.addAuthority(role.getRoleGroupName(), user); - - if (!AuthenticationUtil.getAdminUserName().equals(user)) - { - // add the dynamic admin authority - authorityService.addAuthority(role.getRoleGroupName(), AuthenticationUtil.getAdminUserName()); - } - } - } - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Error loading json configuration file rm-default-roles-bootstrap.json", exception); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Helper method to check whether the current authority is a system role or not - * - * @param roleAuthority The role to check - * @return Returns true if roleAuthority is a system role, false otherwise - */ - private boolean isSystemRole(String roleAuthority) - { - boolean isSystemRole = false; - - for (String systemRole : SYSTEM_ROLES) - { - if (StringUtils.contains(roleAuthority, systemRole)) - { - isSystemRole = true; - break; - } - } - - return isSystemRole; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRoles(NodeRef) - */ - public Set getRoles(final NodeRef rmRootNode) - { - return getRoles(rmRootNode, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRoles(NodeRef, boolean) - */ - @Override - public Set getRoles(final NodeRef rmRootNode, final boolean includeSystemRoles) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Set result = new HashSet<>(13); - - Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); - for (String roleAuthority : roleAuthorities) - { - if (includeSystemRoles || !isSystemRole(roleAuthority)) - { - String groupShortName = authorityService.getShortName(roleAuthority); - String name = getShortRoleName(groupShortName, rmRootNode); - String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); - String translated = I18NUtil.getMessage(displayLabel); - if (translated != null) - { - displayLabel = translated; - } - Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); - - Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); - result.add(role); - } - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRolesByUser(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public Set getRolesByUser(final NodeRef rmRootNode, final String user) - { - return getRolesByUser(rmRootNode, user, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRolesByUser(NodeRef, String, boolean) - */ - @Override - public Set getRolesByUser(final NodeRef rmRootNode, final String user, final boolean includeSystemRoles) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Set result = new HashSet<>(13); - - Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); - for (String roleAuthority : roleAuthorities) - { - Set users = authorityService.getContainedAuthorities(AuthorityType.USER, roleAuthority, false); - if (users.contains(user) && (includeSystemRoles || !isSystemRole(roleAuthority))) - { - String groupShortName = authorityService.getShortName(roleAuthority); - String name = getShortRoleName(groupShortName, rmRootNode); - String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); - String translated = I18NUtil.getMessage(displayLabel); - if (translated != null) - { - displayLabel = translated; - } - Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); - - Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); - result.add(role); - } - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * - * @param rmRootNode - * @return - */ - private String getZoneName(NodeRef rmRootNode) - { - return RM_ROLE_ZONE_PREFIX + rmRootNode.getId(); - } - - /** - * Get the full role name - * - * @param role - * @param rmRootNode - * @return - */ - private String getFullRoleName(String role, NodeRef rmRootNode) - { - return role + rmRootNode.getId(); - } - - /** - * Get the short role name - * - * @param fullRoleName - * @param rmRootNode - * @return - */ - private String getShortRoleName(String fullRoleName, NodeRef rmRootNode) - { - return fullRoleName.replaceAll(rmRootNode.getId(), ""); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public Role getRole(final NodeRef rmRootNode, final String role) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Role doWork() - { - Role result = null; - - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - if (authorityService.authorityExists(roleAuthority)) - { - String name = getShortRoleName(authorityService.getShortName(roleAuthority), rmRootNode); - String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); - Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); - - result = new Role(name, displayLabel, capabilities, roleAuthority); - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * - * @param rmRootNode - * @param roleAuthority - * @return - */ - private Set getCapabilitiesImpl(NodeRef rmRootNode, String roleAuthority) - { - Set permissions = permissionService.getAllSetPermissions(rmRootNode); - Set capabilities = new HashSet<>(52); - for (AccessPermission permission : permissions) - { - if (permission.getAuthority().equals(roleAuthority)) - { - String capabilityName = permission.getPermission(); - Capability capability = capabilityService.getCapability(capabilityName); - if (capability != null && !capability.isPrivate()) - { - capabilities.add(capability); - } - } - } - - return capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#existsRole(NodeRef, java.lang.String) - */ - public boolean existsRole(final NodeRef rmRootNode, final String role) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Boolean doWork() - { - String fullRoleName = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - - String zone = getZoneName(rmRootNode); - Set roles = authorityService.getAllAuthoritiesInZone(zone, AuthorityType.GROUP); - return Boolean.valueOf(roles.contains(fullRoleName)); - } - }, AuthenticationUtil.getSystemUserName()).booleanValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - * - * TODO .. change this to check a property of the role its self - */ - public boolean hasRMAdminRole(NodeRef rmRootNode, String user) - { - boolean isAdmin = false; - - Set userRoles = this.getRolesByUser(rmRootNode, user); - if (userRoles != null) - { - for (Role role : userRoles) - { - if (role.getName().equals("Administrator")) - { - isAdmin = true; - break; - } - } - } - - return isAdmin; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#createRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - public Role createRole(final NodeRef filePlan, final String role, final String roleDisplayLabel, final Set capabilities) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Role doWork() - { - String fullRoleName = getFullRoleName(role, filePlan); - - // Check that the role does not already exist for the rm root node - if (authorityService.authorityExists(authorityService.getName(AuthorityType.GROUP, fullRoleName))) - { - throw new AlfrescoRuntimeException("The role " + role + " already exists for root rm node " + filePlan.getId()); - } - - // Create a group that relates to the records management role - Set zones = new HashSet<>(2); - zones.add(getZoneName(filePlan)); - zones.add(RMAuthority.ZONE_APP_RM); - - // Look up string, default to passed value if none found - String groupDisplayLabel = I18NUtil.getMessage(roleDisplayLabel); - if (groupDisplayLabel == null) - { - groupDisplayLabel = roleDisplayLabel; - } - - String roleGroup = authorityService.createAuthority(AuthorityType.GROUP, fullRoleName, groupDisplayLabel, zones); - - // do not add system roles to "all" - if (!isSystemRole(role)) - { - // Add the roleGroup to the "all" role group - String allRoleGroup = authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); - authorityService.addAuthority(allRoleGroup, roleGroup); - } - - // TODO .. we should be creating a permission set containing all the capabilities and then assigning that - // single permission group to the file plan .. would be tidier - - // Assign the various capabilities to the group on the root records management node - if (capabilities != null) - { - for (Capability capability : capabilities) - { - permissionService.setPermission(filePlan, roleGroup, capability.getName(), true); - } - } - - return new Role(role, roleDisplayLabel, capabilities, roleGroup); - } - }, AuthenticationUtil.getSystemUserName()); - } - - - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - public Role updateRole(final NodeRef rmRootNode, final String role, final String roleDisplayLabel, final Set capabilities) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Role doWork() - { - if (!existsRole(rmRootNode, role)) - { - throw new AlfrescoRuntimeException("Unable to update role " + role + ", because it does not exist."); - } - - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - - // Reset the role display name - authorityService.setAuthorityDisplayName(roleAuthority, roleDisplayLabel); - - // TODO this needs to be improved, removing all and reading is not ideal - - // Clear the current capabilities - permissionService.clearPermission(rmRootNode, roleAuthority); - - // Re-add the provided capabilities - for (Capability capability : capabilities) - { - permissionService.setPermission(rmRootNode, roleAuthority, capability.getName(), true); - } - - return new Role(role, roleDisplayLabel, capabilities, roleAuthority); - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(NodeRef,String) - */ - public void deleteRole(final NodeRef rmRootNode, final String role) - { - // ensure that we are not trying to delete the admin role - if (ROLE_ADMIN.equals(role)) - { - throw new AlfrescoRuntimeException("Can not delete the records management administration role."); - } - - // ensure that we are not trying to delete a system role - if (FilePlanRoleService.SYSTEM_ROLES.contains(role)) - { - throw new AlfrescoRuntimeException("'" + role + "' is a system role and cannot be deleted."); - } - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - authorityService.deleteAuthority(roleAuthority); - return null; - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getUsersAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Set getUsersAssignedToRole(final NodeRef filePlan, final String roleName) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("roleName", roleName); - - return getAuthoritiesAssignedToRole(filePlan, roleName, AuthorityType.USER); - } - - /** - * Gets all the authorities of a given type directly assigned to the given role in the file plan. - * - * @param filePlan file plan - * @param roleName role name - * @param authorityType authority type - * @return Set directly assigned authorities - */ - private Set getAuthoritiesAssignedToRole(final NodeRef filePlan, final String roleName, final AuthorityType authorityType) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Role role = getRole(filePlan, roleName); - if (role == null) - { - throw new AlfrescoRuntimeException("Can not get authorities for role " + roleName + ", because it does not exist. (filePlan=" + filePlan.toString() + ")"); - } - return authorityService.getContainedAuthorities(authorityType, role.getRoleGroupName(), true); - } - }, AuthenticationUtil.getSystemUserName()); - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getGroupsAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Set getGroupsAssignedToRole(final NodeRef filePlan, final String roleName) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("roleName", roleName); - - return getAuthoritiesAssignedToRole(filePlan, roleName, AuthorityType.GROUP); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getAllAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Set getAllAssignedToRole(NodeRef filePlan, String role) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("roleName", role); - - Set result = new HashSet<>(21); - result.addAll(getUsersAssignedToRole(filePlan, role)); - result.addAll(getGroupsAssignedToRole(filePlan, role)); - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - public void assignRoleToAuthority(final NodeRef filePlan, final String role, final String authorityName) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - if (authorityService.authorityExists(authorityName) && - !getAllAssignedToRole(filePlan, role).contains(authorityName)) - { - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan)); - try - { - authorityService.addAuthority(roleAuthority, authorityName); - } - catch (DuplicateChildNodeNameException exception) - { - // ignore, because the work has already been performed - } - } - return null; - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#unassignRoleFromAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Override - public void unassignRoleFromAuthority(final NodeRef filePlan, final String role, final String authorityName) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan)); - authorityService.removeAuthority(roleAuthority, authorityName); - return null; - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getAllRolesContainerGroup(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String getAllRolesContainerGroup(NodeRef filePlan) - { - return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java deleted file mode 100644 index f2edb8a3e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.role; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; - -/** - * Records management role class - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public class Role -{ - /** Role name */ - private String name; - - /** Role label */ - private String displayLabel; - - /** Role capabilities */ - private Set capabilities; - - /** Role group name */ - private String roleGroupName; - - /** Role group short name */ - private String groupShortName; - - /** - * @param name - * @param displayLabel - * @param capabilities - * @param roleGroupName - */ - public Role(String name, String displayLabel, Set capabilities, String roleGroupName) - { - this.name = name; - this.displayLabel = displayLabel; - this.capabilities = capabilities; - this.roleGroupName = roleGroupName; - } - - /** - * @param name - * @param displayLabel - * @param capabilities - * @param roleGroupName - * @param groupShortName - */ - public Role(String name, String displayLabel, Set capabilities, String roleGroupName, String groupShortName) - { - this(name, displayLabel, capabilities, roleGroupName); - this.groupShortName = groupShortName; - } - - /** - * @return the name - */ - public String getName() - { - return name; - } - - /** - * @return the displayLabel - */ - public String getDisplayLabel() - { - return displayLabel; - } - - /** - * @return the capabilities - */ - public Set getCapabilities() - { - return capabilities; - } - - /** - * @return the roleGroupName - */ - public String getRoleGroupName() - { - return roleGroupName; - } - - /** - * @return the groupShortName - */ - public String getGroupShortName() - { - return this.groupShortName; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java deleted file mode 100644 index 06165ba6f5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.WebScriptUtils.getTemplateVars; - -import javax.servlet.http.HttpServletResponse; -import java.util.Map; - -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.namespace.NamespaceService; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -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 - * @author Gavin Cornwell - */ -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; - } - - /** - * Parses the request and providing it's valid returns the NodeRef. - * - * @param req The webscript request - * @return The NodeRef passed in the request - * - */ - protected NodeRef parseRequestForNodeRef(WebScriptRequest req) - { - // 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); - - // create the NodeRef and ensure it is valid - 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java deleted file mode 100644 index 68771071a9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -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.IndexTokenisationMode; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2ClassAssociation; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.dictionary.M2Property; -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.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This webscript applies necessary changes to the RM custom model in the repository. These changes - * are to 'patch' a deployed RM custom model during the DoD certification process. With that in mind - * they are safe to apply to a live database i.e. without side-effect to existing data and safe - * to call multiple times. - *

- * - * TODO This webscript should be removed after DOD certification as none of these patches are needed - * for a newly-installed DoD amp. - * - * @author neilm - */ -@Deprecated -public class ApplyDodCertModelFixesGet extends DeclarativeWebScript - implements RecordsManagementModel -{ - private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef("workspace://SpacesStore/records_management_custom_model"); - private static final String RMC_CUSTOM_RECORD_SERIES_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordSeriesProperties"; - private static final String RMC_CUSTOM_RECORD_CATEGORY_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordCategoryProperties"; - private static final String RMC_CUSTOM_RECORD_FOLDER_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordFolderProperties"; - private static final String RMC_CUSTOM_RECORD_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordProperties"; - - /** Logger */ - private static final Logger LOGGER = LoggerFactory.getLogger(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) - { - LOGGER.info("Applying webscript-based patches to RM custom model in the repo."); - - M2Model customModel = readCustomContentModel(); - if (customModel == null) - { - final String msg = "Custom content model could not be read"; - LOGGER.error(msg); - throw new AlfrescoRuntimeException(msg); - } - - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); - M2Aspect customAssocsAspect = customModel.getAspect(customAspectName); - - if (customAssocsAspect == null) - { - final String msg = "Unknown aspect: " + customAspectName; - LOGGER.error(msg); - throw new AlfrescoRuntimeException(msg); - } - - // MOB-1573. All custom references should have many-many multiplicity. - LOGGER.info("MOB-1573. All custom references should have many-many multiplicity."); - - for (M2ClassAssociation classAssoc : customAssocsAspect.getAssociations()) - { - classAssoc.setSourceMany(true); - classAssoc.setTargetMany(true); - - } - - //MOB-1621. Custom fields should be created as untokenized by default. - LOGGER.info("MOB-1621. Custom fields should be created as untokenized by default."); - - List allCustomPropertiesAspects = new ArrayList<>(4); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_SERIES_PROPERTIES); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_CATEGORY_PROPERTIES); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_FOLDER_PROPERTIES); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_PROPERTIES); - for (String aspectName : allCustomPropertiesAspects) - { - M2Aspect aspectObj = customModel.getAspect(aspectName); - List customProperties = aspectObj.getProperties(); - for (M2Property propertyObj : customProperties) - { - propertyObj.setIndexed(true); - propertyObj.setIndexedAtomically(true); - propertyObj.setStoredInIndex(false); - propertyObj.setIndexTokenisationMode(IndexTokenisationMode.FALSE); - } - } - - - writeCustomContentModel(customModel); - - LOGGER.info("Completed application of webscript-based patches to RM custom model in the repo."); - - Map model = new HashMap<>(1, 1.0f); - model.put("success", true); - - return model; - } - - private M2Model readCustomContentModel() - { - ContentReader reader = this.contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, - ContentModel.TYPE_CONTENT); - - if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} - - 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(M2Model deserializedModel) - { - ContentWriter writer = this.contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, - 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("Exception when writing custom model xml.", uex); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java deleted file mode 100644 index 8f793bbf4f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -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.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2ClassAssociation; -import org.alfresco.repo.dictionary.M2Model; -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; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This webscript patches the RM custom model as fix for MOB-1573. It is only necessary for databases - * that had their RM amps initialised before the fix went in. - * There is no side-effect if it is called when it is not needed or if it is called multiple times. - * - * TODO This webscript should be removed after DOD certification. - * - * @author neilm - */ -@Deprecated -public class ApplyFixMob1573Get extends DeclarativeWebScript - implements RecordsManagementModel -{ - 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) - { - M2Model customModel = readCustomContentModel(); - if (customModel == null) - { - throw new AlfrescoRuntimeException("Custom content model could not be read"); - } - - // 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); - M2Aspect customAssocsAspect = customModel.getAspect(aspectName); - - if (customAssocsAspect == null) - { - throw new AlfrescoRuntimeException("Unknown aspect: "+aspectName); - } - - for (M2ClassAssociation classAssoc : customAssocsAspect.getAssociations()) - { - classAssoc.setSourceMany(true); - classAssoc.setTargetMany(true); - } - - writeCustomContentModel(customModel); - - Map model = new HashMap<>(1, 1.0f); - model.put("success", true); - - return model; - } - - private M2Model readCustomContentModel() - { - ContentReader reader = contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, - ContentModel.TYPE_CONTENT); - - if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} - - 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(M2Model deserializedModel) - { - ContentWriter writer = contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, - 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("Exception when writing custom model xml.", uex); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java deleted file mode 100644 index 8fc6895910..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to clear the - * Records Management audit log. - * - * @author Gavin Cornwell - */ -public class AuditLogDelete extends BaseAuditAdminWebScript -{ - /* - * @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) - { - this.rmAuditService.clearAuditLog(getDefaultFilePlan()); - - // create model object with the audit status model - Map model = new HashMap<>(1); - model.put("auditstatus", createAuditStatusModel()); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java deleted file mode 100644 index 2b0dc87995..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.File; -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Implementation for Java backed webscript to return audit - * log of RM events, optionally scoped to an RM node. - * - * @author Gavin Cornwell - */ -public class AuditLogGet extends BaseAuditRetrievalWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(AuditLogGet.class); - - private static final String PARAM_EXPORT = "export"; - private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit"; - private static final int DEFAULT_VIEW_LOG_MAX_SIZE = 100; - - /** Content Streamer */ - protected ContentStreamer contentStreamer; - - /** Capability service */ - protected CapabilityService capabilityService; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** Maximum number of entries to be displayed in View Audit Log */ - private int viewLogMaxSize; - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - /** - * - * @param capabilityService Capability Service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * - * @param filePlanService File Plan Service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * - * @param viewLogMaxSize Maximum number of entries to be displayed in View Audit Log - */ - public void setViewLogMaxSize(int viewLogMaxSize) - { - this.viewLogMaxSize = (viewLogMaxSize <= 0 ? DEFAULT_VIEW_LOG_MAX_SIZE: viewLogMaxSize); - } - - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - File auditTrail = null; - - try - { - RecordsManagementAuditQueryParameters queryParams = parseQueryParameters(req); - ReportFormat reportFormat = parseReportFormat(req); - - if( !userCanAccessAudit(queryParams) ) - { - throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access denied because the user does not have the Access Audit capability"); - } - - // limit the number of audit log entries to be returned - if (queryParams.getMaxEntries() <= 0 || queryParams.getMaxEntries() > viewLogMaxSize) - { - queryParams.setMaxEntries(viewLogMaxSize); - } - - // parse the parameters and get a file containing the audit trail - auditTrail = this.rmAuditService.getAuditTrailFile(queryParams, reportFormat); - - if (logger.isDebugEnabled()) - { - logger.debug("Streaming audit trail from file: " + auditTrail.getAbsolutePath()); - } - - boolean attach = false; - String attachFileName = null; - String export = req.getParameter(PARAM_EXPORT); - if (Boolean.parseBoolean(export)) - { - attach = true; - attachFileName = auditTrail.getName(); - - if (logger.isDebugEnabled()) - { - logger.debug("Exporting audit trail using file name: " + attachFileName); - } - } - - // stream the file back to the client - contentStreamer.streamContent(req, res, auditTrail, null, attach, attachFileName, null); - } - finally - { - if (auditTrail != null) - { - if (logger.isDebugEnabled()) - { - logger.debug( - "Audit results written to file: \n" + - " File: " + auditTrail + "\n" + - " Parameter: " + parseQueryParameters(req)); - } - else - { - auditTrail.delete(); - } - } - } - } - - private boolean userCanAccessAudit(RecordsManagementAuditQueryParameters queryParams) - { - NodeRef targetNode = queryParams.getNodeRef(); - if( targetNode == null ) - { - targetNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if(targetNode == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default RM site was not found"); - } - } - return AccessStatus.ALLOWED.equals( - capabilityService.getCapabilityAccessState(targetNode, ACCESS_AUDIT_CAPABILITY)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java deleted file mode 100644 index dc5c5ec045..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Implementation for Java backed webscript to file an - * audit log as a record. - * - * @author Gavin Cornwell - */ -public class AuditLogPost extends BaseAuditRetrievalWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(AuditLogPost.class); - - /** Constants */ - protected static final String PARAM_DESTINATION = "destination"; - protected static final String RESPONSE_SUCCESS = "success"; - protected static final String RESPONSE_RECORD = "record"; - protected static final String RESPONSE_RECORD_NAME = "recordName"; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** - * Sets the record folder service - * - * @param recordFolderService Record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Sets the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.repo.web.scripts.content.StreamContent#execute(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.WebScriptResponse) - */ - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - try - { - ParameterCheck.mandatory("req", req); - ParameterCheck.mandatory("res", res); - - // build the json object from the request - JSONObject json = getJSONObjectFromRequest(req); - - // extract the destination parameter, ensure it's present and it is a record folder and not closed or cut off - NodeRef destination = getDestination(json); - - // file audit trail as a record - NodeRef record = fileAuditTrail(destination, req); - - // create response - String response = createResponse(record); - - // write the JSON response - writeResponse(res, response); - } - catch (Exception ex) - { - JSONObject json = new JSONObject(); - putToJSONObject(json, "message", ex.getMessage()); - writeResponse(res, json.toString()); - } - } - - /** - * Helper method to write the response to the web script response - * - * @param res {@link WebScriptResponse} Web script response - * @param reponse {@link String} Response to write - * @throws IOException can throw an exception whilst writing the response - */ - private void writeResponse(WebScriptResponse res, String response) throws IOException - { - // setup response - res.setContentType(MimetypeMap.MIMETYPE_JSON); - res.setContentEncoding("UTF-8"); - res.setHeader("Content-Length", Long.toString(response.length())); - - // write the JSON response - res.getWriter().write(response); - } - - /** - * Helper method to create the response text from the record - * - * @param record {@link NodeRef} The audit trail as record - * @return Response text as {@link String} - */ - @SuppressWarnings("null") - private String createResponse(NodeRef record) - { - JSONObject responseJSON = new JSONObject(); - boolean recordExists = record != null; - - putToJSONObject(responseJSON, RESPONSE_SUCCESS, recordExists); - - if (recordExists) - { - putToJSONObject(responseJSON, RESPONSE_RECORD, record.toString()); - putToJSONObject(responseJSON, RESPONSE_RECORD_NAME, (String) nodeService.getProperty(record, ContentModel.PROP_NAME)); - } - - return responseJSON.toString(); - } - - /** - * Helper method to put a key and a value to a json object. - * It handles the {@link JSONException} so that a try/catch - * block is not need through out the code - * - * @param json The json object the key/value write to - * @param key The key which will be written to the json object - * @param value The value which will be written to the json object - */ - private void putToJSONObject(JSONObject json, String key, Object value) - { - try - { - json.put(key, value); - } - catch (JSONException error) - { - throw new AlfrescoRuntimeException("Error writing the value '" + value + "' of the key '" + key + "' to the json object.", error); - } - } - - /** - * Helper method which will file the audit trail - * - * @param destination The destination where the audit trail will be filed - * @param req {@link WebScriptRequest} from which additional parameters will be retrieved - * @return The {@link NodeRef} of the record - */ - private NodeRef fileAuditTrail(NodeRef destination, WebScriptRequest req) - { - - NodeRef record = rmAuditService.fileAuditTrailAsRecord(parseQueryParameters(req), destination, parseReportFormat(req)); - - if (logger.isDebugEnabled()) - { - logger.debug("Filed audit trail as new record: '" + record + "'."); - } - - return record; - } - - /** - * Helper method to create a json object from the request - * - * @param req {@link WebScriptRequest} from which the json object will be created - * @return Returns a json object containing the request content - * @throws IOException can throw an exception whilst getting the content from the request - */ - private JSONObject getJSONObjectFromRequest(WebScriptRequest req) throws IOException - { - JSONObject json; - - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - } - catch (JSONException error) - { - throw new AlfrescoRuntimeException("Error creating json object from request content.", error); - } - - return json; - } - - /** - * Helper method to get the destination from the json object - * - * @param json The json object which was created from the request content - * @return {@link NodeRef} The destination of the audit log - */ - private NodeRef getDestination(JSONObject json) - { - if (!json.has(PARAM_DESTINATION)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory parameter '" + PARAM_DESTINATION + "' has not been supplied."); - } - - String destinationParam; - try - { - destinationParam = json.getString(PARAM_DESTINATION); - } - catch (JSONException error) - { - throw new AlfrescoRuntimeException("Error extracting 'destination' from parameter.", error); - } - - if (StringUtils.isBlank(destinationParam)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Please select a record folder."); - } - - NodeRef destination = new NodeRef(destinationParam); - if (!nodeService.exists(destination)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "Selected node does not exist"); - } - - // ensure the node is a record folder - if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(destination))) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Selected node is not a record folder"); - } - - // ensure the record folder is not closed - if (recordFolderService.isRecordFolderClosed(destination)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Cannot file into a closed folder."); - } - - // ensure the record folder is not cut off - if (dispositionService.isDisposableItemCutoff(destination)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Cannot file into a cut off folder."); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Filing audit trail as record in record folder: '" + destination + "'."); - } - - return destination; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java deleted file mode 100644 index ef5026bb74..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -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 start - * and stop Records Management auditing. - * - * @author Gavin Cornwell - */ -public class AuditLogPut extends BaseAuditAdminWebScript -{ - protected static final String PARAM_ENABLED = "enabled"; - - /* - * @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) - { - try - { - // determine whether to start or stop auditing - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // check the enabled property present - if (!json.has(PARAM_ENABLED)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'enabled' parameter was not provided in request body"); - } - - boolean enabled = json.getBoolean(PARAM_ENABLED); - if (enabled) - { - this.rmAuditService.startAuditLog(getDefaultFilePlan()); - } - else - { - this.rmAuditService.stopAuditLog(getDefaultFilePlan()); - } - - // create model object with the audit status model - Map model = new HashMap<>(1); - model.put("auditstatus", createAuditStatusModel()); - return model; - } - 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); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java deleted file mode 100644 index 867b873459..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * GET audit log status - * - * @author Roy Wetherall - */ -public class AuditLogStatusGet extends DeclarativeWebScript -{ - /** Records management audit service */ - protected RecordsManagementAuditService rmAuditService; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** - * Sets the RecordsManagementAuditService instance - * - * @param rmAuditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.web.scripts.content.StreamContent#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("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan()))); - return model; - } - - /** - * Helper method to get default file plan. - * - * @return NodeRef default file plan - */ - protected NodeRef getDefaultFilePlan() - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Default file plan not found."); - } - return filePlan; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java deleted file mode 100644 index 1fcbd73e09..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Base class for all audit administration webscripts. - * - * @author Gavin Cornwell - */ -public class BaseAuditAdminWebScript extends DeclarativeWebScript -{ - /** Records management audit service */ - protected RecordsManagementAuditService rmAuditService; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** - * Sets the RecordsManagementAuditService instance - * - * @param rmAuditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Creates a model to represent the current status of the RM audit log. - * - * @return Map of RM audit log status - */ - protected Map createAuditStatusModel() - { - Map auditStatus = new HashMap<>(3); - - auditStatus.put("started", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStarted(getDefaultFilePlan()))); - auditStatus.put("stopped", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStopped(getDefaultFilePlan()))); - auditStatus.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan()))); - - return auditStatus; - } - - /** - * Helper method to get default file plan. - * - * @return NodeRef default file plan - */ - protected NodeRef getDefaultFilePlan() - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Default file plan not found."); - } - return filePlan; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java deleted file mode 100644 index da42561132..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.web.scripts.content.StreamContent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.InvalidQNameException; -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.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Base class for all audit retrieval webscripts. - * - * @author Gavin Cornwell - */ -public class BaseAuditRetrievalWebScript extends StreamContent -{ - /** Logger */ - private static Log logger = LogFactory.getLog(BaseAuditRetrievalWebScript.class); - - private static final String PARAM_USER = "user"; - private static final String PARAM_SIZE = "size"; - private static final String PARAM_EVENT = "event"; - private static final String PARAM_FROM = "from"; - private static final String PARAM_TO = "to"; - private static final String PARAM_PROPERTY = "property"; - private static final String DATE_PATTERN = "yyyy-MM-dd"; - - protected RecordsManagementAuditService rmAuditService; - protected NamespaceService namespaceService; - - /** - * Sets the RecordsManagementAuditService instance - * - * @param rmAuditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Parses the given request and builds an instance of - * RecordsManagementAuditQueryParameters to retrieve the relevant audit entries - * - * @param req The request - * @return RecordsManagementAuditQueryParameters instance - */ - protected RecordsManagementAuditQueryParameters parseQueryParameters(WebScriptRequest req) - { - // create parameters for audit trail retrieval - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - - // the webscripts can have a couple of different forms of url, work out - // whether a nodeRef has been supplied or whether the whole audit - // log should be displayed - NodeRef nodeRef = null; - Map templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - if (storeType != null && storeType.length() > 0) - { - // there is a store_type so all other params are likely to be present - String storeId = templateVars.get("store_id"); - String nodeId = templateVars.get("id"); - - // create the nodeRef - nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); - } - - // gather all the common filtering parameters, these could be on the - // query string, in a multipart/form-data request or in a JSON body - String size = null; - String user = null; - String event = null; - String from = null; - String to = null; - String property = null; - - if (MimetypeMap.MIMETYPE_JSON.equals(req.getContentType())) - { - try - { - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - if (json.has(PARAM_SIZE)) - { - size = json.getString(PARAM_SIZE); - } - if (json.has(PARAM_USER)) - { - user = json.getString(PARAM_USER); - } - if (json.has(PARAM_EVENT)) - { - event = json.getString(PARAM_EVENT); - } - if (json.has(PARAM_FROM)) - { - from = json.getString(PARAM_FROM); - } - if (json.has(PARAM_TO)) - { - to = json.getString(PARAM_TO); - } - if (json.has(PARAM_PROPERTY)) - { - property = json.getString(PARAM_PROPERTY); - } - } - catch (IOException ioe) - { - // log a warning - if (logger.isWarnEnabled()) - { - logger.warn("Failed to parse JSON parameters for audit query: " + ioe.getMessage()); - } - } - catch (JSONException je) - { - // log a warning - if (logger.isWarnEnabled()) - { - logger.warn("Failed to parse JSON parameters for audit query: " + je.getMessage()); - } - } - } - else - { - size = req.getParameter(PARAM_SIZE); - user = req.getParameter(PARAM_USER); - event = req.getParameter(PARAM_EVENT); - from = req.getParameter(PARAM_FROM); - to = req.getParameter(PARAM_TO); - property = req.getParameter(PARAM_PROPERTY); - } - - // setup the audit query parameters object - params.setNodeRef(nodeRef); - params.setUser(user); - params.setEvent(event); - - if (size != null && size.length() > 0) - { - try - { - params.setMaxEntries(Integer.parseInt(size)); - } - catch (NumberFormatException nfe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring size parameter as '" + size + "' is not a number!"); - } - } - } - - if (from != null && from.length() > 0) - { - try - { - SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN); - params.setDateFrom(dateFormat.parse(from)); - } - catch (ParseException pe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring from parameter as '" + from + "' does not conform to the date pattern: " + DATE_PATTERN); - } - } - } - - if (to != null && to.length() > 0) - { - try - { - SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN); - params.setDateTo(dateFormat.parse(to)); - } - catch (ParseException pe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring to parameter as '" + to + "' does not conform to the date pattern: " + DATE_PATTERN); - } - } - } - - if (property != null && property.length() > 0) - { - try - { - params.setProperty(QName.createQName(property, namespaceService)); - } - catch (InvalidQNameException iqe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring property parameter as '" + property + "' is an invalid QName"); - } - } - } - - return params; - } - - /** - * Parses the given request for the format the audit report - * should be returned in - * - * @param req The request - * @return The format for the report - */ - protected ReportFormat parseReportFormat(WebScriptRequest req) - { - String format = req.getFormat(); - - if (format != null) - { - if (format.equalsIgnoreCase("json")) - { - return ReportFormat.JSON; - } - else if (format.equalsIgnoreCase("html")) - { - return ReportFormat.HTML; - } - } - - return ReportFormat.JSON; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java deleted file mode 100644 index fa9dcf9719..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.QName; - -/** - * Base class for all custom property webscripts. - * - * @author Roy Wetherall - */ -public class BaseCustomPropertyWebScript extends AbstractRmWebScript -{ - /** - * Takes the element name and maps it to the QName of the customisable type. The passed element name should be a prefixed - * qname string, but to support previous versions of this API a couple of hard coded checks are made first. - * - * @param elementName - * @return - */ - protected QName mapToTypeQName(String elementName) - { - // Direct matching provided for backward compatibility with RM 1.0 - if ("recordFolder".equalsIgnoreCase(elementName)) - { - return RecordsManagementModel.TYPE_RECORD_FOLDER; - } - else if ("record".equalsIgnoreCase(elementName)) - { - return RecordsManagementModel.ASPECT_RECORD; - } - else if ("recordCategory".equalsIgnoreCase(elementName)) - { - return RecordsManagementModel.TYPE_RECORD_CATEGORY; - } - else if ("recordSeries".equalsIgnoreCase(elementName)) - { - return CompatibilityModel.TYPE_RECORD_SERIES; - } - else - { - // Try and convert the string to a qname - return QName.createQName(elementName, getNamespaceService()); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java deleted file mode 100644 index 2b0961d3c7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.web.scripts.content.StreamACP; -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.namespace.RegexQNamePattern; -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.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Abstract base class for transfer related web scripts. - * - * @author Gavin Cornwell - */ -public abstract class BaseTransferWebScript extends StreamACP - implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(BaseTransferWebScript.class); - - protected FilePlanService filePlanService; - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - File tempFile = null; - try - { - // retrieve requested format - String format = req.getFormat(); - - // construct model for template - Status status = new Status(); - Cache cache = new Cache(getDescription().getRequiredCache()); - Map model = new HashMap<>(); - model.put("status", status); - model.put("cache", cache); - - // get the parameters that represent the NodeRef, we know they are present - // otherwise this webscript would not have matched - Map templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String nodeId = templateVars.get("id"); - String transferId = templateVars.get("transfer_id"); - - // create and return the file plan NodeRef - NodeRef filePlan = new NodeRef(new StoreRef(storeType, storeId), nodeId); - - if (logger.isDebugEnabled()) - { - logger.debug("Retrieving transfer '" + transferId + "' from file plan: " + filePlan); - } - - // ensure the file plan exists - if (!this.nodeService.exists(filePlan)) - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "Node " + filePlan.toString() + " does not exist"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return; - } - - // ensure the node is a filePlan object - if (!filePlanService.isFilePlan(filePlan)) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "Node " + filePlan.toString() + " is not a file plan"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return; - } - - // attempt to find the transfer node - NodeRef transferNode = findTransferNode(filePlan, transferId); - - // send 404 if the transfer is not found - if (transferNode == null) - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "Could not locate transfer with id: " + transferId); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return; - } - - // execute the transfer operation - tempFile = executeTransfer(transferNode, req, res, status, cache); - } - catch (Exception e) - { - throw createStatusException(e, req, res); - } - finally - { - // try and delete the temporary file (if not in debug mode) - if (tempFile != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Transfer report saved to temporary file: " + tempFile.getAbsolutePath()); - } - else - { - tempFile.delete(); - } - } - } - } - - /** - * Abstract method subclasses implement to perform the actual logic required. - * - * @param transferNode The transfer node - * @param req The request - * @param res The response - * @param status Status object - * @param cache Cache object - * @return File object representing the file containing the JSON of the report - * @throws IOException - */ - protected abstract File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException; - - /** - * Finds a transfer object with the given id in the given file plan. - * This method returns null if a transfer with the given id is not found. - * - * @param filePlan The file plan to search - * @param transferId The id of the transfer being requested - * @return The transfer node or null if not found - */ - protected NodeRef findTransferNode(NodeRef filePlan, String transferId) - { - NodeRef transferNode = null; - - // get all the transfer nodes and find the one we need - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - List assocs = this.nodeService.getChildAssocs(transferContainer, - ContentModel.ASSOC_CONTAINS, - RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - if (child.getChildRef().getId().equals(transferId)) - { - transferNode = child.getChildRef(); - break; - } - } - - return transferNode; - } - - /** - * Returns an array of NodeRefs representing the items to be transferred. - * - * @param transferNode The transfer object - * @return Array of NodeRefs - */ - protected NodeRef[] getTransferNodes(NodeRef transferNode) - { - List assocs = this.nodeService.getChildAssocs(transferNode, - RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - NodeRef[] itemsToTransfer = new NodeRef[assocs.size()]; - for (int idx = 0; idx < assocs.size(); idx++) - { - itemsToTransfer[idx] = assocs.get(idx).getChildRef(); - } - - return itemsToTransfer; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java deleted file mode 100644 index 79fb8ddc93..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -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.RecordsManagementService; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.Role; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.RMAuthority; -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.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -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.WebScriptRequest; - -/** - * BootstrapTestData GET WebScript implementation. - */ -@Deprecated -public class BootstrapTestDataGet extends DeclarativeWebScript - implements RecordsManagementModel -{ - private static Log logger = LogFactory.getLog(BootstrapTestDataGet.class); - - private static final String ARG_SITE_NAME = "site"; - private static final String ARG_IMPORT = "import"; - - private static final String XML_IMPORT = "alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml"; - private static final String CHARSET_NAME = "UTF-8"; - - private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private NodeService nodeService; - private SearchService searchService; - private RecordsManagementService recordsManagementService; - private RecordsManagementActionService recordsManagementActionService; - private ImporterService importerService; - private SiteService siteService; - private PermissionService permissionService; - private RecordsManagementSecurityService recordsManagementSecurityService; - private AuthorityService authorityService; - private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; - private DispositionService dispositionService; - private RecordFolderService recordFolderService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - public void setRecordsManagementService(RecordsManagementService recordsManagementService) - { - this.recordsManagementService = recordsManagementService; - } - - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } - - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService) - { - this.recordsManagementSecurityService = recordsManagementSecurityService; - } - - public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour searchBehaviour) - { - this.recordsManagementSearchBehaviour = searchBehaviour; - } - - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // resolve import argument - boolean importData = false; - if (req.getParameter(ARG_IMPORT) != null) - { - importData = Boolean.parseBoolean(req.getParameter(ARG_IMPORT)); - } - - // resolve rm site - String siteName = RmSiteType.DEFAULT_SITE_NAME; - if (req.getParameter(ARG_SITE_NAME) != null) - { - siteName = req.getParameter(ARG_SITE_NAME); - } - - if (importData) - { - SiteInfo site = siteService.getSite(siteName); - if (site == null) - { - throw new AlfrescoRuntimeException("Records Management site does not exist: " + siteName); - } - - // resolve documentLibrary (filePlan) container - NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - if (filePlan == null) - { - filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); - } - - // import the RM test data ACP into the the provided filePlan node reference - InputStream is = BootstrapTestDataGet.class.getClassLoader().getResourceAsStream(XML_IMPORT); - if (is == null) - { - throw new AlfrescoRuntimeException("The DODExampleFilePlan.xml import file could not be found"); - } - Reader viewReader = null; - try - { - viewReader = new InputStreamReader(is, CHARSET_NAME); - } - catch (UnsupportedEncodingException error) - { - throw new AlfrescoRuntimeException("The Character Encoding '" + CHARSET_NAME + "' is not supported.", error); - } - Location location = new Location(filePlan); - importerService.importView(viewReader, location, null, null); - } - - // Patch data - BootstrapTestDataGet.patchLoadedData(searchService, nodeService, recordsManagementService, - recordsManagementActionService, permissionService, - authorityService, recordsManagementSecurityService, - recordsManagementSearchBehaviour, - dispositionService, recordFolderService); - - Map model = new HashMap<>(1, 1.0f); - model.put("success", true); - - return model; - } - - /** - * Temp method to patch AMP'ed data - * - * @param searchService - * @param nodeService - * @param recordsManagementService - * @param recordsManagementActionService - */ - public static void patchLoadedData( final SearchService searchService, - final NodeService nodeService, - final RecordsManagementService recordsManagementService, - final RecordsManagementActionService recordsManagementActionService, - final PermissionService permissionService, - final AuthorityService authorityService, - final RecordsManagementSecurityService recordsManagementSecurityService, - final RecordsManagementSearchBehaviour recordManagementSearchBehaviour, - final DispositionService dispositionService, - final RecordFolderService recordFolderService) - { - AuthenticationUtil.RunAsWork runAsWork = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - java.util.List rmRoots = recordsManagementService.getFilePlans(); - logger.info("Bootstraping " + rmRoots.size() + " rm roots ..."); - for (NodeRef rmRoot : rmRoots) - { - if (permissionService.getInheritParentPermissions(rmRoot)) - { - logger.info("Updating permissions for rm root: " + rmRoot); - permissionService.setInheritParentPermissions(rmRoot, false); - } - - String allRoleShortName = RMAuthority.ALL_ROLES_PREFIX + rmRoot.getId(); - String allRoleGroupName = authorityService.getName(AuthorityType.GROUP, allRoleShortName); - - if (!authorityService.authorityExists(allRoleGroupName)) - { - logger.info("Creating all roles group for root node: " + rmRoot.toString()); - - // Create "all" role group for root node - String allRoles = authorityService.createAuthority(AuthorityType.GROUP, - allRoleShortName, - RMAuthority.ALL_ROLES_DISPLAY_NAME, - new HashSet<>(Arrays.asList(RMAuthority.ZONE_APP_RM))); - - // Put all the role groups in it - Set roles = recordsManagementSecurityService.getRoles(rmRoot); - for (Role role : roles) - { - logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); - authorityService.addAuthority(allRoles, role.getRoleGroupName()); - } - - // Set the permissions - permissionService.setPermission(rmRoot, allRoles, RMPermissionModel.READ_RECORDS, true); - } - } - - // Make sure all the containers do not inherit permissions - ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordsManagementContainer\""); - try - { - logger.info("Bootstraping " + rs.length() + " record containers ..."); - - for (NodeRef container : rs.getNodeRefs()) - { - String containerName = (String)nodeService.getProperty(container, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(container)) - { - logger.info("Updating permissions for record container: " + containerName); - permissionService.setInheritParentPermissions(container, false); - } - } - } - finally - { - rs.close(); - } - - // fix up the test dataset to fire initial events for disposition schedules - rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); - try - { - logger.info("Bootstraping " + rs.length() + " record folders ..."); - - for (NodeRef recordFolder : rs.getNodeRefs()) - { - String folderName = (String)nodeService.getProperty(recordFolder, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(recordFolder)) - { - logger.info("Updating permissions for record folder: " + folderName); - permissionService.setInheritParentPermissions(recordFolder, false); - } - - if (!nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)) - { - // See if the folder has a disposition schedule that needs to be applied - DispositionSchedule ds = dispositionService.getDispositionSchedule(recordFolder); - if (ds != null) - { - // Fire action to "set-up" the folder correctly - logger.info("Setting up bootstraped record folder: " + folderName); - recordFolderService.setupRecordFolder(recordFolder); - } - } - - // fixup the search behaviour aspect for the record folder - logger.info("Setting up search aspect for record folder: " + folderName); - recordManagementSearchBehaviour.fixupSearchAspect(recordFolder); - } - } - finally - { - rs.close(); - } - - return null; - } - }; - - AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java deleted file mode 100644 index 6d7bd9f671..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -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 remove RM custom property definitions - * from the custom model. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionDelete extends AbstractRmWebScript -{ - private static final String PROP_ID = "propId"; - - private static Log logger = LogFactory.getLog(CustomPropertyDefinitionDelete.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) - { - Map ftlModel = null; - try - { - QName propQName = getPropertyFromReq(req); - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Deleting property definition ").append(propQName); - logger.debug(msg.toString()); - } - ftlModel = removePropertyDefinition(propQName); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return ftlModel; - } - - private QName getPropertyFromReq(WebScriptRequest req) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - String propIdString = templateVars.get(PROP_ID); - - QName propQName = this.rmAdminService.getQNameForClientId(propIdString); - Map existingPropDefs = rmAdminService.getCustomPropertyDefinitions(); - - if (!existingPropDefs.containsKey(propQName)) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, - "Requested property definition (id:" + propIdString + ") does not exist"); - } - - return propQName; - } - - /** - * Applies custom properties to the specified record node. - */ - protected Map removePropertyDefinition(QName propQName) throws JSONException - { - Map result = new HashMap<>(); - - rmAdminService.removeCustomPropertyDefinition(propQName); - - result.put("propertyqname", propQName.toPrefixString(getNamespaceService())); - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java deleted file mode 100644 index c3529a760c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -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.model.RecordsManagementCustomModel; -import org.alfresco.service.namespace.QName; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.URLDecoder; -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 property definitions - * to the custom model. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript -{ - protected RecordsManagementAdminService rmAdminService; - - private static final String PARAM_DATATYPE = "dataType"; - private static final String PARAM_TITLE = "title"; - private static final String PARAM_DESCRIPTION = "description"; - private static final String PARAM_DEFAULT_VALUE = "defaultValue"; - private static final String PARAM_MULTI_VALUED = "multiValued"; - private static final String PARAM_MANDATORY = "mandatory"; - private static final String PARAM_PROTECTED = "protected"; - private static final String PARAM_CONSTRAINT_REF = "constraintRef"; - private static final String PARAM_ELEMENT = "element"; - private static final String PARAM_LABEL = "label"; - private static final String PROP_ID = "propId"; - private static final String MESSAGE = "errorMessage"; - private static final String URL = "url"; - - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - JSONObject json = null; - Map ftlModel = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - try - { - ftlModel = createPropertyDefinition(req, json); - } - catch (CustomMetadataException e) - { - status.setCode(Status.STATUS_BAD_REQUEST); - ftlModel = new HashMap<>(); - ftlModel.put(MESSAGE, e.getMessage()); - } - } - 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); - } - return ftlModel; - } - - /** - * Applies custom properties. - * @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; - } - - @SuppressWarnings("rawtypes") - protected Map getParamsFromUrlAndJson(WebScriptRequest req, JSONObject json) - throws JSONException - { - 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 - */ - protected QName createNewPropertyDefinition(Map params) throws CustomMetadataException - { - // 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; - if (serializableParam != null) - { - if (serializableParam instanceof String) - { - type = QName.createQName((String)serializableParam, getNamespaceService()); - } - else if (serializableParam instanceof QName) - { - type = (QName)serializableParam; - } - else - { - 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()); - } - else if (serializableParam instanceof QName) - { - constraintRef = (QName)serializableParam; - } - else - { - 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()); - } - - return rmAdminService.addCustomPropertyDefinition( - proposedQName, - customisableType, - label, - type, - title, - description, - defaultValue, - multiValued, - mandatory, - isProtected, - constraintRef); - } - - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java deleted file mode 100644 index 134eb9f49d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.namespace.QName; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ParameterCheck; -import org.springframework.extensions.surf.util.URLEncoder; -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 update RM custom property definitions - * in the custom model. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript -{ - private RecordsManagementAdminService rmAdminService; - - private static final String PARAM_LABEL = "label"; - private static final String PARAM_CONSTRAINT_REF = "constraintRef"; - private static final String PROP_ID = "propId"; - private static final String URL = "url"; - private static final String MESSAGE = "errorMessage"; - - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - JSONObject json = null; - Map ftlModel = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - try - { - ftlModel = handlePropertyDefinitionUpdate(req, json); - } - catch (CustomMetadataException e) - { - status.setCode(Status.STATUS_BAD_REQUEST); - ftlModel = new HashMap<>(); - ftlModel.put(MESSAGE, e.getMessage()); - } - } - 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); - } - - return ftlModel; - } - - /** - * Applies custom properties. - * @throws CustomMetadataException - */ - protected Map handlePropertyDefinitionUpdate(WebScriptRequest req, JSONObject json) - throws JSONException, CustomMetadataException - { - Map result = new HashMap<>(); - - Map params = getParamsFromUrlAndJson(req, json); - - QName propertyQName; - propertyQName = updatePropertyDefinition(params); - String localName = propertyQName.getLocalName(); - - result.put(PROP_ID, localName); - - String urlResult = req.getServicePath(); - result.put(URL, urlResult); - - return result; - } - - /** - * If label has a non-null value, it is set on the property def. - * If constraintRef has a non-null value, it is set on this propDef. - * If constraintRef has a null value, all constraints for that propDef are removed. - * - * @param params - * @return - * @throws CustomMetadataException - */ - protected QName updatePropertyDefinition(Map params) throws CustomMetadataException - { - QName result = null; - boolean updated = false; - - String propId = (String)params.get(PROP_ID); - ParameterCheck.mandatoryString("propId", propId); - - QName propQName = rmAdminService.getQNameForClientId(propId); - if (propQName == null) - { - propQName = rmAdminService.getQNameForClientId(URLEncoder.encode(propId)); - } - if (propQName == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "Could not find property definition for: " + propId); - } - - if (params.containsKey(PARAM_CONSTRAINT_REF)) - { - String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF); - List constraints = rmAdminService.getCustomPropertyDefinitions().get(propQName).getConstraints(); - - if (constraintRef == null) - { - result = rmAdminService.removeCustomPropertyDefinitionConstraints(propQName); - updated = !constraints.isEmpty(); - } - else - { - boolean exists = false; - for (ConstraintDefinition constraintDefinition : constraints) - { - if (constraintDefinition.getConstraint().getShortName().equalsIgnoreCase(constraintRef)) - { - exists = true; - break; - } - } - if (!exists) - { - QName constraintRefQName = QName.createQName(constraintRef, getNamespaceService()); - result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); - updated = true; - } - } - } - - if (params.containsKey(PARAM_LABEL)) - { - String label = (String)params.get(PARAM_LABEL); - try - { - result = rmAdminService.updateCustomPropertyDefinitionName(propQName, label); - } - catch (PropertyAlreadyExistsMetadataException ex) - { - if (!updated) - { - String propIdAsString = rmAdminService.getQNameForClientId(label).toPrefixString(getNamespaceService()); - throw new PropertyAlreadyExistsMetadataException(propIdAsString); - } - } - } - - return result; - } - - - @SuppressWarnings("unchecked") - protected Map getParamsFromUrlAndJson(WebScriptRequest req, JSONObject json) - throws JSONException - { - Map params; - params = new HashMap<>(); - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String propId = templateVars.get(PROP_ID); - if (propId != null) - { - params.put(PROP_ID, (Serializable)propId); - } - - for (Iterator iter = json.keys(); iter.hasNext(); ) - { - String nextKeyString = iter.next(); - String nextValueString = null; - if (!json.isNull(nextKeyString)) - { - nextValueString = json.getString(nextKeyString); - } - - params.put(nextKeyString, nextValueString); - } - - return params; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java deleted file mode 100644 index 9814dd8a9a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -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; - -/** - * This class provides the implementation for the custompropdefinitions.get webscript. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionsGet extends BaseCustomPropertyWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(CustomPropertyDefinitionsGet.class); - - private static final String ELEMENT = "element"; - private static final String PROP_ID = "propId"; - - /** Records management admin service */ - private RecordsManagementAdminService rmAdminService; - - /** - * @param rmAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String propId = templateVars.get(PROP_ID); - String elementName = req.getParameter(ELEMENT); - - if (logger.isDebugEnabled() && elementName != null) - { - logger.debug("Getting custom property definitions for elementName " + elementName); - } - else if (logger.isDebugEnabled() && propId != null) - { - logger.debug("Getting custom property definition for propId " + propId); - } - - // If propId has been provided then this is a request for a single custom-property-defn. - // else it is a request for all defined on the specified element. - List propData = new ArrayList<>(); - if (propId != null) - { - QName propQName = rmAdminService.getQNameForClientId(propId); - PropertyDefinition propDefn = rmAdminService.getCustomPropertyDefinitions().get(propQName); - if (propQName == null || propDefn == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Property definition for " + propId + " not found."); - } - propData.add(propDefn); - } - else if (elementName != null) - { - QName customisableType = mapToTypeQName(elementName); - Map currentCustomProps = rmAdminService.getCustomPropertyDefinitions(customisableType); - if (currentCustomProps != null) - { - for (Entry entry : currentCustomProps.entrySet()) - { - propData.add(entry.getValue()); - } - } - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Either elementName or propId must be specified."); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Retrieved custom property definitions: " + propData); - } - - model.put("customProps", propData); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java deleted file mode 100644 index 85b6d1a789..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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 org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -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 remove RM custom relationship 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"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Rule service */ - private RuleService ruleService; - - /** - * 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; - } - - /** - * 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 - */ - 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) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(1); - try - { - getRuleService().disableRuleType(RuleType.OUTBOUND); - removeCustomRelationship(req); - model.put(SUCCESS, true); - } - finally - { - getRuleService().enableRuleType(RuleType.OUTBOUND); - } - return model; - } - - /** - * Removes a custom relationship - * - * @param req The webscript request - */ - private void removeCustomRelationship(WebScriptRequest req) - { - String uniqueName = getRequestParameterValue(req, REF_ID); - NodeRef source = parseRequestForNodeRef(req); - NodeRef target = getTargetNode(req); - - getRelationshipService().removeRelationship(uniqueName, source, target); - getRelationshipService().removeRelationship(uniqueName, target, source); - } - - /** - * 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); - - NodeRef targetNode = new NodeRef(storeType, storeId, nodeId); - if (!getNodeService().exists(targetNode)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + - targetNode.toString() + "'."); - } - - return targetNode; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java deleted file mode 100644 index 6cd90bb95c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -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.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -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 add RM custom relationship 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; - - /** Rule service */ - private RuleService ruleService; - - /** - * 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; - } - - /** - * 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 - */ - 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) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(1); - try - { - getRuleService().disableRuleType(RuleType.INBOUND); - addCustomRelationship(req); - model.put(SUCCESS, true); - } - finally - { - getRuleService().enableRuleType(RuleType.INBOUND); - } - return model; - } - - /** - * Adds a custom relationship - * - * @param req The webscript request - */ - protected void addCustomRelationship(WebScriptRequest req) - { - JSONObject json = getRequestContentAsJSONObject(req); - String uniqueName = getStringValueFromJSONObject(json, REF_ID); - NodeRef target = getTargetNode(json); - NodeRef source = parseRequestForNodeRef(req); - - if (uniqueName.endsWith(INVERT)) - { - String uniqueNameStem = uniqueName.split(INVERT)[0]; - getRelationshipService().addRelationship(uniqueNameStem, target, source); - } - else - { - getRelationshipService().addRelationship(uniqueName, source, target); - } - } - - /** - * 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); - - if (!getNodeService().exists(targetNode)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + - targetNode.toString() + "'."); - } - - return targetNode; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java deleted file mode 100644 index cd541b476b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; -import static org.apache.commons.lang3.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java deleted file mode 100644 index 46e5abc5ba..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; - -import java.util.HashMap; -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.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * 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 -{ - /** - * @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) - { - 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; - } - - /** - * Creates relationship definition data for the ftl template - * - * @param relationshipDefinition The relationship definition - * @param servicePath The service path - * @return The relationship definition data - */ - private Map createRelationshipDefinitionData(RelationshipDefinition relationshipDefinition, String servicePath) - { - 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; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java deleted file mode 100644 index caed9e70e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to update RM custom reference definitions. - * There is currently only support for updating the label (for bidirectional references) or - * the source/target (for parent/child references). - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomReferenceDefinitionPut extends CustomReferenceDefinitionBase -{ - /** - * @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, REF_ID); - JSONObject requestContent = getRequestContentAsJSONObject(req); - RelationshipDisplayName displayName = createDisplayName(requestContent); - getRelationshipService().updateRelationshipDefinition(uniqueName, displayName); - - Map model = new HashMap<>(); - String servicePath = req.getServicePath(); - Map customReferenceData = createRelationshipDefinitionData(servicePath, uniqueName); - model.putAll(customReferenceData); - - return model; - } - - /** - * Creates relationship definition data for the ftl template - * - * @param servicePath The service path - * @param String The relationship unique name - * @return The relationship definition data - */ - private Map createRelationshipDefinitionData(String servicePath, String uniqueName) - { - Map relationshipDefinitionData = new HashMap<>(3); - relationshipDefinitionData.put(URL, servicePath); - relationshipDefinitionData.put(REF_ID, uniqueName); - relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); - return relationshipDefinitionData; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java deleted file mode 100644 index e894b17e46..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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 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.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 reference definitions. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomReferenceDefinitionsGet extends CustomReferenceDefinitionBase -{ - /** - * @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, 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<>(); - - if (isBlank(uniqueName)) - { - relationshipDefinitions.addAll(getRelationshipService().getRelationshipDefinitions()); - } - else - { - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) - { - relationshipDefinitions.add(relationshipDefinition); - } - } - - return relationshipDefinitions; - } - - /** - * 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) - { - Map data = new HashMap<>(); - - RelationshipType type = relationshipDefinition.getType(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - if (RelationshipType.BIDIRECTIONAL.equals(type)) - { - data.put(LABEL, displayName.getSourceText()); - } - else if (RelationshipType.PARENTCHILD.equals(type)) - { - data.put(SOURCE, displayName.getSourceText()); - data.put(TARGET, displayName.getTargetText()); - } - else - { - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type '") - .append(type) - .append("'."); - - throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); - } - - data.put(REF_ID, relationshipDefinition.getUniqueName()); - data.put(REFERENCE_TYPE, type.toString().toLowerCase()); - - relationshipDefinitionData.add(data); - } - - return relationshipDefinitionData; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java deleted file mode 100644 index f3f6224ad4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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 -{ - PARENT_CHILD("parentchild"), - 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()) - { - if (type.printableString.equals(stg)) - { - return type; - } - } - throw new IllegalArgumentException("Unrecognised CustomReferenceType: " + stg); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java deleted file mode 100644 index 03d2fa61a5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -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.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.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -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. - * - * @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"; - private static final String SOURCE = "source"; - private static final String TARGET = "target"; - private static final String PARENT_REF = "parentRef"; - private static final String CHILD_REF = "childRef"; - private static final String SOURCE_REF = "sourceRef"; - private static final String TARGET_REF = "targetRef"; - private static final String CUSTOM_REFS_FROM = "customRefsFrom"; - private static final String CUSTOM_REFS_TO = "customRefsTo"; - private static final String NODE_NAME = "nodeName"; - private static final String NODE_TITLE = "nodeTitle"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * 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; - } - - /** - * 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 - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @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<>(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; - } - - /** - * 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; - } - - /** - * 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) - { - 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); - } - - } - - return relationshipData; - } - - /** - * Determines 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); - if (AccessStatus.ALLOWED.equals(viewRecordCapability.hasPermission(nodeRef))) - { - result = true; - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java deleted file mode 100644 index f9f9897801..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class provides the implementation for the customisable.get webscript. - * - * @author Roy Wetherall - */ -public class CustomisableGet extends DeclarativeWebScript -{ - /** Records management admin service */ - private RecordsManagementAdminService rmAdminService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** - * @param rmAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - Set qnames = rmAdminService.getCustomisable(); - ArrayList items = new ArrayList<>(qnames.size()); - for (QName qname : qnames) - { - ClassDefinition definition = dictionaryService.getClass(qname); - if (definition != null) - { - String name = qname.toPrefixString(namespaceService); - String title = definition.getTitle(dictionaryService); - if (title == null || title.length() == 0) - { - title = qname.getLocalName(); - } - boolean isAspect = definition.isAspect(); - - items.add(new Item(name, isAspect, title)); - } - } - - // Sort the customisable types and aspects by title - Collections.sort(items, new Comparator() - { - @Override - public int compare(Item o1, Item o2) - { - return o1.title.compareToIgnoreCase(o2.title); - }}); - - model.put("items", items); - return model; - } - - /** - * Model items - */ - public class Item - { - private String name; - private boolean isAspect; - private String title; - - public Item(String name, boolean isAspect, String title) - { - this.name = name; - this.isAspect = isAspect; - this.title = title; - } - - public String getName() - { - return name; - } - - public boolean getIsAspect() - { - return isAspect; - } - - public String getTitle() - { - return title; - } - - @Override - public int hashCode() - { - int varCode = (null == name ? 0 : name.hashCode()); - return 31 + varCode; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || (obj.getClass() != this.getClass())) - { - return false; - } - else - { - return this.name.equals(((Item)obj).name); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java deleted file mode 100644 index 13ba582974..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -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.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteService; -import org.apache.commons.lang3.StringUtils; -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; - -public class DataSetPost extends DeclarativeWebScript implements RecordsManagementModel -{ - /** 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"; - - /** Logger */ - private static Log logger = LogFactory.getLog(DataSetPost.class); - - /** Site service */ - private SiteService siteService; - - /** Data set service */ - private DataSetService dataSetService; - - /** - * Set site service - * - * @param siteService the site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * Data set service - * - * @param dataSetService the data set service - */ - public void setDataSetService(DataSetService dataSetService) - { - this.dataSetService = dataSetService; - } - - /** - * @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, 1.0f); - try - { - // Resolve data set id - String dataSetId = req.getServiceMatch().getTemplateVars().get(ARG_DATA_SET_ID); - if (StringUtils.isBlank(dataSetId)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A data set id was not provided."); - } - if (!dataSetService.existsDataSet(dataSetId)) - { - 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) - { - filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, - TYPE_FILE_PLAN, null); - } - - // Load data set in to the file plan - dataSetService.loadDataSet(filePlan, dataSetId); - - model.put("success", true); - model.put("message", "Successfully imported data set."); - } - catch (Exception ex) - { - model.put("success", false); - model.put("message", ex.getMessage()); - logger.error("Error while importing data set: " + ex); - } - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java deleted file mode 100644 index bbc8724400..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -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.lang3.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -public class DataSetsGet extends DeclarativeWebScript -{ - - /** Constant for the site name parameter */ - private static final String ARG_SITE_NAME = "site"; - - /** Constant for the unloadedonly parameter */ - private static final String ARG_UNLOADED_ONLY = "unloadedonly"; - - /** Data set service */ - private DataSetService dataSetService; - - /** Site service */ - private SiteService siteService; - - /** - * Set data set service - * - * @param dataSetService the data set service - */ - public void setDataSetService(DataSetService dataSetService) - { - this.dataSetService = dataSetService; - } - - /** - * Set site service - * - * @param siteService the site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @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) - { - // Get the site name from the URL and find out the file plan - String siteName = req.getParameter(ARG_SITE_NAME); - if (StringUtils.isBlank(siteName)) - { - siteName = RmSiteType.DEFAULT_SITE_NAME; - } - NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - - // Check if only unloaded data sets should be returned - default value is false - String unloadedOnlyParam = req.getParameter(ARG_UNLOADED_ONLY); - boolean unloadedOnly = false; - if (StringUtils.isNotBlank(unloadedOnlyParam)) - { - unloadedOnly = Boolean.valueOf(unloadedOnlyParam).booleanValue(); - } - - // Get the loaded/unloaded data sets depending on the "unloadedOnly" parameter - Map dataSets = dataSetService.getDataSets(filePlan, unloadedOnly); - List> dataSetList = new ArrayList<>(dataSets.size()); - - for (Map.Entry entry : dataSets.entrySet()) - { - Map dataSet = new HashMap<>(3); - DataSet value = entry.getValue(); - - // Data set details - String dataSetId = value.getId(); - String isLoaded = String.valueOf(dataSetService.isLoadedDataSet(filePlan, dataSetId)); - - dataSet.put("label", value.getLabel()); - dataSet.put("id", dataSetId); - dataSet.put("isLoaded", isLoaded); - - // Add data set to the list - dataSetList.add(dataSet); - } - - Map model = new HashMap<>(1); - model.put("datasets", dataSetList); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java deleted file mode 100644 index 4ee9b26d26..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Abstract base class for all disposition related java backed webscripts. - * - * @author Gavin Cornwell - */ -public class DispositionAbstractBase extends AbstractRmWebScript -{ - - public final static String COMBINE_DISPOSITION_STEP_CONDITIONS = "combineDispositionStepConditions"; - /** - * Parses the request and providing it's valid returns the DispositionSchedule object. - * - * @param req The webscript request - * @return The DispositionSchedule object the request is aimed at - */ - protected DispositionSchedule parseRequestForSchedule(WebScriptRequest req) - { - // get the NodeRef from the request - NodeRef nodeRef = parseRequestForNodeRef(req); - - // Determine whether we are getting the inherited disposition schedule or not - boolean inherited = true; - String inheritedString = req.getParameter("inherited"); - if (inheritedString != null) - { - inherited = Boolean.parseBoolean(inheritedString); - } - - // make sure the node passed in has a disposition schedule attached - DispositionSchedule schedule = null; - if (inherited) - { - schedule = getDispositionService().getDispositionSchedule(nodeRef); - } - else - { - schedule = getDispositionService().getAssociatedDispositionSchedule(nodeRef); - } - if (schedule == null) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Node " + - nodeRef.toString() + " does not have a disposition schedule"); - } - - return schedule; - } - - /** - * Parses the request and providing it's valid returns the DispositionActionDefinition object. - * - * @param req The webscript request - * @param schedule The disposition schedule - * @return The DispositionActionDefinition object the request is aimed at - */ - protected DispositionActionDefinition parseRequestForActionDefinition(WebScriptRequest req, - DispositionSchedule schedule) - { - // make sure the requested action definition exists - Map templateVars = req.getServiceMatch().getTemplateVars(); - String actionDefId = templateVars.get("action_def_id"); - DispositionActionDefinition actionDef = schedule.getDispositionActionDefinition(actionDefId); - if (actionDef == null) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, - "Requested disposition action definition (id:" + actionDefId + ") does not exist"); - } - - return actionDef; - } - - /** - * Helper to create a model to represent the given disposition action definition. - * - * @param actionDef The DispositionActionDefinition instance to generate model for - * @param url The URL for the DispositionActionDefinition - * @return Map representing the model - */ - protected Map createActionDefModel(DispositionActionDefinition actionDef, - String url) - { - Map model = new HashMap<>(8); - - model.put("id", actionDef.getId()); - model.put("index", actionDef.getIndex()); - model.put("url", url); - model.put("name", actionDef.getName()); - model.put("label", actionDef.getLabel()); - model.put("eligibleOnFirstCompleteEvent", actionDef.eligibleOnFirstCompleteEvent()); - - if (actionDef.getDescription() != null) - { - model.put("description", actionDef.getDescription()); - } - - if (actionDef.getPeriod() != null) - { - model.put("period", actionDef.getPeriod().toString()); - } - - if (actionDef.getPeriodProperty() != null) - { - model.put("periodProperty", actionDef.getPeriodProperty().toPrefixString(getNamespaceService())); - } - - if (actionDef.getLocation() != null) - { - model.put("location", actionDef.getLocation()); - } - - if (actionDef.getGhostOnDestroy() != null) - { - model.put("ghostOnDestroy", actionDef.getGhostOnDestroy()); - } - - List events = actionDef.getEvents(); - if (events != null && events.size() > 0) - { - List eventNames = new ArrayList<>(events.size()); - for (RecordsManagementEvent event : events) - { - eventNames.add(event.getName()); - } - model.put("events", eventNames); - } - - if(getNodeService().getProperty(actionDef.getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS) != null) - { - model.put("combineDispositionStepConditions", getNodeService().getProperty(actionDef.getNodeRef(), PROP_COMBINE_DISPOSITION_STEP_CONDITIONS)); - } - - return model; - } - - /** - * Helper method to parse the request and retrieve the disposition schedule model. - * - * @param req The webscript request - * @return Map representing the model - */ - protected Map getDispositionScheduleModel(WebScriptRequest req) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // add all the schedule data to Map - Map scheduleModel = new HashMap<>(8); - - // build url - String serviceUrl = req.getServiceContextPath() + req.getPathInfo(); - scheduleModel.put("url", serviceUrl); - String actionsUrl = serviceUrl + "/dispositionactiondefinitions"; - scheduleModel.put("actionsUrl", actionsUrl); - scheduleModel.put("nodeRef", schedule.getNodeRef().toString()); - scheduleModel.put("recordLevelDisposition", schedule.isRecordLevelDisposition()); - scheduleModel.put("canStepsBeRemoved", - !getDispositionService().hasDisposableItems(schedule)); - - if (schedule.getDispositionAuthority() != null) - { - scheduleModel.put("authority", schedule.getDispositionAuthority()); - } - - if (schedule.getDispositionInstructions() != null) - { - scheduleModel.put("instructions", schedule.getDispositionInstructions()); - } - - boolean unpublishedUpdates = false; - boolean publishInProgress = false; - - List> actions = new ArrayList<>(); - for (DispositionActionDefinition actionDef : schedule.getDispositionActionDefinitions()) - { - NodeRef actionDefNodeRef = actionDef.getNodeRef(); - if (getNodeService().hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE)) - { - unpublishedUpdates = true; - publishInProgress = ((Boolean) getNodeService().getProperty(actionDefNodeRef, RecordsManagementModel.PROP_PUBLISH_IN_PROGRESS)).booleanValue(); - } - - actions.add(createActionDefModel(actionDef, actionsUrl + "/" + actionDef.getId())); - } - scheduleModel.put("actions", actions); - scheduleModel.put("unpublishedUpdates", unpublishedUpdates); - scheduleModel.put("publishInProgress", publishInProgress); - - // create model object with just the schedule data - Map model = new HashMap<>(1); - model.put("schedule", scheduleModel); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java deleted file mode 100644 index dac89c9e10..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to delete a dispostion action definition. - * - * @author Gavin Cornwell - */ -public class DispositionActionDefinitionDelete extends DispositionAbstractBase -{ - /* - * @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) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // parse the request to retrieve the action definition object - DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule); - - // remove the action definition from the schedule - removeDispositionActionDefinitions(schedule, actionDef); - - // return the disposition schedule model - return getDispositionScheduleModel(req); - } - - /** - * Helper method to remove a disposition action definition and the following definition(s) - * - * @param schedule The disposition schedule - * @param actionDef The disposition action definition - */ - private void removeDispositionActionDefinitions(DispositionSchedule schedule, DispositionActionDefinition actionDef) - { - int index = actionDef.getIndex(); - List dispositionActionDefinitions = schedule.getDispositionActionDefinitions(); - for (DispositionActionDefinition dispositionActionDefinition : dispositionActionDefinitions) - { - if (dispositionActionDefinition.getIndex() >= index) - { - getDispositionService().removeDispositionActionDefinition(schedule, dispositionActionDefinition); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java deleted file mode 100644 index 01b6f6fe1f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -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.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -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 create a new dispositon action definition. - * - * @author Gavin Cornwell - */ -public class DispositionActionDefinitionPost extends DispositionAbstractBase -{ - /* - * @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) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // retrieve the rest of the post body and create the action - // definition - JSONObject json = null; - DispositionActionDefinition actionDef = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - actionDef = createActionDefinition(json, schedule); - } - 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); - } - - // create model object with just the action data - Map model = new HashMap<>(1); - model.put("action", createActionDefModel(actionDef, req.getURL() + "/" + actionDef.getId())); - return model; - } - - /** - * Creates a dispositionActionDefinition node in the repo. - * - * @param json The JSON to use to create the action definition - * @param schedule The DispositionSchedule the action is for - * @return The DispositionActionDefinition representing the new action definition - */ - protected DispositionActionDefinition createActionDefinition(JSONObject json, - DispositionSchedule schedule) throws JSONException - { - // extract the data from the JSON request - if (!json.has("name")) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'name' parameter was not provided in request body"); - } - - // create the properties for the action definition - Map props = new HashMap<>(8); - String name = json.getString("name"); - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME, name); - - if (json.has("description")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_DESCRIPTION, json.getString("description")); - } - - if (json.has("period")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD, json.getString("period")); - } - - if (json.has("periodProperty")) - { - QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); - } - - if (json.has("eligibleOnFirstCompleteEvent")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION, - json.getBoolean("eligibleOnFirstCompleteEvent") ? "or" : "and"); - } - - if (json.has(COMBINE_DISPOSITION_STEP_CONDITIONS)) - { - props.put(RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS, - json.getBoolean(COMBINE_DISPOSITION_STEP_CONDITIONS)); - } - - if (json.has("location")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_LOCATION, - json.getString("location")); - } - - if (json.has("events")) - { - JSONArray events = json.getJSONArray("events"); - List eventsList = new ArrayList<>(events.length()); - for (int x = 0; x < events.length(); x++) - { - eventsList.add(events.getString(x)); - } - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT, (Serializable)eventsList); - } - - if (json.has("name") && "destroy".equals(json.getString("name"))) - { - if (json.has("ghostOnDestroy")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "ghost"); - } - else - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "delete"); - } - } - - // add the action definition to the schedule - return getDispositionService().addDispositionActionDefinition(schedule, props); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java deleted file mode 100644 index 2c823d1f59..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -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.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -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 update an existing dispositon - * action definition. - * - * @author Gavin Cornwell - */ -public class DispositionActionDefinitionPut extends DispositionAbstractBase -{ - /* - * @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) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // parse the request to retrieve the action definition object - DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule); - - // retrieve the rest of the post body and update the action definition - JSONObject json = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - actionDef = updateActionDefinition(actionDef, 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); - } - - // create model object with just the action data - Map model = new HashMap<>(1); - model.put("action", createActionDefModel(actionDef, req.getURL())); - return model; - } - - /** - * 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 - * @return The updated DispositionActionDefinition - */ - protected DispositionActionDefinition updateActionDefinition(DispositionActionDefinition actionDef, - JSONObject json) throws JSONException - { - // create the properties for the action definition - Map props = new HashMap<>(8); - - if (json.has("name")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME, json.getString("name")); - } - - if (json.has("description")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_DESCRIPTION, json.getString("description")); - } - - if (json.has("period")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD, json.getString("period")); - } - - if (json.has("periodProperty")) - { - QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); - } - - if (json.has("eligibleOnFirstCompleteEvent")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION, - json.getBoolean("eligibleOnFirstCompleteEvent") ? "or" : "and"); - } - - if (json.has(COMBINE_DISPOSITION_STEP_CONDITIONS)) - { - props.put(RecordsManagementModel.PROP_COMBINE_DISPOSITION_STEP_CONDITIONS, - json.getBoolean(COMBINE_DISPOSITION_STEP_CONDITIONS)); - } - - if (json.has("location")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_LOCATION, - json.getString("location")); - } - - if (json.has("events")) - { - JSONArray events = json.getJSONArray("events"); - List eventsList = new ArrayList<>(events.length()); - for (int x = 0; x < events.length(); x++) - { - eventsList.add(events.getString(x)); - } - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT, (Serializable)eventsList); - } - - if (json.has("name") && "destroy".equals(json.getString("name"))) - { - if (json.has("ghostOnDestroy")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "ghost"); - } - else - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "delete"); - } - } - - // update the action definition - return getDispositionService().updateDispositionActionDefinition(actionDef, props); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java deleted file mode 100644 index aec00ae300..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.PersonService; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -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) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // 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); - if (nextAction == null) - { - Map nextActionModel = new HashMap<>(2); - nextActionModel.put("notFound", true); - nextActionModel.put("message", "Node " + nodeRef.toString() + " does not have a disposition lifecycle"); - Map model = new HashMap<>(1); - model.put("nextaction", nextActionModel); - return model; - } - else - { - // add all the next action data to Map - Map nextActionModel = new HashMap<>(8); - String serviceUrl = req.getServiceContextPath() + req.getPathInfo(); - nextActionModel.put("url", serviceUrl); - nextActionModel.put("name", nextAction.getName()); - nextActionModel.put("label", nextAction.getLabel()); - nextActionModel.put("eventsEligible", getDispositionService().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 - */ - protected void addUsersRealName(Map model, String userName, String propertyPrefix) - { - NodeRef user = this.personService.getPerson(userName); - if (user != null) - { - String firstName = (String) getNodeService().getProperty(user, ContentModel.PROP_FIRSTNAME); - if (firstName != null) - { - model.put(propertyPrefix + "FirstName", firstName); - } - - String lastName = (String) getNodeService().getProperty(user, ContentModel.PROP_LASTNAME); - if (lastName != null) - { - model.put(propertyPrefix + "LastName", lastName); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java deleted file mode 100644 index f4a4e7e8fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.util.StringUtils; - -/** - * @author Roy Wetherall - */ -public class DispositionPropertiesGet extends DeclarativeWebScript -{ - protected DispositionService dispositionService; - protected NamespaceService namespaceService; - protected DictionaryService dictionaryService; - - /** - * Sets the disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Sets the DictionaryService instance - * - * @param dictionaryService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /* - * @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) - { - boolean recordLevel = false; - String recordLevelValue = req.getParameter("recordlevel"); - if (recordLevelValue != null) - { - recordLevel = Boolean.valueOf(recordLevelValue); - } - String dispositionAction = req.getParameter("dispositionaction"); - - Collection dispositionProperties = dispositionService.getDispositionProperties(recordLevel, dispositionAction); - List> items = new ArrayList<>(dispositionProperties.size()); - for (DispositionProperty dispositionProperty : dispositionProperties) - { - PropertyDefinition propDef = dispositionProperty.getPropertyDefinition(); - QName propName = dispositionProperty.getQName(); - - if (propDef != null) - { - Map item = new HashMap<>(2); - String propTitle = propDef.getTitle(dictionaryService); - if (propTitle == null || propTitle.length() == 0) - { - propTitle = StringUtils.capitalize(propName.getLocalName()); - } - item.put("label", propTitle); - item.put("value", propName.toPrefixString(this.namespaceService)); - items.add(item); - } - } - - // create model object with the lists model - Map model = new HashMap<>(1); - model.put("properties", items); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java deleted file mode 100644 index 44ce73f91f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.Map; - -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return full details - * about a disposition schedule. - * - * @author Gavin Cornwell - */ -public class DispositionScheduleGet extends DispositionAbstractBase -{ - /* - * @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) - { - // return the disposition schedule model - return getDispositionScheduleModel(req); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java deleted file mode 100644 index 235e927982..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class provides the implementation for the dodcustomtypes.get webscript. - * - * @author Neil McErlean - */ -public class DodCustomTypesGet extends DeclarativeWebScript -{ - // TODO Investigate a way of not hard-coding the 4 custom types here. - private static final List CUSTOM_TYPE_ASPECTS = Arrays.asList(new QName[]{DOD5015Model.ASPECT_SCANNED_RECORD, - DOD5015Model.ASPECT_PDF_RECORD, DOD5015Model.ASPECT_DIGITAL_PHOTOGRAPH_RECORD, DOD5015Model.ASPECT_WEB_RECORD}); - - private DictionaryService dictionaryService; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - List customTypeAspectDefinitions = new ArrayList<>(4); - for (QName aspectQName : CUSTOM_TYPE_ASPECTS) - { - AspectDefinition nextAspectDef = dictionaryService.getAspect(aspectQName); - customTypeAspectDefinitions.add(nextAspectDef); - } - model.put("dodCustomTypes", customTypeAspectDefinitions); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java deleted file mode 100644 index fe05e17a84..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.json.JSONException; -import org.json.JSONObject; -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 return - * custom email field mappings - */ -public class EmailMapDelete extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * @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) - { - try - { - // Get the data from the request - JSONObject json = new JSONObject(req.getServiceMatch().getTemplateVars()); - - // Delete custom mapping - customEmailMappingService.deleteCustomMapping(json.getString("from"), json.getString("to")); - - // Create model object with the lists of custom mappings - Map model = new HashMap<>(1); - model.put("emailmap", customEmailMappingService.getCustomMappings()); - - return model; - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java deleted file mode 100644 index 48e4cd1863..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return - * custom email field mappings - */ -public class EmailMapGet extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * @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) - { - // Create model object with the lists of custom mappings - Map model = new HashMap<>(1); - model.put("emailmap", customEmailMappingService.getCustomMappings()); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java deleted file mode 100644 index 24dfeb1f24..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return email mapping keys - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class EmailMapKeysGet extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Create model object with the lists of email mapping keys - Map model = new HashMap<>(1); - model.put("emailmapkeys", customEmailMappingService.getEmailMappingKeys()); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java deleted file mode 100644 index f4921cf7dd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -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 return - * custom email field mappings - */ -public class EmailMapPost extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * @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); - try - { - // Get the data from the content - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Add custom mapping - customEmailMappingService.addCustomMapping(json.getString("from"), json.getString("to")); - - // Add the lists of custom mappings to the model - model.put("emailmap", customEmailMappingService.getCustomMappings()); - } - 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 (AlfrescoRuntimeException are) - { - throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, - are.getMessage(), are); - } - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java deleted file mode 100644 index cef577959a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.repo.exporter.ACPExportPackageHandler; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.repo.web.scripts.content.StreamACP; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.view.ExporterCrawlerParameters; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Creates an RM specific ACP file of nodes to export then streams it back - * to the client. - * - * @author Gavin Cornwell - */ -public class ExportPost extends StreamACP -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ExportPost.class); - - protected static final String PARAM_TRANSFER_FORMAT = "transferFormat"; - - /** Content Streamer */ - private ContentStreamer contentStreamer; - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @SuppressWarnings("deprecation") - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - File tempACPFile = null; - try - { - NodeRef[] nodeRefs = null; - boolean transferFormat = false; - String contentType = req.getContentType(); - if (MULTIPART_FORMDATA.equals(contentType)) - { - // get nodeRefs parameter from form - nodeRefs = getNodeRefs(req.getParameter(PARAM_NODE_REFS)); - - // look for the transfer format - String transferFormatParam = req.getParameter(PARAM_TRANSFER_FORMAT); - if (transferFormatParam != null && transferFormatParam.length() > 0) - { - transferFormat = Boolean.parseBoolean(transferFormatParam); - } - } - else - { - // presume the request is a JSON request so get nodeRefs from JSON body - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - nodeRefs = getNodeRefs(json); - - if (json.has(PARAM_TRANSFER_FORMAT)) - { - transferFormat = json.getBoolean(PARAM_TRANSFER_FORMAT); - } - } - - // setup the ACP parameters - ExporterCrawlerParameters params = new ExporterCrawlerParameters(); - params.setCrawlSelf(true); - params.setCrawlChildNodes(true); - params.setExportFrom(new Location(nodeRefs)); - - // if transfer format has been requested we need to exclude certain aspects - if (transferFormat) - { - // restrict specific aspects from being returned - QName[] excludedAspects = new QName[] { - RenditionModel.ASPECT_RENDITIONED, - ContentModel.ASPECT_THUMBNAILED, - RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE, - RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH, - RecordsManagementModel.ASPECT_EXTENDED_SECURITY}; - params.setExcludeAspects(excludedAspects); - } - else - { - // restrict specific aspects from being returned - QName[] excludedAspects = new QName[] {RecordsManagementModel.ASPECT_EXTENDED_SECURITY}; - params.setExcludeAspects(excludedAspects); - } - - // create an ACP of the nodes - tempACPFile = createACP(params, - transferFormat ? ZIP_EXTENSION : ACPExportPackageHandler.ACP_EXTENSION, - transferFormat); - - // stream the ACP back to the client as an attachment (forcing save as) - contentStreamer.streamContent(req, res, tempACPFile, null, true, tempACPFile.getName(), null); - } - catch (IOException ioe) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", ioe); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - catch(Exception e) - { - if (logger.isDebugEnabled()) - { - StringWriter stack = new StringWriter(); - e.printStackTrace(new PrintWriter(stack)); - logger.debug("Caught exception; decorating with appropriate status template : " + stack.toString()); - } - - throw createStatusException(e, req, res); - } - finally - { - // try and delete the temporary file - if (tempACPFile != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Deleting temporary archive: " + tempACPFile.getAbsolutePath()); - } - - tempACPFile.delete(); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java deleted file mode 100644 index f00533f744..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.model.ContentModel; -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.role.FilePlanRoleService; -import org.alfresco.repo.exporter.ACPExportPackageHandler; -import org.alfresco.repo.importer.ACPImportPackageHandler; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -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.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.util.TempFileProvider; -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; -import org.springframework.extensions.webscripts.WrappingWebScriptRequest; -import org.springframework.extensions.webscripts.servlet.FormData.FormField; -import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest; -import org.springframework.util.FileCopyUtils; - -/** - * Imports an ACP file into a records management container. - * - * @author Gavin Cornwell - */ -public class ImportPost extends DeclarativeWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ImportPost.class); - - protected static final String MULTIPART_FORMDATA = "multipart/form-data"; - protected static final String PARAM_DESTINATION = "destination"; - protected static final String PARAM_ARCHIVE = "archive"; - protected static final String PARAM_FILEDATA = "filedata"; - protected static final String TEMP_FILE_PREFIX = "import_"; - - protected NodeService nodeService; - protected DictionaryService dictionaryService; - protected ImporterService importerService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanService filePlanService; - - /** - * @param nodeService - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the data dictionary service - * - * @param dictionaryService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Sets the ImporterService to use - * - * @param importerService The ImporterService - */ - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Unwrap to a WebScriptServletRequest if we have one - WebScriptServletRequest webScriptServletRequest = null; - WebScriptRequest current = req; - do - { - if (current instanceof WebScriptServletRequest) - { - webScriptServletRequest = (WebScriptServletRequest) current; - current = null; - } - else if (current instanceof WrappingWebScriptRequest) - { - current = ((WrappingWebScriptRequest) req).getNext(); - } - else - { - current = null; - } - } - while (current != null); - - // get the content type of request and ensure it's multipart/form-data - String contentType = req.getContentType(); - if (MULTIPART_FORMDATA.equals(contentType) && webScriptServletRequest != null) - { - String nodeRef = req.getParameter(PARAM_DESTINATION); - - if (nodeRef == null || nodeRef.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'destination' parameter was not provided in form data"); - } - - // create and check noderef - final NodeRef destination = new NodeRef(nodeRef); - if (nodeService.exists(destination)) - { - // check the destination is an RM container - if (!nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) || - !dictionaryService.isSubClass(nodeService.getType(destination), ContentModel.TYPE_FOLDER)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "NodeRef '" + destination + "' does not represent an Records Management container node."); - } - } - else - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "NodeRef '" + destination + "' does not exist."); - } - - // as there is no 'import capability' and the RM admin user is different from - // the DM admin user (meaning the webscript 'admin' authentication can't be used) - // perform a manual check here to ensure the current user has the RM admin role. - boolean isAdmin = filePlanRoleService.hasRMAdminRole( - filePlanService.getFilePlan(destination), - AuthenticationUtil.getRunAsUser()); - if (!isAdmin) - { - throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access Denied"); - } - - File acpFile = null; - try - { - // create a temporary file representing uploaded ACP file - FormField acpContent = webScriptServletRequest.getFileField(PARAM_ARCHIVE); - if (acpContent == null) - { - acpContent = webScriptServletRequest.getFileField(PARAM_FILEDATA); - if (acpContent == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'archive' file content was not provided in form data"); - } - } - - acpFile = TempFileProvider.createTempFile(TEMP_FILE_PREFIX, "." + ACPExportPackageHandler.ACP_EXTENSION); - - // copy contents of uploaded file to temp ACP file - FileOutputStream fos = new FileOutputStream(acpFile); - // NOTE: this method closes both streams - FileCopyUtils.copy(acpContent.getInputStream(), fos); - - if (logger.isDebugEnabled()) - { - logger.debug("Importing uploaded ACP (" + acpFile.getAbsolutePath() + ") into " + nodeRef); - } - - // setup the import handler - final ACPImportPackageHandler importHandler = new ACPImportPackageHandler(acpFile, "UTF-8"); - - // import the ACP file as the system user - AuthenticationUtil.runAs(new RunAsWork() - { - public NodeRef doWork() - { - importerService.importView(importHandler, new Location(destination), null, null); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - // create and return model - Map model = new HashMap<>(1); - model.put("success", true); - return model; - } - catch (FileNotFoundException fnfe) - { - throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, - "Failed to import ACP file", fnfe); - } - catch (IOException ioe) - { - throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, - "Failed to import ACP file", ioe); - } - finally - { - if (acpFile != null) - { - acpFile.delete(); - } - } - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Request is not " + MULTIPART_FORMDATA + " encoded"); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java deleted file mode 100644 index aac75da506..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -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.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.repository.PeriodProvider; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.util.StringUtils; - -/** - * Implementation for Java backed webscript to return lists - * of values for various records management services. - * - * @author Gavin Cornwell - */ -public class ListOfValuesGet extends DeclarativeWebScript -{ - protected RecordsManagementActionService rmActionService; - protected RecordsManagementAuditService rmAuditService; - protected RecordsManagementEventService rmEventService; - protected DispositionService dispositionService; - protected DictionaryService ddService; - protected NamespaceService namespaceService; - - /** - * Sets the RecordsManagementActionService instance - * - * @param rmActionService The RecordsManagementActionService instance - */ - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * Sets the RecordsManagementAuditService instance - * - * @param rmAuditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * Sets the RecordsManagementEventService instance - * - * @param rmEventService The RecordsManagementEventService instance - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * Sets the disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Sets the DictionaryService instance - * - * @param ddService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService ddService) - { - this.ddService = ddService; - } - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /* - * @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) - { - // add all the lists data to a Map - Map listsModel = new HashMap<>(4); - String requestUrl = req.getURL(); - listsModel.put("dispositionActions", createDispositionActionsModel(requestUrl)); - listsModel.put("events", createEventsModel(requestUrl)); - listsModel.put("periodTypes", createPeriodTypesModel(requestUrl)); - listsModel.put("periodProperties", createPeriodPropertiesModel(requestUrl)); - listsModel.put("auditEvents", createAuditEventsModel(requestUrl)); - - // create model object with the lists model - Map model = new HashMap<>(1); - model.put("lists", listsModel); - return model; - } - - /** - * Creates the model for the list of disposition actions. - * - * @param baseUrl The base URL of the service - * @return model of disposition actions list - */ - protected Map createDispositionActionsModel(String baseUrl) - { - // iterate over the disposition actions - List dispositionActions = this.rmActionService.getDispositionActions(); - List> items = new ArrayList<>(dispositionActions.size()); - for (RecordsManagementAction dispositionAction : dispositionActions) - { - Map item = new HashMap<>(2); - item.put("label", dispositionAction.getLabel()); - item.put("value", dispositionAction.getName()); - items.add(item); - } - - // create the model - Map model = new HashMap<>(2); - model.put("url", baseUrl + "/dispositionactions"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of events. - * - * @param baseUrl The base URL of the service - * @return model of events list - */ - protected Map createEventsModel(String baseUrl) - { - // get all the events including their display labels from the event service - List events = this.rmEventService.getEvents(); - List> items = new ArrayList<>(events.size()); - for (RecordsManagementEvent event : events) - { - Map item = new HashMap<>(3); - item.put("label", event.getDisplayLabel()); - item.put("value", event.getName()); - item.put("automatic", - this.rmEventService.getEventType(event.getType()).isAutomaticEvent()); - items.add(item); - } - - // create the model - Map model = new HashMap<>(2); - model.put("url", baseUrl + "/events"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of period types. - * - * @param baseUrl The base URL of the service - * @return model of period types list - */ - protected Map createPeriodTypesModel(String baseUrl) - { - // iterate over all period provides, but ignore 'cron' - Set providers = Period.getProviderNames(); - List> items = new ArrayList<>(providers.size()); - for (String provider : providers) - { - PeriodProvider pp = Period.getProvider(provider); - if (!pp.getPeriodType().equals("cron")) - { - Map item = new HashMap<>(2); - item.put("label", pp.getDisplayLabel()); - item.put("value", pp.getPeriodType()); - items.add(item); - } - } - - // create the model - Map model = new HashMap<>(2); - model.put("url", baseUrl + "/periodtypes"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of period properties. - * - * @param baseUrl The base URL of the service - * @return model of period properties list - */ - protected Map createPeriodPropertiesModel(String baseUrl) - { - // iterate over all period properties and get the label from their type definition - Collection dispositionProperties = dispositionService.getDispositionProperties(); - List> items = new ArrayList<>(dispositionProperties.size()); - for (DispositionProperty dispositionProperty : dispositionProperties) - { - PropertyDefinition propDef = dispositionProperty.getPropertyDefinition(); - QName propName = dispositionProperty.getQName(); - - if (propDef != null) - { - Map item = new HashMap<>(2); - String propTitle = propDef.getTitle(ddService); - if (propTitle == null || propTitle.length() == 0) - { - propTitle = StringUtils.capitalize(propName.getLocalName()); - } - item.put("label", propTitle); - item.put("value", propName.toPrefixString(this.namespaceService)); - items.add(item); - } - } - - // create the model - Map model = new HashMap<>(2); - model.put("url", baseUrl + "/periodproperties"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of audit events. - * - * @param baseUrl The base URL of the service - * @return model of audit events list - */ - protected Map createAuditEventsModel(String baseUrl) - { - // iterate over all audit events - List auditEvents = this.rmAuditService.getAuditEvents(); - List> items = new ArrayList<>(auditEvents.size()); - for (AuditEvent event : auditEvents) - { - Map item = new HashMap<>(2); - item.put("label", event.getLabel()); - item.put("value", event.getName()); - items.add(item); - } - - // create the model - Map model = new HashMap<>(2); - model.put("url", baseUrl + "/auditevents"); - model.put("items", items); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java deleted file mode 100644 index 484bff4a84..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return - * the values for an RM constraint. - */ -public class RMConstraintGet extends DeclarativeWebScript -{ - - /* - * @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 extensionPath = req.getExtensionPath(); - - String constraintName = extensionPath.replace('_', ':'); - - List values = caveatConfigService.getRMAllowedValues(constraintName); - - // create model object with the lists model - Map model = new HashMap<>(1); - model.put("allowedValuesForCurrentUser", values); - model.put("constraintName", extensionPath); - - return model; - } - - public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) - { - this.caveatConfigService = caveatConfigService; - } - - public RMCaveatConfigService getCaveatConfigService() - { - return caveatConfigService; - } - - private RMCaveatConfigService caveatConfigService; - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java deleted file mode 100644 index 031c25a475..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Record metadata aspects GET - * - * @author Roy Wetherall - */ -public class RecordMetaDataAspectsGet extends DeclarativeWebScript -{ - /** parameters */ - private static final String PARAM_NODEREF = "noderef"; - - protected DictionaryService dictionaryService; - protected NamespaceService namespaceService; - protected RecordService recordService; - protected FilePlanService filePlanService; - - /** - * Set the dictionary service instance - * - * @param dictionaryService the {@link DictionaryService} instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Sets the {@link NamespaceService} instance - * - * @param namespaceService The {@link NamespaceService} instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /* - * @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) - { - // Get the nodeRef and confirm it is valid - NodeRef nodeRef = null; - String nodeRefValue = req.getParameter(PARAM_NODEREF); - if (nodeRefValue == null || nodeRefValue.trim().length() == 0) - { - // get the file plan if a node ref hasn't been specified - // TODO will need to remove when multi file plans supported - nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - } - else - { - nodeRef = new NodeRef(nodeRefValue); - } - - // Get the details of all the aspects - Set aspectQNames = recordService.getRecordMetadataAspects(nodeRef); - List> aspects = new ArrayList<>(aspectQNames.size() + 1); - for (QName aspectQName : aspectQNames) - { - // Get the prefix aspect and default the label to the localname - String prefixString = aspectQName.toPrefixString(namespaceService); - String label = aspectQName.getLocalName(); - - Map aspect = new HashMap<>(2); - aspect.put("id", prefixString); - - // Try and get the aspect definition - AspectDefinition aspectDefinition = dictionaryService.getAspect(aspectQName); - if (aspectDefinition != null) - { - // Fet the label from the aspect definition - label = aspectDefinition.getTitle(dictionaryService); - } - aspect.put("value", label); - - // Add the aspect details to the aspects list - aspects.add(aspect); - } - - // create model object with the lists model - Map model = new HashMap<>(1); - model.put("aspects", aspects); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java deleted file mode 100644 index d62f1613f2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java deleted file mode 100644 index 7b2cebbe83..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java deleted file mode 100644 index e91fe54d8f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java deleted file mode 100644 index 2c28ecf1b4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -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; - -/** - * This class provides the implementation for the rmaction webscript. - * - * @author Neil McErlean - */ -public class RmActionPost extends DeclarativeWebScript -{ - private static Log logger = LogFactory.getLog(RmActionPost.class); - - private static final String PARAM_NAME = "name"; - private static final String PARAM_NODE_REF = "nodeRef"; - private static final String PARAM_NODE_REFS = "nodeRefs"; - private static final String PARAM_PARAMS = "params"; - - private NodeService nodeService; - private RecordsManagementActionService rmActionService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - @SuppressWarnings("unchecked") - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String reqContentAsString; - try - { - reqContentAsString = req.getContent().getContent(); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - - String actionName = null; - List targetNodeRefs = new ArrayList<>(1); - Map actionParams = new HashMap<>(3); - - try - { - JSONObject jsonObj = new JSONObject(new JSONTokener(reqContentAsString)); - - // Get the action name - if (jsonObj.has(PARAM_NAME)) - { - actionName = jsonObj.getString(PARAM_NAME); - } - - // Get the target references - if (jsonObj.has(PARAM_NODE_REF)) - { - NodeRef nodeRef = new NodeRef(jsonObj.getString(PARAM_NODE_REF)); - targetNodeRefs.add(nodeRef); - } - if (jsonObj.has(PARAM_NODE_REFS)) - { - JSONArray jsonArray = jsonObj.getJSONArray(PARAM_NODE_REFS); - if (jsonArray.length() != 0) - { - targetNodeRefs = new ArrayList<>(jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) - { - NodeRef nodeRef = new NodeRef(jsonArray.getString(i)); - targetNodeRefs.add(nodeRef); - } - } - } - - // params are optional. - if (jsonObj.has(PARAM_PARAMS)) - { - JSONObject paramsObj = jsonObj.getJSONObject(PARAM_PARAMS); - for (Iterator iter = paramsObj.keys(); iter.hasNext(); ) - { - String nextKeyString = iter.next(); - Object nextValue = paramsObj.get(nextKeyString); - - // Check for date values - if ((nextValue instanceof JSONObject) && ((JSONObject)nextValue).has("iso8601")) - { - String dateStringValue = ((JSONObject)nextValue).getString("iso8601"); - nextValue = ISO8601DateFormat.parse(dateStringValue); - } - - actionParams.put(nextKeyString, (Serializable)nextValue); - } - } - } - catch (JSONException exception) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request JSON.", exception); - } - - // validate input: check for mandatory params. - // Some RM actions can be posted without a nodeRef. - if (actionName == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "A mandatory parameter has not been provided in URL"); - } - - // Check that all the nodes provided exist and build report string - StringBuilder targetNodeRefsString = new StringBuilder(30); - boolean firstTime = true; - for (NodeRef targetNodeRef : targetNodeRefs) - { - if (!nodeService.exists(targetNodeRef)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The targetNode does not exist (" + targetNodeRef.toString() + ")"); - } - - // Build the string - if (firstTime) - { - firstTime = false; - } - else - { - targetNodeRefsString.append(", "); - } - targetNodeRefsString.append(targetNodeRef.toString()); - } - - // Proceed to execute the specified action on the specified node. - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Executing Record Action ") - .append(actionName) - .append(", (") - .append(targetNodeRefsString.toString()) - .append("), ") - .append(actionParams); - logger.debug(msg.toString()); - } - - Map model = new HashMap<>(); - if (targetNodeRefs.isEmpty()) - { - RecordsManagementActionResult result = this.rmActionService.executeRecordsManagementAction(actionName, actionParams); - if (result.getValue() != null) - { - model.put("result", result.getValue().toString()); - } - } - else - { - Map resultMap = this.rmActionService.executeRecordsManagementAction(targetNodeRefs, actionName, actionParams); - Map results = new HashMap<>(resultMap.size()); - for (Map.Entry entry : resultMap.entrySet()) - { - Object value = entry.getValue().getValue(); - if (value != null) - { - results.put(entry.getKey().toString(), value.toString()); - } - } - model.put("results", results); - } - - model.put("message", "Successfully queued action [" + actionName + "] on " + targetNodeRefsString.toString()); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java deleted file mode 100644 index 13e88f80ed..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.File; -import java.io.IOException; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.view.ExporterCrawlerParameters; -import org.alfresco.service.cmr.view.Location; -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.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Streams the nodes of a transfer object to the client in the form of an - * ACP file. - * - * @author Gavin Cornwell - */ -@Deprecated -public class TransferGet extends BaseTransferWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferGet.class); - - /** Content Streamer */ - private ContentStreamer contentStreamer; - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - @Override - protected File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException - { - // get all 'transferred' nodes - NodeRef[] itemsToTransfer = getTransferNodes(transferNode); - - // setup the ACP parameters - ExporterCrawlerParameters params = new ExporterCrawlerParameters(); - params.setCrawlSelf(true); - params.setCrawlChildNodes(true); - params.setExportFrom(new Location(itemsToTransfer)); - QName[] excludedAspects = new QName[] { - RenditionModel.ASPECT_RENDITIONED, - ContentModel.ASPECT_THUMBNAILED, - RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE, - RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH}; - params.setExcludeAspects(excludedAspects); - - // create an archive of all the nodes to transfer - File tempFile = createACP(params, ZIP_EXTENSION, true); - - if (logger.isDebugEnabled()) - { - logger.debug("Creating transfer archive for " + itemsToTransfer.length + - " items into file: " + tempFile.getAbsolutePath()); - } - - // stream the archive back to the client as an attachment (forcing save as) - contentStreamer.streamContent(req, res, tempFile, null, true, tempFile.getName(), null); - - // return the temp file for deletion - return tempFile; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java deleted file mode 100644 index d047074771..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.Date; -import java.util.List; - -import org.alfresco.model.ContentModel; -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.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Returns a JSON representation of a transfer report. - * - * @author Gavin Cornwell - */ -@Deprecated -public class TransferReportGet extends BaseTransferWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferReportGet.class); - - protected static final String REPORT_FILE_PREFIX = "report_"; - protected static final String REPORT_FILE_SUFFIX = ".json"; - - protected DictionaryService ddService; - protected DispositionService dispositionService; - protected ContentStreamer contentStreamer; - - /** - * Sets the DictionaryService instance - * - * @param ddService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService ddService) - { - this.ddService = ddService; - } - - /** - * Sets the disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - @Override - protected File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException - { - // generate the report (will be in JSON format) - File report = generateJSONTransferReport(transferNode); - - // stream the report back to the client - contentStreamer.streamContent(req, res, report, null, false, null, null); - - // return the file for deletion - return report; - } - - /** - * Generates a File containing the JSON representation of a transfer report. - * - * @param transferNode The transfer node - * @return File containing JSON representation of a transfer report - * @throws IOException - */ - File generateJSONTransferReport(NodeRef transferNode) throws IOException - { - File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX); - - // create the writer - try (FileOutputStream fileOutputStream = new FileOutputStream(report); - Writer writer = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF-8"))) - { - // get all 'transferred' nodes - NodeRef[] itemsToTransfer = getTransferNodes(transferNode); - - if (logger.isDebugEnabled()) - { - logger.debug("Generating JSON transfer report for " + itemsToTransfer.length + - " items into file: " + report.getAbsolutePath()); - } - - // use RMService to get disposition authority - String dispositionAuthority = null; - if (itemsToTransfer.length > 0) - { - // use the first transfer item to get to disposition schedule - DispositionSchedule ds = dispositionService.getDispositionSchedule(itemsToTransfer[0]); - if (ds != null) - { - dispositionAuthority = ds.getDispositionAuthority(); - } - } - - // write the JSON header - writer.write("{\n\t\"data\":\n\t{"); - writer.write("\n\t\t\"transferDate\": \""); - writer.write(ISO8601DateFormat.format( - (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED))); - writer.write("\",\n\t\t\"transferPerformedBy\": \""); - writer.write(AuthenticationUtil.getRunAsUser()); - writer.write("\",\n\t\t\"dispositionAuthority\": \""); - writer.write(dispositionAuthority != null ? dispositionAuthority : ""); - writer.write("\",\n\t\t\"items\":\n\t\t["); - - // write out JSON representation of items to transfer - generateTransferItemsJSON(writer, itemsToTransfer); - - // write the JSON footer - writer.write("\n\t\t]\n\t}\n}"); - } - - return report; - } - - /** - * Generates the JSON to represent the given NodeRefs - * - * @param writer Writer to write to - * @param itemsToTransfer NodeRefs being transferred - * @throws IOException - */ - protected void generateTransferItemsJSON(Writer writer, NodeRef[] itemsToTransfer) - throws IOException - { - boolean first = true; - for (NodeRef item : itemsToTransfer) - { - if (first) - { - first = false; - } - else - { - writer.write(","); - } - - if (ddService.isSubClass(nodeService.getType(item), ContentModel.TYPE_FOLDER)) - { - generateTransferFolderJSON(writer, item); - } - else - { - generateTransferRecordJSON(writer, item); - } - } - } - - /** - * Generates the JSON to represent the given folder. - * - * @param writer Writer to write to - * @param folderNode Folder being transferred - * @throws IOException - */ - protected void generateTransferFolderJSON(Writer writer, NodeRef folderNode) - throws IOException - { - // TODO: Add identation - - writer.write("\n{\n\"type\":\"folder\",\n"); - writer.write("\"name\":\""); - writer.write((String)nodeService.getProperty(folderNode, ContentModel.PROP_NAME)); - writer.write("\",\n\"nodeRef\":\""); - writer.write(folderNode.toString()); - writer.write("\",\n\"id\":\""); - writer.write((String)nodeService.getProperty(folderNode, RecordsManagementModel.PROP_IDENTIFIER)); - writer.write("\",\n\"children\":\n["); - - boolean first = true; - List assocs = this.nodeService.getChildAssocs(folderNode, - ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - if (first) - { - first = false; - } - else - { - writer.write(","); - } - - NodeRef childRef = child.getChildRef(); - if (ddService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER)) - { - generateTransferFolderJSON(writer, childRef); - } - else - { - generateTransferRecordJSON(writer, childRef); - } - } - - writer.write("\n]\n}"); - } - - /** - * Generates the JSON to represent the given record. - * - * @param writer Writer to write to - * @param recordNode Record being transferred - * @throws IOException - */ - protected void generateTransferRecordJSON(Writer writer, NodeRef recordNode) - throws IOException - { - writer.write("\n{\n\"type\":\"record\",\n"); - writer.write("\"name\":\""); - writer.write((String)nodeService.getProperty(recordNode, ContentModel.PROP_NAME)); - writer.write("\",\n\"nodeRef\":\""); - writer.write(recordNode.toString()); - writer.write("\",\n\"id\":\""); - writer.write((String)nodeService.getProperty(recordNode, RecordsManagementModel.PROP_IDENTIFIER)); - writer.write("\""); - - if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD)) - { - writer.write(",\n\"declaredBy\":\""); - writer.write((String)nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_BY)); - writer.write("\",\n\"declaredAt\":\""); - writer.write(ISO8601DateFormat.format( - (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT))); - writer.write("\""); - } - - writer.write("\n}"); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java deleted file mode 100644 index 1455199d5d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java +++ /dev/null @@ -1,453 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Serializable; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -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.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.lang3.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ParameterCheck; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Files a transfer report as a record. - * - * @author Gavin Cornwell - */ -@Deprecated -public class TransferReportPost extends BaseTransferWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferReportPost.class); - - protected static final String REPORT_FILE_PREFIX = "report_"; - protected static final String REPORT_FILE_SUFFIX = ".html"; - protected static final String PARAM_DESTINATION = "destination"; - protected static final String RESPONSE_SUCCESS = "success"; - protected static final String RESPONSE_RECORD = "record"; - protected static final String RESPONSE_RECORD_NAME = "recordName"; - - protected DictionaryService ddService; - protected RecordsManagementActionService rmActionService; - protected DispositionService dispositionService; - protected ContentService contentService; - - /** - * Sets the DictionaryService instance - * - * @param ddService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService ddService) - { - this.ddService = ddService; - } - - /** - * Sets the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Sets the RecordsManagementActionService instance - * - * @param rmActionService RecordsManagementActionService instance - */ - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * Sets the ContentSerivce instance - * - * @param contentService ContentService instance - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException - { - File report = null; - - // retrieve requested format - String format = req.getFormat(); - Map model = new HashMap<>(); - model.put("status", status); - model.put("cache", cache); - - try - { - // extract the destination parameter, ensure it's present and it is - // a record folder - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - if (!json.has(PARAM_DESTINATION)) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "Mandatory '" + PARAM_DESTINATION + "' parameter has not been supplied"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return null; - } - - String destinationParam = json.getString(PARAM_DESTINATION); - NodeRef destination = new NodeRef(destinationParam); - - if (!this.nodeService.exists(destination)) - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "Node " + destination.toString() + " does not exist"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return null; - } - - // ensure the node is a filePlan object - if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(this.nodeService.getType(destination))) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "Node " + destination.toString() + " is not a record folder"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return null; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Filing transfer report as record in record folder: " + destination); - } - - // generate the report (will be in JSON format) - report = generateHTMLTransferReport(transferNode); - - // file the report as a record - NodeRef record = fileTransferReport(report, destination); - - if (logger.isDebugEnabled()) - { - logger.debug("Filed transfer report as new record: " + record); - } - - // return success flag and record noderef as JSON - JSONObject responseJSON = new JSONObject(); - responseJSON.put(RESPONSE_SUCCESS, (record != null)); - if (record != null) - { - responseJSON.put(RESPONSE_RECORD, record.toString()); - responseJSON.put(RESPONSE_RECORD_NAME, - (String)nodeService.getProperty(record, ContentModel.PROP_NAME)); - } - - // setup response - String jsonString = responseJSON.toString(); - res.setContentType(MimetypeMap.MIMETYPE_JSON); - res.setContentEncoding("UTF-8"); - res.setHeader("Content-Length", Long.toString(jsonString.length())); - - // write the JSON response - res.getWriter().write(jsonString); - } - catch (JSONException je) - { - throw createStatusException(je, req, res); - } - - // return the file for deletion - return report; - } - - /** - * Generates a File containing the JSON representation of a transfer report. - * - * @param transferNode The transfer node - * @return File containing JSON representation of a transfer report - * @throws IOException - */ - File generateHTMLTransferReport(NodeRef transferNode) throws IOException - { - File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX); - - // create the writer - try (FileOutputStream fileOutputStream = new FileOutputStream(report) ; - Writer writer = new OutputStreamWriter(fileOutputStream, Charset.forName("UTF-8"))) - { - // get all 'transferred' nodes - NodeRef[] itemsToTransfer = getTransferNodes(transferNode); - - if (logger.isDebugEnabled()) - { - logger.debug("Generating HTML transfer report for " + itemsToTransfer.length + - " items into file: " + report.getAbsolutePath()); - } - - // use RMService to get disposition authority - String dispositionAuthority = null; - if (itemsToTransfer.length > 0) - { - // use the first transfer item to get to disposition schedule - DispositionSchedule ds = dispositionService.getDispositionSchedule(itemsToTransfer[0]); - if (ds != null) - { - dispositionAuthority = ds.getDispositionAuthority(); - } - } - - // write the HTML header - writer.write("\n"); - writer.write("\n\n"); - Boolean isAccession = (Boolean)this.nodeService.getProperty(transferNode, PROP_TRANSFER_ACCESSION_INDICATOR); - if (isAccession) - { - writer.write("Accession Report\n"); - } - else - { - writer.write("Transfer Report\n"); - } - writer.write("\n"); - if (isAccession) - { - writer.write("\n

Accession Report

\n"); - } - else - { - writer.write("\n

Transfer Report

\n"); - } - - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - writer.write("
Transfer Date:"); - Date transferDate = (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED); - writer.write(StringEscapeUtils.escapeHtml4(transferDate.toString())); - writer.write("
Transfer Location:"); - if (isAccession) - { - writer.write("NARA"); - } - else - { - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(transferNode, - RecordsManagementModel.PROP_TRANSFER_LOCATION))); - } - writer.write("
Performed By:"); - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(transferNode, - ContentModel.PROP_CREATOR))); - writer.write("
Disposition Authority:"); - writer.write(dispositionAuthority != null ? StringEscapeUtils.escapeHtml4(dispositionAuthority) : ""); - writer.write("
\n"); - - writer.write("

Transferred Items

\n"); - - // write out HTML representation of items to transfer - generateTransferItemsHTML(writer, itemsToTransfer); - - // write the HTML footer - writer.write(""); - } - - return report; - } - - /** - * Generates the JSON to represent the given NodeRefs - * - * @param writer Writer to write to - * @param itemsToTransfer NodeRefs being transferred - * @throws IOException - */ - protected void generateTransferItemsHTML(Writer writer, NodeRef[] itemsToTransfer) - throws IOException - { - for (NodeRef item : itemsToTransfer) - { - writer.write("
\n"); - if (ddService.isSubClass(nodeService.getType(item), ContentModel.TYPE_FOLDER)) - { - generateTransferFolderHTML(writer, item); - } - else - { - generateTransferRecordHTML(writer, item); - } - writer.write("
\n"); - } - } - - /** - * Generates the JSON to represent the given folder. - * - * @param writer Writer to write to - * @param folderNode Folder being transferred - * @throws IOException - */ - protected void generateTransferFolderHTML(Writer writer, NodeRef folderNode) - throws IOException - { - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(folderNode, - ContentModel.PROP_NAME))); - writer.write(" (Unique Folder Identifier: "); - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(folderNode, - RecordsManagementModel.PROP_IDENTIFIER))); - writer.write(")\n"); - - writer.write("
\n"); - - // NOTE: we don't expect any nested folder structures so just render - // the records contained in the folder. - - List assocs = this.nodeService.getChildAssocs(folderNode, - ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - NodeRef childRef = child.getChildRef(); - if (this.nodeService.hasAspect(childRef, RecordsManagementModel.ASPECT_RECORD)) - { - generateTransferRecordHTML(writer, childRef); - } - } - - writer.write("\n
\n"); - } - - /** - * Generates the JSON to represent the given record. - * - * @param writer Writer to write to - * @param recordNode Record being transferred - * @throws IOException - */ - protected void generateTransferRecordHTML(Writer writer, NodeRef recordNode) - throws IOException - { - writer.write("
\n"); - writer.write(" "); - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(recordNode, - ContentModel.PROP_NAME))); - writer.write(" (Unique Record Identifier: "); - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(recordNode, - RecordsManagementModel.PROP_IDENTIFIER))); - writer.write(")"); - - if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD)) - { - Date declaredOn = (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT); - writer.write(" declared by "); - writer.write(StringEscapeUtils.escapeHtml4((String)this.nodeService.getProperty(recordNode, - RecordsManagementModel.PROP_DECLARED_BY))); - writer.write(" on "); - writer.write(StringEscapeUtils.escapeHtml4(declaredOn.toString())); - } - - writer.write("\n
\n"); - } - - /** - * Files the given transfer report as a record in the given record folder. - * - * @param report Report to file - * @param destination The destination record folder - * @return NodeRef of the created record - */ - protected NodeRef fileTransferReport(File report, NodeRef destination) - { - ParameterCheck.mandatory("report", report); - ParameterCheck.mandatory("destination", destination); - - NodeRef record = null; - - Map properties = new HashMap<>(1); - properties.put(ContentModel.PROP_NAME, report.getName()); - - // file the transfer report as an undeclared record - record = this.nodeService.createNode(destination, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(report.getName())), - ContentModel.TYPE_CONTENT, properties).getChildRef(); - - // Set the content - ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_HTML); - writer.setEncoding("UTF-8"); - writer.putContent(report); - - return record; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java deleted file mode 100644 index d9fba3bee0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.model.ContentModel; -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.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PersonService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return user rights report. - * - * @author Gavin Cornwell - */ -public class UserRightsReportGet extends DeclarativeWebScript -{ - protected AuthorityService authorityService; - protected PersonService personService; - protected NodeService nodeService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanService filePlanService; - - /** - * Sets the AuthorityService instance - * - * @param authorityService AuthorityService instance - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Sets the PersonService instance - * - * @param personService PersonService instance - */ - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - /** - * Sets the NodeService instance - * - * @param nodeService NodeService instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /* - * @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 filePlanNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - if (filePlanNode == null) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "The default RM site could not be found."); - return null; - } - - // construct all the maps etc. needed to build the model - Map usersMap = new HashMap<>(8); - Map rolesMap = new HashMap<>(8); - Map groupsMap = new HashMap<>(8); - - // iterate over all the roles for the file plan and construct models - Set roles = filePlanRoleService.getRoles(filePlanNode); - for (Role role : roles) - { - // get or create the RoleModel object for current role - String roleName = role.getName(); - RoleModel roleModel = rolesMap.get(roleName); - if (roleModel == null) - { - roleModel = new RoleModel(role); - rolesMap.put(roleName, roleModel); - } - - // get the users for the current RM role - String group = role.getRoleGroupName(); - Set users = authorityService.getContainedAuthorities(AuthorityType.USER, group, false); - roleModel.setUsers(users); - - // setup a user model object for each user - for (String userName : users) - { - UserModel userModel = usersMap.get(userName); - if (userModel == null) - { - NodeRef userRef = this.personService.getPerson(userName); - userModel = new UserModel(userName, - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_FIRSTNAME), - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_LASTNAME)); - usersMap.put(userName, userModel); - } - - userModel.addRole(roleName); - } - - // get the groups for the cuurent RM role - Set groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, group, false); - roleModel.setGroups(groups); - - // setup a user model object for each user in each group - for (String groupName : groups) - { - GroupModel groupModel = groupsMap.get(groupName); - if (groupModel == null) - { - groupModel = new GroupModel(groupName, - authorityService.getAuthorityDisplayName(groupName)); - groupsMap.put(groupName, groupModel); - } - - // get users in each group - Set groupUsers = this.authorityService.getContainedAuthorities(AuthorityType.USER, groupName, true); - for (String userName : groupUsers) - { - UserModel userModel = usersMap.get(userName); - if (userModel == null) - { - NodeRef userRef = this.personService.getPerson(userName); - userModel = new UserModel(userName, - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_FIRSTNAME), - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_LASTNAME)); - usersMap.put(userName, userModel); - } - - userModel.addGroup(groupName); - userModel.addRole(roleName); - groupModel.addUser(userName); - } - } - } - - // add all the lists data to a Map - Map reportModel = new HashMap<>(4); - reportModel.put("users", usersMap); - reportModel.put("roles", rolesMap); - reportModel.put("groups", groupsMap); - - // create model object with the lists model - Map model = new HashMap<>(1); - model.put("report", reportModel); - return model; - } - - /** - * Class to represent a role for use in a Freemarker template. - * - * @author Gavin Cornwell - */ - public class RoleModel extends Role - { - private Set users = new HashSet<>(8); - private Set groups = new HashSet<>(8); - - public RoleModel(Role role) - { - super(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName()); - } - - public void addUser(String username) - { - this.users.add(username); - } - - public void addGroup(String groupName) - { - this.groups.add(groupName); - } - - public void setUsers(Set users) - { - this.users = users; - } - - public void setGroups(Set groups) - { - this.groups = groups; - } - - public Set getUsers() - { - return this.users; - } - - public Set getGroups() - { - return this.groups; - } - } - - /** - * Class to represent a user for use in a Freemarker template. - * - * @author Gavin Cornwell - */ - public class UserModel - { - private String userName; - private String firstName; - private String lastName; - private Set roles; - private Set groups; - - public UserModel(String userName, String firstName, String lastName) - { - this.userName = userName; - this.firstName = firstName; - this.lastName = lastName; - this.roles = new HashSet<>(2); - this.groups = new HashSet<>(2); - } - - public String getUserName() - { - return this.userName; - } - - public String getFirstName() - { - return this.firstName; - } - - public String getLastName() - { - return this.lastName; - } - - public Set getRoles() - { - return this.roles; - } - - public Set getGroups() - { - return this.groups; - } - - public void addRole(String roleName) - { - this.roles.add(roleName); - } - - public void addGroup(String groupName) - { - this.groups.add(groupName); - } - } - - /** - * Class to represent a group for use in a Freemarker template. - * - * @author Gavin Cornwell - */ - public class GroupModel - { - private String name; - private String label; - private Set users; - - public GroupModel(String name, String label) - { - this.name = name; - this.label = label; - this.users = new HashSet<>(4); - } - - public String getName() - { - return this.name; - } - - public String getDisplayLabel() - { - return this.label; - } - - public Set getUsers() - { - return this.users; - } - - public void addUser(String userName) - { - this.users.add(userName); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java deleted file mode 100644 index bff157591b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import org.apache.commons.lang3.StringUtils; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Base class for Records management event web scripts - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RMEventBase extends DeclarativeWebScript -{ - /** - * Helper method for getting the value for a key from a JSON object - * - * @param json The request content as JSON object - * @param key The key for which the value should be retrieved (e.g. "eventName") - * @return String The value for the provided key if the key exists, null otherwise - * @throws JSONException If there is no string value for the key - */ - protected String getValue(JSONObject json, String key) throws JSONException - { - String result = null; - if (json.has(key)) - { - result = json.getString(key); - } - return result; - } - - /** - * Helper method for checking the key (e.g. "eventName") - * - * @param key String The key which will be checked - * @param msg String The error message to throw if the key doesn't have a value - */ - protected void doCheck(String key, String msg) - { - if (StringUtils.isBlank(key)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, msg); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java deleted file mode 100644 index b3b9d964d3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -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; - -/** - * Records management event delete web script - * - * @author Roy Wetherall - */ -public class RmEventDelete extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Event name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String eventName = templateVars.get("eventname"); - if (eventName == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided on the URL."); - } - - // Check the event exists - if (!rmEventService.existsEvent(eventName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The event " + eventName + " does not exist."); - } - - // Remove the event - rmEventService.removeEvent(eventName); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java deleted file mode 100644 index f1be2de7cc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -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; - -/** - * Records management event GET web script - * - * @author Roy Wetherall - */ -public class RmEventGet extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Event name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String eventName = templateVars.get("eventname"); - if (eventName == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided on the URL."); - } - - // Check the event exists - if (!rmEventService.existsEvent(eventName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The event " + eventName + " does not exist."); - } - - // Get the event - RecordsManagementEvent event = rmEventService.getEvent(eventName); - model.put("event", event); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java deleted file mode 100644 index cd1364bdc5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.util.ParameterCheck; -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; - -/** - * Records management event PUT web script - * - * @author Roy Wetherall - */ -public class RmEventPut extends RMEventBase -{ - /** Parameter names */ - public static final String PARAM_EVENTNAME = "eventname"; - - /** Records management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - ParameterCheck.mandatory("req", req); - - Map model = new HashMap<>(); - JSONObject json = null; - try - { - // Convert the request content to JSON - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Check the event name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String eventName = templateVars.get(PARAM_EVENTNAME); - if (eventName == null || - eventName.isEmpty() || - !rmEventService.existsEvent(eventName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided."); - } - - // Check the event display label - String eventDisplayLabel = getValue(json, "eventDisplayLabel"); - doCheck(eventDisplayLabel, "No event display label was provided."); - - // Check the event type - String eventType = getValue(json, "eventType"); - doCheck(eventType, "No event type was provided."); - - // Check if the event can be edited or not - RecordsManagementEvent event = null; - if (canEditEvent(eventDisplayLabel, eventName, eventType)) - { - // Create event - event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); - } - else - { - // Get event - event = rmEventService.getEvent(eventName); - } - - model.put("event", event); - } - 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); - } - - return model; - } - - /** - * Helper method for checking if an event can be edited or not. Throws an - * error if an event with the same display label already exists. - * - * @param eventDisplayLabel The display label of the event - * @param eventName The name of the event - * @param eventType The type of the event - * @return true if the event can be edited, false otherwise - */ - private boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType) - { - boolean canEditEvent; - - try - { - canEditEvent = rmEventService.canEditEvent(eventDisplayLabel, eventName, eventType); - } - catch (AlfrescoRuntimeException are) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, are.getLocalizedMessage(), are); - } - - return canEditEvent; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java deleted file mode 100644 index 2610cc0006..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management event types GET web script - * - * @author Roy Wetherall - */ -public class RmEventTypesGet extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Get the events - List events = rmEventService.getEventTypes(); - model.put("eventtypes", events); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java deleted file mode 100644 index 9840dd1bbe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management events GET web script - * - * @author Roy Wetherall - */ -public class RmEventsGet extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Get the events - List events = rmEventService.getEvents(); - model.put("events", events); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java deleted file mode 100644 index 957180f9fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.util.GUID; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -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; - -/** - * Records management event POST web script - * - * @author Roy Wetherall - */ -public class RmEventsPost extends RMEventBase -{ - /** Records management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - ParameterCheck.mandatory("req", req); - - Map model = new HashMap<>(); - JSONObject json = null; - try - { - // Convert the request content to JSON - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Get the event name - String eventName = getEventName(json); - - // Check the event display label - String eventDisplayLabel = getValue(json, "eventDisplayLabel"); - doCheck(eventDisplayLabel, "No event display label was provided."); - - // Check if the event can be created - canCreateEvent(eventDisplayLabel, eventName); - - // Check the event type - String eventType = getValue(json, "eventType"); - doCheck(eventType, "No event type was provided."); - - // Create event - RecordsManagementEvent event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); - - model.put("event", event); - } - 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); - } - - return model; - } - - /** - * Helper method for getting the event name - * - * @param json The request content as JSON object - * @return String The event name. A generated GUID if it doesn't exist - * @throws JSONException If there is no string value for the key - */ - private String getEventName(JSONObject json) throws JSONException - { - String eventName = getValue(json, "eventName"); - - if (StringUtils.isBlank(eventName)) - { - // Generate the event name - eventName = GUID.generate(); - } - - return eventName; - } - - /** - * Helper method for checking if an event can be created or not. Throws an - * error if the event already exists. - * - * @param eventDisplayLabel The display label of the event - * @param eventName The name of the event - */ - private boolean canCreateEvent(String eventDisplayLabel, String eventName) - { - boolean canCreateEvent = true; - - if (!rmEventService.canCreateEvent(eventDisplayLabel, eventName)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Cannot create event. An event with the display label '" - + eventDisplayLabel + "' already exists."); - } - - return canCreateEvent; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java deleted file mode 100644 index 8c29e857bd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Delete role web script - * - * @author Roy Wetherall - */ -public class RmRoleDelete extends RoleDeclarativeWebScript -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Role name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String roleParam = templateVars.get("rolename"); - if (StringUtils.isBlank(roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - // Check that the role exists - if (!filePlanRoleService.existsRole(filePlan, roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The role " + roleParam + " does not exist on the records managment root " + filePlan.toString()); - } - - filePlanRoleService.deleteRole(filePlan, roleParam); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java deleted file mode 100644 index 966029a1a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.Map; - -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; - -/** - * Role GET web script API - * - * @author Roy Wetherall - */ -public class RmRoleGet extends RoleDeclarativeWebScript -{ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Role name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String roleParam = templateVars.get("rolename"); - if (roleParam == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - // Check that the role exists - if (!filePlanRoleService.existsRole(filePlan, roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The role " + roleParam + " does not exist on the records managment root " + filePlan); - } - - RoleItem item = new RoleItem(filePlanRoleService.getRole(filePlan, roleParam)); - model.put("role", item); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java deleted file mode 100644 index 8d82590be0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -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.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.json.JSONArray; -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; - -/** - * - * - * @author Roy Wetherall - */ -public class RmRolePut extends RoleDeclarativeWebScript -{ - private CapabilityService capabilityService; - - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - JSONObject json = null; - try - { - // Role name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String roleParam = templateVars.get("rolename"); - if (roleParam == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); - } - - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - String name = json.getString("name"); - // TODO check - String displayLabel = json.getString("displayLabel"); - // TODO check - - JSONArray capabilitiesArray = json.getJSONArray("capabilities"); - Set capabilites = new HashSet<>(capabilitiesArray.length()); - for (int i = 0; i < capabilitiesArray.length(); i++) - { - Capability capability = capabilityService.getCapability(capabilitiesArray.getString(i)); - capabilites.add(capability); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - // Check that the role exists - if (!filePlanRoleService.existsRole(filePlan, roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The role " + roleParam + " does not exist on the records managment root " + filePlan); - } - - Role role = filePlanRoleService.updateRole(filePlan, name, displayLabel, capabilites); - model.put("role", new RoleItem(role)); - - } - 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); - } - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java deleted file mode 100644 index a9ea8d4cd5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.role.Role; -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; - -/** - * Get information about record management roles - * - * @author Roy Wetherall - */ -public class RmRolesGet extends RoleDeclarativeWebScript -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - Set roles = null; - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_FOUND, "File plan does not exist."); - } - - // get the includesystem parameter - boolean includeSystem = false; - String includeSystemValue = req.getParameter("is"); - if (includeSystemValue != null && includeSystemValue.length() != 0) - { - includeSystem = Boolean.parseBoolean(includeSystemValue); - } - - // get the user filter - String user = req.getParameter("user"); - if (user != null && user.length() != 0) - { - roles = filePlanRoleService.getRolesByUser(filePlan, user, includeSystem); - } - else - { - roles = filePlanRoleService.getRoles(filePlan, includeSystem); - } - - // get the auths parameter - boolean showAuths = false; - String auths = req.getParameter("auths"); - if (auths != null && auths.length() != 0) - { - showAuths = Boolean.parseBoolean(auths); - } - - Set items = createRoleItems(filePlan, roles, showAuths); - model.put("roles", items); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java deleted file mode 100644 index e8f99cd1fb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -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.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.json.JSONArray; -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; - -/** - * RM Roles Post implementation - * - * @author Roy Wetherall - */ -public class RmRolesPost extends RoleDeclarativeWebScript -{ - private CapabilityService capabilityService; - - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(); - JSONObject json = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - String name = json.getString("name"); - // TODO check - String displayString = json.getString("displayLabel"); - // TODO check - - JSONArray capabilitiesArray = json.getJSONArray("capabilities"); - Set capabilites = new HashSet<>(capabilitiesArray.length()); - for (int i = 0; i < capabilitiesArray.length(); i++) - { - Capability capability = capabilityService.getCapability(capabilitiesArray.getString(i)); - capabilites.add(capability); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - Role role = filePlanRoleService.createRole(filePlan, name, displayString, capabilites); - model.put("role", new RoleItem(role)); - - } - 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); - } - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java deleted file mode 100644 index f3bef8d3cf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.admin; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -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.role.Role; -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.lang3.StringUtils; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Base declarative web script for role API. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RoleDeclarativeWebScript extends DeclarativeWebScript -{ - /** File plan service */ - protected FilePlanService filePlanService; - - /** File plan role service */ - protected FilePlanRoleService filePlanRoleService; - - /** Authority service */ - protected AuthorityService authorityService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Utility method to get the file plan from the passed parameters. - * - * @param req - * @return - */ - protected NodeRef getFilePlan(WebScriptRequest req) - { - NodeRef filePlan = null; - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("siteid"); - if (siteId != null) - { - filePlan = filePlanService.getFilePlanBySiteId(siteId); - } - - if (filePlan == null) - { - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String id = templateVars.get("id"); - - if (!StringUtils.isEmpty(storeType) && - !StringUtils.isEmpty(storeId) && - !StringUtils.isEmpty(id)) - { - StoreRef storeRef = new StoreRef(storeType, storeId); - NodeRef nodeRef = new NodeRef(storeRef, id); - if (filePlanService.isFilePlan(nodeRef)) - { - filePlan = nodeRef; - } - } - } - - if (filePlan == null) - { - // Assume we are in a legacy repository and we will grab the default file plan - filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - - return filePlan; - } - - /** - * Create role items - * - * @param filePlan - * @param roles - * @return - */ - protected Set createRoleItems(NodeRef filePlan, Set roles) - { - return createRoleItems(filePlan, roles, false); - } - - /** - * Create role items - * - * @param filePlan - * @param roles - * @param showAuths - * @return - */ - protected Set createRoleItems(NodeRef filePlan, Set roles, boolean showAuths) - { - Set items = new HashSet<>(roles.size()); - for (Role role : roles) - { - RoleItem item = null; - if (showAuths) - { - item = new RoleItem(role, - createAuthorityItems(filePlanRoleService.getUsersAssignedToRole(filePlan, role.getName())), - createAuthorityItems(filePlanRoleService.getGroupsAssignedToRole(filePlan, role.getName()))); - } - else - { - item = new RoleItem(role); - } - items.add(item); - } - return items; - } - - /** - * Create authority items - * - * @param authorities - * @return - */ - private Set createAuthorityItems(Set authorities) - { - Set result = new HashSet<>(authorities.size()); - - for (String authority : authorities) - { - String displayLabel = authority; - if (!AuthorityType.getAuthorityType(authority).equals(AuthorityType.USER)) - { - displayLabel = authorityService.getAuthorityDisplayName(authority); - } - result.add(new AuthorityItem(authority, displayLabel)); - } - - return result; - } - - /** - * Role Item Helper Class - * - * @author Roy Wetherall - * @since 2.1 - */ - public class RoleItem - { - private String name; - private String groupShortName; - private String displayLabel; - private Set capabilities; - private boolean showAuths = false; - private Set assignedUsers; - private Set assignedGroups; - - public RoleItem(Role role) - { - this.name = role.getName(); - this.displayLabel = role.getDisplayLabel(); - this.capabilities = role.getCapabilities(); - } - - public RoleItem(Role role, Set assignedUsers, Set assignedGroups) - { - this.name = role.getName(); - this.groupShortName = role.getGroupShortName(); - this.displayLabel = role.getDisplayLabel(); - this.capabilities = role.getCapabilities(); - this.showAuths = true; - this.assignedUsers = assignedUsers; - this.assignedGroups = assignedGroups; - } - - public String getName() - { - return name; - } - - public String getGroupShortName() - { - return groupShortName; - } - - public String getDisplayLabel() - { - return displayLabel; - } - - public Set getCapabilities() - { - return capabilities; - } - - public boolean getShowAuths() - { - return showAuths; - } - - public Set getAssignedGroups() - { - return assignedGroups; - } - - public Set getAssignedUsers() - { - return assignedUsers; - } - } - - /** - * Authority Item Helper Class - * - * @author Roy Wetherall - * @since 2.1 - */ - public class AuthorityItem - { - private String name; - private String displayLabel; - - public AuthorityItem(String name, String displayLabel) - { - this.name = name; - this.displayLabel = displayLabel; - } - - public String getName() - { - return name; - } - - public String getDisplayLabel() - { - return displayLabel; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java deleted file mode 100644 index 02a7ccd5f1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.capability; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import javax.servlet.http.HttpServletResponse; - -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.Group; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.lang3.StringUtils; -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; - -/** - * Capabilities GET web service implementation. - */ -public class CapabilitiesGet extends DeclarativeWebScript -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.web.scripts.content.StreamContent#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 templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String nodeId = templateVars.get("id"); - - NodeRef nodeRef = null; - if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(nodeId)) - { - nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); - } - else - { - // we are talking about the file plan node - // TODO we are making the assumption there is only one file plan here! - nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (nodeRef == null) - { - throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The default file plan node could not be found."); - } - } - - boolean grouped = false; - String groupedString = req.getParameter("grouped"); - if (StringUtils.isNotBlank(groupedString)) - { - grouped = Boolean.parseBoolean(groupedString); - } - - Map model = new TreeMap<>(); - if (grouped) - { - // Construct the map which is needed to build the model - Map groupedCapabilitiesMap = new TreeMap<>(); - - List groups = capabilityService.getGroups(); - for (Group group : groups) - { - String capabilityGroupTitle = group.getTitle(); - if (StringUtils.isNotBlank(capabilityGroupTitle)) - { - String capabilityGroupId = group.getId(); - - List capabilities = capabilityService.getCapabilitiesByGroupId(capabilityGroupId); - for (Capability capability : capabilities) - { - String capabilityName = capability.getName(); - String capabilityTitle = capability.getTitle(); - - if (groupedCapabilitiesMap.containsKey(capabilityGroupId)) - { - groupedCapabilitiesMap.get(capabilityGroupId).addCapability(capabilityName, capabilityTitle); - } - else - { - GroupedCapabilities groupedCapabilities = new GroupedCapabilities(capabilityGroupId, capabilityGroupTitle, capabilityName, capabilityTitle); - groupedCapabilities.addCapability(capabilityName, capabilityTitle); - groupedCapabilitiesMap.put(capabilityGroupId, groupedCapabilities); - } - } - } - } - model.put("groupedCapabilities", groupedCapabilitiesMap); - } - else - { - boolean includePrivate = false; - String includePrivateString = req.getParameter("includeAll"); - if (StringUtils.isNotBlank(includePrivateString)) - { - includePrivate = Boolean.parseBoolean(includePrivateString); - } - - Map map = capabilityService.getCapabilitiesAccessState(nodeRef, includePrivate); - List list = new ArrayList<>(map.size()); - for (Map.Entry entry : map.entrySet()) - { - AccessStatus accessStatus = entry.getValue(); - if (!AccessStatus.DENIED.equals(accessStatus)) - { - Capability capability = entry.getKey(); - list.add(capability.getName()); - } - } - model.put("capabilities", list); - } - - return model; - } - - /** - * Class to represent grouped capabilities for use in a Freemarker template - * - */ - public class GroupedCapabilities - { - private String capabilityGroupId; - private String capabilityGroupTitle; - private String capabilityName; - private String capabilityTitle; - private Map capabilities; - - public GroupedCapabilities(String capabilityGroupId, String capabilityGroupTitle, String capabilityName, String capabilityTitle) - { - this.capabilityGroupId = capabilityGroupId; - this.capabilityGroupTitle = capabilityGroupTitle; - this.capabilityName = capabilityName; - this.capabilityTitle = capabilityTitle; - this.capabilities = new TreeMap<>(); - } - - public String getGroupId() - { - return this.capabilityGroupId; - } - - public String getGroupTitle() - { - return this.capabilityGroupTitle; - } - - public String getCapabilityName() - { - return this.capabilityName; - } - - public String getCapabilityTitle() - { - return this.capabilityTitle; - } - - public Map getCapabilities() - { - return this.capabilities; - } - - public void addCapability(String capabilityName, String capabilityTitle) - { - this.capabilities.put(capabilityName, capabilityTitle); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java deleted file mode 100644 index ea8954c1ef..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.util.NodeTypeUtility; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -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; - -/** - * Base class for the hold webscripts - * - * @author Tuna Aksoy - * @since 2.2 - */ -public abstract class BaseHold extends DeclarativeWebScript -{ - /** Hold Service */ - private HoldService holdService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** node service */ - private NodeService nodeService; - - /** Node type utility */ - private NodeTypeUtility nodeTypeUtility; - - /** - * Set the hold service - * - * @param holdService the hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param nodeTypeUtility node type utility - */ - public void setNodeTypeUtility(NodeTypeUtility nodeTypeUtility) - { - this.nodeTypeUtility = nodeTypeUtility; - } - - /** - * Returns the hold service - * - * @return Returns the hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - - /** - * @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) - { - final JSONObject json = getJSONFromContent(req); - final List holds = getHolds(json); - final List nodeRefs = getItemNodeRefs(json); - doAction(holds, nodeRefs); - return new HashMap<>(); - } - - /** - * Abstract method which will be implemented in the subclasses. - * It will either add the item(s) to the hold(s) or remove it/them from the hold(s) - * - * @param holds List of hold {@link NodeRef}(s) - * @param nodeRefs List of item {@link NodeRef}(s) (record(s) / record folder(s) / active content(s)) which will be - * either added to the hold(s) or removed from the hold(s) - */ - abstract void doAction(List holds, List nodeRefs); - - /** - * Helper method the get the json object from the request - * - * @param req The webscript request - * @return The json object which was sent in the request body - */ - protected JSONObject getJSONFromContent(WebScriptRequest req) - { - JSONObject json = null; - try - { - final String content = req.getContent().getContent(); - json = new JSONObject(new JSONTokener(content)); - } - 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); - } - - return json; - } - - /** - * Helper method to get the {@link NodeRef}s for the items(s) (record(s) / record folder(s) / active content(s)) - * which will be added to the hold(s) - * - * @param json The request content as JSON object - * @return List of item {@link NodeRef}s which will be added to the hold(s) - */ - protected List getItemNodeRefs(JSONObject json) - { - final List nodeRefs = new ArrayList<>(); - try - { - final JSONArray nodeRefsArray = json.getJSONArray("nodeRefs"); - for (int i = 0; i < nodeRefsArray.length(); i++) - { - NodeRef nodeReference = new NodeRef(nodeRefsArray.getString(i)); - checkItemNodeRef(nodeReference); - nodeRefs.add(nodeReference); - } - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not get information from the json array.", je); - } - - return nodeRefs; - } - - /** - * Helper method for checking the node reference for an item - * - * @param nodeRef The {@link NodeRef} of an item (record / record folder / active content) - */ - private void checkItemNodeRef(NodeRef nodeRef) - { - // ensure that the node exists - if (!nodeService.exists(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Item being added to hold does not exist."); - } - - // ensure that the node we are adding to the hold is a record or record folder or active content - if (!recordFolderService.isRecordFolder(nodeRef) && - !nodeTypeUtility.instanceOf(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items added to a hold must be either a record, a record folder or active content."); - } - } - - /** - * Helper method to get the list of {@link NodeRef}(s) for the hold(s) which will contain the item (record / record folder / active content) - * - * @param json The request content as JSON object - * @return List of {@link NodeRef}(s) of the hold(s) - */ - protected List getHolds(JSONObject json) - { - final List holds = new ArrayList<>(); - try - { - final JSONArray holdsArray = json.getJSONArray("holds"); - for (int i = 0; i < holdsArray.length(); i++) - { - final NodeRef nodeRef = new NodeRef(holdsArray.getString(i)); - checkHoldNodeRef(nodeRef); - holds.add(nodeRef); - } - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not get information from the json array.", je); - } - - return holds; - } - - /** - * Helper method for checking the node reference for a hold - * - * @param nodeRef The {@link NodeRef} of a hold - */ - private void checkHoldNodeRef(NodeRef nodeRef) - { - // check the hold exists - if (!nodeService.exists(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The hold does not exist."); - } - - // check the noderef is actually a hold - if (!holdService.isHold(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items are being added to a node that isn't a hold."); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java deleted file mode 100644 index aeb87f1a54..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hold POJO - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class Hold -{ - /** Hold name */ - private String name; - - /** Hold node reference */ - private NodeRef nodeRef; - - /** - * Constructor - * - * @param name The name of the hold - * @param nodeRef The {@link NodeRef} of the hold - */ - public Hold(String name, NodeRef nodeRef) - { - this.name = name; - this.nodeRef = nodeRef; - } - - /** - * Gets the hold name - * - * @return The name of the hold - */ - public String getName() - { - return this.name; - } - - /** - * Gets the hold node reference - * - * @return The {@link NodeRef} of the hold - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java deleted file mode 100644 index 4c78b59959..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Implementation for Java backed webscript to add an item to the given hold(s) in the hold container. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class HoldPost extends BaseHold -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List) - */ - @Override - void doAction(List holds, List nodeRefs) - { - getHoldService().addToHolds(holds, nodeRefs); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java deleted file mode 100644 index 1a300481cc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Implementation for Java backed webscript to remove an item from the given hold(s) in the hold container. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class HoldPut extends BaseHold -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List) - */ - @Override - void doAction(List holds, List nodeRefs) - { - getHoldService().removeFromHolds(holds, nodeRefs); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java deleted file mode 100644 index 0f019dd5f9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -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 org.alfresco.model.ContentModel; -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.hold.HoldService; -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.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.apache.commons.lang3.StringUtils; -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 return the list of holds in the hold container. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class HoldsGet extends DeclarativeWebScript -{ - /** File Plan Service */ - private FilePlanService filePlanService; - - /** Node Service */ - private NodeService nodeService; - - /** Hold Service */ - private HoldService holdService; - - /** permission service */ - private PermissionService permissionService; - - /** - * Set the file plan service - * - * @param filePlanService the file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Set the node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the hold service - * - * @param holdService the hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Set the permission service - * - * @param permissionService the permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @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) - { - final boolean fileOnly = getFileOnly(req); - final NodeRef itemNodeRef = getItemNodeRef(req); - final List holds = new ArrayList<>(); - - if (itemNodeRef == null) - { - final NodeRef filePlan = getFilePlan(req); - holds.addAll(holdService.getHolds(filePlan)); - } - else - { - final boolean includedInHold = getIncludedInHold(req); - holds.addAll(holdService.heldBy(itemNodeRef, includedInHold)); - } - - final List holdObjects = new ArrayList<>(holds.size()); - for (NodeRef nodeRef : holds) - { - // only add if user has filling permission on the hold - if (!fileOnly || permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED) - { - final String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - holdObjects.add(new Hold(name, nodeRef)); - } - } - - final Map model = new HashMap<>(1); - sortHoldByName(holdObjects); - model.put("holds", holdObjects); - - return model; - } - - /** - * Helper method to get the file plan from the request - * - * @param req The webscript request - * @return The {@link NodeRef} of the file plan - */ - private NodeRef getFilePlan(WebScriptRequest req) - { - NodeRef filePlan = null; - - final Map templateVars = req.getServiceMatch().getTemplateVars(); - final String storeType = templateVars.get("store_type"); - final String storeId = templateVars.get("store_id"); - final String id = templateVars.get("id"); - - if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(id)) - { - filePlan = new NodeRef(new StoreRef(storeType, storeId), id); - - // check that this node is actually a file plan - if (!nodeService.exists(filePlan) || !filePlanService.isFilePlan(filePlan)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The file plan provided could not be found."); - } - } - else - { - filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default file plan node could not be found."); - } - } - - return filePlan; - } - - /** - * Helper method to get the item node reference from the request - * - * @param req The webscript request - * @return The {@link NodeRef} of the item (record / record folder) or null if the parameter has not been passed - */ - private NodeRef getItemNodeRef(WebScriptRequest req) - { - final String nodeRef = req.getParameter("itemNodeRef"); - NodeRef itemNodeRef = null; - if (StringUtils.isNotBlank(nodeRef)) - { - itemNodeRef = new NodeRef(nodeRef); - } - return itemNodeRef; - } - - /** - * Helper method to get the includeInHold parameter value from the request - * - * @param req The webscript request - * @return The value of the includeInHold parameter - */ - private boolean getIncludedInHold(WebScriptRequest req) - { - boolean result = true; - final String includedInHold = req.getParameter("includedInHold"); - if (StringUtils.isNotBlank(includedInHold)) - { - result = Boolean.parseBoolean(includedInHold); - } - return result; - } - - private boolean getFileOnly(WebScriptRequest req) - { - boolean result = false; - final String fillingOnly = req.getParameter("fileOnly"); - if (StringUtils.isNotBlank(fillingOnly)) - { - result = Boolean.parseBoolean(fillingOnly); - } - return result; - } - - /** - * Helper method to sort the holds by their names - * - * @param holds List of holds to sort - */ - private void sortHoldByName(List holds) - { - Collections.sort(holds, new Comparator() - { - @Override - public int compare(Hold h1, Hold h2) - { - return h1.getName().toLowerCase().compareTo(h2.getName().toLowerCase()); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/ClassificationReasonsUtil.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/ClassificationReasonsUtil.java deleted file mode 100644 index f84bd63d9d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/ClassificationReasonsUtil.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.model.ContentModel.PROP_NAME; -import static org.alfresco.service.namespace.QName.createQName; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; - -/** - * Method to replace the plain text classification reason id with the correct nodeRef during record search - * @author Ross Gale - * @since 2.7 - */ -public class ClassificationReasonsUtil extends SearchUtil -{ - - public static final String CR_URI = "http://www.alfresco.org/model/securitymarks/1.0"; - public static final QName CLASSIFICATION_REASONS_CONTAINER = createQName(CR_URI,"classificationReasonsContainer"); - public static final QName PROP_CLASSIFICATION_REASON_CODE = createQName(CR_URI, "classificationReasonCode"); - public static final String REASONS_KEY = "clf:classificationReasons:"; - - /** - * Replace plain text reason id with nodeRef - * @param searchQuery String e.g. clf:classificationReasons:1.4(a) - * @return String e.g. clf:classificationReasons:5cc6d344-fa94-4370-9c81-d947b7e8f2ac - */ - public String replaceReasonWithNodeRef(String searchQuery) - { - List queries = new ArrayList<>(Arrays.asList(searchQuery.split(" "))); - StringBuilder stringBuilder = new StringBuilder(); - for (String queryToEdit : queries) - { - if(queryToEdit.contains(REASONS_KEY)) - { - for (String reasonId : retrieveAllNodeIds(getRootContainer(CLASSIFICATION_REASONS_CONTAINER))) - { - NodeRef reasonNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, reasonId); - Map properties = nodeService.getProperties(reasonNodeRef); - if (queryToEdit.equals(REASONS_KEY + properties.get(PROP_CLASSIFICATION_REASON_CODE).toString()) || - queryToEdit.equals(REASONS_KEY +"\""+ properties.get(PROP_CLASSIFICATION_REASON_CODE).toString() + "\"")) - { - queryToEdit = REASONS_KEY + properties.get(PROP_NAME).toString(); - break; - } - } - } - stringBuilder.append(queryToEdit).append(" "); - } - return stringBuilder.toString(); - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java deleted file mode 100644 index 64ca9a5f9f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.service.cmr.site.SiteService; -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; - -/** - * Records Management saved search DELETE web script - * - * @author Roy Wetherall - */ -public class RMSavedSearchesDelete extends DeclarativeWebScript -{ - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /* - * @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 templateVars = req.getServiceMatch().getTemplateVars(); - - // Get the site id and confirm it's valid - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - // Get the name of the saved search - String name = templateVars.get("name"); - if (name == null || name.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Saved search name not provided."); - } - - // Delete the saved search - recordsManagementSearchService.deleteSavedSearch(siteId, name); - - // Indicate success in the model - Map model = new HashMap<>(1); - model.put("success", true); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java deleted file mode 100644 index 8fee250adc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -import org.alfresco.service.cmr.site.SiteService; -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; - -/** - * RM saved searches GET web script - * - * @author Roy Wetherall - */ -public class RMSavedSearchesGet extends DeclarativeWebScript -{ - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /* - * @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) - { - // create model object with the lists model - Map model = new HashMap<>(13); - - // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - // Get the saved search details - List details = recordsManagementSearchService.getSavedSearches(siteId); - List items = new ArrayList<>(); - for (SavedSearchDetails savedSearchDetails : details) - { - String name = savedSearchDetails.getName(); - String description = savedSearchDetails.getDescription(); - String query = savedSearchDetails.getCompatibility().getQuery(); - String params = savedSearchDetails.getCompatibility().getParams(); - String sort = savedSearchDetails.getCompatibility().getSort(); - - Item item = new Item(name, description, query, params, sort); - items.add(item); - } - - model.put("savedSearches", items); - return model; - } - - /** - * Item class to contain information about items being placed in model. - */ - public class Item - { - private String name; - private String description; - private String query; - private String params; - private String sort; - - public Item(String name, String description, String query, String params, String sort) - { - this.name = name; - this.description = description; - this.query = query; - this.params = params; - this.sort = sort; - } - - public String getName() - { - return name; - } - - public String getDescription() - { - return description; - } - - public String getQuery() - { - return query; - } - - public String getParams() - { - return params; - } - - public String getSort() - { - return sort; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java deleted file mode 100644 index 4c837966f1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetailsCompatibility; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -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; - -/** - * Records management saved search POST web script. - * - * @author Roy Wetherall - */ -public class RMSavedSearchesPost extends DeclarativeWebScript -{ - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** Namespace service */ - protected NamespaceService namespaceService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @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) - { - // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - try - { - // Parse the JSON passed in the request - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Get the details of the saved search - if (!json.has("name")) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'name' parameter was not provided in request body"); - } - String name = json.getString("name"); - String description = null; - if (json.has("description")) - { - description = json.getString("description"); - } - boolean isPublic = true; - if (json.has("public")) - { - isPublic = json.getBoolean("public"); - } - // NOTE: we do not need to worry about the query - if (!json.has("params")) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'params' parameter was not provided in request body"); - } - String params = json.getString("params"); - String sort = null; - if (json.has("sort")) - { - sort = json.getString("sort"); - } - - // Use the compatibility class to create a saved search details and save - String search = SavedSearchDetailsCompatibility.getSearchFromParams(params); - if (search == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'terms' was not provided in 'params' parameter found in the request body"); - } - RecordsManagementSearchParameters searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(params, sort, namespaceService); - recordsManagementSearchService.saveSearch(siteId, name, description, search, searchParameters, isPublic); - - } - 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); - } - - // Indicate success in the model - Map model = new HashMap<>(1); - model.put("success", true); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java deleted file mode 100644 index 4ba371c00c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.module.org_alfresco_module_rm.script.slingshot.ClassificationReasonsUtil.REASONS_KEY; - -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Date; -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.search.RecordsManagementSearchParameters; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -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.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -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; - -/** - * RM search GET web script - * - * @author Roy Wetherall - */ -public class RMSearchGet extends DeclarativeWebScript -{ - /** Logger for the class. */ - private static final Logger LOGGER = LoggerFactory.getLogger(RMSearchGet.class); - /** URL Parameters */ - private static final String PARAM_QUERY = "query"; - private static final String PARAM_SORTBY = "sortby"; - private static final String PARAM_FILTERS = "filters"; - private static final String PARAM_MAX_ITEMS = "maxitems"; - private static final String SYSTEM = "System"; - - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** Namespace service */ - protected NamespaceService namespaceService; - - /** Node serivce */ - protected NodeService nodeService; - - /** Dictionary service */ - protected DictionaryService dictionaryService; - - /** Permission service */ - protected PermissionService permissionService; - - /** Person service */ - protected PersonService personService; - - /** Person data cache */ - private Map personDataCache = null; - - /** Utility class for record categories */ - private RecordCategoryUtil recordCategoryUtil; - - /** Utility class for classification reasons (enterprise only) */ - private ClassificationReasonsUtil classificationReasonsUtil; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param recordCategoryUtil utility class for record categories - */ - public void setRecordCategoryUtil(RecordCategoryUtil recordCategoryUtil) - { - this.recordCategoryUtil = recordCategoryUtil; - } - - public void setClassificationReasonsUtil(ClassificationReasonsUtil classificationReasonsUtil) - { - this.classificationReasonsUtil = classificationReasonsUtil; - } - - /** - * @param personService person service - */ - 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) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap<>(1); - try - { - // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - // Get the query parameter - String query = req.getParameter(PARAM_QUERY); - // TODO check that this is there - - String sortby = req.getParameter(PARAM_SORTBY); - // TODO this is optional - - String filters = req.getParameter(PARAM_FILTERS); - // TODO this is optional - - //Replace any plain text reason ids with the appropriate node reference - if(query.contains(REASONS_KEY)) - { - query = classificationReasonsUtil.replaceReasonWithNodeRef(query); - } - - // Convert into a rm search parameter object - RecordsManagementSearchParameters searchParameters = - SavedSearchDetailsCompatibility.createSearchParameters(filters, new String[]{",", "/"}, sortby, namespaceService); - - // Set the max results - String maxItems = req.getParameter(PARAM_MAX_ITEMS); - if (maxItems != null && maxItems.length() != 0) - { - searchParameters.setMaxItems(Integer.parseInt(maxItems)); - } - - // Execute search - List> results = recordsManagementSearchService.search(siteId, query, searchParameters); - - // Reset person data cache - personDataCache = new HashMap<>(57); - - // Process the result items - List items = new ArrayList<>(results.size()); - for (Pair pair : results) - { - // FIXME: See RM-478 - // TC 3-3 Create User Groups - try - { - Item item = new Item(pair.getFirst(), pair.getSecond()); - items.add(item); - } - catch(Exception e) - { - LOGGER.debug("Ignoring failed attempt to add item to search results.", e); - } - } - - // Return model - model.put("items", items); - } - catch (Exception ex) - { - model.put("errorMessage", ex.toString()); - } - return model; - - } - - /** - * Item class to contain information about items being placed in model. - */ - public class Item - { - private NodeRef nodeRef; - private String type; - private int size; - private String parentFolder = ""; - private String browseUrl; - private boolean isContainer; - private String modifiedBy; - private String createdBy; - private Map nodeProperties; - private Map properties; - private String recordCategoryId; - - public Item(NodeRef parent, NodeRef nodeRef) - { - // Set node ref - this.nodeRef = nodeRef; - - // Get type - QName nodeRefType = nodeService.getType(nodeRef); - this.type = nodeRefType.toPrefixString(namespaceService); - - // Get properties - this.nodeProperties = nodeService.getProperties(nodeRef); - - // Determine if container or not - isContainer = true; - if (dictionaryService.isSubClass(nodeRefType, ContentModel.TYPE_CONTENT)) - { - isContainer = false; - } - - // Get parent node reference -// NodeRef parent = null; -// ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); -// if (assoc != null) -// { -// parent = assoc.getParentRef(); -// } - - if (isContainer) - { - this.size = -1; - - String displayPath = nodeService.getPath(nodeRef).toDisplayPath(nodeService, permissionService); - String[] pathElements = displayPath.split("/"); - if (pathElements.length >= 5) - { - if (pathElements.length > 5) - { - this.parentFolder = (String)nodeService.getProperty(parent, ContentModel.PROP_NAME); - } - - pathElements = (String[])ArrayUtils.subarray(pathElements, 5, pathElements.length); - String newPath = StringUtils.join(pathElements, "/"); - StringBuilder relPath = new StringBuilder("/").append(newPath); - if (relPath.length() > 1) - { - relPath.append("/"); - } - relPath.append(getName()); - try - { - this.browseUrl = "documentlibrary?path=" + URLEncoder.encode(relPath.toString(), "UTF-8").replaceAll("\\+","%20"); - } - catch (UnsupportedEncodingException e) - { - throw new AlfrescoRuntimeException("Could not process search results.", e); - } - } - } - else - { - // Get the document size - ContentData contentData = (ContentData)nodeProperties.get(ContentModel.PROP_CONTENT); - this.size = 0; - if (contentData != null) - { - this.size = (int)contentData.getSize(); - } - - // Set the document parent name - if (parent != null) - { - this.parentFolder = (String)nodeService.getProperty(parent, ContentModel.PROP_NAME); - } - - // Set the document browse URL - this.browseUrl = "document-details?nodeRef=" + nodeRef.toString(); - } - - this.modifiedBy = getDisplayName(getModifiedByUser()); - this.createdBy = getDisplayName(getCreatedByUser()); - - // Process the custom properties - properties = new HashMap<>(nodeProperties.size()); - for (Map.Entry entry : nodeProperties.entrySet()) - { - QName qName = entry.getKey().getPrefixedQName(namespaceService); - if (!NamespaceService.SYSTEM_MODEL_1_0_URI.equals(qName.getNamespaceURI())) - { - String prefixName = qName.getPrefixString().replace(":", "_"); - properties.put(prefixName, entry.getValue()); - } - } - properties.put("rma_recordCategoryIdentifier", recordCategoryUtil.getCategoryIdFromNodeId(nodeRef, false)); - } - - private String getDisplayName(String userName) - { - //Fix for RM-6834 - if(userName.equals(SYSTEM)) - { - return SYSTEM; - } - - String result = personDataCache.get(userName); - if (result == null) - { - NodeRef person = personService.getPerson(userName); - if (person != null) - { - StringBuilder displayName = new StringBuilder(128); - displayName.append(nodeService.getProperty(person, ContentModel.PROP_FIRSTNAME)) - .append(" ") - .append(nodeService.getProperty(person, ContentModel.PROP_LASTNAME)); - result = displayName.toString(); - } - else - { - result = userName; - } - personDataCache.put(userName, result); - } - - return result; - } - - public NodeRef getNodeRef() - { - return nodeRef; - } - - public String getType() - { - return type; - } - - public String getName() - { - return (String)nodeProperties.get(ContentModel.PROP_NAME); - } - - public String getTitle() - { - return (String)nodeProperties.get(ContentModel.PROP_TITLE); - } - - public String getDescription() - { - return (String)nodeProperties.get(ContentModel.PROP_DESCRIPTION); - } - - public Date getModifiedOn() - { - return (Date)nodeProperties.get(ContentModel.PROP_MODIFIED); - } - - public String getModifiedByUser() - { - return (String)nodeProperties.get(ContentModel.PROP_MODIFIER); - } - - public String getModifiedBy() - { - return modifiedBy; - } - - public Date getCreatedOn() - { - return (Date)nodeProperties.get(ContentModel.PROP_CREATED); - } - - public String getCreatedByUser() - { - return (String)nodeProperties.get(ContentModel.PROP_CREATOR); - } - - public String getCreatedBy() - { - return createdBy; - } - - public String getAuthor() - { - return (String)nodeProperties.get(ContentModel.PROP_AUTHOR); - } - - public String getParentFolder() - { - return parentFolder; - } - - public int getSize() - { - return size; - } - - public String getBrowseUrl() - { - return browseUrl; - } - - public Map getProperties() - { - return properties; - } - - public String getRecordCategoryId() - { - return recordCategoryId; - } - - public void setRecordCategoryId(String recordCategoryId) - { - this.recordCategoryId = recordCategoryId; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java deleted file mode 100644 index e4739d7443..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -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.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM search properties GET web script - * - * @author Roy Wetherall - */ -public class RMSearchPropertiesGet extends DeclarativeWebScript -{ - /** Services */ - private RecordsManagementAdminService adminService; - private RecordService recordService; - private DictionaryService dictionaryService; - private NamespaceService namespaceService; - private FilePlanService filePlanService; - - /** - * @param adminService records management admin service - */ - public void setAdminService(RecordsManagementAdminService adminService) - { - this.adminService = adminService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @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<>(13); - - List groups = new ArrayList<>(5); - - // get the file plan - // TODO the file plan should be passed to this web script - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // get the record metadata aspects - Set aspects = recordService.getRecordMetadataAspects(filePlan); - for (QName aspect : aspects) - { - Map properties = dictionaryService.getPropertyDefs(aspect); - Property[] propObjs = new Property[properties.size()]; - int index = 0; - for (PropertyDefinition propertyDefinition : properties.values()) - { - Property propObj = new Property(propertyDefinition); - propObjs[index] = propObj; - index ++; - } - - AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect); - Group group = new Group(aspect.getLocalName(), aspectDefinition.getTitle(dictionaryService), propObjs); - groups.add(group); - } - - Map customProps = adminService.getCustomPropertyDefinitions(); - Property[] propObjs = new Property[customProps.size()]; - int index = 0; - for (PropertyDefinition propertyDefinition : customProps.values()) - { - Property propObj = new Property(propertyDefinition); - propObjs[index] = propObj; - index ++; - } - - Group group = new Group("rmcustom", "Custom", propObjs); - groups.add(group); - - model.put("groups", groups); - return model; - } - - public class Group - { - private String id; - private String label; - private Property[] properties; - - public Group(String id, String label, Property[] properties) - { - this.id = id; - this.label = label; - this.properties = properties.clone(); - } - - public String getId() - { - return id; - } - - public String getLabel() - { - return label; - } - - public Property[] getProperties() - { - return properties; - } - } - - public class Property - { - private String prefix; - private String shortName; - private String label; - private String type; - - public Property(PropertyDefinition propertyDefinition) - { - QName qName = propertyDefinition.getName().getPrefixedQName(namespaceService); - this.prefix = QName.splitPrefixedQName(qName.toPrefixString())[0]; - this.shortName = qName.getLocalName(); - this.label = propertyDefinition.getTitle(dictionaryService); - this.type = propertyDefinition.getDataType().getName().getLocalName(); - } - - public String getPrefix() - { - return prefix; - } - - public String getShortName() - { - return shortName; - } - - public String getLabel() - { - return label; - } - - public String getType() - { - return type; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordCategoryUtil.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordCategoryUtil.java deleted file mode 100644 index 32e25e9156..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordCategoryUtil.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_IDENTIFIER; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RECORD_CATEGORY; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RECORD_FOLDER; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Path; -import org.alfresco.service.cmr.repository.Path.ChildAssocElement; - -/** - * Utility class for record categories - * @author Ross Gale - * @since 2.7 - */ -public class RecordCategoryUtil -{ - /** - * Node service - */ - private NodeService nodeService; - - /** - * Setter for the node service - * @param nodeService Node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Return the record category id for a file plan element - * @param nodeRef the node reference of the file plan element - * @param includeFolders return an id for records, folders and categories - * @return Record category identifier - */ - public String getCategoryIdFromNodeId(NodeRef nodeRef, boolean includeFolders) - { - if(!includeFolders) - { - if (nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) || nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY)) - { - return null; - } - } - //Search for the first category from the end of the path to save time - Path path = nodeService.getPath(nodeRef); - for(int x = path.size()-1; x >= 0; x--) - { - NodeRef ref = ((ChildAssocElement) path.get(x)).getRef().getChildRef(); - if (nodeService.getType(ref).equals(TYPE_RECORD_CATEGORY)) - { - return nodeService.getProperty(ref, PROP_IDENTIFIER).toString(); - } - } - return null; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java deleted file mode 100644 index 3e81281d3f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.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); - List recordableVersions = getRecordableVersionConfigService().getVersions(nodeRef); - model.put("recordableVersions", recordableVersions); - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java deleted file mode 100644 index 7ea4c55a53..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.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) - { - 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 req 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/SearchUtil.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/SearchUtil.java deleted file mode 100644 index 966be93a47..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/SearchUtil.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.model.ContentModel.ASSOC_CHILDREN; -import static org.alfresco.model.ContentModel.TYPE_CONTAINER; -import static org.alfresco.service.cmr.repository.StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -import org.alfresco.error.AlfrescoRuntimeException; -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; - -/** - * Parent class for records search utilities - * - * @author Ross Gale - * @since 2.7 - */ -public class SearchUtil -{ - /** - * Node service - */ - protected NodeService nodeService; - - /** - * Setter for node service - * - * @param nodeService Node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Use a container node ref and return the nodeIds of the contents - * - * @param nodeRef container - * @return list of nodeIds - */ - protected Set retrieveAllNodeIds(NodeRef nodeRef) - { - List childAssocRefs = nodeService.getChildAssocs(nodeRef); - return childAssocRefs.stream().map(assoc -> assoc.getChildRef().getId()).collect(Collectors.toSet()); - } - - /** - * Helper method to get the classification reason root container. - * The method creates the container if it doesn't already exist. - * - * @return reference to the classification reason root container - */ - protected NodeRef getRootContainer(QName container) - { - NodeRef rootNodeRef = nodeService.getRootNode(STORE_REF_WORKSPACE_SPACESSTORE); - List assocRefs = nodeService.getChildAssocs(rootNodeRef, ASSOC_CHILDREN, container); - - if (assocRefs.isEmpty()) - { - return nodeService.createNode(rootNodeRef, ASSOC_CHILDREN, container, TYPE_CONTAINER).getChildRef(); - } - else if (assocRefs.size() != 1) - { - throw new AlfrescoRuntimeException("Only one container is allowed."); - } - else - { - return assocRefs.iterator().next().getChildRef(); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java deleted file mode 100644 index 771b1502a3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Recordable version class - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java deleted file mode 100644 index 02a1b6d4e8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot.forms; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM metadata used by form extension - * - * @author Roy Wetherall - */ -public class RMMetaDataGet extends DeclarativeWebScript -{ - /** Query parameters */ - private static final String PARAM_NODEREF = "noderef"; - private static final String PARAM_TYPE = "type"; - private static final String PARAM_EXTENDED = "extended"; - - /** NodeRef pattern */ - private static final Pattern NODE_REF_PATTERN = Pattern.compile(".+://.+/.+"); - - /** QName pattern */ - private static final Pattern QNAME_PATTERN = Pattern.compile(".+:[^=,]+"); - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Node service */ - private NodeService nodeService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /* - * @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) - { - // create model object with the lists model - Map model = new HashMap<>(1); - - boolean extended = false; - String result = "NONE"; - - // Get the nodeRef and confirm it is valid - String nodeRef = req.getParameter(PARAM_NODEREF); - if (nodeRef == null || nodeRef.length() == 0) - { - String type = req.getParameter(PARAM_TYPE); - if (type != null && type.length() != 0 && type.indexOf(':') != -1) - { - Matcher m = QNAME_PATTERN.matcher(type); - if (m.matches()) - { - QName qname = QName.createQName(type, namespaceService); - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKindFromType(qname); - if (kind != null) - { - result = kind.toString(); - } - } - } - } - else - { - // quick test before running slow match for full NodeRef pattern - if (nodeRef.indexOf(':') != -1) - { - Matcher m = NODE_REF_PATTERN.matcher(nodeRef); - if (m.matches()) - { - NodeRef nodeRefObj = new NodeRef(nodeRef); - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRefObj); - if (kind != null) - { - result = kind.toString(); - } - - String extendedValue = req.getParameter(PARAM_EXTENDED); - if (extendedValue != null && extendedValue.length() != 0) - { - extended = Boolean.parseBoolean(extendedValue); - if (extended) - { - // get the aspects of the node - model.put("aspects", getAspects(nodeRefObj)); - } - } - } - } - } - - model.put("kind", result); - model.put("extended", extended); - return model; - } - - /** - * Gets the current node aspects - * - * @return node aspects - */ - public List getAspects(NodeRef nodeRef) - { - Set qnames = nodeService.getAspects(nodeRef); - List aspects = new ArrayList<>(qnames.size()); - for (QName qname : qnames) - { - aspects.add(new Aspect(qname)); - } - return aspects; - } - - /** - * Qname wrapper class - */ - public class QNameBean implements Serializable - { - private static final long serialVersionUID = 6982292337846270774L; - - protected QName name; - - public QNameBean(QName name) - { - this.name = name; - } - - public String getName() - { - return name.toString(); - } - - public String getPrefixedName() - { - return name.toPrefixString(namespaceService); - } - - public String toString() - { - return getName(); - } - } - - /** - * Aspect wrapper class - */ - public class Aspect extends QNameBean - { - private static final long serialVersionUID = -6448182941386934326L; - - public Aspect(QName name) - { - super(name); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java deleted file mode 100644 index 38600df7d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * @author Roy Wetherall - */ -@AlfrescoPublicApi -@SuppressWarnings("serial") -public class RecordsManagementSearchParameters -{ - /** Default sort order */ - private static final List DEFAULT_SORT_ORDER = new ArrayList() - { - { - add(new SortItem(ContentModel.PROP_NAME, Boolean.TRUE)); - } - }; - - /** Default templates */ - private static final Map DEFAULT_TEMPLATES = new HashMap() - { - { - put("keywords", "%(cm:name cm:title cm:description TEXT)"); - put("name", "%(cm:name)"); - put("title", "%(cm:title)"); - put("description", "%(cm:description)"); - put("creator", "%(cm:creator)"); - put("created", "%(cm:created)"); - put("modifier", "%(cm:modifier)"); - put("modified", "%(cm:modified)"); - put("author", "%(cm:author)"); - put("markings", "%(rmc:supplementalMarkingList)"); - put("dispositionEvents", "%(rma:recordSearchDispositionEvents)"); - put("dispositionActionName", "%(rma:recordSearchDispositionActionName)"); - put("dispositionActionAsOf", "%(rma:recordSearchDispositionActionAsOf)"); - put("dispositionEventsEligible", "%(rma:recordSearchDispositionEventsEligible)"); - put("dispositionPeriod", "%(rma:recordSearchDispositionPeriod)"); - put("hasDispositionSchedule", "%(rma:recordSearchHasDispositionSchedule)"); - put("dispositionInstructions", "%(rma:recordSearchDispositionInstructions)"); - put("dispositionAuthority", "%(rma:recordSearchDispositionAuthority)"); - put("vitalRecordReviewPeriod", "%(rma:recordSearchVitalRecordReviewPeriod)"); - } - }; - - /** Default included container types */ - private static final List DEFAULT_INCLUDED_CONTAINER_TYPES = Collections.emptyList(); - - /** Max items */ - private int maxItems; - - private boolean includeRecords = true; - private boolean includeUndeclaredRecords = false; - private boolean includeVitalRecords = false; - private boolean includeRecordFolders = true; - private boolean includeFrozen = false; - private boolean includeCutoff = false; - - private List includedContainerTypes = DEFAULT_INCLUDED_CONTAINER_TYPES; - private List sortOrder = DEFAULT_SORT_ORDER; - private Map templates = DEFAULT_TEMPLATES; - - private static final String JSON_MAXITEMS = "maxitems"; - private static final String JSON_RECORDS = "records"; - private static final String JSON_UNDECLAREDRECORDS = "undeclaredrecords"; - private static final String JSON_VITALRECORDS = "vitalrecords"; - private static final String JSON_RECORDFOLDERES = "recordfolders"; - private static final String JSON_FROZEN = "frozen"; - private static final String JSON_CUTOFF = "cutoff"; - private static final String JSON_CONTAINERTYPES = "containertypes"; - private static final String JSON_SORT = "sort"; - private static final String JSON_FIELD = "field"; - private static final String JSON_ASCENDING = "ascending"; - - /** - * { - * "maxItems" : 500, - * "records" : true, - * "undeclaredrecords" : false, - * "vitalrecords" : false, - * "recordfolders" : false, - * "frozen" : false, - * "cutoff" : false, - * "containertypes" : - * [ - * "rma:recordSeries", - * "rma:recordCategory" - * ] - * "sort" : - * [ - * { - * "field" : "cm:name", - * "ascending" : true - * } - * ] - * } - */ - public static RecordsManagementSearchParameters createFromJSON(String json, NamespaceService namespaceService) - { - try - { - JSONObject jsonObject = new JSONObject(json); - return RecordsManagementSearchParameters.createFromJSON(jsonObject, namespaceService); - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Unable to create records management search parameters from json string. " + json, e); - } - } - - /** - * - * @param jsonObject - * @return - */ - public static RecordsManagementSearchParameters createFromJSON(JSONObject jsonObject, NamespaceService namespaceService) - { - try - { - RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - - // Get the search parameter properties - if (jsonObject.has(JSON_MAXITEMS)) - { - searchParameters.setMaxItems(jsonObject.getInt(JSON_MAXITEMS)); - } - if (jsonObject.has(JSON_RECORDS)) - { - searchParameters.setIncludeRecords(jsonObject.getBoolean(JSON_RECORDS)); - } - if (jsonObject.has(JSON_UNDECLAREDRECORDS)) - { - searchParameters.setIncludeUndeclaredRecords(jsonObject.getBoolean(JSON_UNDECLAREDRECORDS)); - } - if (jsonObject.has(JSON_VITALRECORDS)) - { - searchParameters.setIncludeVitalRecords(jsonObject.getBoolean(JSON_VITALRECORDS)); - } - if (jsonObject.has(JSON_RECORDFOLDERES)) - { - searchParameters.setIncludeRecordFolders(jsonObject.getBoolean(JSON_RECORDFOLDERES)); - } - if (jsonObject.has(JSON_FROZEN)) - { - searchParameters.setIncludeFrozen(jsonObject.getBoolean(JSON_FROZEN)); - } - if (jsonObject.has(JSON_CUTOFF)) - { - searchParameters.setIncludeCutoff(jsonObject.getBoolean(JSON_CUTOFF)); - } - - // Get container types - if (jsonObject.has(JSON_CONTAINERTYPES)) - { - JSONArray jsonArray = jsonObject.getJSONArray(JSON_CONTAINERTYPES); - List containerTypes = new ArrayList<>(jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) - { - String type = jsonArray.getString(i); - containerTypes.add(QName.createQName(type, namespaceService)); - } - searchParameters.setIncludedContainerTypes(containerTypes); - } - - // Get sort details - if (jsonObject.has(JSON_SORT)) - { - JSONArray jsonArray = jsonObject.getJSONArray(JSON_SORT); - List sortOrder = new ArrayList<>(jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) - { - JSONObject sortJSONObject = jsonArray.getJSONObject(i); - if (sortJSONObject.has(JSON_FIELD) && - sortJSONObject.has(JSON_ASCENDING)) - { - sortOrder.add(new SortItem( - QName.createQName(sortJSONObject.getString(JSON_FIELD), namespaceService), - sortJSONObject.getBoolean(JSON_ASCENDING))); - } - } - searchParameters.setSortOrder(sortOrder); - } - - return searchParameters; - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Unable to create records management search parameters from json string. " + jsonObject.toString(), e); - } - } - - /** - * - * @return - */ - public String toJSONString(NamespaceService namespaceService) - { - return toJSONObject(namespaceService).toString(); - } - - public JSONObject toJSONObject(NamespaceService namespaceService) - { - try - { - JSONObject jsonObject = new JSONObject(); - jsonObject.put(JSON_MAXITEMS, maxItems); - jsonObject.put(JSON_RECORDS, includeRecords); - jsonObject.put(JSON_UNDECLAREDRECORDS, includeUndeclaredRecords); - jsonObject.put(JSON_VITALRECORDS, includeVitalRecords); - jsonObject.put(JSON_RECORDFOLDERES, includeRecordFolders); - jsonObject.put(JSON_FROZEN, includeFrozen); - jsonObject.put(JSON_CUTOFF, includeCutoff); - - // Included containers - JSONArray jsonArray = new JSONArray(); - for (QName containerType : includedContainerTypes) - { - jsonArray.put(containerType.toPrefixString(namespaceService)); - } - jsonObject.put(JSON_CONTAINERTYPES, jsonArray); - - // Sort - JSONArray jsonSortArray = new JSONArray(); - for (SortItem entry : sortOrder) - { - JSONObject jsonEntry = new JSONObject(); - jsonEntry.put(JSON_FIELD, entry.property.toPrefixString(namespaceService)); - jsonEntry.put(JSON_ASCENDING, entry.assc); - jsonSortArray.put(jsonEntry); - } - jsonObject.put(JSON_SORT, jsonSortArray); - - return jsonObject; - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Unable to generate json string for records management search parameters.", e); - } - } - - public void setMaxItems(int maxItems) - { - this.maxItems = maxItems; - } - - public int getMaxItems() - { - return maxItems; - } - - public void setSortOrder(List sortOrder) - { - this.sortOrder = sortOrder; - } - - public List getSortOrder() - { - return sortOrder; - } - - public void setTemplates(Map templates) - { - this.templates = templates; - } - - public Map getTemplates() - { - return templates; - } - - public void setIncludeRecords(boolean includeRecords) - { - this.includeRecords = includeRecords; - } - - public boolean isIncludeRecords() - { - return includeRecords; - } - - public void setIncludeUndeclaredRecords(boolean includeUndeclaredRecords) - { - this.includeUndeclaredRecords = includeUndeclaredRecords; - } - - public boolean isIncludeUndeclaredRecords() - { - return includeUndeclaredRecords; - } - - public void setIncludeVitalRecords(boolean includeVitalRecords) - { - this.includeVitalRecords = includeVitalRecords; - } - - public boolean isIncludeVitalRecords() - { - return includeVitalRecords; - } - - public void setIncludeRecordFolders(boolean includeRecordFolders) - { - this.includeRecordFolders = includeRecordFolders; - } - - public boolean isIncludeRecordFolders() - { - return includeRecordFolders; - } - - public void setIncludeFrozen(boolean includeFrozen) - { - this.includeFrozen = includeFrozen; - } - - public boolean isIncludeFrozen() - { - return includeFrozen; - } - - public void setIncludeCutoff(boolean includeCutoff) - { - this.includeCutoff = includeCutoff; - } - - public boolean isIncludeCutoff() - { - return includeCutoff; - } - - public void setIncludedContainerTypes(List includedContainerTypes) - { - this.includedContainerTypes = includedContainerTypes; - } - - public List getIncludedContainerTypes() - { - return includedContainerTypes; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java deleted file mode 100644 index bf821ff27b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.Pair; - -/** - * Records management search service. - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi at the moment as it requires SavedSearchDetails which is not public API. -public interface RecordsManagementSearchService -{ - /** - * Execute a records management search - * @param siteId the id of the rm site to query - * @param query search query string - * @param searchParameters search parameters - * @return {@link List}<{@link Pair} <{@link NodeRef}, {@link NodeRef}>> search results as pairs for parent and child nodes - */ - List> search(String siteId, String query, RecordsManagementSearchParameters searchParameters); - - /** - * Get all the searches saved on the given records management site. - * @param siteId site id - * @return {@link List}<{@link SavedSearchDetails}> list of saved search details - */ - List getSavedSearches(String siteId); - - /** - * Get a named saved search for a given records management site. - * @param siteId site id - * @param name name of search - * @return {@link SavedSearchDetails} saved search details - */ - SavedSearchDetails getSavedSearch(String siteId, String name); - - /** - * Save records management search. - * @param siteId site id - * @param name name - * @param description description - * @param search search string - * @param isPublic indicates whether the saved search is public or not - * @return {@link SavedSearchDetails} details of the saved search - */ - SavedSearchDetails saveSearch(String siteId, String name, String description, String search, RecordsManagementSearchParameters searchParameters, boolean isPublic); - - /** - * Save records management search. - * @param savedSearchDetails details of search to save - * @return {@link SavedSearchDetails} details of the saved search - */ - SavedSearchDetails saveSearch(SavedSearchDetails savedSearchDetails); - - /** - * Delete saved search - * @param siteId site id - * @param name name of saved search - */ - void deleteSavedSearch(String siteId, String name); - - /** - * Delete saved search - * @param savedSearchDetails saved search details - */ - void deleteSavedSearch(SavedSearchDetails savedSearchDetails); - - /** - * Adds the reports as saved searches to a given site. - * @param siteId site id - */ - void addReports(String siteId); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java deleted file mode 100644 index 80343f07c5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java +++ /dev/null @@ -1,666 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentReader; -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.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ISO9075; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_SAVED_SEARCH; - -/** - * Records management search service implementation - * - * @author Roy Wetherall - */ -public class RecordsManagementSearchServiceImpl implements RecordsManagementSearchService -{ - private static final String SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; - - /** Name of the main site container used to store the saved searches within */ - private static final String SEARCH_CONTAINER = "Saved Searches"; - - /** File folder service */ - private FileFolderService fileFolderService; - - /** Search service */ - private SearchService searchService; - - /** Site service */ - private SiteService siteService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** - * Node service - */ - private NodeService nodeService; - - /** List of report details */ - private List reports = new ArrayList<>(13); - - /** - * Records Search Parameters - */ - private RecordsManagementSearchParameters recordsManagementSearchParameters; - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param nodeService Node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param reportsJSON - */ - public void setReportsJSON(String reportsJSON) - { - try - { - JSONArray jsonArray = new JSONArray(reportsJSON); - for (int i=0; i < jsonArray.length(); i++) - { - JSONObject report = jsonArray.getJSONObject(i); - - // Get the name - if (!report.has(SavedSearchDetails.NAME)) - { - throw new AlfrescoRuntimeException("Unable to load report details because name has not been specified. \n" + reportsJSON); - } - String name = report.getString(SavedSearchDetails.NAME); - String translatedName = I18NUtil.getMessage(name); - if (translatedName != null) - { - name = translatedName; - } - - // Get the query - if (!report.has(SavedSearchDetails.SEARCH)) - { - throw new AlfrescoRuntimeException("Unable to load report details because search has not been specified for report " + name + ". \n" + reportsJSON); - } - String query = report.getString(SavedSearchDetails.SEARCH); - - // Get the description - String description = ""; - if (report.has(SavedSearchDetails.DESCRIPTION)) - { - description = report.getString(SavedSearchDetails.DESCRIPTION); - String translatedDescription = I18NUtil.getMessage(description); - if (translatedDescription != null) - { - description = translatedDescription; - } - } - - if (report.has("searchparams")) - { - recordsManagementSearchParameters = RecordsManagementSearchParameters.createFromJSON(report.getJSONObject("searchparams"), namespaceService); - } - - // Create the report details and add to list - ReportDetails reportDetails = new ReportDetails(name, description, query, recordsManagementSearchParameters); - reports.add(reportDetails); - } - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Unable to load report details.\n" + reportsJSON, exception); - } - } - - /** - * Set RecordsManagementSearchParameters service - * - * @param recordsManagementSearchParameters - */ - public void setRecordsManagementSearchParameters(RecordsManagementSearchParameters recordsManagementSearchParameters) - { - this.recordsManagementSearchParameters = recordsManagementSearchParameters; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#search(java.lang.String, java.lang.String, org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters) - */ - @Override - public List> search(String siteId, String query, RecordsManagementSearchParameters rmSearchParameters) - { - // build the full RM query - StringBuilder fullQuery = new StringBuilder(1024); - fullQuery.append("PATH:\"") - .append(SITES_SPACE_QNAME_PATH) - .append("cm:").append(ISO9075.encode(siteId)).append("/cm:documentLibrary//*\"") - .append(" AND (") - .append(buildQueryString(query, rmSearchParameters)) - .append(")"); - - // create the search parameters - SearchParameters searchParameters = new SearchParameters(); - searchParameters.setQuery(fullQuery.toString()); - searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); - searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - searchParameters.setMaxItems(recordsManagementSearchParameters.getMaxItems()); - searchParameters.setNamespace(RecordsManagementModel.RM_URI); - - // set sort - for(SortItem entry : rmSearchParameters.getSortOrder()) - { - searchParameters.addSort(entry.property.toPrefixString(namespaceService), entry.assc); - } - - // set templates - for (Entry entry : rmSearchParameters.getTemplates().entrySet()) - { - searchParameters.addQueryTemplate(entry.getKey(), entry.getValue()); - } - - // execute query - ResultSet resultSet = searchService.query(searchParameters); - - // process results - List> result = new ArrayList<>(resultSet.length()); - for (ChildAssociationRef childAssoc : resultSet.getChildAssocRefs()) - { - result.add(new Pair<>(childAssoc.getParentRef(), childAssoc.getChildRef())); - } - - // return results - return result; - } - - /** - * - * @param queryTerm - * @param aspects - * @param types - * @return - */ - /*package*/ String buildQueryString(String queryTerm, RecordsManagementSearchParameters searchParameters) - { - StringBuilder aspectQuery = new StringBuilder(); - if (searchParameters.isIncludeRecords()) - { - appendAspect(aspectQuery, "rma:record"); - if (!searchParameters.isIncludeUndeclaredRecords()) - { - appendAspect(aspectQuery, "rma:declaredRecord"); - } - if (searchParameters.isIncludeVitalRecords()) - { - appendAspect(aspectQuery, "rma:vitalRecord"); - } - } - - StringBuilder typeQuery = new StringBuilder(); - if (searchParameters.isIncludeRecordFolders()) - { - appendType(typeQuery, "rma:recordFolder"); - } - List includedContainerTypes = searchParameters.getIncludedContainerTypes(); - if (includedContainerTypes != null && includedContainerTypes.size() != 0) - { - for (QName includedContainerType : includedContainerTypes) - { - appendType(typeQuery, includedContainerType.toPrefixString(namespaceService)); - } - } - - StringBuilder query = new StringBuilder(); - if (queryTerm == null || queryTerm.length() == 0) - { - // Default to search for everything - query.append("ISNODE:T"); - } - else - { - if (isComplexQueryTerm(queryTerm)) - { - query.append(queryTerm); - } - else - { - query.append("keywords:\"" + queryTerm + "\""); - } - } - - StringBuilder fullQuery = new StringBuilder(1024); - if (aspectQuery.length() != 0 || typeQuery.length() != 0) - { - if (aspectQuery.length() != 0 && typeQuery.length() != 0) - { - fullQuery.append("("); - } - - if (aspectQuery.length() != 0) - { - fullQuery.append("(").append(aspectQuery).append(") "); - } - - if (typeQuery.length() != 0) - { - fullQuery.append("(").append(typeQuery).append(")"); - } - - if (aspectQuery.length() != 0 && typeQuery.length() != 0) - { - fullQuery.append(")"); - } - } - - if (searchParameters.isIncludeFrozen()) - { - appendAspect(fullQuery, "rma:frozen"); - } - else - { - appendNotAspect(fullQuery, "rma:frozen"); - } - if (searchParameters.isIncludeCutoff()) - { - appendAspect(fullQuery, "rma:cutOff"); - } - - if (fullQuery.length() != 0) - { - fullQuery.append(" AND "); - } - fullQuery.append(query).append(" AND NOT ASPECT:\"rma:versionedRecord\""); - - return fullQuery.toString(); - } - - private boolean isComplexQueryTerm(String query) - { - return query.matches(".*[\":].*"); - } - - /** - * - * @param sb - * @param aspect - */ - private void appendAspect(StringBuilder sb, String aspect) - { - appendWithJoin(sb, " AND ", "ASPECT:\"", aspect, "\""); - } - - private void appendNotAspect(StringBuilder sb, String aspect) - { - appendWithJoin(sb, " AND ", "NOT ASPECT:\"", aspect, "\""); - } - - /** - * - * @param sb - * @param type - */ - private void appendType(StringBuilder sb, String type) - { - appendWithJoin(sb, " ", "TYPE:\"", type, "\""); - } - - /** - * - * @param sb - * @param withJoin - * @param prefix - * @param value - * @param postfix - */ - private void appendWithJoin(StringBuilder sb, String withJoin, String prefix, String value, String postfix) - { - if (sb.length() != 0) - { - sb.append(withJoin); - } - sb.append(prefix).append(value).append(postfix); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearches(java.lang.String) - */ - @Override - public List getSavedSearches(String siteId) - { - List result = new ArrayList<>(17); - - NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); - if (container != null) - { - // add the details of all the public saved searches - List searches = fileFolderService.listFiles(container); - for (FileInfo search : searches) - { - addSearchDetailsToList(result, search.getNodeRef()); - } - - // add the details of any "private" searches for the current user - String userName = AuthenticationUtil.getFullyAuthenticatedUser(); - NodeRef userContainer = fileFolderService.searchSimple(container, userName); - if (userContainer != null) - { - List userSearches = fileFolderService.listFiles(userContainer); - for (FileInfo userSearch : userSearches) - { - addSearchDetailsToList(result, userSearch.getNodeRef()); - } - } - } - - return result; - } - - /** - * Add the search details to the list. - * @param searches list of search details - * @param searchNode search node - */ - private void addSearchDetailsToList(List searches, NodeRef searchNode) - { - ContentReader reader = fileFolderService.getReader(searchNode); - String jsonString = reader.getContentString(); - SavedSearchDetails savedSearchDetails = SavedSearchDetails.createFromJSON(jsonString, namespaceService, this, searchNode); - searches.add(savedSearchDetails); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearch(java.lang.String, java.lang.String) - */ - @Override - public SavedSearchDetails getSavedSearch(String siteId, String name) - { - // check for mandatory parameters - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("name", name); - - SavedSearchDetails result = null; - - // get the saved search node - NodeRef searchNode = getSearchNodeRef(siteId, name); - - if (searchNode != null) - { - // get the json content - ContentReader reader = fileFolderService.getReader(searchNode); - String jsonString = reader.getContentString(); - - // create the saved search details - result = SavedSearchDetails.createFromJSON(jsonString, namespaceService, this, searchNode); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(String, String, String, String, RecordsManagementSearchParameters, boolean) - */ - @Override - public SavedSearchDetails saveSearch(String siteId, String name, String description, String query, RecordsManagementSearchParameters searchParameters, boolean isPublic) - { - // Check for mandatory parameters - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("query", query); - ParameterCheck.mandatory("searchParameters", searchParameters); - - // Create saved search details - SavedSearchDetails savedSearchDetails = new SavedSearchDetails(siteId, name, description, query, searchParameters, isPublic, false, namespaceService, this); - - // Save search details - return saveSearch(savedSearchDetails); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails) - */ - @Override - public SavedSearchDetails saveSearch(final SavedSearchDetails savedSearchDetails) - { - // Check for mandatory parameters - ParameterCheck.mandatory("savedSearchDetails", savedSearchDetails); - - // Get the root saved search container - final String siteId = savedSearchDetails.getSiteId(); - NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); - if (container == null) - { - container = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return siteService.createContainer(siteId, SEARCH_CONTAINER, null, null); - } - }, AuthenticationUtil.getSystemUserName()); - } - - // Get the private container for the current user - if (!savedSearchDetails.isPublic()) - { - final String userName = AuthenticationUtil.getFullyAuthenticatedUser(); - NodeRef userContainer = fileFolderService.searchSimple(container, userName); - if (userContainer == null) - { - final NodeRef parentContainer = container; - userContainer = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return fileFolderService.create(parentContainer, userName, ContentModel.TYPE_FOLDER).getNodeRef(); - } - }, AuthenticationUtil.getSystemUserName()); - } - container = userContainer; - } - - // Get the saved search node - NodeRef searchNode = fileFolderService.searchSimple(container, savedSearchDetails.getName()); - if (searchNode == null) - { - final NodeRef searchContainer = container; - searchNode = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return fileFolderService.create(searchContainer, savedSearchDetails.getName(), ContentModel.TYPE_CONTENT).getNodeRef(); - } - }, AuthenticationUtil.getSystemUserName()); - } - nodeService.addAspect(searchNode, ASPECT_SAVED_SEARCH, null); - // Write the JSON content to search node - final NodeRef writableSearchNode = searchNode; - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - ContentWriter writer = fileFolderService.getWriter(writableSearchNode); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_JSON); - writer.putContent(savedSearchDetails.toJSONString()); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - return savedSearchDetails; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#deleteSavedSearch(java.lang.String, java.lang.String) - */ - @Override - public void deleteSavedSearch(String siteId, String name) - { - // Check parameters - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("name", name); - - // Get the search node for the saved query - NodeRef searchNode = getSearchNodeRef(siteId, name); - if (searchNode != null && fileFolderService.exists(searchNode)) - { - fileFolderService.delete(searchNode); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#deleteSavedSearch(org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails) - */ - @Override - public void deleteSavedSearch(SavedSearchDetails savedSearchDetails) - { - // Check parameters - ParameterCheck.mandatory("savedSearchDetails", savedSearchDetails); - - // Delete the saved search - deleteSavedSearch(savedSearchDetails.getSiteId(), savedSearchDetails.getName()); - } - - /** - * Get the saved search node reference. - * @param siteId site id - * @param name search name - * @return {@link NodeRef} search node reference - */ - private NodeRef getSearchNodeRef(String siteId, String name) - { - NodeRef searchNode = null; - - // Get the root saved search container - NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); - if (container != null) - { - // try and find the search node - searchNode = fileFolderService.searchSimple(container, name); - - // can't find it so check the users container - if (searchNode == null) - { - String userName = AuthenticationUtil.getFullyAuthenticatedUser(); - NodeRef userContainer = fileFolderService.searchSimple(container, userName); - if (userContainer != null) - { - searchNode = fileFolderService.searchSimple(userContainer, name); - } - } - } - - return searchNode; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#addReports(java.lang.String) - */ - @Override - public void addReports(String siteId) - { - for (ReportDetails report : reports) - { - // Create saved search details - SavedSearchDetails savedSearchDetails = new SavedSearchDetails( - siteId, - report.getName(), - report.getDescription(), - report.getSearch(), - report.getSearchParameters(), - true, - true, - namespaceService, - this); - - // Save search details - saveSearch(savedSearchDetails); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java deleted file mode 100644 index 93d5827964..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Report details. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public class ReportDetails -{ - /** Name */ - protected String name; - - /** Description */ - protected String description; - - /** Search */ - protected String search; - - /** Search parameters */ - protected RecordsManagementSearchParameters searchParameters; - - /** - * - * @param name - * @param description - * @param search - * @param searchParameters - */ - public ReportDetails(String name, String description, String search, RecordsManagementSearchParameters searchParameters) - { - this.name = name; - this.description = description; - this.search = search; - this.searchParameters = searchParameters; - } - - /** - * @return {@link String} name - */ - public String getName() - { - return name; - } - - /** - * @return {@link String} description - */ - public String getDescription() - { - return description; - } - - /** - * @param description description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return {@link String} search string - */ - public String getSearch() - { - return search; - } - - /** - * @param search query string - */ - public void setSearch(String search) - { - this.search = search; - } - - /** - * @return - */ - public RecordsManagementSearchParameters getSearchParameters() - { - return searchParameters; - } - - /** - * @param searchParameters - */ - public void setSearchParameters(RecordsManagementSearchParameters searchParameters) - { - this.searchParameters = searchParameters; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java deleted file mode 100644 index 05fd18991b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.util.ParameterCheck; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Saved search details. - * - * Example format of posted Saved Search JSON: - * - * { - * "siteid" : "rm", - * "name": "search name", - * "description": "the search description", - * "search": "the search sting as entered by the user", - * "public": boolean, - * "searchparams" : - * { - * "maxItems" : 500, - * "records" : true, - * "undeclaredrecords" : false, - * "vitalrecords" : false, - * "recordfolders" : false, - * "frozen" : false, - * "cutoff" : false, - * "containertypes" : - * [ - * "rma:recordSeries", - * "rma:recordCategory" - * ] - * "sort" : - * [ - * { - * "field" : "cm:name", - * "ascending" : true - * } - * ] - * } - * } - * - * where: name and query values are mandatory, - * searchparams contains the filters, sort, etc information about the query - * query is there for backward compatibility - * note: - * "params": "terms=keywords:xyz&undeclared=true", - * "sort": "cm:name/asc" - * "query": "the complete search query string", - * ... are sometimes found in the place of searchparams and are migrated to the new format when re-saved - * params are in URL encoded name/value pair format - * sort is in comma separated "property/dir" packed format i.e. "cm:name/asc,cm:title/desc" - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi at the moment as it requires RecordsManagementSearchServiceImpl which is not public API. -public class SavedSearchDetails extends ReportDetails -{ - // JSON label values - public static final String SITE_ID = "siteid"; - public static final String NAME = "name"; - public static final String DESCRIPTION = "description"; - public static final String SEARCH = "search"; - public static final String PUBLIC = "public"; - public static final String REPORT = "report"; - public static final String SEARCHPARAMS = "searchparams"; - - // JSON values for backwards compatibility - public static final String QUERY = "query"; - public static final String SORT = "sort"; - public static final String PARAMS = "params"; - - private static final String DEFAULT_SITE_ID = "rm"; - - /** Site id */ - private String siteId; - - /** Indicates whether the saved search is public or not */ - private boolean isPublic = true; - - /** Indicates whether the saved search is a report */ - private boolean isReport = false; - - /** Helper method to link to search node ref if provided */ - private NodeRef nodeRef = null; - - /** Namespace service */ - NamespaceService namespaceService; - - /** Records management search service */ - RecordsManagementSearchServiceImpl searchService; - - /** Saves search details compatibility */ - private SavedSearchDetailsCompatibility compatibility; - - /** - * - * @param jsonString - * @return - */ - /*package*/ static SavedSearchDetails createFromJSON(String jsonString, NamespaceService namespaceService, RecordsManagementSearchServiceImpl searchService, NodeRef nodeRef) - { - try - { - JSONObject search = new JSONObject(jsonString); - - // Get the site id - String siteId = DEFAULT_SITE_ID; - if (search.has(SITE_ID)) - { - siteId = search.getString(SITE_ID); - } - - // Get the name - if (!search.has(NAME)) - { - throw new AlfrescoRuntimeException("Can not create saved search details from json, because required name is not present. " + jsonString); - } - String name = search.getString(NAME); - - // Get the description - String description = ""; - if (search.has(DESCRIPTION)) - { - description = search.getString(DESCRIPTION); - String translated = I18NUtil.getMessage(description); - if (translated != null) - { - description = translated; - } - } - - // Get the query - String query = null; - if (!search.has(SEARCH)) - { - // We are probably dealing with a "old" style saved search - if (search.has(PARAMS)) - { - String oldParams = search.getString(PARAMS); - query = SavedSearchDetailsCompatibility.getSearchFromParams(oldParams); - } - else - { - throw new AlfrescoRuntimeException("Can not create saved search details from json, because required search is not present. " + jsonString); - } - - } - else - { - query = search.getString(SEARCH); - } - - // Get the search parameters - RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - if (search.has(SEARCHPARAMS)) - { - searchParameters = RecordsManagementSearchParameters.createFromJSON(search.getJSONObject(SEARCHPARAMS), namespaceService); - } - else - { - // See if we are dealing with the old style of saved search - if (search.has(PARAMS)) - { - String oldParams = search.getString(PARAMS); - String oldSort = search.getString(SORT); - searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(oldParams, oldSort, namespaceService); - } - } - - // Determine whether the saved query is public or not - boolean isPublic = true; - if (search.has(PUBLIC)) - { - isPublic = search.getBoolean(PUBLIC); - } - - // Determine whether the saved query is a report or not - boolean isReport = false; - if (search.has(REPORT)) - { - isReport = search.getBoolean(REPORT); - } - - // Create the saved search details object - SavedSearchDetails savedSearchDetails = new SavedSearchDetails(siteId, name, description, query, searchParameters, isPublic, isReport, namespaceService, searchService); - savedSearchDetails.nodeRef = nodeRef; - return savedSearchDetails; - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Can not create saved search details from json. " + jsonString, exception); - } - } - - /** - * @param siteId - * @param name - * @param description - * @param isPublic - */ - /*package*/ SavedSearchDetails( - String siteId, - String name, - String description, - String serach, - RecordsManagementSearchParameters searchParameters, - boolean isPublic, - boolean isReport, - NamespaceService namespaceService, - RecordsManagementSearchServiceImpl searchService) - { - super(name, description, serach, searchParameters); - - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("namespaceService", namespaceService); - ParameterCheck.mandatory("searchService", searchService); - - this.siteId = siteId; - this.isPublic = isPublic; - this.isReport = isReport; - this.namespaceService = namespaceService; - this.compatibility = new SavedSearchDetailsCompatibility(this, namespaceService, searchService); - this.searchService = searchService; - } - - /** - * @return - */ - public String getSiteId() - { - return siteId; - } - - /** - * @return - */ - public boolean isPublic() - { - return isPublic; - } - - /** - * @return - */ - public boolean isReport() - { - return isReport; - } - - public SavedSearchDetailsCompatibility getCompatibility() - { - return compatibility; - } - - /** - * @return NodeRef search node ref, null if not set - */ - public NodeRef getNodeRef() - { - return nodeRef; - } - - /** - * @return - */ - public String toJSONString() - { - try - { - JSONObject jsonObject = new JSONObject(); - jsonObject.put(SITE_ID, siteId); - jsonObject.put(NAME, name); - jsonObject.put(DESCRIPTION, description); - jsonObject.put(SEARCH, search); - jsonObject.put(SEARCHPARAMS, searchParameters.toJSONObject(namespaceService)); - jsonObject.put(PUBLIC, isPublic); - - // Add full query for backward compatibility - jsonObject.put(QUERY, searchService.buildQueryString(search, searchParameters)); - jsonObject.put(SORT, compatibility.getSort()); - - return jsonObject.toString(); - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Can not convert saved search details into JSON.", exception); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java deleted file mode 100644 index b069e34fc1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Compatibility class. - * - * Used to bridge between the old style of saved search passed and required by the UI and the new actual saved search details. - * Eventually will be factored out as web scripts are brought up to date. - */ -// Not @AlfrescoPublicApi at the moment as it requires RecordsManagementSearchServiceImpl which is not public API. -public class SavedSearchDetailsCompatibility implements RecordsManagementModel -{ - /** Saved search details */ - private final SavedSearchDetails savedSearchDetails; - - /** Namespace service */ - private final NamespaceService namespaceService; - - /** Records management search service implementation */ - private final RecordsManagementSearchServiceImpl searchService; - - /** - * Retrieve the search from the parameter string - * @param params parameter string - * @return String search term - */ - public static String getSearchFromParams(String params) - { - String search = null; - String[] values = params.split("&"); - for (String value : values) - { - if (value.startsWith("terms")) - { - String[] terms = value.trim().split("="); - try - { - search = URLDecoder.decode(terms[1], "UTF-8"); - } - catch (UnsupportedEncodingException e) - { - // Do nothing just return null - search = null; - } - break; - } - } - - return search; - } - - public static RecordsManagementSearchParameters createSearchParameters(String params, String sort, NamespaceService namespaceService) - { - return createSearchParameters(params, new String[]{"&", "="}, sort, namespaceService); - } - - /** - * - * @param params - * @param sort - * @param namespaceService - * @return - */ - public static RecordsManagementSearchParameters createSearchParameters(String params, String[] paramsDelim, String sort, NamespaceService namespaceService) - { - RecordsManagementSearchParameters result = new RecordsManagementSearchParameters(); - List includedContainerTypes = new ArrayList<>(2); - - // Map the param values into the search parameter object - String[] values = params.split(paramsDelim[0]); - for (String value : values) - { - String[] paramValues = value.split(paramsDelim[1]); - String paramName = paramValues[0].trim(); - String paramValue = paramValues[1].trim(); - if ("records".equals(paramName)) - { - result.setIncludeRecords(Boolean.parseBoolean(paramValue)); - } - else if ("undeclared".equals(paramName)) - { - result.setIncludeUndeclaredRecords(Boolean.parseBoolean(paramValue)); - } - else if ("vital".equals(paramName)) - { - result.setIncludeVitalRecords(Boolean.parseBoolean(paramValue)); - } - else if ("folders".equals(paramName)) - { - result.setIncludeRecordFolders(Boolean.parseBoolean(paramValue)); - } - else if ("frozen".equals(paramName)) - { - result.setIncludeFrozen(Boolean.parseBoolean(paramValue)); - } - else if ("cutoff".equals(paramName)) - { - result.setIncludeCutoff(Boolean.parseBoolean(paramValue)); - } - else if ("categories".equals(paramName) && Boolean.parseBoolean(paramValue)) - { - includedContainerTypes.add(TYPE_RECORD_CATEGORY); - } - } - result.setIncludedContainerTypes(includedContainerTypes); - - if (sort != null) - { - // Map the sort string into the search details - String[] sortPairs = sort.split(","); - List sortOrder = new ArrayList<>(sortPairs.length); - for (String sortPairString : sortPairs) - { - String[] sortPair = sortPairString.split("/"); - QName field = QName.createQName(sortPair[0], namespaceService); - Boolean isAcsending = Boolean.FALSE; - if ("asc".equals(sortPair[1])) - { - isAcsending = Boolean.TRUE; - } - sortOrder.add(new SortItem(field, isAcsending)); - } - result.setSortOrder(sortOrder); - } - - return result; - } - - /** - * Constructor - * @param savedSearchDetails - */ - public SavedSearchDetailsCompatibility(SavedSearchDetails savedSearchDetails, - NamespaceService namespaceService, - RecordsManagementSearchServiceImpl searchService) - { - this.savedSearchDetails = savedSearchDetails; - this.namespaceService = namespaceService; - this.searchService = searchService; - } - - /** - * Get the sort string from the saved search details - * @return - */ - public String getSort() - { - StringBuilder builder = new StringBuilder(64); - - for (SortItem entry : this.savedSearchDetails.getSearchParameters().getSortOrder()) - { - if (builder.length() !=0) - { - builder.append(","); - } - - String order = "desc"; - if (entry.assc) - { - order = "asc"; - } - builder.append(entry.property.toPrefixString(this.namespaceService)) - .append("/") - .append(order); - } - - return builder.toString(); - } - - /** - * Get the parameter string from the saved search details - * @return - */ - public String getParams() - { - List includeContainerTypes = this.savedSearchDetails.getSearchParameters().getIncludedContainerTypes(); - StringBuilder builder = new StringBuilder(128); - builder.append("terms=").append(this.savedSearchDetails.getSearch()).append("&") - .append("records=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecords()).append("&") - .append("undeclared=").append(this.savedSearchDetails.getSearchParameters().isIncludeUndeclaredRecords()).append("&") - .append("vital=").append(this.savedSearchDetails.getSearchParameters().isIncludeVitalRecords()).append("&") - .append("folders=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecordFolders()).append("&") - .append("frozen=").append(this.savedSearchDetails.getSearchParameters().isIncludeFrozen()).append("&") - .append("cutoff=").append(this.savedSearchDetails.getSearchParameters().isIncludeCutoff()).append("&") - .append("categories=").append(includeContainerTypes.contains(TYPE_RECORD_CATEGORY)).append("&") - .append("series=").append(false); - return builder.toString(); - } - - /** - * Build the full query string - * @return - */ - public String getQuery() - { - return searchService.buildQueryString(this.savedSearchDetails.getSearch(), this.savedSearchDetails.getSearchParameters()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java deleted file mode 100644 index 87e6f5be46..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.search; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -@AlfrescoPublicApi -/*package*/ class SortItem -{ - public QName property = null; - public boolean assc = true; - public SortItem(QName property, boolean assc) - { - this.property = property; - this.assc = assc; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java deleted file mode 100644 index 5e78b25bad..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.Pair; - -/** - * Extended security service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ExtendedSecurityService extends DeprecatedExtendedSecurityService -{ - /** IPR group prefix */ - static final String IPR_GROUP_PREFIX = "IPR"; - - /** - * Indicates whether a node has extended security. - * - * @param nodeRef node reference - * @return boolean true if the node has extended security, false otherwise - */ - boolean hasExtendedSecurity(NodeRef nodeRef); - - /** - * Gets the set of authorities that are extended readers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended readers - */ - Set getReaders(NodeRef nodeRef); - - /** - * Get the set of authorities that are extended writers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended writers - */ - Set getWriters(NodeRef nodeRef); - - /** - * Helper to allow caller to provide authority sets as a pair where the - * first is the readers and the second is the writers. - * - * @see #set(NodeRef, Set, Set) - * - * @param nodeRef node reference - * @param readersAndWriters pair where first is the set of readers and the - * second is the set of writers - */ - void set(NodeRef nodeRef, Pair, Set> readersAndWriters); - - /** - * Set extended security for a node, where the readers will be granted ReadRecord - * permission and ViewRecord capability to the node and where the writers will be - * granted Filling permission and Filling capability to the node. - *

- * Note it is vaild to provide 'null' values for readers and/or writers. - * - * @param nodeRef node reference - * @param readers set of readers - * @param writers set of writers - * - * @since 2.5 - */ - void set(NodeRef nodeRef, Set readers, Set writers); - - /** - * Removes all extended security from a node. - * - * @param nodeRef node reference - */ - void remove(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java deleted file mode 100644 index cb34dc7ae5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java +++ /dev/null @@ -1,673 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.model.RenditionModel; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.extensions.webscripts.ui.common.StringUtils; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; - -/** - * Extended security service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedSecurityServiceImpl extends ServiceBaseImpl - implements ExtendedSecurityService, - RecordsManagementModel, - ApplicationListener -{ - /** ipr group names */ - static final String ROOT_IPR_GROUP = "INPLACE_RECORD_MANAGEMENT"; - static final String READER_GROUP_PREFIX = ExtendedSecurityService.IPR_GROUP_PREFIX + "R"; - static final String WRITER_GROUP_PREFIX = ExtendedSecurityService.IPR_GROUP_PREFIX + "W"; - - /** max page size for authority query */ - private static final int MAX_ITEMS = 50; - - /** File plan service */ - private FilePlanService filePlanService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** authority service */ - private AuthorityService authorityService; - - /** permission service */ - private PermissionService permissionService; - - /** transaction service */ - private TransactionService transactionService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Application context refresh event handler - */ - @Override - public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) - { - // run as System on bootstrap - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - // if the root group doesn't exist then create it - if (!authorityService.authorityExists(getRootIRPGroup())) - { - authorityService.createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, - Collections.singleton(RMAuthority.ZONE_APP_RM)); - } - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Get root IPR group name - */ - private String getRootIRPGroup() - { - return GROUP_PREFIX + ROOT_IPR_GROUP; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#hasExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean hasExtendedSecurity(NodeRef nodeRef) - { - return (getIPRGroups(nodeRef) != null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#getReaders(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public Set getReaders(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Set result = Collections.EMPTY_SET; - Pair iprGroups = getIPRGroups(nodeRef); - if (iprGroups != null) - { - result = getAuthorities(iprGroups.getFirst()); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#getWriters(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public Set getWriters(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Set result = Collections.EMPTY_SET; - Pair iprGroups = getIPRGroups(nodeRef); - if (iprGroups != null) - { - result = getAuthorities(iprGroups.getSecond()); - } - - return result; - } - - /** - * Helper to get authorities for a given group - * - * @param group group name - * @return Set immediate authorities - */ - private Set getAuthorities(String group) - { - Set result = new HashSet<>(); - result.addAll(authorityService.getContainedAuthorities(null, group, true)); - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#set(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.util.Pair) - */ - @Override - public void set(NodeRef nodeRef, Pair, Set> readersAndWriters) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - set(nodeRef, readersAndWriters.getFirst(), readersAndWriters.getSecond()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#set(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) - */ - @Override - public void set(NodeRef nodeRef, Set readers, Set writers) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // remove existing extended security, assuming there is any - remove(nodeRef); - - // find groups - Pair iprGroups = createOrFindIPRGroups(readers, writers); - - // assign groups to correct fileplan roles - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, iprGroups.getFirst()); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, iprGroups.getSecond()); - - // assign groups to node - assignIPRGroupsToNode(iprGroups, nodeRef); - - // apply the readers to any renditions of the content - if (isRecord(nodeRef)) - { - List assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - assignIPRGroupsToNode(iprGroups, child); - } - } - } - - /** - * Get the IPR groups associated with a given node reference. - *

- * Return null if none found. - * - * @param nodeRef node reference - * @return Pair where first is the read group and second if the write group, null if none found - */ - private Pair getIPRGroups(NodeRef nodeRef) - { - Pair result = null; - String iprReaderGroup = null; - String iprWriterGroup = null; - - // get all the set permissions - Set permissions = permissionService.getAllSetPermissions(nodeRef); - for (AccessPermission permission : permissions) - { - // look for the presence of the reader group - if (permission.getAuthority().startsWith(GROUP_PREFIX + READER_GROUP_PREFIX)) - { - iprReaderGroup = permission.getAuthority(); - } - // look for the presence of the writer group - else if (permission.getAuthority().startsWith(GROUP_PREFIX + WRITER_GROUP_PREFIX)) - { - iprWriterGroup = permission.getAuthority(); - } - } - - // assuming the are both present then return - if (iprReaderGroup != null && iprWriterGroup != null) - { - result = new Pair<>(iprReaderGroup, iprWriterGroup); - } - - return result; - } - - /** - * Given a set of readers and writers find or create the appropriate IPR groups. - *

- * The IPR groups are named with hashes of the authority lists in order to reduce - * the set of groups that require exact match. A further index is used to handle - * a situation where there is a hash clash, but a difference in the authority lists. - *

- * When no match is found the groups are created. Once created - * - * @param filePlan file plan - * @param readers authorities with read - * @param writers authorities with write - * @return Pair where first is the full name of the read group and - * second is the full name of the write group - */ - private Pair createOrFindIPRGroups(Set readers, Set writers) - { - return new Pair<>( - createOrFindIPRGroup(READER_GROUP_PREFIX, readers), - createOrFindIPRGroup(WRITER_GROUP_PREFIX, writers)); - } - - /** - * Create or find an IPR group based on the provided prefix and authorities. - * - * @param groupPrefix group prefix - * @param authorities authorities - * @return String full group name - */ - private String createOrFindIPRGroup(String groupPrefix, Set authorities) - { - String group = null; - - // find group or determine what the next index is if no group exists or there is a clash - Pair groupResult = findIPRGroup(groupPrefix, authorities); - - if (groupResult.getFirst() == null) - { - group = createIPRGroup(groupPrefix, authorities, groupResult.getSecond()); - } - else - { - group = groupResult.getFirst(); - } - - return group; - } - - /** - * Given a group name prefix and the authorities, finds the exact match existing group. - *

- * If the group does not exist then the group returned is null and the index shows the next available - * group index for creation. - * - * @param groupPrefix group name prefix - * @param authorities authorities - * @return Pair where first is the name of the found group, null if none found and second - * if the next available create index - */ - private Pair findIPRGroup(String groupPrefix, Set authorities) - { - String iprGroup = null; - int nextGroupIndex = 0; - boolean hasMoreItems = true; - int pageCount = 0; - - // determine the short name prefix - String groupShortNamePrefix = getIPRGroupPrefixShortName(groupPrefix, authorities); - - // iterate over the authorities to find a match - while (hasMoreItems == true) - { - // get matching authorities - PagingResults results = authorityService.getAuthorities(AuthorityType.GROUP, - RMAuthority.ZONE_APP_RM, - groupShortNamePrefix, - false, - false, - new PagingRequest(MAX_ITEMS*pageCount, MAX_ITEMS)); - - // record the total count - nextGroupIndex = nextGroupIndex + results.getPage().size(); - - // see if any of the matching groups exactly match - for (String group : results.getPage()) - { - // if exists and matches we have found our group - if (isIPRGroupTrueMatch(group, authorities)) - { - return new Pair(group, nextGroupIndex); - } - } - - // determine if there are any more pages to inspect - hasMoreItems = results.hasMoreItems(); - pageCount ++; - } - - return new Pair<>(iprGroup, nextGroupIndex); - } - - /** - * Determines whether a group exactly matches a list of authorities. - * - * @param authorities list of authorities - * @param group group - * @return - */ - private boolean isIPRGroupTrueMatch(String group, Set authorities) - { - //Remove GROUP_EVERYONE for proper comparison as GROUP_EVERYONE is never included in an IPR group - Set plainAuthorities = new HashSet(); - if (authorities != null) - { - plainAuthorities.addAll(authorities); - plainAuthorities.remove(PermissionService.ALL_AUTHORITIES); - } - Set contained = authorityService.getContainedAuthorities(null, group, true); - return contained.equals(plainAuthorities); - } - - /** - * Get IPR group prefix short name. - *

- * 'package' scope to help testing. - * - * @param prefix prefix - * @param authorities authorities - * @return String group prefix short name - */ - /*package*/ String getIPRGroupPrefixShortName(String prefix, Set authorities) - { - StringBuilder builder = new StringBuilder(128) - .append(prefix) - .append(getAuthoritySetHashCode(authorities)); - - return builder.toString(); - } - - /** - * Get IPR group short name. - *

- * Note this excludes the "GROUP_" prefix. - *

- * 'package' scope to help testing. - * - * @param prefix prefix - * @param readers read authorities - * @param writers write authorities - * @param index group index - * @return String group short name - */ - /*package*/ String getIPRGroupShortName(String prefix, Set authorities, int index) - { - return getIPRGroupShortName(prefix, authorities, Integer.toString(index)); - } - - /** - * Get IPR group short name. - *

- * Note this excludes the "GROUP_" prefix. - * - * @param prefix prefix - * @param readers read authorities - * @param writers write authorities - * @param index group index - * @return String group short name - */ - private String getIPRGroupShortName(String prefix, Set authorities, String index) - { - StringBuilder builder = new StringBuilder(128) - .append(getIPRGroupPrefixShortName(prefix, authorities)) - .append(index); - - return builder.toString(); - } - - /** - * Gets the hashcode value of a set of authorities. - * - * @param authorities set of authorities - * @return int hash code - */ - private int getAuthoritySetHashCode(Set authorities) - { - int result = 0; - if (authorities != null && !authorities.isEmpty()) - { - result = StringUtils.join(authorities.toArray(), "").hashCode(); - } - return result; - } - - /** - * Creates a new IPR group. - * - * @param groupNamePrefix group name prefix - * @param children child authorities - * @param index group index - * @return String full name of created group - */ - private String createIPRGroup(String groupNamePrefix, Set children, int index) - { - ParameterCheck.mandatory("groupNamePrefix", groupNamePrefix); - - // get the group name - String groupShortName = getIPRGroupShortName(groupNamePrefix, children, index); - - // create group - String group; - try - { - group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM)); - - // add root parent - authorityService.addAuthority(getRootIRPGroup(), group); - - // add children if provided - if (children != null) - { - for (String child : children) - { - if (authorityService.authorityExists(child) && !PermissionService.ALL_AUTHORITIES.equals(child)) - { - authorityService.addAuthority(group, child); - } - } - } - } - catch(DuplicateChildNodeNameException ex) - { - // the group was concurrently created - group = authorityService.getName(AuthorityType.GROUP, groupShortName); - } - - return group; - } - - /** - * Assign IPR groups to a node reference with the correct permissions. - * - * @param iprGroups iprGroups, first read and second write - * @param nodeRef node reference - */ - private void assignIPRGroupsToNode(Pair iprGroups, NodeRef nodeRef) - { - permissionService.setPermission(nodeRef, iprGroups.getFirst(), RMPermissionModel.READ_RECORDS, true); - permissionService.setPermission(nodeRef, iprGroups.getSecond(), RMPermissionModel.FILING, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#remove(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void remove(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Pair iprGroups = getIPRGroups(nodeRef); - if (iprGroups != null) - { - // remove any extended security that might be present - clearPermissions(nodeRef, iprGroups); - - // remove the readers from any renditions of the content - if (isRecord(nodeRef)) - { - List assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - clearPermissions(child, iprGroups); - } - } - } - } - - /** - * Clear the nodes IPR permissions - * - * @param nodeRef node reference - */ - private void clearPermissions(NodeRef nodeRef, Pair iprGroups) - { - // remove group permissions from node - permissionService.clearPermission(nodeRef, iprGroups.getFirst()); - permissionService.clearPermission(nodeRef, iprGroups.getSecond()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#getExtendedReaders(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override @Deprecated public Set getExtendedReaders(NodeRef nodeRef) - { - return getReaders(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#getExtendedWriters(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override @Deprecated public Set getExtendedWriters(NodeRef nodeRef) - { - return getWriters(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#addExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) - */ - @Override @Deprecated public void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers) - { - set(nodeRef, readers, writers); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#addExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set, boolean) - */ - @Override @Deprecated public void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents) - { - set(nodeRef, readers, writers); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeAllExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override @Deprecated public void removeAllExtendedSecurity(NodeRef nodeRef) - { - remove(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) - */ - @Override @Deprecated public void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers) - { - remove(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set, boolean) - */ - @Override @Deprecated public void removeExtendedSecurity(NodeRef nodeRef, Set readers, Setwriters, boolean applyToParents) - { - remove(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeAllExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override @Deprecated public void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents) - { - remove(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java deleted file mode 100644 index 377d90dba2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * File plan permission service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface FilePlanPermissionService -{ - /** - * Setup permissions for a record category - * - * @param recordCategory record category node reference - */ - void setupRecordCategoryPermissions(NodeRef recordCategory); - - /** - * Setup permissions for an object within a given parent. - * - * @param parent parent node to inherit permissions from - * @param nodeRef node ref to setup permissions on - */ - void setupPermissions(NodeRef parent, NodeRef nodeRef); - - /** - * Sets a permission on a file plan object. Assumes allow is true. Cascades permission down to record folder. - * Cascades ReadRecord up to file plan. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - */ - void setPermission(NodeRef nodeRef, String authority, String permission); - - /** - * Deletes a permission from a file plan object. Cascades removal down to record folder. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - */ - void deletePermission(NodeRef nodeRef, String authority, String permission); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java deleted file mode 100644 index 3a5cc8a722..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java +++ /dev/null @@ -1,715 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import static java.util.Collections.singletonMap; - -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTION_COMMIT; -import static org.alfresco.repo.policy.annotation.BehaviourKind.CLASS; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName; -import static org.alfresco.service.cmr.security.OwnableService.NO_OWNER; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.apache.commons.lang3.BooleanUtils.isTrue; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -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; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -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.cmr.security.AccessPermission; -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.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * File plan permission service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class FilePlanPermissionServiceImpl extends ServiceBaseImpl - implements FilePlanPermissionService, - RMPermissionModel, - NodeServicePolicies.OnMoveNodePolicy -{ - /** An audit key for the set permission event. */ - private static final String AUDIT_SET_PERMISSION = "set-permission"; - - /** An namespace to use when constructing QNames to use for auditing changes to permissions. */ - private static final String AUDIT_NAMESPACE = "audit://permissions/"; - - /** Permission service */ - private PermissionService permissionService; - - /** Ownable service */ - private OwnableService ownableService; - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Authority service */ - private AuthorityService authorityService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** The RM audit service. */ - private RecordsManagementAuditService recordsManagementAuditService; - - /** Logger */ - private static final Log LOGGER = LogFactory.getLog(FilePlanPermissionServiceImpl.class); - - /** - * Initialisation method - */ - public void init() - { - getPolicyComponent().bindClassBehaviour( - NodeServicePolicies.OnAddAspectPolicy.QNAME, - ASPECT_RECORD, - new JavaBehaviour(this, "onAddRecord", TRANSACTION_COMMIT)); - getPolicyComponent().bindClassBehaviour( - NodeServicePolicies.OnMoveNodePolicy.QNAME, - ASPECT_RECORD, - new JavaBehaviour(this, "onMoveRecord", TRANSACTION_COMMIT)); - getPolicyComponent().bindClassBehaviour( - NodeServicePolicies.OnMoveNodePolicy.QNAME, - TYPE_RECORD_CATEGORY, - new JavaBehaviour(this, "onMoveNode", TRANSACTION_COMMIT)); - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_SET_PERMISSION, "rm.audit.set-permission")); - return null; - } - }); - } - - /** - * Gets the permission service - * - * @return The permission service - */ - protected PermissionService getPermissionService() - { - return this.permissionService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * Gets the policy component - * - * @return The policy component - */ - protected PolicyComponent getPolicyComponent() - { - return this.policyComponent; - } - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Gets the ownable service - * - * @return The ownable service - */ - protected OwnableService getOwnableService() - { - return this.ownableService; - } - - /** - * @param ownableService ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * Gets the authority service - * - * @return The authority service - */ - public AuthorityService getAuthorityService() - { - return this.authorityService; - } - - /** - * Sets the authority service - * - * @param authorityService The authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - 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; - } - - /** - * Set the RM audit service. - * - * @param recordsManagementAuditService The RM audit service. - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupRecordCategoryPermissions(final NodeRef recordCategory) - { - mandatory("recordCategory", recordCategory); - - // assert that we have a record category in our hands - if (!instanceOf(recordCategory, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException("Unable to setup record category permissions, because node is not a record category."); - } - - // setup category permissions - NodeRef parentNodeRef = nodeService.getPrimaryParent(recordCategory).getParentRef(); - setupPermissions(parentNodeRef, recordCategory); - } - - /** - * Setup permissions on new unfiled record folder - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:unfiledRecordFolder", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateUnfiledRecordFolder(ChildAssociationRef childAssocRef) - { - mandatory("childAssocRef", childAssocRef); - setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); - } - - /** - * Setup permissions on new record folder - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:recordFolder", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateRecordFolder(ChildAssociationRef childAssocRef) - { - mandatory("childAssocRef", childAssocRef); - setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); - } - - /** - * Setup permissions on newly created hold. - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:hold", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateHold(final ChildAssociationRef childAssocRef) - { - createContainerElement(childAssocRef); - } - - /** - * Setup permissions on newly created transfer. - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:transfer", - kind = CLASS, - policy = "alf:onCreateNode", - 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() - { - @Override - public Boolean doWork() - { - return getPermissionService().hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED; - } - }, user); - - if (!hasUserPermission) - { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - getPermissionService().setPermission(nodeRef, user, RMPermissionModel.FILING, true); - return null; - } - }); - } - } - - /** - * Helper method to setup permissions. - * - * @param parent parent node reference - * @param nodeRef child node reference - */ - @Override - public void setupPermissions(final NodeRef parent, final NodeRef nodeRef) - { - mandatory("parent", parent); - mandatory("nodeRef", nodeRef); - - if (nodeService.exists(nodeRef) && nodeService.exists(parent)) - { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Object doWork() - { - // set inheritance - boolean isParentNodeFilePlan = isRecordCategory(nodeRef) && isFilePlan(parent); - boolean inheritanceAllowed = isInheritanceAllowed(nodeRef, isParentNodeFilePlan); - getPermissionService().setInheritParentPermissions(nodeRef, inheritanceAllowed); - - Set keepPerms = new HashSet<>(5); - Set origionalPerms= getPermissionService().getAllSetPermissions(nodeRef); - - for (AccessPermission perm : origionalPerms) - { - if (perm.getAuthority().startsWith(PermissionService.GROUP_PREFIX + ExtendedSecurityService.IPR_GROUP_PREFIX)) - { - // then we can assume this is a permission we want to preserve - keepPerms.add(perm); - } - } - - // clear all existing permissions and start again - getPermissionService().clearPermission(nodeRef, null); - - // re-add keep'er permissions - for (AccessPermission keeper : keepPerms) - { - setPermission(nodeRef, keeper.getAuthority(), keeper.getPermission()); - } - - if (!inheritanceAllowed) - { - String adminRole = getAdminRole(nodeRef); - getPermissionService().setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); - } - - // remove owner - getOwnableService().setOwner(nodeRef, NO_OWNER); - - if (isParentNodeFilePlan) - { - Set perms = permissionService.getAllSetPermissions(parent); - for (AccessPermission perm : perms) - { - if (RMPermissionModel.FILING.equals(perm.getPermission())) - { - AccessStatus accessStatus = perm.getAccessStatus(); - boolean allow = false; - if (AccessStatus.ALLOWED.equals(accessStatus)) - { - allow = true; - } - permissionService.setPermission( - nodeRef, - perm.getAuthority(), - perm.getPermission(), - allow); - } - } - } - - return null; - } - }); - } - } - - private String getAdminRole(NodeRef nodeRef) - { - NodeRef filePlan = getFilePlan(nodeRef); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("The file plan could not be found for the give node: '" + nodeRef + "'."); - } - return authorityService.getName(AuthorityType.GROUP, FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); - } - - /** - * Indicates whether the default behaviour is to inherit permissions or not. - * - * @param nodeRef node reference - * @param isParentNodeFilePlan true if parent node is a file plan, false otherwise - * @return boolean true if inheritance true, false otherwise - */ - private boolean isInheritanceAllowed(NodeRef nodeRef, Boolean isParentNodeFilePlan) - { - return !(isFilePlan(nodeRef) || - isTransfer(nodeRef) || - isHold(nodeRef) || - isUnfiledRecordsContainer(nodeRef) || - (isRecordCategory(nodeRef) && isTrue(isParentNodeFilePlan))); - } - - /** - * Sets ups records permission when aspect is added. - * - * @see NodeServicePolicies.OnAddAspectPolicy#onAddAspect(NodeRef, QName) - * - * @param record - * @param aspectTypeQName - */ - public void onAddRecord(final NodeRef record, final QName aspectTypeQName) - { - mandatory("childAssocRef", record); - mandatory("childAssocRef", aspectTypeQName); - - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Object doWork() - { - if (nodeService.exists(record) && nodeService.hasAspect(record, aspectTypeQName)) - { - NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); - setupPermissions(recordFolder, record); - } - - return null; - } - }); - } - - /** - * onMoveRecord behaviour - * - * @param sourceAssocRef source association reference - * @param destinationAssocRef destination association reference - */ - public void onMoveRecord(final ChildAssociationRef sourceAssocRef, final ChildAssociationRef destinationAssocRef) - { - mandatory("sourceAssocRef", sourceAssocRef); - mandatory("destinationAssocRef", destinationAssocRef); - - authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - NodeRef record = sourceAssocRef.getChildRef(); - if (nodeService.exists(record) && nodeService.hasAspect(record, ASPECT_RECORD)) - { - boolean inheritParentPermissions = permissionService.getInheritParentPermissions(record); - - Set keepPerms = new HashSet<>(5); - Set origionalRecordPerms= permissionService.getAllSetPermissions(record); - - for (AccessPermission recordPermission : origionalRecordPerms) - { - String permission = recordPermission.getPermission(); - if ((RMPermissionModel.FILING.equals(permission) || RMPermissionModel.READ_RECORDS.equals(permission)) && - recordPermission.isSetDirectly()) - { - // then we can assume this is a permission we want to preserve - keepPerms.add(recordPermission); - } - } - - // re-setup the records permissions - setupPermissions(destinationAssocRef.getParentRef(), record); - - // re-add keep'er permissions - for (AccessPermission keeper : keepPerms) - { - setPermission(record, keeper.getAuthority(), keeper.getPermission()); - } - - permissionService.setInheritParentPermissions(record, inheritParentPermissions); - } - - return null; - } - }, getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setPermission(NodeRef, String, String) - */ - @Override - public void setPermission(final NodeRef nodeRef, final String authority, final String permission) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("authority", authority); - ParameterCheck.mandatory("permission", permission); - - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (canPerformPermissionAction(nodeRef)) - { - QName auditProperty = constructAuditEventName(authority, permission); - Map oldPermission = getCurrentPermissionForAuthority(nodeRef, authority, permission, auditProperty); - // Set the permission on the node - getPermissionService().setPermission(nodeRef, authority, permission, true); - // Add an entry in the audit log. - recordsManagementAuditService.auditOrUpdateEvent(nodeRef, AUDIT_SET_PERMISSION, oldPermission, - new HashMap<>(singletonMap(auditProperty, (Serializable) true)), true); - } - else - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Setting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); - } - } - - return null; - } - }); - } - - /** - * Get the current permission on a node for an authority. - * - * @param nodeRef The node. - * @param authority The authority. - * @param auditProperty The QName used as the key in the returned map. - * @return A map from the audit property to true or false depending on whether the user currently has permission. - */ - private Map getCurrentPermissionForAuthority(NodeRef nodeRef, String authority, String permission, QName auditProperty) - { - Set allSetPermissions = getPermissionService().getAllSetPermissions(nodeRef); - for (AccessPermission setPermission : allSetPermissions) - { - if (setPermission.getAuthority().equals(authority) && setPermission.getPermission().equals(permission)) - { - return new HashMap<>(singletonMap(auditProperty, (Serializable) true)); - } - } - return new HashMap<>(singletonMap(auditProperty, (Serializable) false)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deletePermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Override - public void deletePermission(final NodeRef nodeRef, final String authority, final String permission) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("authority", authority); - ParameterCheck.mandatory("permission", permission); - - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (canPerformPermissionAction(nodeRef)) - { - QName auditProperty = constructAuditEventName(authority, permission); - Map oldPermission = getCurrentPermissionForAuthority(nodeRef, authority, permission, auditProperty); - // Delete permission on this node - getPermissionService().deletePermission(nodeRef, authority, permission); - // Add an entry in the audit log. - recordsManagementAuditService.auditOrUpdateEvent(nodeRef, AUDIT_SET_PERMISSION, oldPermission, - new HashMap<>(singletonMap(auditProperty, (Serializable) false)), true); - } - else - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Deleting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); - } - } - - return null; - } - }); - } - - /** - * Construct a QName so that the authority and permission are visible in the log. - * - * @param authority The authority whose permission is being changed. - * @param permission The name of the permission being changed. - * @return A QName such that the local name will make sense to the end user. - */ - private QName constructAuditEventName(String authority, String permission) - { - return QName.createQName(AUDIT_NAMESPACE, permission + " " + authority); - } - - private boolean canPerformPermissionAction(NodeRef nodeRef) - { - return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef) || isTransfer(nodeRef) || isHold(nodeRef); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - if (isFilePlan(newChildAssocRef.getParentRef())) - { - permissionService.setInheritParentPermissions(oldChildAssocRef.getChildRef(), false); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java deleted file mode 100644 index b7e74753a7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor; -import org.alfresco.service.cmr.security.AccessStatus; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import net.sf.acegisecurity.AccessDeniedException; -import net.sf.acegisecurity.intercept.InterceptorStatusToken; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Records Management Method Security Interceptor. - *

- * Provides a way to record information about the capabilities being executed and report - * when an access denied exception is thrown. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(RMMethodSecurityInterceptor.class); - - /** - * Helper class to hold capability report information - */ - private static class CapabilityReport - { - public String name; - public AccessStatus status; - public Map conditions = new HashMap<>(); - } - - /** - * Helper method to translate vote to access status. - * - * @param vote vote - * @return {@link AccessStatus} access status - */ - private static AccessStatus translate(int vote) - { - switch (vote) - { - case AccessDecisionVoter.ACCESS_ABSTAIN: - return AccessStatus.UNDETERMINED; - case AccessDecisionVoter.ACCESS_GRANTED: - return AccessStatus.ALLOWED; - case AccessDecisionVoter.ACCESS_DENIED: - return AccessStatus.DENIED; - default: - return AccessStatus.UNDETERMINED; - } - } - - /** - * Current capability report details. - *

- * Used to generate the capability error report. - */ - private static final ThreadLocal> CAPABILITIES = new ThreadLocal>() - { - @Override - protected Map initialValue() - { - return new HashMap<>(); - } - }; - - /** - * Indicates whether this is an RM security check or not - */ - private static final ThreadLocal IS_RM_SECURITY_CHECK = new ThreadLocal() - { - protected Boolean initialValue() {return false;} - }; - - /** - * Messages to display in error report. - */ - private static final ThreadLocal> MESSAGES = new ThreadLocal>() - { - protected List initialValue() {return new ArrayList<>();} - }; - - /** - * Get capability report object from the thread local, creating one for - * the given capability name if one does not already exist. - * - * @param name capability name - * @return {@link CapabilityReport} object containing information about the capability - */ - private static CapabilityReport getCapabilityReport(String name) - { - Map map = RMMethodSecurityInterceptor.CAPABILITIES.get(); - CapabilityReport capability = map.get(name); - if (capability == null) - { - capability = new CapabilityReport(); - capability.name = name; - - map.put(name, capability); - } - return capability; - } - - /** - * Indicates whether this is a RM security check or not - * - * @param newValue true if RM security check, false otherwise - */ - public static void isRMSecurityChecked(boolean newValue) - { - if (LOGGER.isDebugEnabled()) - { - RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.set(newValue); - } - } - - /** - * Add a message to be displayed in the error report. - * - * @param message error message - */ - public static void addMessage(String message) - { - if (LOGGER.isDebugEnabled()) - { - List messages = RMMethodSecurityInterceptor.MESSAGES.get(); - messages.add(message); - } - } - - public static void addMessage(String message, Object ... params) - { - if (LOGGER.isDebugEnabled()) - { - addMessage(MessageFormat.format(message, params)); - } - } - - /** - * Report capability status. - * - * @param name capability name - * @param status capability status - */ - public static void reportCapabilityStatus(String name, int status) - { - if (LOGGER.isDebugEnabled()) - { - CapabilityReport capability = getCapabilityReport(name); - capability.status = translate(status); - } - } - - /** - * Report capability condition. - * - * @param name capability name - * @param conditionName capability condition name - * @param expected expected value - * @param actual actual value - */ - public static void reportCapabilityCondition(String name, String conditionName, boolean expected, boolean actual) - { - if (LOGGER.isDebugEnabled()) - { - CapabilityReport capability = getCapabilityReport(name); - if (!expected) - { - conditionName = "!" + conditionName; - } - capability.conditions.put(conditionName, (expected == actual)); - } - } - - /** - * Gets the failure report for the currently recorded capabilities. - * - * @return {@link String} capability error report - */ - public String getFailureReport() - { - String result = null; - - if (LOGGER.isDebugEnabled()) - { - Collection capabilities = RMMethodSecurityInterceptor.CAPABILITIES.get().values(); - - if (!capabilities.isEmpty()) - { - StringBuilder buffer = new StringBuilder("\n"); - for (CapabilityReport capability : capabilities) - { - buffer.append(" ").append(capability.name).append(" (").append(capability.status).append(")\n"); - if (!capability.conditions.isEmpty()) - { - for (Map.Entry entry : capability.conditions.entrySet()) - { - buffer.append(" - ").append(entry.getKey()).append(" ("); - if (entry.getValue()) - { - buffer.append("passed"); - } - else - { - buffer.append("failed"); - } - buffer.append(")\n"); - } - } - } - - result = buffer.toString(); - } - } - - return result; - } - - /** - * @see net.sf.acegisecurity.intercept.AbstractSecurityInterceptor#beforeInvocation(java.lang.Object) - */ - @Override - protected InterceptorStatusToken beforeInvocation(Object object) - { - InterceptorStatusToken result = null; - try - { - // clear the capability report information - RMMethodSecurityInterceptor.CAPABILITIES.remove(); - RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.remove(); - RMMethodSecurityInterceptor.MESSAGES.remove(); - - // before invocation (where method security check takes place) - result = super.beforeInvocation(object); - } - catch (AccessDeniedException exception) - { - if (LOGGER.isDebugEnabled()) - { - MethodInvocation mi = (MethodInvocation)object; - - StringBuilder methodDetails = new StringBuilder("\n"); - if (RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.get()) - { - methodDetails.append("RM method security check was performed.\n"); - } - else - { - methodDetails.append("Standard DM method security check was performed.\n"); - } - - boolean first = true; - methodDetails.append("Failed on method: ").append(mi.getMethod().getName()).append("("); - for (Object arg : mi.getArguments()) - { - if (first) - { - first = false; - } - else - { - methodDetails.append(", "); - } - - if (arg != null) - { - methodDetails.append(arg.toString()); - } - else - { - methodDetails.append("null"); - } - } - methodDetails.append(")\n"); - - List messages = RMMethodSecurityInterceptor.MESSAGES.get(); - for (String message : messages) - { - methodDetails.append(message).append("\n"); - } - - String failureReport = getFailureReport(); - if (failureReport == null) - { - // rethrow with additional information - throw new AccessDeniedException(exception.getMessage() + methodDetails, exception); - } - else - { - // rethrow with additional information - throw new AccessDeniedException(exception.getMessage() + methodDetails + getFailureReport(), exception); - } - } - else - { - throw exception; - } - } - return result; - } - - /** - * @see net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor#invoke(org.aopalliance.intercept.MethodInvocation) - */ - @Override - public Object invoke(MethodInvocation mi) throws Throwable - { - Object result = null; - InterceptorStatusToken token = beforeInvocation(mi); - - try - { - result = mi.proceed(); - } - finally - { - result = super.afterInvocation(token, result); - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java deleted file mode 100644 index 7887ed2c97..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.PropertyValue; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.config.TypedStringValue; - -/** - * Records management method security post processor. - *

- * Combines RM method security configuration with that of the core server before the security - * bean is instantiated. - * - * @author Roy Wetherall - */ -public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor -{ - private static final Logger LOGGER = LoggerFactory.getLogger(RMMethodSecurityPostProcessor.class); - - public static final String PROP_OBJECT_DEFINITION_SOURCE = "objectDefinitionSource"; - public static final String PROPERTY_PREFIX = "rm.methodsecurity."; - public static final String SECURITY_BEAN_POSTFIX = "_security"; - - /** Security bean names */ - private Set securityBeanNames; - private Set securityBeanNameCache; - - /** Configuration properties */ - private Properties properties; - - /** - * Set of security beans to apply RM configuration to. - *

- * Used in the case where the security bean does not follow the standard naming convention. - * - * @param securityBeanNames security bean names - */ - public void setSecurityBeanNames(Set securityBeanNames) - { - this.securityBeanNames = securityBeanNames; - } - - /** - * @param properties configuration properties - */ - public void setProperties(Properties properties) - { - this.properties = properties; - } - - /** - * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) - */ - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) - { - for (String bean : getSecurityBeanNames(beanFactory)) - { - if (beanFactory.containsBeanDefinition(bean)) - { - LOGGER.debug("Adding RM method security definitions for {}", bean); - - BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); - PropertyValue beanValue = beanDef.getPropertyValues().getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE); - if (beanValue != null) - { - String beanStringValue = (String)((TypedStringValue)beanValue.getValue()).getValue(); - String mergedStringValue = merge(beanStringValue); - beanDef.getPropertyValues().addPropertyValue(PROP_OBJECT_DEFINITION_SOURCE, new TypedStringValue(mergedStringValue)); - } - } - } - } - - /** - * Get all the security bean names by looking at the property values set. - * - * @param beanFactory - * @return - */ - private Set getSecurityBeanNames(ConfigurableListableBeanFactory beanFactory) - { - if (securityBeanNameCache == null) - { - securityBeanNameCache = new HashSet<>(21); - if (securityBeanNames != null) - { - securityBeanNameCache.addAll(securityBeanNames); - } - - for (Object key : properties.keySet()) - { - String[] split = ((String)key).split("\\."); - int index = split.length - 2; - String securityBeanName = split[index] + SECURITY_BEAN_POSTFIX; - if (!securityBeanNameCache.contains(securityBeanName) && beanFactory.containsBean(securityBeanName)) - { - LOGGER.debug("Adding {} to list from properties.", securityBeanName); - - securityBeanNameCache.add(securityBeanName); - } - } - } - - return securityBeanNameCache; - } - - /** - * @param beanStringValue - * @param rmBeanStringValue - * @return - */ - private String merge(String beanStringValue) - { - Map map = convertToMap(beanStringValue); - - for (Map.Entry entry : map.entrySet()) - { - String key = entry.getKey(); - String propKey = PROPERTY_PREFIX + key; - if (properties.containsKey(propKey)) - { - map.put(key, entry.getValue() + "," + properties.getProperty(propKey)); - } - else - { - LOGGER.warn("Missing RM security definition for method {}", key); - } - } - - return convertToString(map); - } - - /** - * Convert the lines of a string to a map, separating keys from values by the first "=" sign. - * - * @param stringValue The multi-line string. - * @return The resulting map. - * @throws AlfrescoRuntimeException If a non-blank line does not contain an "=" sign. - */ - protected Map convertToMap(String stringValue) - { - String[] values = stringValue.trim().split("\n"); - Map map = new HashMap<>(values.length); - for (String value : values) - { - String trimmed = value.trim(); - if (trimmed.isEmpty()) - { - continue; - } - String[] pair = trimmed.split("=", 2); - if (pair.length != 2) - { - throw new AlfrescoRuntimeException("Could not convert string to map " + trimmed); - } - map.put(pair[0], pair[1]); - } - return map; - } - - /** - * @param map - * @return - */ - private String convertToString(Map map) - { - StringBuilder buffer = new StringBuilder(256); - for (Map.Entry entry : map.entrySet()) - { - buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); - } - - return buffer.toString(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java deleted file mode 100644 index 388960cba6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.site; - -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.CannedQuery; -import org.alfresco.query.PagingRequest; -import org.alfresco.repo.node.getchildren.FilterProp; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; - -/** - * Override default implementation to add rma:rmsite to list of returned site types. - * - * See https://issues.alfresco.com/jira/browse/RM-387 - * - * @author Roy Wetherall - */ -public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory - implements RecordsManagementModel -{ - @Override - public CannedQuery getCannedQuery(NodeRef parentRef, String pattern, Set assocTypeQNames, Set childTypeQNames, List filterProps, List> sortProps, PagingRequest pagingRequest) - { - childTypeQNames.add(TYPE_RM_SITE); - return super.getCannedQuery(parentRef, pattern, assocTypeQNames, childTypeQNames, filterProps, sortProps, pagingRequest); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java deleted file mode 100644 index 48596b3703..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.transfer; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Transfer Service Interface - * - * @author Tuna Aksoy - * @since 2.2 - */ -@AlfrescoPublicApi -public interface TransferService -{ - /** - * Indicates whether the given node is a transfer (container) or not. - * - * @param nodeRef node reference - * @return boolean true if transfer, false otherwise - * - * @since 2.0 - */ - boolean isTransfer(NodeRef nodeRef); - - /** - * Create the transfer node and link the disposition lifecycle node beneath it - * - * @param nodeRef node reference to transfer - * @param isAccession Indicates whether this transfer is an accession or not - * @return Returns the transfer object node reference - * - * @since 2.2 - */ - NodeRef transfer(NodeRef nodeRef, boolean isAccession); - - /** - * Completes the transfer for the given node. - * - * @param nodeRef node reference to complete the transfer - * - * @since 2.2 - */ - void completeTransfer(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java deleted file mode 100644 index 544ffac9fd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.transfer; - -import java.io.Serializable; -import java.util.Date; -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.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.model.rma.type.TransferContainerType; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.TransferType; -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.ServiceBaseImpl; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Transfer service implementation - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class TransferServiceImpl extends ServiceBaseImpl - implements TransferService, RecordsManagementModel -{ - /** Transfer node reference key */ - public static final String KEY_TRANSFER_NODEREF = "transferNodeRef"; - - /** I18N */ - private static final String MSG_NODE_ALREADY_TRANSFER = "rm.action.node-already-transfer"; - - /** File Plan Service */ - protected FilePlanService filePlanService; - - /** Disposition service */ - protected DispositionService dispositionService; - - /** Record service */ - protected RecordService recordService; - - /** Record folder service */ - protected RecordFolderService recordFolderService; - - /** Freeze Service */ - protected FreezeService freezeService; - - protected TransferContainerType transferContainerType; - - protected TransferType transferType; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - public void setTransferContainerType(TransferContainerType transferContainerType) - { - this.transferContainerType = transferContainerType; - } - - public void setTransferType(TransferType transferType) - { - this.transferType = transferType; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#transfer(NodeRef, boolean) - */ - @Override - public NodeRef transfer(NodeRef nodeRef, boolean isAccession) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Get the root rm node - NodeRef root = filePlanService.getFilePlan(nodeRef); - - // Get the transfer object - NodeRef transferNodeRef = (NodeRef)AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); - if (transferNodeRef == null) - { - // Calculate a transfer name - QName nodeDbid = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "node-dbid"); - Long dbId = (Long) nodeService.getProperty(nodeRef, nodeDbid); - String transferName = StringUtils.leftPad(dbId.toString(), 10, "0"); - - // Create the transfer object - Map transferProps = new HashMap<>(2); - transferProps.put(ContentModel.PROP_NAME, transferName); - transferProps.put(PROP_TRANSFER_ACCESSION_INDICATOR, isAccession); - - // setup location property from disposition schedule - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - DispositionActionDefinition actionDef = da.getDispositionActionDefinition(); - if (actionDef != null) - { - transferProps.put(PROP_TRANSFER_LOCATION, actionDef.getLocation()); - } - } - - NodeRef transferContainer = filePlanService.getTransferContainer(root); - - transferContainerType.disable(); - transferType.disable(); - try - { - transferNodeRef = nodeService.createNode(transferContainer, - ContentModel.ASSOC_CONTAINS, - QName.createQName(RM_URI, transferName), - TYPE_TRANSFER, - transferProps).getChildRef(); - - } - finally - { - transferContainerType.enable(); - transferType.enable(); - } - // Bind the hold node reference to the transaction - AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, transferNodeRef); - } - else - { - // ensure this node has not already in the process of being transferred - List transferredAlready = nodeService.getChildAssocs(transferNodeRef, ASSOC_TRANSFERRED, ASSOC_TRANSFERRED); - for(ChildAssociationRef car : transferredAlready) - { - if(car.getChildRef().equals(nodeRef)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_ALREADY_TRANSFER, nodeRef.toString())); - - } - } - } - - // Link the record to the trasnfer object - transferType.disable(); - try - { - nodeService.addChild(transferNodeRef, - nodeRef, - ASSOC_TRANSFERRED, - ASSOC_TRANSFERRED); - // Set PDF indicator flag - setPDFIndicationFlag(transferNodeRef, nodeRef); - } - finally - { - transferType.enable(); - } - - // Set the transferring indicator aspect - nodeService.addAspect(nodeRef, ASPECT_TRANSFERRING, null); - if (isRecordFolder(nodeRef)) - { - // add the transferring indicator aspect to all the child records - for (NodeRef record : recordService.getRecords(nodeRef)) - { - nodeService.addAspect(record, ASPECT_TRANSFERRING, null); - } - } - - return transferNodeRef; - } - - /** - * - * @param transferNodeRef - * @param dispositionLifeCycleNodeRef - */ - private void setPDFIndicationFlag(NodeRef transferNodeRef, NodeRef dispositionLifeCycleNodeRef) - { - if (recordFolderService.isRecordFolder(dispositionLifeCycleNodeRef)) - { - List records = recordService.getRecords(dispositionLifeCycleNodeRef); - for (NodeRef record : records) - { - setPDFIndicationFlag(transferNodeRef, record); - } - } - else - { - ContentData contentData = (ContentData)nodeService.getProperty(dispositionLifeCycleNodeRef, ContentModel.PROP_CONTENT); - if (contentData != null && - MimetypeMap.MIMETYPE_PDF.equals(contentData.getMimetype())) - { - // Set the property indicator - nodeService.setProperty(transferNodeRef, PROP_TRANSFER_PDF_INDICATOR, true); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#completeTransfer(NodeRef) - */ - @Override - public void completeTransfer(NodeRef nodeRef) - { - boolean accessionIndicator = ((Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); - String transferLocation = nodeService.getProperty(nodeRef, PROP_TRANSFER_LOCATION).toString(); - - 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); - } - - // Delete the transfer object - nodeService.deleteNode(nodeRef); - - NodeRef transferNodeRef = (NodeRef) AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); - if (transferNodeRef != null && transferNodeRef.equals(nodeRef)) - { - AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, null); - } - } - - /** - * Marks the node complete - * - * @param nodeRef - * disposition lifecycle node reference - */ - private void markComplete(NodeRef nodeRef, boolean accessionIndicator, String transferLocation) - { - // Set the completed date - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); - } - - // Remove the transferring indicator aspect - nodeService.removeAspect(nodeRef, ASPECT_TRANSFERRING); - nodeService.setProperty(nodeRef, PROP_LOCATION, transferLocation); - - // Determine which marker aspect to use - QName markerAspectQName = null; - if (accessionIndicator) - { - markerAspectQName = ASPECT_ASCENDED; - } - else - { - markerAspectQName = ASPECT_TRANSFERRED; - } - - // Mark the object and children accordingly - nodeService.addAspect(nodeRef, markerAspectQName, null); - if (recordFolderService.isRecordFolder(nodeRef)) - { - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - nodeService.addAspect(record, markerAspectQName, null); - nodeService.setProperty(record, PROP_LOCATION, transferLocation); - } - } - - // Update to the next disposition action - dispositionService.updateNextDispositionAction(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java deleted file mode 100644 index 8157a95873..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -/** - * Alfresco Transaction Support delegation bean. - * - * @author Roy Wetherall - * @since 2.3 - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport - */ -public class AlfrescoTransactionSupport -{ - /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#bindResource(Object, Object) - */ - public void bindResource(Object key, Object resource) - { - org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource(key, resource); - } - - /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#unbindResource(Object) - */ - public void unbindResource(Object key) - { - org.alfresco.repo.transaction.AlfrescoTransactionSupport.unbindResource(key); - } - - /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#getResource(Object) - * @since 2.4.a - */ - public Object getResource(Object key) - { - return org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(key); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java deleted file mode 100644 index 41b0a1ced9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import org.alfresco.repo.security.authentication.AuthenticationException; -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) - */ - 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(); - } - - /** - * Helper method that gets the guest user name. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getGuestUserName() - */ - public String getGuestUserName() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getGuestUserName(); - } - - /** - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#isRunAsUserTheSystemUser() - */ - public boolean isRunAsUserTheSystemUser() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.isRunAsUserTheSystemUser(); - } - - /** - * Helper method to get the user that is currently in effect for purposes of authentication. This includes any - * overlays introduced by {@link #runAs}. - * - * @return Returns the name of the user - * @throws AuthenticationException - */ - public String getRunAsUser() throws AuthenticationException - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getRunAsUser(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ContentBinDuplicationUtility.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ContentBinDuplicationUtility.java deleted file mode 100644 index a754c1a855..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ContentBinDuplicationUtility.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.repo.policy.BehaviourFilter; -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 java.util.Set; - -/** - * Utility class to duplicate the content of a node without triggering the audit or versioning behaviours - * @author Ross Gale - * @since 2.7.2 - */ -public class ContentBinDuplicationUtility extends ServiceBaseImpl -{ - /** - * Behaviour filter - */ - private BehaviourFilter behaviourFilter; - - /** - * Provides methods for accessing and transforming content. - */ - private ContentService contentService; - - /** Records Management Query DAO */ - private RecordsManagementQueryDAO recordsManagementQueryDAO; - - /** - * Setter for behaviour filter - * @param behaviourFilter BehaviourFilter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * Setter for content service - * @param contentService ContentService - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Setter for the Records Management QueryDAO - * - * @param recordsManagementQueryDAO The RM query DAO to set - */ - public void setRecordsManagementQueryDAO(RecordsManagementQueryDAO recordsManagementQueryDAO) - { - this.recordsManagementQueryDAO = recordsManagementQueryDAO; - } - - /** - * Determines whether the bin file for a given node has at least one other reference to it - * Will return true if the binary exists and is referenced by at least one other node - * @param nodeRef Node with the binary in question - * @return boolean for if the bin has at least one other reference to it - */ - public boolean hasAtLeastOneOtherReference(NodeRef nodeRef) - { - boolean hasAtLeastOneOtherReference = false; - String contentUrl = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT).getContentUrl(); - - Set referencesToContentNode = recordsManagementQueryDAO.getNodeRefsWhichReferenceContentUrl(contentUrl); - if (referencesToContentNode.size() > 1) - { - hasAtLeastOneOtherReference = true; - } - return hasAtLeastOneOtherReference; - } - - /** - * Duplicate the content of a node without triggering the audit or versioning behaviours - * - * @param nodeRef The node with the content to duplicate - */ - public void duplicate(NodeRef nodeRef) - { - //Adding fix for RM-6788 where too many duplicates are being made this is a workaround waiting on a full - // solution - if (!nodeService.hasAspect(nodeRef, ASPECT_ARCHIVED)) - { - //disabling versioning and auditing - behaviourFilter.disableBehaviour(); - try - { - //create a new content URL for the copy/original node - updateContentProperty(nodeRef); - } - finally - { - //enable versioning and auditing - behaviourFilter.enableBehaviour(); - } - } - } - - /** - * Helper to update the content property for the node - * - * @param nodeRef the node - */ - private void updateContentProperty(NodeRef nodeRef) - { - ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - if (reader != null) - { - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - writer.putContent(reader); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/FileUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/FileUtils.java deleted file mode 100644 index eb3bfbd439..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/FileUtils.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; - -/** - * Utility class for working with files. - * - * @author Roxana Lucanu - * @since 2.7 - */ -public class FileUtils -{ - /** - * Helper method to convert a stream to a string. - * - * @param is input stream - * @return {@link String} string - * @throws IOException - */ - public static String convertStreamToString(InputStream is) throws IOException - { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")))) - { - StringBuilder sb = new StringBuilder(); - String line = null; - - while ((line = reader.readLine()) != null) - { - sb.append(line + "\n"); - } - return sb.toString(); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/NodeTypeUtility.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/NodeTypeUtility.java deleted file mode 100644 index d289b9b4f7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/NodeTypeUtility.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import java.util.concurrent.ConcurrentHashMap; - -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Utility class to check if a node type is instance of another type - * - * @author Claudia Agache - * @since 3.2 - */ -public class NodeTypeUtility -{ - /** Static cache for results of types that are instances of other Alfresco types. */ - private static ConcurrentHashMap instanceOfCache = new ConcurrentHashMap<>(); - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Utility method to quickly determine whether one class is equal to or sub of another. - * - * @param className class name - * @param ofClassName class name to check against - * @return boolean true if equal to or sub, false otherwise - */ - public boolean instanceOf(QName className, QName ofClassName) - { - ParameterCheck.mandatory("className", className); - ParameterCheck.mandatory("ofClassName", ofClassName); - - String key = className.toString() + "|" + ofClassName.toString(); - return instanceOfCache.computeIfAbsent(key, k -> - (ofClassName.equals(className) || dictionaryService.isSubClass(className, ofClassName))); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java deleted file mode 100644 index dc413fe9d7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Utility class with policy helper methods. - * - * @author Roy Wetherall - */ -public final class PoliciesUtil -{ - private PoliciesUtil() - { - // Will not be called - } - - /** - * Get all aspect and node type qualified names - * - * @param nodeRef - * the node we are interested in - * @return Returns a set of qualified names containing the node type and all - * the node aspects, or null if the node no longer exists - */ - public static Set getTypeAndAspectQNames(final NodeService nodeService, final NodeRef nodeRef) - { - return AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Set qnames = null; - try - { - Set aspectQNames = nodeService.getAspects(nodeRef); - - QName typeQName = nodeService.getType(nodeRef); - - qnames = new HashSet<>(aspectQNames.size() + 1); - qnames.addAll(aspectQNames); - qnames.add(typeQName); - } - catch (InvalidNodeRefException e) - { - qnames = Collections.emptySet(); - } - // done - return qnames; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java deleted file mode 100644 index fa58c62593..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheck.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import static java.util.Collections.unmodifiableList; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.service.namespace.QName; - -/** - * Utility check for modification of a properties based off presence in a whitelist. - * - * @author Ross Gale - * @since 3.2 - */ -public class PropertyModificationAllowedCheck -{ - /** - * List of qnames that can be modified - */ - private List whiteList; - - /** - * List of model URI's for which the properties can be updated - */ - private List editableURIs; - - /** - * Getter for list of model URI's - * - * @return return the list of model URI's - */ - private List getEditableURIs() - { - return unmodifiableList(editableURIs); - } - - /** - * Setter for list of model URI's - * - * @param editableURIs List - */ - public void setEditableURIs(List editableURIs) - { - this.editableURIs = unmodifiableList(editableURIs); - } - - /** - * Setter for list of qnames - * - * @param whiteList List - */ - public void setWhiteList(List whiteList) - { - this.whiteList = unmodifiableList(whiteList); - - } - - /** - * Compares the node properties with the requested update to make sure all potential updates are permitted - * - * @param before current node properties - * @param after updated properties for the node - * @return true - if all modified property keys are in the whitelist or - * in the list of model URI's for which the properties can be modified - */ - public boolean check(Map before, Map after) - { - boolean proceed = true; - // Initially check for changes to existing keys and values. - for (final Map.Entry entry : before.entrySet()) - { - final QName key = entry.getKey(); - final Serializable beforeValue = entry.getValue(); - //check if property has been updated - final boolean modified = after.containsKey(key) && after.get(key) != null - && !after.get(key).equals(beforeValue); - - //check if the property has been emptied or removed - final boolean propertyRemovedEmptied = (after.get(key) == null && beforeValue != null) - || !after.containsKey(key); - if (modified || propertyRemovedEmptied) - { - proceed = allowPropertyUpdate(key); - } - if (!proceed) - { - return proceed; - } - } - - // Check for new values. Record individual values and group as a single map. - final Set newKeys = new HashSet<>(after.keySet()); - newKeys.removeAll(before.keySet()); - for (final QName key : newKeys) - { - proceed = allowPropertyUpdate(key); - if (!proceed) - { - break; - } - } - return proceed; - } - - /** - * Determines whether the property should be allowed to be updated or not. - * - * @param key property - * @return true if property update is allowed - */ - private boolean allowPropertyUpdate(QName key) - { - return whiteList.contains(key) || getEditableURIs().contains(key.getNamespaceURI()); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java deleted file mode 100644 index 61707c4d0e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import static org.springframework.util.ObjectUtils.nullSafeEquals; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.google.common.collect.ImmutableSet; - -import org.apache.commons.collections.CollectionUtils; - -/** - * Various common helper methods for Collections. This class is probably only appropriate for use with relatively - * small collections as it has not been optimised for dealing with large collections. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -// This class should all be moved to core Alfresco whenever possible and reused from there. -public final class RMCollectionUtils -{ - private RMCollectionUtils() { /* Intentionally empty. */} - - /** - * Gets the list of duplicate elements contained within the specified list, if any. - * @param l the list in which to find duplicates. - * @param the element type of the list. - * @return a list of duplicate elements. If there are no duplicates, returns an empty list. - */ - public static List getDuplicateElements(List l) - { - final Set uniqueElems = new HashSet<>(); - final List duplicateElems = new ArrayList<>(); - - for (T elem: l) - { - if (uniqueElems.contains(elem)) - { - if (!duplicateElems.contains(elem)) duplicateElems.add(elem); - } - else - { - uniqueElems.add(elem); - } - } - return duplicateElems; - } - - /** Returns the head (element at index 0) of the provided List. - * - * @param l the list whose head is sought. - * @param the type of the List. - * @return the head element or {@code null} for the empty list. - * @throws NullPointerException if l is {@code null} - */ - public static T head(List l) - { - return l.isEmpty() ? null : l.get(0); - } - - /** - * Returns the tail of the provided List i.e. the sublist which contains - * all elements of the given list except the {@link #head(List) head}. - * - * @param l the list whose tail is sought. - * @param the type of the List. - * @return the tail sublist, which will be an empty list if the provided list had only a single element. - * @throws NullPointerException if l is {@code null} - * @throws UnsupportedOperationException if the provided list was empty. - */ - public static List tail(List l) - { - if (l.isEmpty()) - { - throw new UnsupportedOperationException("Cannot get tail of empty list."); - } - else - { - return l.subList(1, l.size()); - } - } - - /** - * Returns a Serializable List containing all of the provided elements. - * - * @param elements the elements to put in a list. - * @param the element type. - * @return a Serializable List containing all the provided elements. - */ - @SuppressWarnings("unchecked") - @SafeVarargs - public static > - LIST asSerializableList(T... elements) - { - final LIST l = (LIST)new ArrayList(elements.length); - for (T element : elements) - { - l.add(element); - } - return l; - } - - /** - * Returns a Set containing all of the provided elements. Duplicate elements will be removed as per the - * {@code Set} contract. - * - * @param elements the elements to put in a Set. - * @param the element type. - * @return a Set containing all the provided elements (without duplicates). - */ - @SafeVarargs - public static HashSet asSet(T... elements) - { - final HashSet set = new HashSet<>(elements.length); - for (T element : elements) - { - set.add(element); - } - return set; - } - - /** - * Returns a Set containing all of the elements in the provided collection. - * Duplicate elements will be removed as per the - * {@code Set} contract. - * - * @param c the elements to put in a Set. - * @param the element type. - * @return a Set containing all the provided elements (without duplicates). - */ - public static HashSet asSet(Collection c) - { - return new HashSet<>(c); - } - - /** - * This enum represents a change in an entry between 2 collections. - */ - public enum Difference - { - ADDED, REMOVED, CHANGED, UNCHANGED - } - - /** - * Determines the change in a Map entry between two Maps. - * Note that both maps must have the same types of key-value pair. - * - * @param from the first collection. - * @param to the second collection. - * @param key the key identifying the entry. - * @param the type of the key. - * @param the type of the value. - * @return the {@link Difference}. - * - * @throws IllegalArgumentException if {@code key} is {@code null}. - */ - public static Difference diffKey(Map from, Map to, K key) - { - if (key == null) { throw new IllegalArgumentException("Key cannot be null."); } - - if (from.containsKey(key)) - { - if (to.containsKey(key)) - { - if (nullSafeEquals(from.get(key), to.get(key))) { return Difference.UNCHANGED; } - else { return Difference.CHANGED; } - } - else { return Difference.REMOVED; } - } - else - { - if (to.containsKey(key)) { return Difference.ADDED; } - else { return Difference.UNCHANGED; } - } - } - - /** - * Convert a collection to an immutable set. Any instances of null in the original collection will be removed. - * - * @param collection The original collection. - * @param The type of the object in the collection. - * @return The immutable set. - */ - public static ImmutableSet toImmutableSet(Collection collection) - { - if (collection == null) - { - return null; - } - // Guava immutable collections can't contain null. - if (collection.contains(null)) - { - // Make sure we're not changing the original collection (which might not be editable anyway). - collection = new HashSet<>(collection); - collection.remove(null); - } - return ImmutableSet.copyOf(collection); - } - - /** - * Check if a property is null or an empty collection. Note that this is the same as - * {org.apache.commons.collections.CollectionUtils.isEmpty(Collection)}, except that it takes a Serializable rather - * than a Collection. This avoids awkward casting exceptions when working with properties. - * - * @param value The (probably Collection) value to check. - * @return true if the supplied value is null or an empty collection. - */ - public static boolean isEmpty(Serializable value) - { - if (value instanceof Collection) - { - return CollectionUtils.isEmpty((Collection) value); - } - return (value == null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java deleted file mode 100644 index 679c972d1a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMContainerCacheManager.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.util.Pair; - -/** - * Provides operations to manipulate the records management root cache - * - * @author Tiago Salvado - * - * @see RecordsManagementModel - */ -public class RMContainerCacheManager implements RecordsManagementModel -{ - /** node service */ - private NodeService nodeService; - - /** root records management cache */ - private SimpleCache, Set> cache; - - /** - * @param nodeService - * node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param cache - */ - public void setCache(SimpleCache, Set> cache) - { - this.cache = cache; - } - - /** - * Verifies if there is cached nodes for supplied storeRef - * - * @param storeRef - * @return true if there are cached nodes, false otherwise - */ - public boolean isCached(StoreRef storeRef) - { - Pair key = getKey(storeRef); - Set values = cache.get(key); - boolean isCached = (values != null && !values.isEmpty()); - if (!isCached) - { - cache.remove(key); - } - return isCached; - } - - /** - * Obtains the cached nodes for supplied storeRef - * - * @param storeRef - * @return a set containing the cached nodes - */ - public Set get(StoreRef storeRef) - { - return cache.get(getKey(storeRef)); - } - - /** - * Caches the supplied node - * - * @param nodeRef - */ - public void add(NodeRef nodeRef) - { - if (nodeRef != null && nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT)) - { - Set entries; - Pair key = getKey(nodeRef.getStoreRef()); - - if (cache.contains(key)) - { - entries = this.cache.get(key); - } - else - { - entries = new HashSet<>(); - } - - if (!entries.contains(nodeRef)) - { - entries.add(nodeRef); - } - - if (entries.size() > 0) - { - cache.put(key, entries); - } - } - } - - /** - * Removes the supplied entry from the cache - * - * @param nodeRef - */ - public void remove(NodeRef nodeRef) - { - if (nodeRef != null) - { - if (nodeService.hasAspect(nodeRef, ASPECT_RECORDS_MANAGEMENT_ROOT)) - { - Pair key = getKey(nodeRef.getStoreRef()); - if (cache.contains(key)) - { - cache.get(key).remove(nodeRef); - if (cache.get(key).size() == 0) - { - cache.remove(key); - } - } - } - } - } - - /** - * Resets the cache entries - */ - public void reset() - { - this.cache.clear(); - } - - /** - * Builds the cache key using the supplied storeRef - * - * @param storeRef - * @return a pair corresponding to the cache key - */ - private Pair getKey(StoreRef storeRef) - { - return new Pair(storeRef, ASPECT_RECORDS_MANAGEMENT_ROOT.toString()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java deleted file mode 100644 index 79bd0e24f3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import org.apache.commons.lang3.StringUtils; - -/** - * Utility class that contains validation not present in {@link org.alfresco.util.ParameterCheck}. - * - * @author tpage - */ -public class RMParameterCheck -{ - /** - * Checks that the string parameter with the given name is not blank i.e. it is not null, zero length or entirely - * composed of whitespace. - * - * @param strParamName Name of parameter to check - * @param strParamValue Value of the parameter to check - */ - public static void checkNotBlank(final String strParamName, final String strParamValue) - throws IllegalArgumentException - { - if (StringUtils.isBlank(strParamValue)) { throw new IllegalArgumentException(strParamName - + " is a mandatory parameter"); } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java deleted file mode 100644 index 9611cd24cd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java +++ /dev/null @@ -1,542 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import java.util.Map; -import java.util.Set; - - -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.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.rendition.RenditionService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Helper base class for service implementations. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ServiceBaseImpl implements RecordsManagementModel, ApplicationContextAware -{ - /** Node service */ - protected NodeService nodeService; - - /** 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; - - /** Content service */ - protected ContentService contentService; - - /** Node type utility */ - protected NodeTypeUtility nodeTypeUtility; - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param service service - */ - public void setRenditionService(RenditionService service) - { - this.renditionService = service; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param authenticationUtil authentication util helper - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param nodeTypeUtility node type utility - */ - public void setNodeTypeUtility(NodeTypeUtility nodeTypeUtility) - { - this.nodeTypeUtility = nodeTypeUtility; - } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * Set the content service - * - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Helper to get internal node service. - *

- * Used for performance reasons. - */ - protected NodeService getInternalNodeService() - { - if (internalNodeService == null) - { - internalNodeService = (NodeService)applicationContext.getBean("dbNodeService"); - } - - return internalNodeService; - } - - /** - * Gets the file plan component kind from the given node reference - * - * @see FilePlanService#getFilePlanComponentKind(org.alfresco.service.cmr.repository.NodeRef) - */ - public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) - { - FilePlanComponentKind result = null; - - Map map = transactionalResourceHelper.getMap("rm.transaction.filePlanComponentByNodeRef"); - if (map.containsKey(nodeRef)) - { - result = map.get(nodeRef); - } - else - { - if (isFilePlanComponent(nodeRef)) - { - result = FilePlanComponentKind.FILE_PLAN_COMPONENT; - - if (isFilePlan(nodeRef)) - { - result = FilePlanComponentKind.FILE_PLAN; - } - else if (isRecordCategory(nodeRef)) - { - result = FilePlanComponentKind.RECORD_CATEGORY; - } - else if (isRecordFolder(nodeRef)) - { - result = FilePlanComponentKind.RECORD_FOLDER; - } - else if (isRecord(nodeRef)) - { - result = FilePlanComponentKind.RECORD; - } - else if (instanceOf(nodeRef, TYPE_HOLD_CONTAINER)) - { - result = FilePlanComponentKind.HOLD_CONTAINER; - } - else if (isHold(nodeRef)) - { - result = FilePlanComponentKind.HOLD; - } - else if (instanceOf(nodeRef, TYPE_TRANSFER_CONTAINER)) - { - result = FilePlanComponentKind.TRANSFER_CONTAINER; - } - else if (isTransfer(nodeRef)) - { - result = FilePlanComponentKind.TRANSFER; - } - else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION)) - { - result = FilePlanComponentKind.DISPOSITION_SCHEDULE; - } - else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER)) - { - result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER; - } - else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_FOLDER)) - { - result = FilePlanComponentKind.UNFILED_RECORD_FOLDER; - } - } - - if (result != null) - { - map.put(nodeRef, result); - } - } - - return result; - } - - /** - * Gets the file plan component kind from the given type. - * - * @see FilePlanService#getFilePlanComponentKindFromType(QName) - */ - public FilePlanComponentKind getFilePlanComponentKindFromType(QName type) - { - FilePlanComponentKind result = null; - - if (ASPECT_FILE_PLAN_COMPONENT.equals(type)) - { - result = FilePlanComponentKind.FILE_PLAN_COMPONENT; - } - else if (instanceOf(type, ASPECT_RECORD)) - { - result = FilePlanComponentKind.RECORD; - } - else if (instanceOf(type, TYPE_FILE_PLAN)) - { - result = FilePlanComponentKind.FILE_PLAN; - } - else if (instanceOf(type, TYPE_RECORD_CATEGORY)) - { - result = FilePlanComponentKind.RECORD_CATEGORY; - } - else if (instanceOf(type, TYPE_RECORD_FOLDER)) - { - result = FilePlanComponentKind.RECORD_FOLDER; - } - else if (instanceOf(type, TYPE_HOLD)) - { - result = FilePlanComponentKind.HOLD; - } - else if (instanceOf(type, TYPE_TRANSFER)) - { - result = FilePlanComponentKind.TRANSFER; - } - else if (instanceOf(type, TYPE_DISPOSITION_SCHEDULE) || - instanceOf(type, TYPE_DISPOSITION_ACTION_DEFINITION)) - { - result = FilePlanComponentKind.DISPOSITION_SCHEDULE; - } - - return result; - } - - /** - * Indicates whether the given node is a file plan component or not. - *

- * Exposed in the FilePlan service. - * - * @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isFilePlanComponent(NodeRef nodeRef) - { - boolean result = false; - if (getInternalNodeService().exists(nodeRef) && - getInternalNodeService().hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT)) - { - result = true; - } - return result; - } - - /** - * Indicates whether the given node is a file plan or not. - *

- * Exposed in the FilePlan service. - * - * @see FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isFilePlan(NodeRef nodeRef) - { - return instanceOf(nodeRef, TYPE_FILE_PLAN); - } - - /** - * Indicates whether the given node is a file plan container or not. - * - * @see FilePlanService#isFilePlanContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isFilePlanContainer(NodeRef nodeRef) - { - return instanceOf(nodeRef, TYPE_RECORDS_MANAGEMENT_CONTAINER); - } - - /** - * Indicates whether the given node is a record category or not. - * - * @see FilePlanService#isRecordCategory(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isRecordCategory(NodeRef nodeRef) - { - return instanceOf(nodeRef, TYPE_RECORD_CATEGORY); - } - - /** - * Indicates whether the given node is a record folder or not. - *

- * Exposed in the RecordFolder service. - * - * @param nodeRef node reference - * @return boolean true if record folder, false otherwise - */ - public boolean isRecordFolder(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - return instanceOf(nodeRef, TYPE_RECORD_FOLDER); - } - - /** - * Indicates whether the given node reference is a record or not. - * - * @param nodeRef node reference - * @return boolean true if node reference is a record, false otherwise - */ - public boolean isRecord(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return getInternalNodeService().hasAspect(nodeRef, ASPECT_RECORD); - } - - /** - * Indicates whether the given node reference is a hold or not. - *

- * Exposed publicly in the {@link HoldService} - * - * @param nodeRef node reference - * @return boolean true if rma:hold or sub-type, false otherwise - */ - public boolean isHold(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean isHold = false; - if (getInternalNodeService().exists(nodeRef) && - instanceOf(nodeRef, TYPE_HOLD)) - { - isHold = true; - } - return isHold; - } - - /** - * Indicates whether the given node reference is a transfer or not. - * - * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#isTransfer(NodeRef) - */ - public boolean isTransfer(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return instanceOf(nodeRef, TYPE_TRANSFER); - } - - /** - * Indicates whether the given node reference is an unfiled records container or not. - * - * @param nodeRef node reference - * @return boolean true if rma:unfiledRecordContainer or sub-type, false otherwise - */ - public boolean isUnfiledRecordsContainer(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER); - } - - /** - * Indicates whether a record is complete or not. - * - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isDeclared(NodeRef record) - { - ParameterCheck.mandatory("record", record); - - return getInternalNodeService().hasAspect(record, ASPECT_DECLARED_RECORD); - } - - /** - * Gets the file plan that a given file plan component resides within. - * - * @param nodeRef node reference - * @return {@link NodeRef} file plan, null if none - */ - public NodeRef getFilePlan(final NodeRef nodeRef) - { - NodeRef result = null; - if (nodeRef != null) - { - Map transactionCache = transactionalResourceHelper.getMap("rm.servicebase.getFilePlan"); - if (transactionCache.containsKey(nodeRef)) - { - result = transactionCache.get(nodeRef); - } - else - { - result = (NodeRef)getInternalNodeService().getProperty(nodeRef, PROP_ROOT_NODEREF); - if (result == null || !instanceOf(result, TYPE_FILE_PLAN)) - { - if (instanceOf(nodeRef, TYPE_FILE_PLAN)) - { - result = nodeRef; - } - else - { - ChildAssociationRef parentAssocRef = getInternalNodeService().getPrimaryParent(nodeRef); - if (parentAssocRef != null) - { - result = getFilePlan(parentAssocRef.getParentRef()); - } - } - } - - // cache result in transaction if result is not null - if (result != null) - { - transactionCache.put(nodeRef, result); - } - } - } - - return result; - } - - /** - * Utility method to safely and quickly determine if a node is a type (or sub-type) of the one specified. - * - * @param nodeRef node reference - * @param ofClassName class name to check - */ - protected boolean instanceOf(NodeRef nodeRef, QName ofClassName) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("ofClassName", ofClassName); - QName className = getInternalNodeService().getType(nodeRef); - return instanceOf(className, ofClassName); - } - - /** - * Utility method to quickly determine whether one class is equal to or sub of another. - * - * @param className class name - * @param ofClassName class name to check against - * @return boolean true if equal to or sub, false otherwise - */ - protected boolean instanceOf(QName className, QName ofClassName) - { - return nodeTypeUtility.instanceOf(className, ofClassName); - } - - /** - * Utility method to get the next counter for a node. - *

- * If the node is not already countable, then rma:countable is added and 0 returned. - * - * @param nodeRef node reference - * @return int next counter value - */ - protected int getNextCount(NodeRef nodeRef) - { - int counter = 0; - if (!nodeService.hasAspect(nodeRef, ASPECT_COUNTABLE)) - { - PropertyMap props = new PropertyMap(1); - props.put(PROP_COUNT, 1); - nodeService.addAspect(nodeRef, ASPECT_COUNTABLE, props); - counter = 1; - } - else - { - Integer value = (Integer)this.nodeService.getProperty(nodeRef, PROP_COUNT); - if (value != null) - { - counter = value.intValue() + 1; - } - else - { - counter = 1; - } - nodeService.setProperty(nodeRef, PROP_COUNT, counter); - - } - return counter; - } - - /** - * Helper method to get a set containing the node's type and all it's aspects - * - * @param nodeRef nodeRef - * @return Set set of qname's - */ - protected Set getTypeAndApsects(NodeRef nodeRef) - { - Set result = nodeService.getAspects(nodeRef); - result.add(nodeService.getType(nodeRef)); - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java deleted file mode 100644 index 77f85db234..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java deleted file mode 100644 index 08637b970b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * An enumeration for the methods of updating a collection of immutable objects. - * - * @author Tom Page - * @since 2.5 - */ -@AlfrescoPublicApi -public enum UpdateActionType -{ - ADD, - REMOVE; - - public static UpdateActionType valueOfIgnoreCase(String name) - { - UpdateActionType actionType; - try - { - actionType = UpdateActionType.valueOf(name.toUpperCase()); - } - catch (Exception e) - { - throw new IllegalArgumentException("Could not find enum with name '" + name + "'. Not one of the values accepted for Enum class: [ADD, REMOVE]"); - } - - return actionType; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/dao/QueryField.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/dao/QueryField.java deleted file mode 100644 index 8786f20a4c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/dao/QueryField.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util.dao; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Interface for representations of fields that queries can be sorted by. - * - * @author Tom Page - * @since 2.6 - */ -@AlfrescoPublicApi -public interface QueryField -{ -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/dao/QueryParams.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/dao/QueryParams.java deleted file mode 100644 index 24e004698c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/dao/QueryParams.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util.dao; - -import java.util.List; - -import com.google.common.collect.ImmutableList; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.util.Pair; - -/** - * Options when listing something. - * - * @author Tom Page - * @since 2.6 - */ -@AlfrescoPublicApi -public class QueryParams -{ - /** The ordered list of columns to sort on (and their sort direction). */ - private List> sortProps; - /** The number of items to skip before creating the list. */ - private int skipCount = 0; - /** The total number of items to return (assuming enough are available). */ - private int maxItems = 10; - - /** - * Constructor that takes the sort order. - * - * @param sortProps A list of fields to sort on, and the direction to sort in. - */ - public QueryParams(List> sortProps) - { - setSortProps(sortProps); - } - - /** Sets the skip count required. */ - public QueryParams withSkipCount(final int skipCount) - { - this.skipCount = skipCount; - return this; - } - - /** Sets the max items count required. */ - public QueryParams withMaxItems(final int maxItems) - { - this.maxItems = maxItems; - return this; - } - - /** - * Sets the sort properties required. - * - * @param sortProps A list of pairs of properties and sort directions. - * @return The updated QueryParams object. - */ - public QueryParams withSortProps(List> sortProps) - { - this.setSortProps(sortProps); - return this; - } - - /** - * Sets the sort properties required and validates the list. - * - * @param sortProps A list of pairs of properties and sort directions. - */ - public void setSortProps(List> sortProps) - { - this.sortProps = ImmutableList.copyOf(sortProps); - - //validate the list - for(Pair sortPair : sortProps) - { - if(sortPair == null || sortPair.getFirst() == null || sortPair.getSecond() == null) - { - throw new IllegalArgumentException("Unexpected null or null containing element in list: " + sortProps); - } - } - } - - /** Get the ordered list of columns to sort on (and their sort direction). */ - public List> getSortProps() - { - return this.sortProps; - } - - /** Get the number of items to skip before creating the list. */ - public int getSkipCount() - { - return this.skipCount; - } - - /** Get the total number of items to return (assuming enough are available). */ - public int getMaxItems() - { - return this.maxItems; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java deleted file mode 100644 index 737c24f117..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.lock.LockService; -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.VersionService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Extend versionable aspect auto-version behaviour to allow versions to be - * created when the content type is changed. - * - * Note: this behaviour should be merged into core asap - * - * @author Roy Wetherall - * @since 2.3.1 - */ -@BehaviourBean -public class ExtendedVersionableAspect implements NodeServicePolicies.OnSetNodeTypePolicy -{ - /** The i18n'ized messages */ - private static final String MSG_AUTO_VERSION = "create_version.auto_version"; - - /** Transaction resource key */ - private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs"; - - /** node service */ - private NodeService nodeService; - - /** version service */ - private VersionService versionService; - - /** lock service */ - private LockService lockService; - - /** alfresco transaction support */ - private AlfrescoTransactionSupport alfrescoTransactionSupport; - - /** authentication util */ - private AuthenticationUtil authenticationUtil; - - /** indicates whether auto version should be triggered on type change */ - private boolean isAutoVersionOnTypeChange = false; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @param lockService lock service - */ - public void setLockService(LockService lockService) - { - this.lockService = lockService; - } - - /** - * @param alfrescoTransactionSupport alfresco transaction support - */ - public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport) - { - this.alfrescoTransactionSupport = alfrescoTransactionSupport; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param isAutoVersionOnTypeChange true if auto version on type change, false otherwise - */ - public void setAutoVersionOnTypeChange(boolean isAutoVersionOnTypeChange) - { - this.isAutoVersionOnTypeChange = isAutoVersionOnTypeChange; - } - - /** - * On set node type behaviour - * - * @param nodeRef node reference - * @param oldType old type - * @param newType new type - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @Behaviour - ( - type="cm:versionable", - kind=BehaviourKind.CLASS, - notificationFrequency=NotificationFrequency.TRANSACTION_COMMIT - ) - public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType) - { - if (isAutoVersionOnTypeChange && - nodeService.exists(nodeRef) && - !lockService.isLockedAndReadOnly(nodeRef) && - nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) && - !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - { - Map versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS); - if (versionedNodeRefs == null || !versionedNodeRefs.containsKey(nodeRef)) - { - // Determine whether the node is auto versionable (for content updates) or not - boolean autoVersion = false; - Boolean value = (Boolean)nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); - if (value != null) - { - // If the value is not null then - autoVersion = value.booleanValue(); - } - - // NOTE: auto version on type change is a global setting, if thins extension was moved into the - // core then cm:versionable could be extended with a property consistent with the current - // implementation - - if (autoVersion) - { - // Create the auto-version - Map versionProperties = new HashMap<>(1); - versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_AUTO_VERSION)); - - createVersionImpl(nodeRef, versionProperties); - } - } - } - } - - /** - * On create version implementation method. - * - * @param nodeRef node reference - * @param versionProperties version properties - */ - private void createVersionImpl(final NodeRef nodeRef, final Map versionProperties) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - recordCreateVersion(nodeRef, null); - versionService.createVersion(nodeRef, versionProperties); - return null; - } - }); - } - - /** - * Record that the new version has been created - * - * @param versionableNode versionable node reference - * @param version version - */ - @SuppressWarnings("unchecked") - private void recordCreateVersion(NodeRef versionableNode, Version version) - { - Map versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS); - if (versionedNodeRefs == null) - { - versionedNodeRefs = new HashMap<>(); - alfrescoTransactionSupport.bindResource(KEY_VERSIONED_NODEREFS, versionedNodeRefs); - } - versionedNodeRefs.put(versionableNode, versionableNode); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java deleted file mode 100644 index 5fe4c9bac2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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"); - QName PROP_DESTROYED = QName.createQName(RMV_URI, "destroyed"); - - /** 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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java deleted file mode 100644 index 3680bf5a11..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.version; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -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.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; - - /** record model URI's */ - private List recordModelURIs; - - /** - * @param recordModelURIs namespaces specific to records - */ - public void setRecordModelURIs(List recordModelURIs) - { - this.recordModelURIs = recordModelURIs; - } - - /** - * @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) - */ - @SuppressWarnings("unchecked") - @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); - if (record != null && dbNodeService.exists(record)) - { - Map properties = dbNodeService.getProperties(record); - return processProperties(converted, properties); - } - else - { - return (Map)Collections.EMPTY_MAP; - } - } - 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) || - recordModelURIs.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) - */ - @SuppressWarnings("unchecked") - @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); - if (record != null && dbNodeService.exists(record)) - { - Set aspects = dbNodeService.getAspects(record); - return processAspects(aspects); - } - else - { - return (Set)Collections.EMPTY_SET; - } - } - 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) || - recordModelURIs.contains(aspect.getNamespaceURI()))) - { - result.remove(aspect); - } - } - - // remove custom record meta-data aspects - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java deleted file mode 100644 index bd3ec989f3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.version; - -/** - * @author Roy Wetherall - * @since 2.3 - */ -public enum RecordableVersionPolicy -{ - NONE, - MAJOR_ONLY, - ALL -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java deleted file mode 100644 index acbd4f2b85..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.version; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; - -/** - * Recordable version service interface. - * - * @author Roy Wetherall - * @since 2.3 - */ -@AlfrescoPublicApi -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); - - /** - * If the version is a recorded version, gets the related version record. - * - * @param version version - * @return NodeRef node reference of version record - */ - NodeRef getVersionRecord(Version version); - - /** - * Gets the version that relates to the version record - * - * @param record version record node reference - * @return Version version or null if not found - */ - Version getRecordedVersion(NodeRef record); - - /** - * Creates a record from the latest frozen 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 created record. - */ - NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef); - - /** - * 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 filePlan parent node reference - * @param nodeRef node reference - * @param autoVersion true, create new record version from latest version, false creates a record from the latest frozen version - * @return NodeRef node reference to the created record. - */ - NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef, boolean autoVersion); - - /** - * Indicates whether a record version is destroyed or not. - * - * @param version version - * @return boolean true if destroyed, false otherwise - */ - boolean isRecordedVersionDestroyed(Version version); - - /** - * Marks a recorded version as destroyed. - *

- * Note this method does not destroy the associated record, instead it marks the version as destroyed. - * - * @param version version - */ - void destroyRecordedVersion(Version version); - - /** - * Flag that indicate to create new version on record creation if current node is modified - * - * @return boolean true to auto-version on record creation, false to use latest versioned version - */ - boolean isEnableAutoVersionOnRecordCreation(); - - /** - * Create a snapshot version of current node - * - * @param nodeRef node reference - */ - void createSnapshotVersion(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java deleted file mode 100644 index a22c06cd4d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java +++ /dev/null @@ -1,967 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.Date; -import java.util.HashMap; -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.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.Pair; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * 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 */ - protected static final String PROP_VERSION_RECORD = "RecordVersion"; - protected static final String PROP_RECORDED_VERSION_DESTROYED = "RecordedVersionDestroyed"; - - /** I18N */ - private static final String AUTO_VERSION_ON_RECORD_CREATION = "rm.service.enable-autoversion-on-record-creation"; - - /** flag that enable auto-version on record creation */ - private boolean isEnableAutoVersionOnRecordCreation = false; - - /** 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; - - /** - * @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 isEnableAutoVersionOnRecordCreation - */ - public void setEnableAutoVersionOnRecordCreation(boolean isEnableAutoVersionOnRecordCreation) - { - this.isEnableAutoVersionOnRecordCreation = isEnableAutoVersionOnRecordCreation; - } - - public boolean isEnableAutoVersionOnRecordCreation() - { - return isEnableAutoVersionOnRecordCreation; - } - - /** - * @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 - final 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))); - // run as system as we can't be sure if the user has add aspect rights - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); - return null; - } - }); - - // 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 && - nodeService.exists(previousRecord)) - { - versionRecord = previousRecord; - break; - } - } - } - - return versionRecord; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#getRecordedVersion(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Version getRecordedVersion(NodeRef versionRecord) - { - Version version = null; - NodeRef versionedNodeRef = (NodeRef) nodeService.getProperty(versionRecord, RecordableVersionModel.PROP_VERSIONED_NODEREF); - if (versionedNodeRef != null) - { - String versionLabel = (String) nodeService.getProperty(versionRecord, RecordableVersionModel.PROP_VERSION_LABEL); - if (StringUtils.isNotBlank(versionLabel)) - { - VersionHistory versionHistory = getVersionHistory(versionedNodeRef); - if (versionHistory != null) - { - version = versionHistory.getVersion(versionLabel); - } - } - } - return version; - } - - /** - * 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); - - // place the version record reference in the version properties - NodeRef record = (NodeRef) dbNodeService.getProperty(versionRef, PROP_RECORD_NODE_REF); - if (record != null) - { - version.getVersionProperties().put(PROP_VERSION_RECORD, record); - } - - // place information about the destruction of the version record in the properties - Boolean destroyed = (Boolean) dbNodeService.getProperty(versionRef, PROP_DESTROYED); - if (destroyed == null) { destroyed = Boolean.FALSE; } - version.getVersionProperties().put(PROP_RECORDED_VERSION_DESTROYED, destroyed); - - 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#isCurrentVersionRecorded(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) - { - NodeRef versionNodeRef = getVersionNodeRef(version); - return dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#getVersionRecord(org.alfresco.service.cmr.version.Version) - */ - @Override - public NodeRef getVersionRecord(Version version) - { - NodeRef result = null; - NodeRef versionNodeRef = getVersionNodeRef(version); - if (dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - { - // get the version record - result = (NodeRef) dbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF); - - // check that the version record exists - if (result != null && - !dbNodeService.exists(result)) - { - throw new AlfrescoRuntimeException("Version record node doesn't exist. Indicates version has not been updated " - + "when associated version record was deleted. " - + "(nodeRef=" + result.toString() + ")"); - } - } - return result; - } - - /** - * Create Version Store Ref - * - * @param storeRef 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(NodeRef, NodeRef, boolean autoVersion) - */ - @Override - public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef, final boolean isEnableAutoVersionOnRecordCreation) - { - setEnableAutoVersionOnRecordCreation(isEnableAutoVersionOnRecordCreation); - - return createRecordFromLatestVersion(filePlan, nodeRef); - } - - /** - * @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)) - { - createSnapshotVersion(nodeRef); - // 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 and writers - Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(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()); - versionRecordProps.put(ContentModel.PROP_VERSION_TYPE, currentVersion.getVersionType()); - nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); - - // wire record up to previous record - linkToPreviousVersionRecord(nodeRef, record); - - // set the extended security - extendedSecurityService.set(record, readersAndWriters); - - 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; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersionDestroyed(org.alfresco.service.cmr.version.Version) - */ - @Override - public boolean isRecordedVersionDestroyed(Version version) - { - boolean result = false; - - // get the version node reference - NodeRef versionNodeRef = getVersionNodeRef(version); - - // get the destroyed property value - Boolean isDestroyed = (Boolean) dbNodeService.getProperty(versionNodeRef, PROP_DESTROYED); - if (isDestroyed != null) - { - result = isDestroyed.booleanValue(); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#destroyRecordedVersion(org.alfresco.service.cmr.version.Version) - */ - @Override - public void destroyRecordedVersion(Version version) - { - // get the version node reference - NodeRef versionNodeRef = getVersionNodeRef(version); - - // if it's a recorded version - if (dbNodeService.hasAspect(versionNodeRef, ASPECT_RECORDED_VERSION)) - { - // mark it as destroyed - dbNodeService.setProperty(versionNodeRef, PROP_DESTROYED, true); - - // clear the record node reference property - dbNodeService.setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); - } - } - - /** - * 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()); - } - - /** - * Check if current version of the node is modified compared with versioned version - * - * @param nodeRef internal node reference - * @return boolean true if nodeRef is modified, otherwise false - */ - public boolean isCurrentVersionDirty(NodeRef nodeRef) - { - if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) { return false; } - - // get the latest version - Version currentVersion = getCurrentVersion(nodeRef); - Date modificationDate = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED); - - if (currentVersion == null) { return true; } - - // grab the frozen state - NodeRef currentFrozenState = currentVersion.getFrozenStateNodeRef(); - Date frozenModificationDate = (Date) nodeService.getProperty(currentFrozenState, ContentModel.PROP_MODIFIED); - - boolean versionStoreOutdated = ((frozenModificationDate != null) && (modificationDate.getTime() > frozenModificationDate.getTime())); - return versionStoreOutdated; - } - - /** - * @see RecordableVersionService#createSnapshotVersion(NodeRef) - */ - public void createSnapshotVersion(NodeRef nodeRef) - { - boolean autoVersion = isEnableAutoVersionOnRecordCreation(); - // if the flag autoversion on record creation set, create new version on dirty nodes - if (autoVersion && isCurrentVersionDirty(nodeRef)) - { - Map autoVersionProperties = new HashMap<>(2); - autoVersionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - autoVersionProperties.put(VersionModel.PROP_DESCRIPTION, I18NUtil.getMessage(AUTO_VERSION_ON_RECORD_CREATION)); - createVersion(nodeRef, autoVersionProperties); - } - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java deleted file mode 100644 index 43ccfb95bb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java deleted file mode 100644 index 2c3a429c15..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.vital; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -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.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; - -/** - * Action to implement the consequences of a change to the value of the VitalRecordDefinition properties. When the - * VitalRecordIndicator or the reviewPeriod properties are changed on a record container, then any descendant folders or - * records must be updated as a consequence. Descendant folders should have their reviewPeriods and/or - * vitalRecordIndicators updated to match the new value. Descendant records should have their reviewAsOf date updated. - * - * @author Neil McErlean - */ -public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase -{ - protected FilePlanService filePlanService; - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @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, final NodeRef actionedUponNodeRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - propagateChangeToChildrenOf(actionedUponNodeRef); - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - /** - * Propagates the changes to the children of the node specified. - * - * @param actionedUponNodeRef actioned upon node reference - */ - private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) - { - Map parentProps = getNodeService().getProperties(actionedUponNodeRef); - - // parent vital record indicator, default to null if not set - boolean parentVri = false; - Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR); - if (parentVriValue != null) - { - parentVri = parentVriValue.booleanValue(); - } - - Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD); - - List assocs = this.getNodeService().getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef nextAssoc : assocs) - { - NodeRef nextChild = nextAssoc.getChildRef(); - - if (filePlanService.isFilePlanComponent(nextChild) && - !getFreezeService().isFrozen(nextChild)) - { - // If the child is a record, then the VitalRecord aspect needs to be applied or updated - if (getRecordService().isRecord(nextChild)) - { - if (parentVri) - { - VitalRecordDefinition vrDefn = getVitalRecordService().getVitalRecordDefinition(nextChild); - Map aspectProps = new HashMap<>(); - aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate()); - - getNodeService().addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps); - } - else - { - getNodeService().removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD); - } - } - else - // copy the vitalRecordDefinition properties from the parent to the child - { - Map childProps = getNodeService().getProperties(nextChild); - childProps.put(PROP_REVIEW_PERIOD, parentReviewPeriod); - childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri); - getNodeService().setProperties(nextChild, childProps); - } - - // Recurse down the containment hierarchy to all containers - if (!getRecordService().isRecord(nextChild)) - { - this.propagateChangeToChildrenOf(nextChild); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java deleted file mode 100644 index ed59faf551..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.vital; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.dictionary.types.period.Immediately; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Reviewed action. - * - * @author Neil McErlean - */ -public class ReviewedAction extends RMActionExecuterAbstractBase -{ - private static Log logger = LogFactory.getLog(ReviewedAction.class); - - /** - * - * @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) - { - VitalRecordDefinition vrDef = getVitalRecordService().getVitalRecordDefinition(actionedUponNodeRef); - if (vrDef != null && vrDef.isEnabled()) - { - if (getRecordService().isRecord(actionedUponNodeRef)) - { - reviewRecord(actionedUponNodeRef, vrDef); - } - else if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - for (NodeRef record : getRecordService().getRecords(actionedUponNodeRef)) - { - reviewRecord(record, vrDef); - } - } - } - } - - /** - * Make record as reviewed. - * - * @param nodeRef - * @param vrDef - */ - private void reviewRecord(NodeRef nodeRef, VitalRecordDefinition vrDef) - { - // Calculate the next review date - if (vrDef.getReviewPeriod().getPeriodType().equals(Immediately.PERIOD_TYPE)) - { - // Log - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Removing reviewAsOf property from") - .append(nodeRef); - logger.debug(msg.toString()); - } - - this.getNodeService().removeProperty(nodeRef, PROP_REVIEW_AS_OF); - } - else - { - Date reviewAsOf = vrDef.getNextReviewDate(); - if (reviewAsOf != null) - { - // Log - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Setting new reviewAsOf property [") - .append(reviewAsOf) - .append("] on ") - .append(nodeRef); - logger.debug(msg.toString()); - } - - this.getNodeService().setProperty(nodeRef, PROP_REVIEW_AS_OF, reviewAsOf); - // TODO And record previous review date, time, user - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java deleted file mode 100644 index 48e7186993..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.vital; - -import java.util.Date; - -import org.alfresco.service.cmr.repository.Period; - -/** - * Vital record definition interface - * - * @author Roy Wetherall - */ -public interface VitalRecordDefinition -{ - /** - * Indicates whether the vital record definition is enabled or not. - *

- * Note: a result of false indicates that the vital record definition is inactive - * therefore does not impose the rules associated with vital record review on - * associated nodes. - * - * @return boolean true if enabled, false otherwise - */ - boolean isEnabled(); - - /** - * Review period for vital records - * - * @return Period review period - */ - Period getReviewPeriod(); - - /** - * Gets the next review date based on the review period - * - * @return Date date of the next review - */ - Date getNextReviewDate(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java deleted file mode 100644 index e043d724c9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.vital; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; - -/** - * Vital record definition implementation class - * - * @author Roy Wetherall - */ -public class VitalRecordDefinitionImpl implements VitalRecordDefinition, RecordsManagementModel -{ - /** Indicates whether the vital record definition is enabled or not */ - private boolean enabled = false; - - /** Vital record review period */ - private Period reviewPeriod = new Period("none|0"); - - /** - * Constructor. - * - * @param enabled - * @param reviewPeriod - */ - /* package */ VitalRecordDefinitionImpl(boolean enabled, Period reviewPeriod) - { - this.enabled = enabled; - if (reviewPeriod != null) - { - this.reviewPeriod = reviewPeriod; - } - } - - /** - * Helper method to create vital record definition from node reference. - * - * @param nodeService - * @param nodeRef - * @return - */ - /* package */ static VitalRecordDefinition create(NodeService nodeService, NodeRef nodeRef) - { - Boolean enabled = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR); - if (enabled == null) - { - enabled = Boolean.FALSE; - } - Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); - return new VitalRecordDefinitionImpl(enabled, reviewPeriod); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#isEnabled() - */ - @Override - public boolean isEnabled() - { - return enabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#getNextReviewDate() - */ - public Date getNextReviewDate() - { - return getReviewPeriod().getNextDate(new Date()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#getReviewPeriod() - */ - public Period getReviewPeriod() - { - return reviewPeriod; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java deleted file mode 100644 index aa2c186a62..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.vital; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; - -/** - * Vital Record Service. - * - * @author Roy Wetherall - * @since 2.0 - */ -// Not @AlfrescoPublicApi due to e.g. Period. -public interface VitalRecordService -{ - /** Period 'none' */ - Period PERIOD_NONE = new Period("none|0"); - - /** - * Setup the vital record definition for the given node. - * - * @param nodeRef node reference - */ - void setupVitalRecordDefinition(NodeRef nodeRef); - - /** - * Gets the vital record definition details for the node. - * - * @param nodeRef node reference - * @return VitalRecordDefinition vital record definition details - */ - VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef); - - /** - * Sets the vital record definition values for a given node. - * - * @param nodeRef - * @param enabled - * @param reviewPeriod - * @return - */ - VitalRecordDefinition setVitalRecordDefintion(NodeRef nodeRef, boolean enabled, Period reviewPeriod); - - /** - * Indicates whether the record is a vital one or not. - * - * @param nodeRef node reference - * @return boolean true if this is a vital record, false otherwise - */ - boolean isVitalRecord(NodeRef nodeRef); - - /** - * Initialises the vital record details. - * - * @param nodeRef node reference to initialise with vital record details - */ - //void initialiseVitalRecord(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java deleted file mode 100644 index bcbfa5036a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.vital; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -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; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -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.cmr.repository.Period; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Vital record service interface implementation. - * - * @author Roy Wetherall - * @since 2.0 - */ -@BehaviourBean -public class VitalRecordServiceImpl extends ServiceBaseImpl - implements VitalRecordService, - RecordsManagementModel, - RecordsManagementPolicies.OnFileRecord -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Behavior to initialize vital record. - * - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) - * @since 2.2 - */ - @Override - @Behaviour(kind=BehaviourKind.CLASS, type="rma:record") - public void onFileRecord(NodeRef nodeRef) - { - // Calculate the review schedule - VitalRecordDefinition viDef = getVitalRecordDefinition(nodeRef); - if (viDef != null && viDef.isEnabled()) - { - Date reviewAsOf = viDef.getNextReviewDate(); - if (reviewAsOf != null) - { - Map reviewProps = new HashMap<>(1); - reviewProps.put(RecordsManagementModel.PROP_REVIEW_AS_OF, reviewAsOf); - - if (!nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) - { - nodeService.addAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD, reviewProps); - } - else - { - Map props = nodeService.getProperties(nodeRef); - props.putAll(reviewProps); - nodeService.setProperties(nodeRef, props); - } - } - } - else - { - // if we are re-filling then remove the vital aspect if it is not longer a vital record - if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) - { - nodeService.removeAspect(nodeRef, ASPECT_VITAL_RECORD); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setupVitalRecordDefinition(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupVitalRecordDefinition(NodeRef nodeRef) - { - // get the current review period value - Period currentReviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); - if (currentReviewPeriod == null || - PERIOD_NONE.equals(currentReviewPeriod)) - { - // get the immediate parent - NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - - // is the parent a record category - if (parentRef != null && - FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef))) - { - // is the child a record category or folder - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) || - kind.equals(FilePlanComponentKind.RECORD_FOLDER)) - { - // set the vital record definition values to match that of the parent - nodeService.setProperty(nodeRef, - PROP_VITAL_RECORD_INDICATOR, - nodeService.getProperty(parentRef, PROP_VITAL_RECORD_INDICATOR)); - nodeService.setProperty(nodeRef, - PROP_REVIEW_PERIOD, - nodeService.getProperty(parentRef, PROP_REVIEW_PERIOD)); - } - } - } - } - - /** - * @see VitalRecordService#getVitalRecordDefinition(NodeRef) - */ - public VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef) - { - VitalRecordDefinition result = null; - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.RECORD.equals(kind)) - { - result = resolveVitalRecordDefinition(nodeRef); - } - else - { - if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)) - { - result = VitalRecordDefinitionImpl.create(nodeService, nodeRef); - } - } - - return result; - } - - /** - * Resolves the record vital definition. - *

- * NOTE: Currently we only support the resolution of the vital record definition from the - * primary record parent. ie the record folder the record was originally filed within. - *

- * TODO: Add an algorithm to resolve the correct vital record definition when a record is filed in many - * record folders. - * - * @param record - * @return VitalRecordDefinition - */ - private VitalRecordDefinition resolveVitalRecordDefinition(NodeRef record) - { - NodeRef parent = nodeService.getPrimaryParent(record).getParentRef(); - return getVitalRecordDefinition(parent); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setVitalRecordDefintion(org.alfresco.service.cmr.repository.NodeRef, boolean, org.alfresco.service.cmr.repository.Period) - */ - @Override - public VitalRecordDefinition setVitalRecordDefintion(NodeRef nodeRef, boolean enabled, Period reviewPeriod) - { - // Check params - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("enabled", enabled); - - // Set the properties (will automatically add the vital record definition aspect) - nodeService.setProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR, enabled); - nodeService.setProperty(nodeRef, PROP_REVIEW_PERIOD, reviewPeriod); - - return new VitalRecordDefinitionImpl(enabled, reviewPeriod); - } - - /** - * @see VitalRecordService#isVitalRecord(NodeRef) - */ - public boolean isVitalRecord(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java deleted file mode 100644 index f90957822a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.action.evaluator.ActionConditionEvaluator; -import org.alfresco.service.cmr.action.ActionConditionDefinition; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Extended action service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedActionServiceImpl extends ActionServiceImpl implements ApplicationContextAware -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** Application context */ - private ApplicationContext extendedApplicationContext; - - /** - * @see org.alfresco.repo.action.ActionServiceImpl#setApplicationContext(org.springframework.context.ApplicationContext) - */ - public void setApplicationContext(ApplicationContext applicationContext) - { - super.setApplicationContext(applicationContext); - extendedApplicationContext = applicationContext; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.action.ActionServiceImpl#getActionConditionDefinition(java.lang.String) - */ - public ActionConditionDefinition getActionConditionDefinition(String name) - { - // get direct access to action condition definition (i.e. ignoring public flag of executer) - ActionConditionDefinition definition = null; - Object bean = extendedApplicationContext.getBean(name); - if (bean instanceof ActionConditionEvaluator) - { - ActionConditionEvaluator evaluator = (ActionConditionEvaluator) bean; - definition = evaluator.getActionConditionDefintion(); - } - return definition; - } - - /** - * @see org.alfresco.repo.action.ActionServiceImpl#getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getActionDefinitions(NodeRef nodeRef) - { - List result = null; - - // first use the base implementation to get the list of action definitions - List actionDefinitions = super.getActionDefinitions(nodeRef); - - if (nodeRef == null) - { - // nothing to filter - result = actionDefinitions; - } - else - { - // get the file component kind of the node reference - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - result = new ArrayList<>(actionDefinitions.size()); - - // check each action definition - for (ActionDefinition actionDefinition : actionDefinitions) - { - if (actionDefinition instanceof RecordsManagementActionDefinition) - { - if (kind != null) - { - Set applicableKinds = ((RecordsManagementActionDefinition)actionDefinition).getApplicableKinds(); - if (applicableKinds == null || applicableKinds.size() == 0 || applicableKinds.contains(kind)) - { - // an RM action can only act on a RM artifact - result.add(actionDefinition); - } - } - } - else - { - if (kind == null) - { - // a non-RM action can only act on a non-RM artifact - result.add(actionDefinition); - } - } - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java deleted file mode 100644 index 9013cbf053..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang3.StringUtils; - -/** - * Date parameter processor. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DateParameterProcessor extends ParameterProcessor implements ParameterSubstitutionSuggester -{ - private static final String DAY = "day"; - private static final String WEEK = "week"; - private static final String MONTH = "month"; - private static final String YEAR = "year"; - private static final String SHORT = "short"; - private static final String LONG = "long"; - private static final String NUMBER = "number"; - - private static final String SEP = "."; - - private static final String[] ALL_FIELDS_FOR_SUBSTITUTION_QUERY = { - DAY + SEP + SHORT, - DAY, - DAY + SEP + LONG, - DAY + SEP + NUMBER, - DAY + SEP + MONTH, - DAY + SEP + YEAR, - MONTH + SEP + SHORT, - MONTH, - MONTH + SEP + LONG, - MONTH + SEP + NUMBER, - YEAR + SEP + SHORT, - YEAR, - YEAR + SEP + LONG, - YEAR + SEP + WEEK - }; - - private int maximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS; - - /** - * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String process(String value, NodeRef actionedUponNodeRef) - { - // the default position is to return the value un-changed - String result = value; - - // strip the processor name from the value - value = stripName(value); - - if (!value.isEmpty()) - { - String[] values = value.split("\\.", 2); - String field = values[0].trim(); - - if (DAY.equalsIgnoreCase(field)) - { - result = handleDay(values); - } - else if (MONTH.equalsIgnoreCase(field)) - { - result = handleMonth(values); - } - else if (YEAR.equalsIgnoreCase(field)) - { - result = handleYear(values); - } - else - { - throw new AlfrescoRuntimeException("Cannot process the field '" + field + "'."); - } - } - - return result; - } - - private String handleDay(String[] values) - { - String style = getStyle(values); - String pattern; - - if (SHORT.equalsIgnoreCase(style)) - { - pattern = "EE"; - } - else if (LONG.equalsIgnoreCase(style)) - { - pattern = "EEEE"; - } - else if (NUMBER.equalsIgnoreCase(style)) - { - pattern = "uu"; - } - else if (MONTH.equalsIgnoreCase(style)) - { - pattern = "dd"; - } - else if (YEAR.equalsIgnoreCase(style)) - { - pattern = "DDD"; - } - else - { - throw new AlfrescoRuntimeException("The pattern 'date.day." + style + "' is not supported!"); - } - - return new SimpleDateFormat(pattern).format(new Date()); - } - - private String handleMonth(String[] values) - { - String style = getStyle(values); - String pattern; - - if (SHORT.equalsIgnoreCase(style)) - { - pattern = "MMM"; - } - else if (LONG.equalsIgnoreCase(style)) - { - pattern = "MMMM"; - } - else if (NUMBER.equalsIgnoreCase(style)) - { - pattern = "MM"; - } - else - { - throw new AlfrescoRuntimeException("The pattern 'date.month." + style + "' is not supported!"); - } - - return new SimpleDateFormat(pattern).format(new Date()); - } - - private String handleYear(String[] values) - { - String style = getStyle(values); - String pattern; - - if (SHORT.equalsIgnoreCase(style)) - { - pattern = "yy"; - } - else if (LONG.equalsIgnoreCase(style)) - { - pattern = "yyyy"; - } - else if (WEEK.equalsIgnoreCase(style)) - { - pattern = "ww"; - } - else - { - throw new AlfrescoRuntimeException("The pattern 'date.year." + style + "' is not supported!"); - } - - return new SimpleDateFormat(pattern).format(new Date()); - } - - private String getStyle(String[] values) - { - String style; - - if (values.length == 1) - { - style = SHORT; - } - else - { - style = values[1].trim(); - } - - return style; - } - - /** - * Set the maxmimum number of suggestions returned from the global property - * - * @param maximumNumberSuggestions - */ - public void setMaximumNumberSuggestions(int maximumNumberSuggestions) - { - this.maximumNumberSuggestions = (maximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS: maximumNumberSuggestions); - } - - /* (non-Javadoc) - * @see org.alfresco.repo.action.parameter.ParameterSubstitutionSuggester#getSubstitutionSuggestions(java.lang.String) - */ - @Override - public List getSubstitutionSuggestions(String substitutionFragment) - { - List suggestions = new ArrayList<>(); - String namePrefix = this.getName() + "."; - if(StringUtils.isBlank(substitutionFragment) || this.getName().toLowerCase().contains(substitutionFragment.toLowerCase())) - { - for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) - { - suggestions.add(namePrefix + field); - if(suggestions.size() >= maximumNumberSuggestions) - { - break; - } - } - } - else - { - for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) - { - String prefixFieldName = namePrefix + field; - if(prefixFieldName.toLowerCase().contains(substitutionFragment.toLowerCase())) - { - suggestions.add(namePrefix + field); - if(suggestions.size() >= maximumNumberSuggestions) - { - break; - } - } - } - } - return suggestions; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java deleted file mode 100644 index cf1257b18b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Message parameter processor. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class MessageParameterProcessor extends ParameterProcessor -{ - /** - * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String process(String value, NodeRef actionedUponNodeRef) - { - // the default position is to return the value un-changed - String result = value; - - // strip the processor name from the value - value = stripName(value); - if (!value.isEmpty()) - { - result = I18NUtil.getMessage(value); - if (result == null) - { - throw new AlfrescoRuntimeException("The message parameter processor could not resolve the message for the id " + value); - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java deleted file mode 100644 index 3978332955..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang3.ArrayUtils; - -/** - * Node parameter processor. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class NodeParameterProcessor extends ParameterProcessor implements ParameterSubstitutionSuggester -{ - /** Supported data types */ - private QName[] supportedDataTypes = - { - DataTypeDefinition.TEXT, - DataTypeDefinition.BOOLEAN, - DataTypeDefinition.DATE, - DataTypeDefinition.DATETIME, - DataTypeDefinition.DOUBLE, - DataTypeDefinition.FLOAT, - DataTypeDefinition.INT, - DataTypeDefinition.MLTEXT - }; - - private int maximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS; - - /** Node service */ - private NodeService nodeService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Records management admin service */ - private RecordsManagementAdminService recordsManagementAdminService; - - /** List of definitions (aspects and types) to use for substitution suggestions */ - private List suggestionDefinitions = null; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param recordsManagementAdminService Records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - /** - * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String process(String value, NodeRef actionedUponNodeRef) - { - // the default position is to return the value un-changed - String result = value; - - // strip the processor name from the value - value = stripName(value); - if (!value.isEmpty()) - { - QName qname = QName.createQName(value, namespaceService); - - PropertyDefinition propertyDefinition = dictionaryService.getProperty(qname); - if (propertyDefinition == null) - { - throw new AlfrescoRuntimeException("The property " + value + " does not have a property definition."); - } - - QName type = propertyDefinition.getDataType().getName(); - if (ArrayUtils.contains(supportedDataTypes, type)) - { - Serializable propertyValue = nodeService.getProperty(actionedUponNodeRef, qname); - if (propertyValue != null) - { - result = propertyValue.toString(); - } - else - { - // set the result to the empty string - result = ""; - } - } - else - { - throw new AlfrescoRuntimeException("The property " + value + " is of type " + type.toString() + " which is not supported by parameter substitution."); - } - } - - return result; - } - - /** - * Set the maxmimum number of suggestions returned from the global property - * - * @param maximumNumberSuggestions - */ - public void setMaximumNumberSuggestions(int maximumNumberSuggestions) - { - this.maximumNumberSuggestions = (maximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS: maximumNumberSuggestions); - } - - /** - * Add suggestion definition to the list used to get properties suggestions from. - * - * @param definition Type or aspect - */ - public void addSuggestionDefinition(QName definition) - { - if(this.suggestionDefinitions == null) - { - this.suggestionDefinitions = Collections.synchronizedList(new ArrayList<>()); - } - this.suggestionDefinitions.add(definition); - } - - /** - * Get a list of node substitution suggestions for the specified fragment. - * - * @param substitutionFragment The fragment to search for - * @returns A list of node substitution suggestions, for example 'node.cm:title' - * - * @see org.alfresco.repo.action.parameter.ParameterSubstitutionSuggester#getSubstitutionSuggestions(java.lang.String) - */ - @Override - public List getSubstitutionSuggestions(String substitutionFragment) - { - Set suggestionSet = Collections.synchronizedSet(new HashSet<>()); - if(this.suggestionDefinitions != null) - { - for(QName definition : this.suggestionDefinitions) - { - if(getSubstitutionSuggestions(definition, substitutionFragment.toLowerCase(), suggestionSet)) - { - break; - } - } - } - List suggestions = new ArrayList<>(); - suggestions.addAll(suggestionSet); - Collections.sort(suggestions); - return suggestions; - } - - /** - * Get a list of node substitution suggestions for the given definition and specified fragment. - * - * @param definitionName Definition (aspect or type) to get properties of and the call this method for associated aspects - * @param substitutionFragment Substitution fragment to search for - * @param suggestions The current list of suggestions to which we will add newly found suggestions - */ - private boolean getSubstitutionSuggestions(QName definitionName, String substitutionFragment, Set suggestions) - { - boolean gotMaximumSuggestions = false; - ClassDefinition definition = this.dictionaryService.getAspect(definitionName); - if(definition == null) - { - definition = this.dictionaryService.getType(definitionName); - } - if(definition != null) - { - gotMaximumSuggestions = getSubstitutionSuggestionsForDefinition(definition, substitutionFragment, suggestions); - } - if(recordsManagementAdminService.isCustomisable(definitionName) && !gotMaximumSuggestions) - { - gotMaximumSuggestions = processPropertyDefinitions(recordsManagementAdminService.getCustomPropertyDefinitions(definitionName), substitutionFragment, suggestions); - } - return gotMaximumSuggestions; - } - - /** - * Get a list of node substitution suggestions for the given definition and specified fragment. Calls itself recursively for - * associated aspects. - * - * @param definition Definition (aspect or type) to get properties of and the call this method for associated aspects - * @param substitutionFragment Substitution fragment to search for - * @param suggestions The current list of suggestions to which we will add newly found suggestions - */ - private boolean getSubstitutionSuggestionsForDefinition(ClassDefinition definition, String substitutionFragment, Set suggestions) - { - boolean gotMaximumSuggestions = processPropertyDefinitions(definition.getProperties(), substitutionFragment, suggestions); - if(!gotMaximumSuggestions) - { - for(QName defaultAspect : definition.getDefaultAspectNames()) - { - gotMaximumSuggestions = getSubstitutionSuggestions(defaultAspect, substitutionFragment, suggestions); - if(gotMaximumSuggestions) - { - break; - } - } - } - return gotMaximumSuggestions; - } - - /** - * Process the supplied map of property definitions and add the ones that match the supplied fragment to the list of suggestions. - * - * @param definition Definition (aspect or type) to get properties of and the call this method for associated aspects - * @param substitutionFragment Substitution fragment to search for - * @param suggestions The current list of suggestions to which we will add newly found suggestions - */ - private boolean processPropertyDefinitions(Map properties, String substitutionFragment, Set suggestions) - { - boolean gotMaximumSuggestions = false; - if (properties != null) - { - for (Map.Entry entry : properties.entrySet()) - { - PropertyDefinition propertyDefinition = entry.getValue(); - QName type = propertyDefinition.getDataType().getName(); - if(ArrayUtils.contains(supportedDataTypes, type)) - { - String suggestion = getName() + "." + entry.getKey().getPrefixString(); - if(suggestion.toLowerCase().contains(substitutionFragment)) - { - if(suggestions.size() < this.maximumNumberSuggestions) - { - suggestions.add(suggestion); - } - else - { - gotMaximumSuggestions = true; - break; - } - } - } - } - } - return gotMaximumSuggestions; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java deleted file mode 100644 index 514bea55f2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Record metadata bootstrap bean. - *

- * This method of bootstrapping record metadata aspects into the RecordService deprecates the - * previous practice of extending rma:recordMetaData. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class NodeParameterSuggesterBootstrap -{ - /** namespace service */ - private NamespaceService namespaceService; - - /** configured node parameter processor aspect and type names, comma separated */ - private String nodeParameterProcessorAspectsNames; - - /** node parameter processor */ - private NodeParameterProcessor nodeParameterProcessor; - - /** - * @param nodeParameterProcessorAspectsNames map of record metadata aspects against file plan types - */ - public void setNodeParameterProcessorAspects(String nodeParameterProcessorAspectsNames) - { - this.nodeParameterProcessorAspectsNames = nodeParameterProcessorAspectsNames; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param nodeParameterProcessor Node parameter processor - */ - public void setNodeParameterProcessor(NodeParameterProcessor nodeParameterProcessor) - { - this.nodeParameterProcessor = nodeParameterProcessor; - } - - /** - * Init method - */ - public void init() - { - ParameterCheck.mandatory("namespaceService", namespaceService); - - if (nodeParameterProcessorAspectsNames != null) - { - String[] aspectsNames = this.nodeParameterProcessorAspectsNames.split(","); - for (String name : aspectsNames) - { - if((name != null) && !"".equals(name.trim())) - { - // convert to qname and save it - QName aspect = QName.createQName(name.trim(), namespaceService); - - // register with node parameter processor - this.nodeParameterProcessor.addSuggestionDefinition(aspect); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java deleted file mode 100644 index ecba6884fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Abstract parameter processor implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class ParameterProcessor -{ - /** Processor name */ - private String name; - - /** Parameter processor component */ - private ParameterProcessorComponent parameterProcessorComponent; - - /** - * @return parameter processor name - */ - public String getName() - { - return name; - } - - /** - * @param name parameter processor name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @param parameterProcessorComponent parameter processor component - */ - public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) - { - this.parameterProcessorComponent = parameterProcessorComponent; - } - - /** - * Init method - */ - public void init() - { - parameterProcessorComponent.register(this); - } - - /** - * Process the parameter value. - * - * @param value substitution value - * @param actionedUponNodeRef actioned upon node reference - * @return String processed string, original string if subs string invalid - */ - public abstract String process(String value, NodeRef actionedUponNodeRef); - - /** - * Strips the name of the processor from the subs value. - * - * @param value subs value - * @return String subs value with the name and '.' delimiter removed - */ - protected String stripName(String value) - { - String result = ""; - String[] values = value.split("\\.", 2); - if (values.length == 2) - { - result = values[1]; - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java deleted file mode 100644 index b0a70d16e4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.action.ParameterizedItem; -import org.alfresco.service.cmr.action.ParameterizedItemDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Parameter processor component - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ParameterProcessorComponent implements ParameterSubstitutionSuggester -{ - /** regex used to parse parameters */ - private static final String REG_EX_OLD = "\\$\\{([^\\$\\{]+)\\}"; - private static final String REG_EX = "\\{([^\\{]+)\\}"; - - /** registry of parameter processors */ - private Map processors = new HashMap<>(5); - private List subtitutionSuggesterProcessors = new ArrayList<>(5); - - /** - * Register parameter processor - * - * @param processor - */ - public void register(ParameterProcessor processor) - { - this.processors.put(processor.getName(), processor); - if(processor instanceof ParameterSubstitutionSuggester) - { - this.subtitutionSuggesterProcessors.add((ParameterSubstitutionSuggester)processor); - } - } - - /** - * - * @param ruleItem - * @param ruleItemDefinition - * @param actionedUponNodeRef - */ - public void process(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition, NodeRef actionedUponNodeRef) - { - for (Map.Entry entry : ruleItem.getParameterValues().entrySet()) - { - String parameterName = entry.getKey(); - Object parameterValue = entry.getValue(); - - // only sub string property values - if (parameterValue instanceof String) - { - // set the updated parameter value - ruleItem.setParameterValue(parameterName, process((String)parameterValue, actionedUponNodeRef)); - } - } - } - - /** - * Process the value for substitution within the context of the provided node. - * - * @param value value - * @param nodeRef node reference - * @return String resulting value - */ - public String process(String value, NodeRef nodeRef) - { - return process(process(value, nodeRef, REG_EX_OLD), nodeRef, REG_EX); - } - - public String process(String value, NodeRef nodeRef, String regExp) - { - // match the substitution pattern - Pattern patt = Pattern.compile(regExp); - Matcher m = patt.matcher(value); - StringBuffer sb = new StringBuffer(value.length()); - - while (m.find()) - { - String text = m.group(1); - - // lookup parameter processor to use - ParameterProcessor processor = lookupProcessor(text); - if (processor == null) - { - throw new AlfrescoRuntimeException("A parameter processor has not been found for the substitution string " + text); - } - else - { - // process each substitution value - text = processor.process(text, nodeRef); - } - - // append new value - m.appendReplacement(sb, Matcher.quoteReplacement(text)); - } - m.appendTail(sb); - return sb.toString(); - } - - /** - * Return a list of substitution suggestions for the passed string fragment. - * - * @param substitutionFragment Text fragment to search on. - * @return A list of substitutions that match the substitution fragment. - */ - public List getSubstitutionSuggestions(final String substitutionFragment) - { - List suggestions = new ArrayList<>(); - for (ParameterSubstitutionSuggester suggestor : this.subtitutionSuggesterProcessors) - { - suggestions.addAll(suggestor.getSubstitutionSuggestions(substitutionFragment.toLowerCase())); - } - return suggestions; - } - - /** - * Look up parameter processor - * - * @param value - * @return - */ - private ParameterProcessor lookupProcessor(String value) - { - ParameterProcessor result = null; - - if (value != null && !value.isEmpty()) - { - String[] values = value.split("\\.", 2); - if (values.length != 0) - { - // get the processor from the registered map - result = processors.get(values[0]); - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java deleted file mode 100644 index e67711b45d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import java.util.List; - -public interface ParameterSubstitutionSuggester -{ - int DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS = 10; - - List getSubstitutionSuggestions(final String substitutionFragment); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java deleted file mode 100644 index fd6642b348..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.repo.imap; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * Extends the core service ImapServiceImpl functionality - * - * @author Ana Bozianu - * @since 2.4 - * - */ -public class ExtendedImapServiceImpl extends ImapServiceImpl -{ - private NodeService nodeService; - private BehaviourFilter policyBehaviourFilter; - private DictionaryService dictionaryService; - private AuthenticationUtil authenticationUtil; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - @Override - public void setPolicyFilter(BehaviourFilter policyBehaviourFilter) - { - this.policyBehaviourFilter = policyBehaviourFilter; - super.setPolicyFilter(policyBehaviourFilter); - } - - @Override - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - super.setNodeService(nodeService); - } - - /** - * Overwrites the core functionality so we can list RM files in IMAP - * @see https://issues.alfresco.com/jira/browse/RM-3216 - */ - @Override - public String getPathFromSites(final NodeRef ref) - { - return doAsSystem(new RunAsWork() - { - @Override - public String doWork() throws Exception - { - String name = ((String) nodeService.getProperty(ref, ContentModel.PROP_NAME)).toLowerCase(); - if (dictionaryService.isSubClass(nodeService.getType(ref), SiteModel.TYPE_SITE)) - { - return name; - } - else - { - NodeRef parent = nodeService.getPrimaryParent(ref).getParentRef(); - return getPathFromSites(parent) + "/" + name; - } - } - }); - } - - private R doAsSystem(RunAsWork work) - { - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - try - { - return authenticationUtil.runAsSystem(work); - } - finally - { - policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); - policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java deleted file mode 100644 index 296311a1e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.jscript; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.ParameterCheck; - -/** - * Extended jscript search implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedSearch extends Search -{ - /** - * Extended to take into account record read permission check. - * - * @see org.alfresco.repo.jscript.Search#findNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public ScriptNode findNode(NodeRef ref) - { - ParameterCheck.mandatory("ref", ref); - if (this.services.getNodeService().exists(ref) && - (this.services.getPermissionService().hasPermission(ref, PermissionService.READ) == AccessStatus.ALLOWED || - this.services.getPermissionService().hasPermission(ref, RMPermissionModel.READ_RECORDS) == AccessStatus.ALLOWED)) - { - return new ScriptNode(ref, this.services, getScope()); - } - return null; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java deleted file mode 100644 index 483d7945e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.model.filefolder; - -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public class ExtendedFileFolderServiceImpl extends FileFolderServiceImpl -{ - protected RecordService recordService; - - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - @Override - public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) - { - return create(parentNodeRef, name, typeQName, null); - } - - @Override - public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName, QName assocQName) - { - FileInfo result = null; - - recordService.disablePropertyEditableCheck(); - try - { - result = super.create(parentNodeRef, name, typeQName, assocQName); - } - finally - { - recordService.enablePropertyEditableCheck(); - if (result != null) - { - recordService.disablePropertyEditableCheck(result.getNodeRef()); - } - } - - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java deleted file mode 100644 index 57684e61e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.rule; - -import java.util.HashSet; -import java.util.Set; - -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.record.RecordService; -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.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.namespace.QName; - -/** - * Extended rule service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedRuleServiceImpl extends RuleServiceImpl -{ - /** indicates whether the rules should be run as admin or not */ - private boolean runAsAdmin = true; - - /** ignore types */ - private Set ignoredTypes = new HashSet<>(); - - /** file plan service */ - private FilePlanService filePlanService; - - /** node service */ - protected NodeService nodeService; - - /** Record service */ - protected RecordService recordService; - - /** - * @param nodeService node service - */ - public void setNodeService2(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param runAsAdmin true if run rules as admin, false otherwise - */ - public void setRunAsAdmin(boolean runAsAdmin) - { - this.runAsAdmin = runAsAdmin; - } - - /** - * Init method - */ - @Override - public void init() - { - super.init(); - - // Specify a set of system types to be ignored by rule executions - ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE); - ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION); - ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION); - ignoredTypes.add(RecordsManagementModel.TYPE_EVENT_EXECUTION); - } - - /** - * @see org.alfresco.repo.rule.RuleServiceImpl#saveRule(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.rule.Rule) - */ - @Override - public void saveRule(final NodeRef nodeRef, final Rule rule) - { - if (filePlanService.isFilePlanComponent(nodeRef)) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - ExtendedRuleServiceImpl.super.saveRule(nodeRef, rule); - return null; - } - - }); - } - else - { - super.saveRule(nodeRef, rule); - } - } - - /** - * @see org.alfresco.repo.rule.RuleServiceImpl#removeRule(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.rule.Rule) - */ - @Override - public void removeRule(final NodeRef nodeRef, final Rule rule) - { - if (filePlanService.isFilePlanComponent(nodeRef)) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - ExtendedRuleServiceImpl.super.removeRule(nodeRef, rule); - return null; - } - - }); - } - else - { - super.removeRule(nodeRef, rule); - } - } - - /** - * @see org.alfresco.repo.rule.RuleServiceImpl#executeRule(org.alfresco.service.cmr.rule.Rule, org.alfresco.service.cmr.repository.NodeRef, java.util.Set) - */ - @Override - public void executeRule(final Rule rule, final NodeRef nodeRef, final Set executedRules) - { - if (nodeService.exists(nodeRef)) - { - QName typeQName = nodeService.getType(nodeRef); - - // check if this is a rm rule on a rm artifact - if (filePlanService.isFilePlanComponent(nodeRef) && - isFilePlanComponentRule(rule)) - { - // ignore and - if (!isIgnoredType(typeQName)) - { - if (runAsAdmin) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules); - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - else - { - // run as current user - super.executeRule(rule, nodeRef, executedRules); - } - } - } - else - { - // just execute the rule as the current user - super.executeRule(rule, nodeRef, executedRules); - } - } - } - - /** - * Indicates whether the rule is a file plan component - * - * @param rule rule - * @return boolean true if rule is set on a file plan component, false otherwise - */ - private boolean isFilePlanComponentRule(Rule rule) - { - NodeRef nodeRef = getOwningNodeRef(rule); - return filePlanService.isFilePlanComponent(nodeRef); - } - - /** - * @param typeQName type qname - * @return boolean true if ignore type, false otherwise - */ - private boolean isIgnoredType(QName typeQName) - { - return ignoredTypes.contains(typeQName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java deleted file mode 100644 index af9b884bb6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.rule.ruletrigger; - -import java.util.Set; - -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -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.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Prevent multiple triggering of outbound rules when moving records. - * - * @author Roy Wetherall - */ -public class ExtendedBeforeDeleteChildAssociationRuleTrigger - extends RuleTriggerAbstractBase - implements NodeServicePolicies.BeforeDeleteChildAssociationPolicy -{ - /** - * The logger - */ - private static Log logger = LogFactory.getLog(BeforeDeleteChildAssociationRuleTrigger.class); - - private static final String POLICY = "beforeDeleteChildAssociation"; - - private boolean isClassBehaviour = false; - - public void setIsClassBehaviour(boolean isClassBehaviour) - { - this.isClassBehaviour = isClassBehaviour; - } - - /** - * @see org.alfresco.repo.rule.ruletrigger.RuleTrigger#registerRuleTrigger() - */ - public void registerRuleTrigger() - { - if (isClassBehaviour) - { - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), - this, - new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); - } - else - { - this.policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), - this, - new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); - } - } - - public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - // Break out early if rules are not enabled - if (!areRulesEnabled()) - { - return; - } - - NodeRef childNodeRef = childAssocRef.getChildRef(); - - // Avoid renamed nodes - Set renamedNodeRefSet = TransactionalResourceHelper.getSet(RULE_TRIGGER_RENAMED_NODES); - if (renamedNodeRefSet.contains(childNodeRef)) - { - return; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Single child assoc trigger (policy = " + POLICY + ") fired for parent node " + childAssocRef.getParentRef() + " and child node " + childAssocRef.getChildRef()); - } - - triggerRules(childAssocRef.getParentRef(), childNodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java deleted file mode 100644 index 51352e842f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.authority; - -/** - * Interface for defining constants - * - * @author Tuna Aksoy - * @since 2.1 - */ -public interface RMAuthority -{ - /** - * The default rm zone. - */ - String ZONE_APP_RM = "APP.RM"; - - /** - * The constant for all roles display name - */ - String ALL_ROLES_DISPLAY_NAME = "All Roles"; - - /** - * The constant for all roles prefix - */ - String ALL_ROLES_PREFIX = "AllRoles"; -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java deleted file mode 100644 index b86098bc3a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.authority; - -import java.util.Set; -import java.util.regex.Pattern; - -import org.alfresco.service.cmr.security.AuthorityType; - -/** - * This class extends {@link AuthorityDAOImpl}
- * and overrides two methods from the original class
- *
- * addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type)
- *
- * and
- *
- * addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type, Pattern pattern)
- */ -public class RMAuthorityDAOImpl extends AuthorityDAOImpl -{ - protected void addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type) - { - if (isAuthorityNameMatching(authorityName, type)) - { - authorities.add(authorityName); - } - } - - protected void addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type, Pattern pattern) - { - if (isAuthorityNameMatching(authorityName, type)) - { - if (pattern == null) - { - authorities.add(authorityName); - } - else - { - if (pattern.matcher(getShortName(authorityName)).matches()) - { - authorities.add(authorityName); - } - else - { - String displayName = getAuthorityDisplayName(authorityName); - if (displayName != null && pattern.matcher(displayName).matches()) - { - authorities.add(authorityName); - } - } - } - } - } - - private boolean isAuthorityNameMatching(String authorityName, AuthorityType type) - { - boolean isMatching = false; - if (type == null || AuthorityType.getAuthorityType(authorityName).equals(type) && !getAuthorityZones(authorityName).contains("APP.RM")) - { - isMatching = true; - } - return isMatching; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java deleted file mode 100644 index 0501621ac0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.impl; - -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.Pair; - -/** - * Extended Permission Service Interface used in RM. - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface ExtendedPermissionService extends PermissionService -{ - /** - * Get a set of all the authorities that have write access. - * - * @param aclId acl id - * @return {@link Set}<{@link String}> set of authorities with write access - */ - Set getWriters(Long aclId); - - /** - * Get the readers and writers for a given node. - *

- * The writers list includes the owner for the node. - * - * @param nodeRef node reference - * @return Pair<Set<String>, Set<String>> first is a set containing all the authorities that have read permission on the - * document and second is a set containing all the authorities that have write - * permission on the document, including the owner. - * - * @since 2.5 - */ - Pair, Set> getReadersAndWriters(NodeRef nodeRef); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java deleted file mode 100644 index 2704ee1f3d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java +++ /dev/null @@ -1,470 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.impl; - -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessControlEntry; -import org.alfresco.repo.security.permissions.AccessControlList; -import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.Pair; -import org.alfresco.util.PropertyCheck; -import org.apache.commons.lang3.StringUtils; -import org.springframework.context.ApplicationEvent; - - -/** - * Extends the core permission service implementation allowing the consideration of the read records permission. - *

- * This is required for SOLR support. - * - * @author Roy Wetherall - */ -public class ExtendedPermissionServiceImpl extends PermissionServiceImpl implements ExtendedPermissionService -{ - /** An audit key for the enable permission inheritance event. */ - private static final String AUDIT_ENABLE_INHERIT_PERMISSION = "enable-inherit-permission"; - /** An audit key for the disable permission inheritance event. */ - private static final String AUDIT_DISABLE_INHERIT_PERMISSION = "disable-inherit-permission"; - - /** Writers simple cache */ - protected SimpleCache> writersCache; - - /** - * Configured Permission mapping. - *

- * This string comes from alfresco-global.properties and allows fine tuning of the how permissions are mapped. - * This was added as a fix for MNT-16852 to enhance compatibility with our Outlook Integration. - */ - protected List configuredReadPermissions; - /** - * Configured Permission mapping. - *

- * This string also comes from alfresco-global.properties. - */ - protected List configuredFilePermissions; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Permission processor registry */ - private PermissionProcessorRegistry permissionProcessorRegistry; - - /** The RM audit service. */ - private RecordsManagementAuditService recordsManagementAuditService; - - /** {@inheritDoc} Register the audit events. */ - @Override - public void init() - { - super.init(); - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_ENABLE_INHERIT_PERMISSION, "rm.audit.enable-inherit-permission")); - recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_DISABLE_INHERIT_PERMISSION, "rm.audit.disable-inherit-permission")); - return null; - } - }); - } - - /** - * Gets the file plan service - * - * @return the filePlanService - */ - public FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * Sets the file plan service - * - * @param filePlanService the filePlanService to set - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Sets the permission processor registry - * - * @param permissionProcessorRegistry the permissions processor registry - */ - public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) - { - this.permissionProcessorRegistry = permissionProcessorRegistry; - } - - /** - * Set the RM audit service. - * - * @param recordsManagementAuditService The RM audit service. - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setAnyDenyDenies(boolean) - */ - @Override - public void setAnyDenyDenies(boolean anyDenyDenies) - { - super.setAnyDenyDenies(anyDenyDenies); - if (writersCache != null) - { - writersCache.clear(); - } - } - - /** - * @param writersCache the writersCache to set - */ - public void setWritersCache(SimpleCache> writersCache) - { - this.writersCache = writersCache; - } - - /** - * Maps the string from the properties file (rm.haspermissionmap.read) - * to the list used in the hasPermission method - * - * @param readMapping the mapping of permissions to ReadRecord - */ - public void setConfiguredReadPermissions(String readMapping) - { - this.configuredReadPermissions = Arrays.asList(readMapping.split(",")); - } - - /** - * Maps the string set in the properties file (rm.haspermissionmap.write) - * to the list used in the hasPermission method - * - * @param fileMapping the mapping of permissions to FileRecord - */ - public void setConfiguredFilePermissions(String fileMapping) - { - this.configuredFilePermissions = Arrays.asList(fileMapping.split(",")); - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#onBootstrap(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onBootstrap(ApplicationEvent event) - { - super.onBootstrap(event); - PropertyCheck.mandatory(this, "writersCache", writersCache); - } - - /** - * Override to deal with the possibility of hard coded permission checks in core code. Note: Eventually we need to - * merge the RM permission model into the core to make this more robust. - * - * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef, - * java.lang.String) - */ - @Override - public AccessStatus hasPermission(NodeRef nodeRef, String perm) - { - AccessStatus result = AccessStatus.UNDETERMINED; - if (nodeService.exists(nodeRef)) - { - // permission pre-processors - List preProcessors = permissionProcessorRegistry.getPermissionPreProcessors(); - for (PermissionPreProcessor preProcessor : preProcessors) - { - // pre process permission - result = preProcessor.process(nodeRef, perm); - - // veto if denied - if (AccessStatus.DENIED.equals(result)) { return result; } - } - - // evaluate permission - result = hasPermissionImpl(nodeRef, perm); - - // permission post-processors - List postProcessors = permissionProcessorRegistry.getPermissionPostProcessors(); - for (PermissionPostProcessor postProcessor : postProcessors) - { - // post process permission - result = postProcessor.process(result, nodeRef, perm, this.configuredReadPermissions, this.configuredFilePermissions); - } - } - return result; - } - - /** - * Implementation of hasPermission method call. - *

- * Separation also convenient for unit testing. - * - * @param nodeRef node reference - * @param perm permission - * @return {@link AccessStatus} access status result - */ - protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) - { - return super.hasPermission(nodeRef, perm); - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#canRead(java.lang.Long) - */ - @Override - protected AccessStatus canRead(Long aclId) - { - Set authorities = getAuthorisations(); - - // test denied - - if (anyDenyDenies) - { - - Set aclReadersDenied = getReadersDenied(aclId); - - for (String auth : aclReadersDenied) - { - if (authorities.contains(auth)) { return AccessStatus.DENIED; } - } - - } - - // test acl readers - Set aclReaders = getReaders(aclId); - - for (String auth : aclReaders) - { - if (authorities.contains(auth)) { return AccessStatus.ALLOWED; } - } - - return AccessStatus.DENIED; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#getReaders(java.lang.Long) - */ - @Override - public Set getReaders(Long aclId) - { - AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); - if (acl == null) { return Collections.emptySet(); } - - Set aclReaders = readersCache.get((Serializable) acl.getProperties()); - if (aclReaders != null) { return aclReaders; } - - HashSet assigned = new HashSet<>(); - HashSet readers = new HashSet<>(); - - for (AccessControlEntry ace : acl.getEntries()) - { - assigned.add(ace.getAuthority()); - } - - for (String authority : assigned) - { - UnconditionalAclTest test = new UnconditionalAclTest(getPermissionReference(PermissionService.READ)); - UnconditionalAclTest rmTest = new UnconditionalAclTest( - getPermissionReference(RMPermissionModel.READ_RECORDS)); - if (test.evaluate(authority, aclId) || rmTest.evaluate(authority, aclId)) - { - readers.add(authority); - } - } - - aclReaders = Collections.unmodifiableSet(readers); - readersCache.put((Serializable) acl.getProperties(), aclReaders); - return aclReaders; - } - - /** - * Override with check for RM read - * - * @param aclId - * @return - */ - @Override - public Set getReadersDenied(Long aclId) - { - AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); - - if (acl == null) { return Collections.emptySet(); } - Set denied = readersDeniedCache.get(aclId); - if (denied != null) { return denied; } - denied = new HashSet<>(); - Set assigned = new HashSet<>(); - - for (AccessControlEntry ace : acl.getEntries()) - { - assigned.add(ace.getAuthority()); - } - - for (String authority : assigned) - { - UnconditionalDeniedAclTest test = new UnconditionalDeniedAclTest( - getPermissionReference(PermissionService.READ)); - UnconditionalDeniedAclTest rmTest = new UnconditionalDeniedAclTest( - getPermissionReference(RMPermissionModel.READ_RECORDS)); - if (test.evaluate(authority, aclId) || rmTest.evaluate(authority, aclId)) - { - denied.add(authority); - } - } - - readersDeniedCache.put((Serializable) acl.getProperties(), denied); - - return denied; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getWriters(java.lang.Long) - */ - @Override - public Set getWriters(Long aclId) - { - AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); - if (acl == null) { return Collections.emptySet(); } - - Set aclWriters = writersCache.get((Serializable) acl.getProperties()); - if (aclWriters != null) { return aclWriters; } - - HashSet assigned = new HashSet<>(); - HashSet readers = new HashSet<>(); - - for (AccessControlEntry ace : acl.getEntries()) - { - assigned.add(ace.getAuthority()); - } - - for (String authority : assigned) - { - UnconditionalAclTest test = new UnconditionalAclTest(getPermissionReference(PermissionService.WRITE)); - if (test.evaluate(authority, aclId)) - { - readers.add(authority); - } - } - - aclWriters = Collections.unmodifiableSet(readers); - writersCache.put((Serializable) acl.getProperties(), aclWriters); - return aclWriters; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setInheritParentPermissions(org.alfresco.service.cmr.repository.NodeRef, - * boolean) - */ - @Override - 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) - { - setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); - } - if (inheritParentPermissions != super.getInheritParentPermissions(nodeRef)) - { - super.setInheritParentPermissions(nodeRef, inheritParentPermissions); - String auditEvent = (inheritParentPermissions ? AUDIT_ENABLE_INHERIT_PERMISSION : AUDIT_DISABLE_INHERIT_PERMISSION); - recordsManagementAuditService.auditEvent(nodeRef, auditEvent); - } - } - - /** - * Helper method to the RM admin role scoped by the correct file plan. - * - * @param nodeRef node reference - * @return String RM admin role - */ - private String getAdminRole(NodeRef nodeRef) - { - String adminRole = null; - NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - if (filePlan != null) - { - adminRole = authorityService.getName(AuthorityType.GROUP, - FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); - } - return adminRole; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getReadersAndWriters(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Pair, Set> getReadersAndWriters(NodeRef nodeRef) - { - // get the documents readers - Long aclId = nodeService.getNodeAclId(nodeRef); - Set readers = getReaders(aclId); - Set writers = getWriters(aclId); - - // add the current owner to the list of extended writers - Set modifiedWrtiers = new HashSet<>(writers); - String owner = ownableService.getOwner(nodeRef); - if (StringUtils.isNotBlank(owner) && - !owner.equals(OwnableService.NO_OWNER) && - authorityService.authorityExists(owner)) - { - modifiedWrtiers.add(owner); - } - - return new Pair<>(readers, modifiedWrtiers); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java deleted file mode 100644 index ab0d3b188b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.impl.acegi; - -import java.lang.reflect.Method; - -import org.alfresco.service.cmr.security.OwnableService; - -/** - * This is a workaround to make RM 2.1 backwards compatible with the Community version 4.2.d. - * This class will be removed after Community 4.2.e has been released. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RMACLEntryVoter extends ACLEntryVoter -{ - public void setOwnableService(OwnableService ownableService) - { - boolean exists = false; - Method[] declaredMethods = ACLEntryVoter.class.getDeclaredMethods(); - for (Method method : declaredMethods) - { - if (method.getName().equals("setOwnableService")) - { - exists = true; - break; - } - } - if (exists) - { - super.setOwnableService(ownableService); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java deleted file mode 100644 index c6d8e5bcb7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.processor; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - - - -/** - * Permission Post Processor. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public interface PermissionPostProcessor -{ - /** - * Process permission. - * - * @param accessStatus current access status - * @param nodeRef node reference - * @param perm permission - * - * @return {@link AccessStatus} - */ - AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm, - List configuredReadPermissions, List configuredFilePermissions); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java deleted file mode 100644 index 38c3f32fa2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.processor; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - - -/** - * Permission Veto Interface - * - * @author Roy Wetherall - * @since 2.4.a - */ -public interface PermissionPreProcessor -{ - /** - * Process permission. - * - * @param nodeRef node reference - * @param perm permission - * @return {@link AccessStatus} - */ - AccessStatus process(NodeRef nodeRef, String perm); - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java deleted file mode 100644 index 6aaa68dc78..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.processor; - -import java.util.ArrayList; -import java.util.List; - -/** - * Permission Processor Registry - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class PermissionProcessorRegistry -{ - /** permission pre-processors */ - private List permissionPreProcessors = new ArrayList<>(); - - /** permission post-processors */ - private List permissionPostProcessors = new ArrayList<>(); - - /** - * Add a permission pre-processor. - * - * @param permissionPreProcessor permission pre-processor - */ - public void addPermissionPreProcessor(PermissionPreProcessor permissionPreProcessor) - { - permissionPreProcessors.add(permissionPreProcessor); - } - - /** - * Add a permission post-processor. - * - * @param permissionPostProcessor permission post-processor - */ - public void addPermissionPostProcessor(PermissionPostProcessor permissionPostProcessor) - { - permissionPostProcessors.add(permissionPostProcessor); - } - - /** - * Get a list of the registered permission pre-processors. - * - * @return {@link List}<{@link PermissionPreProcessor}> list of permission pre-processors - */ - public List getPermissionPreProcessors() - { - return permissionPreProcessors; - } - - /** - * Get a list of the registered permission post-processors. - * - * @return <{@link List}>{@link PermissionPreProcessor} list of permission post-processors - */ - public List getPermissionPostProcessors() - { - return permissionPostProcessors; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java deleted file mode 100644 index edc2202e8a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.processor.impl; - -import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; - -/** - * Permission post processor base implementation. - *

- * Helper class that can be extended when providing a custom permission - * post processor implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public abstract class PermissionPostProcessorBaseImpl extends PermissionProcessorBaseImpl - implements PermissionPostProcessor -{ - /** - * Init method to add this permission extensions to the registry - */ - public void init() - { - getPermissionProcessorRegistry().addPermissionPostProcessor(this); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java deleted file mode 100644 index 8e846388f7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.processor.impl; - -import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; - -/** - * Permission pre-processor base implementation. - *

- * Helper class that can be extended when providing a custom permission - * pre-processor implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public abstract class PermissionPreProcessorBaseImpl extends PermissionProcessorBaseImpl - implements PermissionPreProcessor -{ - /** - * Init method to add this permission extensions to the registry - */ - public void init() - { - getPermissionProcessorRegistry().addPermissionPreProcessor(this); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java deleted file mode 100644 index 4666dd0cbc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.processor.impl; - -import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; - -/** - * Commonality found in both pre and post permission processor implementations. - * - * @author Roy Wetherall - * @since 2.4.a - */ -/*package*/ abstract class PermissionProcessorBaseImpl -{ - /** permission processor registry */ - private PermissionProcessorRegistry permissionProcessorRegistry; - - /** - * @param permissionProcessorRegistry permission processor registry - */ - public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) - { - this.permissionProcessorRegistry = permissionProcessorRegistry; - } - - /** - * @return {@link PermissionProcessorRegistry} permission processor registry - */ - protected PermissionProcessorRegistry getPermissionProcessorRegistry() - { - return permissionProcessorRegistry; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java deleted file mode 100644 index f805ea4622..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.dictionary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.site.SiteService; -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; - -/** - * Webscript to get the Classdefinitions using classfilter , namespaceprefix and name - * - * This class makes it possible to get only RM related class definitions - * @see ClassesGet for the original implementation - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmClassesGet extends DictionaryWebServiceBase implements RecordsManagementModel -{ - private static final String MODEL_PROP_KEY_CLASS_DEFS = "classdefs"; - private static final String MODEL_PROP_KEY_PROPERTY_DETAILS = "propertydefs"; - private static final String MODEL_PROP_KEY_ASSOCIATION_DETAILS = "assocdefs"; - - private static final String CLASS_FILTER_OPTION_TYPE1 = "all"; - private static final String CLASS_FILTER_OPTION_TYPE2 = "aspect"; - private static final String CLASS_FILTER_OPTION_TYPE3 = "type"; - - private static final String REQ_URL_TEMPL_VAR_CLASS_FILTER = "cf"; - private static final String REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX = "nsp"; - private static final String REQ_URL_TEMPL_VAR_NAME = "n"; - - /** Site service*/ - private SiteService siteService; - - /** - * @param siteService the site service to set - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - return executeImpl(req, RmDictionaryWebServiceUtils.isRmSite(req, siteService)); - } - - /** - * Execute custom Java logic - * - * @param req Web Script request - * @param isRM indicates whether the request comes from an RM site or not - * @return custom service model - */ - private Map executeImpl(WebScriptRequest req, boolean isRM) - { - String classFilter = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_CLASS_FILTER)); - String namespacePrefix = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX)); - String name = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_NAME)); - String className = null; - - Map classdef = new HashMap<>(); - Map> propdef = new HashMap<>(); - Map> assocdef = new HashMap<>(); - Map model = new HashMap<>(); - - List qnames = new ArrayList<>(); - QName classQname = null; - QName myModel = null; - - //if classfilter is not given, then it defaults to all - if (classFilter == null) - { - classFilter = "all"; - } - - //validate classfilter - if (!isValidClassFilter(classFilter)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the classfilter - " + classFilter + " provided in the URL"); - } - - //name alone has no meaning without namespaceprefix - if (namespacePrefix == null && name != null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing namespaceprefix parameter in the URL - both combination of name and namespaceprefix is needed"); - } - - //validate the namespaceprefix and name parameters => if namespaceprefix is given, then name has to be validated along with it - if (namespacePrefix != null) - { - //validate name parameter if present along with the namespaceprefix - if (name != null) - { - className = namespacePrefix + "_" + name; - if (!isValidClassname(className)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the name - " + name + "parameter in the URL"); - } - classQname = QName.createQName(getFullNamespaceURI(className)); - classdef.put(classQname, this.dictionaryservice.getClass(classQname)); - propdef.put(classQname, this.dictionaryservice.getClass(classQname).getProperties().values()); - assocdef.put(classQname, this.dictionaryservice.getClass(classQname).getAssociations().values()); - } - else - { - //if name is not given then the model is extracted from the namespaceprefix, there can be more than one model associated with one namespaceprefix - String namespaceUri = namespaceService.getNamespaceURI(namespacePrefix); - for (QName qnameObj : this.dictionaryservice.getAllModels()) - { - if (qnameObj.getNamespaceURI().equals(namespaceUri)) - { - name = qnameObj.getLocalName(); - myModel = QName.createQName(getFullNamespaceURI(namespacePrefix + "_" + name)); - - // check the classfilter to pull out either all or type or aspects - if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE1)) - { - qnames.addAll(this.dictionaryservice.getAspects(myModel)); - qnames.addAll(this.dictionaryservice.getTypes(myModel)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE3)) - { - qnames.addAll(this.dictionaryservice.getTypes(myModel)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE2)) - { - qnames.addAll(this.dictionaryservice.getAspects(myModel)); - } - } - } - } - } - - // if namespacePrefix is null, then check the class filter to pull out either all, type or aspects - if (myModel == null) - { - if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE1)) - { - qnames.addAll(getAspects(isRM)); - qnames.addAll(getTypes(isRM)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE3)) - { - qnames.addAll(getTypes(isRM)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE2)) - { - qnames.addAll(getAspects(isRM)); - } - } - - if (classdef.isEmpty()) - { - for (QName qnameObj : qnames) - { - classdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj)); - propdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj).getProperties().values()); - assocdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj).getAssociations().values()); - } - } - - List classDefinitions = new ArrayList<>(classdef.values()); - Collections.sort(classDefinitions, new DictionaryComparators.ClassDefinitionComparator(dictionaryservice)); - model.put(MODEL_PROP_KEY_CLASS_DEFS, classDefinitions); - model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, propdef.values()); - model.put(MODEL_PROP_KEY_ASSOCIATION_DETAILS, assocdef.values()); - model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, dictionaryservice); - - return model; - } - - /** - * Returns the names of the types depending on {@link isRM} parameter - * - * @param isRM if true only RM related types will be retrieved - * @return The names of the types defined within the specified model or all of them depending on {@link isRM} parameter - */ - private Collection getTypes(boolean isRM) - { - if (isRM) - { - return this.dictionaryservice.getTypes(RM_MODEL); - } - else - { - return this.dictionaryservice.getAllTypes(); - } - } - - /** - * Returns the names of the aspects depending on {@link isRM} parameter - * - * @param isRM if true only RM related aspects will be retrieved - * @return The names of the aspects defined within the specified model or all of them depending on {@link isRM} parameter - */ - private Collection getAspects(boolean isRM) - { - if (isRM) - { - return this.dictionaryservice.getAspects(RM_MODEL); - } - else - { - return this.dictionaryservice.getAllAspects(); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java deleted file mode 100644 index 7b2031fb48..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.dictionary; - -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Util class for dictionary web services - * - * @author Tuna Aksoy - * @since 2.1 - */ -public final class RmDictionaryWebServiceUtils -{ - private static final String SITE_ID = "siteId"; - private static final String SITE_PRESET = "rm-site-dashboard"; - - private RmDictionaryWebServiceUtils() - { - // Will not be called - } - - public static boolean isRmSite(WebScriptRequest req, SiteService siteService) - { - boolean isRmSite = false; - String siteId = req.getParameter(SITE_ID); - if (StringUtils.isNotBlank(siteId)) - { - SiteInfo site = siteService.getSite(siteId); - if (site != null && site.getSitePreset().equals(SITE_PRESET)) - { - isRmSite = true; - } - } - return isRmSite; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java deleted file mode 100644 index caa69c88ee..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.dictionary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.site.SiteService; -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; - -/** - * Webscript to get the Propertydefinitions for a given classname eg. =>cm_person - * - * This class makes it possible to get only RM related property definitions - * @see PropertiesGet for the original implementation - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmPropertiesGet extends DictionaryWebServiceBase implements RecordsManagementModel -{ - private static final String MODEL_PROP_KEY_PROPERTY_DETAILS = "propertydefs"; - private static final String DICTIONARY_CLASS_NAME = "classname"; - private static final String PARAM_NAME = "name"; - private static final String REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX = "nsp"; - - /** Site service*/ - private SiteService siteService; - - /** - * @param siteService the site service to set - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - return executeImpl(req, RmDictionaryWebServiceUtils.isRmSite(req, siteService)); - } - - /** - * Execute custom Java logic - * - * @param req Web Script request - * @param isRM indicates whether the request comes from an RM site or not - * @return custom service model - */ - private Map executeImpl(WebScriptRequest req, boolean isRM) - { - QName classQName = null; - String className = req.getServiceMatch().getTemplateVars().get(DICTIONARY_CLASS_NAME); - if (className != null && className.length() != 0) - { - classQName = createClassQName(className); - if (classQName == null) - { - // Error - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the className - " + className + " - parameter in the URL"); - } - } - - String[] names = req.getParameterValues(PARAM_NAME); - - String namespacePrefix = req.getParameter(REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX); - String namespaceURI = null; - if (namespacePrefix != null) - { - namespaceURI = this.namespaceService.getNamespaceURI(namespacePrefix); - } - - Map propMap = null; - if (classQName == null) - { - if (names != null) - { - propMap = new HashMap<>(names.length); - for (String name : names) - { - QName propQName = QName.createQName(name, namespaceService); - PropertyDefinition propDef = dictionaryservice.getProperty(propQName); - if (propDef != null) - { - propMap.put(propQName, propDef); - } - } - } - else - { - Collection propQNames = getProperties(isRM); - propMap = new HashMap<>(propQNames.size()); - for (QName propQName : propQNames) - { - propMap.put(propQName, dictionaryservice.getProperty(propQName)); - } - } - - } - else - { - // Get all the property definitions for the class - propMap = dictionaryservice.getClass(classQName).getProperties(); - } - - // Filter the properties by URI - List props = new ArrayList<>(propMap.size()); - for (Map.Entry entry : propMap.entrySet()) - { - if ((namespaceURI != null && - namespaceURI.equals(entry.getKey().getNamespaceURI())) || - namespaceURI == null) - { - props.add(entry.getValue()); - } - } - - // Order property definitions by title - Collections.sort(props, new DictionaryComparators.PropertyDefinitionComparator(dictionaryservice)); - - // Pass list of property definitions to template - Map model = new HashMap<>(); - model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, props); - model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, dictionaryservice); - - return model; - } - - /** - * Returns the names of the properties depending on {@link isRM} parameter - * - * @param isRM if true only RM related properties will be retrieved - * @return The names of the properties defined within the specified model or all of them depending on {@link isRM} parameter - */ - private Collection getProperties(boolean isRM) - { - if (isRM) - { - return dictionaryservice.getProperties(RM_MODEL); - } - else - { - return dictionaryservice.getAllProperties(null); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java deleted file mode 100644 index cf05e3c426..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.roles; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.script.admin.RoleDeclarativeWebScript; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Abstract class for adding/removing a user/group to/from a role - * This class contains the common methods needed in the sub classes. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class AbstractRmAuthorities extends RoleDeclarativeWebScript -{ - /** Constants for the url parameters */ - private static final String ROLE_ID = "roleId"; - private static final String AUTHORITY_NAME = "authorityName"; - - /** - * Util method for getting the nodeRef from the request - * - * @param req The webscript request - * @return The nodeRef passed in the request - */ - protected NodeRef getFilePlan(WebScriptRequest req) - { - NodeRef filePlan = super.getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No filePlan was provided on the URL."); - } - return filePlan; - } - - /** - * Util method for getting the roleId from the request - * - * @param req The webscript request - * @return The role id passed in the request - */ - protected String getRoleId(WebScriptRequest req) - { - return getParamValue(req, ROLE_ID); - } - - /** - * Util method for getting the authorityName from the request - * - * @param req The webscript request - * @return The authorityName passed in the request - */ - protected String getAuthorityName(WebScriptRequest req) - { - return getParamValue(req, AUTHORITY_NAME); - } - - /** - * Helper method to get the value of parameter from the request - * - * @param req The webscript request - * @param param The name of the parameter for which the value is requested - * @return The value for the requested parameter - */ - private String getParamValue(WebScriptRequest req, String param) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - - String authorityName = templateVars.get(param); - if (StringUtils.isBlank(authorityName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No '" + param + "' was provided on the URL."); - } - return authorityName; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/DynamicAuthoritiesGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/DynamicAuthoritiesGet.java deleted file mode 100644 index 9ef008b0be..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/DynamicAuthoritiesGet.java +++ /dev/null @@ -1,619 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/* - * 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.web.scripts.roles; - -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.Writer; -import java.text.MessageFormat; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.AbstractWebScript; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Format; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Webscript used for removing dynamic authorities from the records. - * - * @author Silviu Dinuta - * @since 2.3.0.7 - */ -@SuppressWarnings("deprecation") -public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsManagementModel -{ - private static final String MESSAGE_PARAMETER_BATCHSIZE_GREATER_THAN_ZERO = "Parameter batchsize should be a number greater than 0."; - private static final String MESSAGE_PROCESSING_BEGIN = "Processing - BEGIN"; - private static final String MESSAGE_PROCESSING_END = "Processing - END"; - private static final String MESSAGE_PROCESSING_RECORD_END_TEMPLATE = "Processing record {0} - END"; - private static final String MESSAGE_PROCESSING_RECORD_BEGIN_TEMPLATE = "Processing record {0} - BEGIN"; - private static final String MESSAGE_BATCHSIZE_IS_INVALID = "Parameter batchsize is invalid."; - private static final String MESSAGE_BATCHSIZE_IS_MANDATORY = "Parameter batchsize is mandatory"; - private static final String MESSAGE_NODE_REF_DOES_NOT_EXIST_TEMPLATE = "Parameter parentNodeRef = {0} does not exist."; - private static final String SUCCESS_STATUS = "success"; - /** - * The logger - */ - private static Log logger = LogFactory.getLog(DynamicAuthoritiesGet.class); - private static final String BATCH_SIZE = "batchsize"; - private static final String TOTAL_NUMBER_TO_PROCESS = "maxProcessedRecords"; - private static final String PARAM_EXPORT = "export"; - private static final String PARAM_PARENT_NODE_REF = "parentNodeRef"; - private static final String MODEL_STATUS = "responsestatus"; - private static final String MODEL_MESSAGE = "message"; - private static final String MESSAGE_ALL_TEMPLATE = "Processed {0} records."; - private static final String MESSAGE_PARTIAL_TEMPLATE = "Processed first {0} records."; - private static final String MESSAGE_NO_RECORDS_TO_PROCESS = "There where no records to be processed."; - - - /** services */ - private PatchDAO patchDAO; - private NodeDAO nodeDAO; - private QNameDAO qnameDAO; - private NodeService nodeService; - private PermissionService permissionService; - private ExtendedSecurityService extendedSecurityService; - private TransactionService transactionService; - /** Content Streamer */ - protected ContentStreamer contentStreamer; - private FileFolderService fileFolderService; - - /** service setters */ - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - protected Map buildModel(WebScriptRequest req, WebScriptResponse res) throws IOException - { - Map model = new HashMap<>(); - final Long batchSize = getBatchSizeParameter(req); - // get the max node id and the extended security aspect - Long maxNodeId = patchDAO.getMaxAdmNodeID(); - final Pair recordAspectPair = qnameDAO.getQName(ASPECT_EXTENDED_SECURITY); - if(recordAspectPair == null) - { - model.put(MODEL_STATUS, SUCCESS_STATUS); - model.put(MODEL_MESSAGE, MESSAGE_NO_RECORDS_TO_PROCESS); - logger.info(MESSAGE_NO_RECORDS_TO_PROCESS); - return model; - } - - Long totalNumberOfRecordsToProcess = getMaxToProccessParameter(req, batchSize); - - boolean attach = getExportParameter(req); - - File file = TempFileProvider.createTempFile("processedNodes_", ".csv"); - FileWriter writer = new FileWriter(file); - BufferedWriter out = new BufferedWriter(writer); - List processedNodes = new ArrayList<>(); - try - { - NodeRef parentNodeRef = getParentNodeRefParameter(req); - if (parentNodeRef != null) - { - processedNodes = processChildrenNodes(parentNodeRef, batchSize.intValue(), recordAspectPair, - totalNumberOfRecordsToProcess.intValue(), out, attach); - } - else - { - processedNodes = processNodes(batchSize, maxNodeId, recordAspectPair, totalNumberOfRecordsToProcess, - out, attach); - } - } - finally - { - out.close(); - } - - int processedNodesSize = processedNodes.size(); - - String message = ""; - if (totalNumberOfRecordsToProcess == 0 - || (totalNumberOfRecordsToProcess > 0 && processedNodesSize < totalNumberOfRecordsToProcess)) - { - message = MessageFormat.format(MESSAGE_ALL_TEMPLATE, processedNodesSize); - } - if (totalNumberOfRecordsToProcess > 0 && totalNumberOfRecordsToProcess == processedNodesSize) - { - message = MessageFormat.format(MESSAGE_PARTIAL_TEMPLATE, totalNumberOfRecordsToProcess); - } - model.put(MODEL_STATUS, SUCCESS_STATUS); - model.put(MODEL_MESSAGE, message); - logger.info(message); - - if (attach) - { - try - { - String fileName = file.getName(); - contentStreamer.streamContent(req, res, file, null, attach, fileName, model); - model = null; - } - finally - { - if (file != null) - { - file.delete(); - } - } - } - return model; - } - - /** - * Get export parameter from the request - * - * @param req - * @return - */ - protected boolean getExportParameter(WebScriptRequest req) - { - boolean attach = false; - String export = req.getParameter(PARAM_EXPORT); - if (Boolean.parseBoolean(export)) - { - attach = true; - } - return attach; - } - - /* - * (non-Javadoc) - * @see org.alfresco.repo.web.scripts.content.StreamContent#execute(org.springframework.extensions.webscripts. - * WebScriptRequest, org.springframework.extensions.webscripts.WebScriptResponse) - */ - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - // retrieve requested format - String format = req.getFormat(); - - try - { - String mimetype = getContainer().getFormatRegistry().getMimeType(req.getAgent(), format); - if (mimetype == null) - { - throw new WebScriptException("Web Script format '" + format + "' is not registered"); - } - - // construct model for script / template - Status status = new Status(); - Cache cache = new Cache(getDescription().getRequiredCache()); - Map model = buildModel(req, res); - if (model == null) { return; } - model.put("status", status); - model.put("cache", cache); - - Map templateModel = createTemplateParameters(req, res, model); - - // render output - int statusCode = status.getCode(); - if (statusCode != HttpServletResponse.SC_OK && !req.forceSuccessStatus()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Force success status header in response: " + req.forceSuccessStatus()); - logger.debug("Setting status " + statusCode); - } - res.setStatus(statusCode); - } - - // apply location - String location = status.getLocation(); - if (location != null && location.length() > 0) - { - if (logger.isDebugEnabled()) logger.debug("Setting location to " + location); - res.setHeader(WebScriptResponse.HEADER_LOCATION, location); - } - - // apply cache - res.setCache(cache); - - String callback = null; - if (getContainer().allowCallbacks()) - { - callback = req.getJSONCallback(); - } - if (format.equals(WebScriptResponse.JSON_FORMAT) && callback != null) - { - if (logger.isDebugEnabled()) logger.debug("Rendering JSON callback response: content type=" - + Format.JAVASCRIPT.mimetype() + ", status=" + statusCode + ", callback=" + callback); - - // NOTE: special case for wrapping JSON results in a javascript function callback - res.setContentType(Format.JAVASCRIPT.mimetype() + ";charset=UTF-8"); - res.getWriter().write((callback + "(")); - } - else - { - if (logger.isDebugEnabled()) - logger.debug("Rendering response: content type=" + mimetype + ", status=" + statusCode); - - res.setContentType(mimetype + ";charset=UTF-8"); - } - - // render response according to requested format - renderFormatTemplate(format, templateModel, res.getWriter()); - - if (format.equals(WebScriptResponse.JSON_FORMAT) && callback != null) - { - // NOTE: special case for wrapping JSON results in a javascript function callback - res.getWriter().write(")"); - } - } - catch (Exception e) - { - if (logger.isDebugEnabled()) - { - StringWriter stack = new StringWriter(); - e.printStackTrace(new PrintWriter(stack)); - logger.debug("Caught exception; decorating with appropriate status template : " + stack.toString()); - } - - throw createStatusException(e, req, res); - } - } - - protected void renderFormatTemplate(String format, Map model, Writer writer) - { - format = (format == null) ? "" : format; - - String templatePath = getDescription().getId() + "." + format; - - if (logger.isDebugEnabled()) logger.debug("Rendering template '" + templatePath + "'"); - - renderTemplate(templatePath, model, writer); - } - - /** - * Obtain maximum of the records to be processed from the request if it is specified or bachsize value otherwise - * - * @param req - * @return maximum of the records to be processed from the request if it is specified or bachsize value otherwise - */ - protected Long getMaxToProccessParameter(WebScriptRequest req, final Long batchSize) - { - String totalToBeProcessedRecordsStr = req.getParameter(TOTAL_NUMBER_TO_PROCESS); - //default total number of records to be processed to batch size value - Long totalNumberOfRecordsToProcess = batchSize; - if (StringUtils.isNotBlank(totalToBeProcessedRecordsStr)) - { - try - { - totalNumberOfRecordsToProcess = Long.parseLong(totalToBeProcessedRecordsStr); - } - catch(NumberFormatException ex) - { - //do nothing here, the value will remain 0L in this case - } - } - return totalNumberOfRecordsToProcess; - } - - /** - * Obtain batchsize parameter from the request. - * - * @param req - * @return batchsize parameter from the request - */ - protected Long getBatchSizeParameter(WebScriptRequest req) - { - String batchSizeStr = req.getParameter(BATCH_SIZE); - Long size; - if (StringUtils.isBlank(batchSizeStr)) - { - logger.info(MESSAGE_BATCHSIZE_IS_MANDATORY); - throw new WebScriptException(Status.STATUS_BAD_REQUEST, MESSAGE_BATCHSIZE_IS_MANDATORY); - } - try - { - size = Long.parseLong(batchSizeStr); - if (size <= 0) - { - logger.info(MESSAGE_PARAMETER_BATCHSIZE_GREATER_THAN_ZERO); - throw new WebScriptException(Status.STATUS_BAD_REQUEST, MESSAGE_PARAMETER_BATCHSIZE_GREATER_THAN_ZERO); - } - } - catch (NumberFormatException ex) - { - logger.info(MESSAGE_BATCHSIZE_IS_INVALID); - throw new WebScriptException(Status.STATUS_BAD_REQUEST, MESSAGE_BATCHSIZE_IS_INVALID); - } - return size; - } - - /** - * Get parentNodeRef parameter from the request - * - * @param req - * @return - */ - protected NodeRef getParentNodeRefParameter(WebScriptRequest req) - { - String parentNodeRefStr = req.getParameter(PARAM_PARENT_NODE_REF); - NodeRef parentNodeRef = null; - if (StringUtils.isNotBlank(parentNodeRefStr)) - { - parentNodeRef = new NodeRef(parentNodeRefStr); - if(!nodeService.exists(parentNodeRef)) - { - String message = MessageFormat.format(MESSAGE_NODE_REF_DOES_NOT_EXIST_TEMPLATE, parentNodeRef.toString()); - logger.info(message); - throw new WebScriptException(Status.STATUS_BAD_REQUEST, message); - } - } - return parentNodeRef; - } - - /** - * Process nodes all nodes or the maximum number of nodes specified by batchsize or totalNumberOfRecordsToProcess - * parameters - * - * @param batchSize - * @param maxNodeId - * @param recordAspectPair - * @param totalNumberOfRecordsToProcess - * @return the list of processed nodes - */ - protected List processNodes(final Long batchSize, Long maxNodeId, final Pair recordAspectPair, - Long totalNumberOfRecordsToProcess, final BufferedWriter out, final boolean attach) - { - final Long maxRecordsToProcess = totalNumberOfRecordsToProcess; - final List processedNodes = new ArrayList<>(); - logger.info(MESSAGE_PROCESSING_BEGIN); - // by batch size - for (Long i = 0L; i < maxNodeId; i+=batchSize) - { - if(maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess) - { - break; - } - final Long currentIndex = i; - - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // get the nodes with the extended security aspect applied - List nodeIds = patchDAO.getNodesByAspectQNameId(recordAspectPair.getFirst(), currentIndex, - currentIndex + batchSize); - - // process each one - for (Long nodeId : nodeIds) - { - if(maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess) - { - break; - } - NodeRef record = nodeDAO.getNodePair(nodeId).getSecond(); - String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - logger.info(MessageFormat.format(MESSAGE_PROCESSING_RECORD_BEGIN_TEMPLATE, recordName)); - processNode(record); - logger.info(MessageFormat.format(MESSAGE_PROCESSING_RECORD_END_TEMPLATE, recordName)); - processedNodes.add(record); - if (attach) - { - out.write(recordName); - out.write(","); - out.write(record.toString()); - out.write("\n"); - } - } - - return null; - } - }, false, // read only - true); // requires new - } - logger.info(MESSAGE_PROCESSING_END); - return processedNodes; - } - - protected List processChildrenNodes(NodeRef parentNodeRef, final int batchSize, - final Pair recordAspectPair, final int maxRecordsToProcess, final BufferedWriter out, - final boolean attach) - { - final List processedNodes = new ArrayList<>(); - final List children = fileFolderService.search(parentNodeRef, "*", /*filesSearch*/true, /*folderSearch*/true, /*includeSubfolders*/true); - logger.info(MESSAGE_PROCESSING_BEGIN); - // by batch size - for (int i = 0; i < children.size(); i += batchSize) - { - if (maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess) - { - break; - } - final int currentIndex = i; - - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List nodes = children.subList(currentIndex, Math.min(currentIndex + batchSize, children.size())); - // process each one - for (FileInfo node : nodes) - { - if (maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess) - { - break; - } - NodeRef record = node.getNodeRef(); - if (nodeService.hasAspect(record, recordAspectPair.getSecond())) - { - String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - logger.info(MessageFormat.format(MESSAGE_PROCESSING_RECORD_BEGIN_TEMPLATE, recordName)); - processNode(record); - logger.info(MessageFormat.format(MESSAGE_PROCESSING_RECORD_END_TEMPLATE, recordName)); - processedNodes.add(record); - if (attach) - { - out.write(recordName); - out.write(","); - out.write(record.toString()); - out.write("\n"); - } - } - } - - return null; - } - }, false, // read only - true); // requires new - } - logger.info(MESSAGE_PROCESSING_END); - return processedNodes; - } - - /** - * Process each node - * - * @param nodeRef - */ - @SuppressWarnings({ "unchecked"}) - protected void processNode(NodeRef nodeRef) - { - // get the reader/writer data - Map readers = (Map)nodeService.getProperty(nodeRef, PROP_READERS); - Map writers = (Map)nodeService.getProperty(nodeRef, PROP_WRITERS); - - // remove extended security aspect - nodeService.removeAspect(nodeRef, ASPECT_EXTENDED_SECURITY); - - // remove dynamic authority permissions - permissionService.clearPermission(nodeRef, ExtendedReaderDynamicAuthority.EXTENDED_READER); - permissionService.clearPermission(nodeRef, ExtendedWriterDynamicAuthority.EXTENDED_WRITER); - - // if record then ... - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - Set readersKeySet = null; - if (readers != null) - { - readersKeySet = readers.keySet(); - } - Set writersKeySet = null; - if (writers != null) - { - writersKeySet = writers.keySet(); - } - // re-set extended security via API - extendedSecurityService.set(nodeRef, readersKeySet, writersKeySet); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java deleted file mode 100644 index cbdfc6bcad..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.roles; - -import java.util.HashMap; -import java.util.Map; - -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; - -/** - * Webscript for removing a user or a group from a role - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmAuthoritiesDelete extends AbstractRmAuthorities -{ - /** - * @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) - { - NodeRef filePlan = getFilePlan(req); - String roleId = getRoleId(req); - String authorityName = getAuthorityName(req); - - filePlanRoleService.unassignRoleFromAuthority(filePlan, roleId, authorityName); - - return new HashMap<>(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java deleted file mode 100644 index 3633643c9f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.roles; - -import java.util.HashMap; -import java.util.Map; - -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; - -/** - * Webscript for adding a user or a group to a role - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmAuthoritiesPost extends AbstractRmAuthorities -{ - /** - * @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) - { - NodeRef filePlan = getFilePlan(req); - String roleId = getRoleId(req); - String authorityName = getAuthorityName(req); - - filePlanRoleService.assignRoleToAuthority(filePlan, roleId, authorityName); - - return new HashMap<>(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java deleted file mode 100644 index 4779e4e069..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.rule; - -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.RecordsManagementActionCondition; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.service.cmr.action.ActionConditionDefinition; -import org.alfresco.service.cmr.action.ActionService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the RM related action condition definition list. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RmActionConditionDefinitionsGet extends DeclarativeWebScript -{ - private ActionService actionService; - - private RecordsManagementActionService recordsManagementActionService; - - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @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) - { - List dmDefs = actionService.getActionConditionDefinitions(); - List conditions = recordsManagementActionService.getRecordsManagementActionConditions(); - - List defs = new ArrayList<>(dmDefs.size() + conditions.size()); - defs.addAll(dmDefs); - for (RecordsManagementActionCondition condition: conditions) - { - if (condition.isPublicCondition()) - { - defs.add(condition.getRecordsManagementActionConditionDefinition()); - } - } - - Map model = new HashMap<>(); - model.put("actionconditiondefinitions", defs); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java deleted file mode 100644 index cba3b689a8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.rule; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.action.ActionService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the RM related action definition list. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmActionDefinitionsGet extends DeclarativeWebScript -{ - private RecordsManagementActionService recordsManagementActionService; - private ActionService extendedActionService; - - private List whitelistedActions = WhitelistedDMActions.getActionsList(); - - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - public void setExtendedActionService(ActionService extendedActionService) - { - this.extendedActionService = extendedActionService; - } - - /** - * @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) - { - List rmActions = recordsManagementActionService.getRecordsManagementActions(); - List actions = extendedActionService.getActionDefinitions(); - Set defs = new HashSet<>(rmActions.size()); - for (RecordsManagementAction action : rmActions) - { - if (action.isPublicAction()) - { - defs.add(action.getRecordsManagementActionDefinition()); - } - } - // If there are any DM whitelisted actions for RM add them in the rule actions - for (ActionDefinition actionDefinition : actions) - { - if (whitelistedActions.contains(actionDefinition.getName())) - { - defs.add(actionDefinition); - } - } - - Map model = new HashMap<>(); - model.put("actiondefinitions", defs); - - return model; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/WhitelistedDMActions.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/WhitelistedDMActions.java deleted file mode 100644 index 9dd7b302e4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/WhitelistedDMActions.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.repo.web.scripts.rule; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * Whitelisted DM actions in RM - */ -public enum WhitelistedDMActions -{ - ARCHIVE("archive"), - RESTORE("restore"); - - private final String value; - - WhitelistedDMActions(String value) - { - this.value = value; - } - - public String getValue() - { - return this.value; - } - - public static List getActionsList() - { - return Stream.of(WhitelistedDMActions.values()) - .map(WhitelistedDMActions::getValue) - .collect(Collectors.toList()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/schedule/UpdateRecordScheduleGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/schedule/UpdateRecordScheduleGet.java deleted file mode 100644 index 4f4f3dec1e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/schedule/UpdateRecordScheduleGet.java +++ /dev/null @@ -1,443 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -/* - * 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.web.scripts.schedule; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.Writer; -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.FrozenAspect; -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.transaction.TransactionService; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.AbstractWebScript; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Format; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Webscript used to update records that are missing their schedule information - * - * @author Roy Wetherall - */ -public class UpdateRecordScheduleGet extends AbstractWebScript implements RecordsManagementModel -{ - /** - * logger - */ - private static Log logger = LogFactory.getLog(UpdateRecordScheduleGet.class); - - /** - * parameters - */ - private static final String PARAM_MAX_RECORD_FOLDERS = "maxRecordFolders"; - private static final String PARAM_RECORD_FOLDER = "recordFolder"; - - private static final String SUCCESS_STATUS = "success"; - private static final String MODEL_STATUS = "responsestatus"; - private static final String MODEL_MESSAGE = "message"; - private static final String MESSAGE_ALL_TEMPLATE = "Updated {0} records from {1} folders with updated disposition instructions."; - private static final String MESSAGE_FOLDER_TEMPLATE = "Updated records in folder {0} with updated disposition instructions."; - - /** - * services - */ - private NodeService nodeService; - private DispositionService dispositionService; - private RecordService recordService; - private TransactionService transactionService; - private RecordsManagementQueryDAO recordsManagementQueryDAO; - private BehaviourFilter behaviourFilter; - private NodeDAO nodeDAO; - private QNameDAO qnameDAO; - private FrozenAspect frozenAspect; - private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; - /** - * service setters - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setRecordsManagementQueryDAO(RecordsManagementQueryDAO recordsManagementQueryDAO) - { - this.recordsManagementQueryDAO = recordsManagementQueryDAO; - } - - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - public void setFrozenAspect(FrozenAspect frozenAspect) - { - this.frozenAspect = frozenAspect; - } - - public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour recordsManagementSearchBehaviour) - { - this.recordsManagementSearchBehaviour = recordsManagementSearchBehaviour; - } - - /** - * Build web script model - */ - protected Map buildModel(WebScriptRequest req, WebScriptResponse res) throws IOException - { - Map model = new HashMap<>(); - transactionService.getRetryingTransactionHelper() - .doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public String execute() throws Throwable - { - qnameDAO.getOrCreateQName(ASPECT_DISPOSITION_PROCESSED); - return null; - } - - }, false, true); - - int maxRecordFolders = getMaxRecordFolders(req); - NodeRef recordFolder = getRecordFolder(req); - - int processedRecords = 0; - String message; - if (recordFolder != null) - { - // Process the specified record folder - updateRecordFolder(recordFolder); - message = MessageFormat.format(MESSAGE_FOLDER_TEMPLATE, recordFolder); - } - else - { - int processedRecordFolders = 0; - int queryBatchSize = 10000; - Long maxNodeId = nodeDAO.getMaxNodeId(); - for (Long i = 0L; i < maxNodeId; i += queryBatchSize) - { - List folders = recordsManagementQueryDAO.getRecordFoldersWithSchedules(i, i + queryBatchSize); - for (NodeRef folder : folders) - { - processedRecords = processedRecords + updateRecordFolder(folder); - processedRecordFolders++; - - if (processedRecordFolders >= maxRecordFolders) - { - // stop processing since we have meet our limit - break; - } - } - - if (processedRecordFolders >= maxRecordFolders) - { - // stop processing since we have meet our limit - break; - } - } - message = MessageFormat.format(MESSAGE_ALL_TEMPLATE, processedRecords, processedRecordFolders); - } - - model.put(MODEL_STATUS, SUCCESS_STATUS); - model.put(MODEL_MESSAGE, message); - logger.info(message); - - return model; - } - - /* - * (non-Javadoc) - * @see org.alfresco.repo.web.scripts.content.StreamContent#execute(org.springframework.extensions.webscripts. - * WebScriptRequest, org.springframework.extensions.webscripts.WebScriptResponse) - */ - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - // retrieve requested format - String format = req.getFormat(); - - try - { - String mimetype = getContainer().getFormatRegistry() - .getMimeType(req.getAgent(), format); - if (mimetype == null) - { - throw new WebScriptException("Web Script format '" + format + "' is not registered"); - } - - // construct model for script / template - Status status = new Status(); - Cache cache = new Cache(getDescription().getRequiredCache()); - - Map model = buildModel(req, res); - - if (model == null) { return; } - model.put("status", status); - model.put("cache", cache); - - Map templateModel = createTemplateParameters(req, res, model); - - // render output - int statusCode = status.getCode(); - if (statusCode != HttpServletResponse.SC_OK && !req.forceSuccessStatus()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Force success status header in response: " + req.forceSuccessStatus()); - logger.debug("Setting status " + statusCode); - } - res.setStatus(statusCode); - } - - // apply location - String location = status.getLocation(); - if (location != null && location.length() > 0) - { - if (logger.isDebugEnabled()) - logger.debug("Setting location to " + location); - res.setHeader(WebScriptResponse.HEADER_LOCATION, location); - } - - // apply cache - res.setCache(cache); - - String callback = null; - if (getContainer().allowCallbacks()) - { - callback = req.getJSONCallback(); - } - if (format.equals(WebScriptResponse.JSON_FORMAT) && callback != null) - { - if (logger.isDebugEnabled()) - logger.debug( - "Rendering JSON callback response: content type=" + Format.JAVASCRIPT.mimetype() + ", status=" - + statusCode + ", callback=" + callback); - - // NOTE: special case for wrapping JSON results in a javascript function callback - res.setContentType(Format.JAVASCRIPT.mimetype() + ";charset=UTF-8"); - res.getWriter() - .write((callback + "(")); - } - else - { - if (logger.isDebugEnabled()) - logger.debug("Rendering response: content type=" + mimetype + ", status=" + statusCode); - - res.setContentType(mimetype + ";charset=UTF-8"); - } - - // render response according to requested format - renderFormatTemplate(format, templateModel, res.getWriter()); - - if (format.equals(WebScriptResponse.JSON_FORMAT) && callback != null) - { - // NOTE: special case for wrapping JSON results in a javascript function callback - res.getWriter() - .write(")"); - } - } - catch (Throwable e) - { - if (logger.isDebugEnabled()) - { - StringWriter stack = new StringWriter(); - e.printStackTrace(new PrintWriter(stack)); - logger.debug("Caught exception; decorating with appropriate status template : " + stack.toString()); - } - - throw createStatusException(e, req, res); - } - } - - protected void renderFormatTemplate(String format, Map model, Writer writer) - { - format = (format == null) ? "" : format; - - String templatePath = getDescription().getId() + "." + format; - - if (logger.isDebugEnabled()) - logger.debug("Rendering template '" + templatePath + "'"); - - renderTemplate(templatePath, model, writer); - } - - protected int getMaxRecordFolders(WebScriptRequest req) - { - String valueStr = req.getParameter(PARAM_MAX_RECORD_FOLDERS); - int value = Integer.MAX_VALUE; - if (StringUtils.isNotBlank(valueStr)) - { - try - { - value = Integer.parseInt(valueStr); - } - catch (NumberFormatException ex) - { - //do nothing here, the value will remain 0L in this case - } - } - return value; - } - - protected NodeRef getRecordFolder(WebScriptRequest req) - { - String valueStr = req.getParameter(PARAM_RECORD_FOLDER); - NodeRef value = null; - if (StringUtils.isNotBlank(valueStr)) - { - value = new NodeRef(valueStr); - } - - return value; - } - - private int updateRecordFolder(final NodeRef recordFolder) - { - return transactionService.getRetryingTransactionHelper() - .doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Integer execute() throws Throwable - { - int recordCount = 0; - frozenAspect.disableOnPropUpdateFrozenAspect(); - try - { - if (logger.isDebugEnabled()) - { - logger.info("Checking folder: " + recordFolder); - } - recordCount = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Integer doWork() throws Exception - { - DispositionSchedule schedule = dispositionService.getDispositionSchedule(recordFolder); - int innerRecordCount = 0; - if (schedule != null && schedule.isRecordLevelDisposition()) - { - - List records = recordService.getRecords(recordFolder); - for (NodeRef record : records) - { - if (!nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)) - { - if (recordFolder.equals(nodeService.getPrimaryParent(record).getParentRef())) - { - if (logger.isDebugEnabled()) - { - logger.info("updating record: " + record); - } - - // update record disposition information - dispositionService.updateNextDispositionAction(record, schedule); - recordsManagementSearchBehaviour.onAddDispositionLifecycleAspect(record,null); - innerRecordCount++; - } - } - } - } - return innerRecordCount; - } - }); - nodeService.addAspect(recordFolder, ASPECT_DISPOSITION_PROCESSED, null); - } - finally - { - frozenAspect.enableOnPropUpdateFrozenAspect(); - } - return recordCount; - } - }, false, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java deleted file mode 100644 index 6645fe7d43..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java +++ /dev/null @@ -1,316 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.substitutionsuggestions; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.action.parameter.ParameterProcessorComponent; -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.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get substitution suggestions - * given a text fragment (e.g. date.month for 'mon'). - * - * @author Mark Hibbins - * @since 2.2 - */ -public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript -{ - private static final String FRAGMENT_PARAMETER = "fragment"; - private static final String PATH_PARAMETER = "path"; - private static final String UNFILED_PARAMETER = "unfiled"; - private static final String UNFILED = "true"; - - private static final String SUBSTITUTIONS_MODEL_KEY = "substitutions"; - - private static final String CREATE_CAPABILITY = "Create"; - private static final String VIEW_CAPABILITY = "ViewRecords"; - - private static final int DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH = 0; - private static final int DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS = 10; - - private int pathSubstitutionMaximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS; - private int substitutionMinimumFragmentSize = DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH; - - private ParameterProcessorComponent parameterProcessorComponent; - private NodeService nodeService; - private FilePlanService filePlanService; - private CapabilityService capabilityService; - - /** - * Set the parameter processor component bean - * - * @param parameterProcessorComponent - */ - public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) - { - this.parameterProcessorComponent = parameterProcessorComponent; - } - - /** - * Set the node service - * - * @param nodeService - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param capabilityService file plan service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * Set the minimum fragment size to process for suggestion processing - * - * @param substitutionMinimumFragmentSize - */ - public void setSubstitutionMinimumFragmentSize(int substitutionMinimumFragmentSize) - { - this.substitutionMinimumFragmentSize = Math.max(substitutionMinimumFragmentSize, DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH); - } - - /** - * Set the maxmimum number of suggestions returned from the global property - * - * @param pathSubstitutionMaximumNumberSuggestions - */ - public void setPathSubstitutionMaximumNumberSuggestions(int pathSubstitutionMaximumNumberSuggestions) - { - this.pathSubstitutionMaximumNumberSuggestions = (pathSubstitutionMaximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS: pathSubstitutionMaximumNumberSuggestions); - } - - /** - * Return a list of substitutions for the given fragment. - * - * @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 fragment = req.getParameter(FRAGMENT_PARAMETER); - String path = req.getParameter(PATH_PARAMETER); - String unfiledString = req.getParameter(UNFILED_PARAMETER); - boolean unfiled = (unfiledString != null) && UNFILED.equals(unfiledString); - - List substitutionSuggestions = new ArrayList<>(); - - if((fragment != null) && (fragment.length() >= this.substitutionMinimumFragmentSize)) - { - substitutionSuggestions.addAll(getSubPathSuggestions(req, path, fragment, unfiled)); - substitutionSuggestions.addAll(this.parameterProcessorComponent.getSubstitutionSuggestions(fragment)); - } - - Map model = new HashMap<>(); - model.put(SUBSTITUTIONS_MODEL_KEY, substitutionSuggestions); - - return model; - } - - /** - * Return a list of path suggestions for the path fragment supplied. - * - * @param path - * @param fragment - * @return - */ - private List getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled) - { - List pathSuggestions = new ArrayList<>(); - if((path != null) && path.startsWith("/") && (fragment != null)) - { - String[] pathFragments = path.split("/"); - - NodeRef currentNode = getFilePlan(req, unfiled); - for(String pathFragment : pathFragments) - { - // ignore empty elements of the path produced by split - if(!pathFragment.isEmpty()) - { - boolean foundThisPathFragment = false; - List children = nodeService.getChildAssocs(currentNode); - for (ChildAssociationRef childAssoc : children) - { - NodeRef childNodeRef = childAssoc.getChildRef(); - String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); - if(fileName.equals(pathFragment) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) - { - foundThisPathFragment = true; - currentNode = childNodeRef; - break; - } - } - if(!foundThisPathFragment) - { - currentNode = null; - break; - } - } - } - - if(currentNode != null) - { - String lowerCaseFragment = fragment.toLowerCase(); - List children = nodeService.getChildAssocs(currentNode); - 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)) - { - pathSuggestions.add("/" + fileName); - if(pathSuggestions.size() >= pathSubstitutionMaximumNumberSuggestions) - { - break; - } - } - } - } - } - return pathSuggestions; - } - - /** - * Utility method to get the file plan from the passed parameters. - * - * @param req - * @return - */ - protected NodeRef getFilePlan(WebScriptRequest req, boolean unfiled) - { - NodeRef filePlan = null; - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("siteid"); - if (siteId != null) - { - filePlan = filePlanService.getFilePlanBySiteId(siteId); - } - - if (filePlan == null) - { - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String id = templateVars.get("id"); - - if (!StringUtils.isEmpty(storeType) && - !StringUtils.isEmpty(storeId) && - !StringUtils.isEmpty(id)) - { - StoreRef storeRef = new StoreRef(storeType, storeId); - NodeRef nodeRef = new NodeRef(storeRef, id); - if (filePlanService.isFilePlan(nodeRef)) - { - filePlan = nodeRef; - } - } - } - - if (filePlan == null) - { - // Assume we are in a legacy repository and we will grab the default file plan - filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - - return unfiled ? filePlanService.getUnfiledContainer(filePlan) : filePlan; - } - - /** - * Identifies record category and record folder types of nodeRef - * - * @param nodeRef Instance of NodeRef to be tested - * @return True if the passed NodeRef instance is a record category or record folder - */ - private boolean isNodeRefAppropriateForPathSuggestion(NodeRef nodeRef, boolean unfiled) - { - // check node type - QName type = nodeService.getType(nodeRef); - boolean isCorrectType = (!unfiled - && (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(type) || RecordsManagementModel.TYPE_RECORD_CATEGORY - .equals(type)) || (unfiled && RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(type))); - - // check permissions - boolean canView = false; - if(isCorrectType) - { - Capability createCapability = capabilityService.getCapability(CREATE_CAPABILITY); - Capability viewCapability = capabilityService.getCapability(VIEW_CAPABILITY); - if ((createCapability != null) && (viewCapability != null)) - { - List requiredCapabilities = new ArrayList<>(); - requiredCapabilities.add(CREATE_CAPABILITY); - requiredCapabilities.add(VIEW_CAPABILITY); - Map map = capabilityService.getCapabilitiesAccessState(nodeRef, requiredCapabilities); - if (map.containsKey(createCapability) && map.containsKey(viewCapability)) - { - AccessStatus createAccessStatus = map.get(createCapability); - AccessStatus viewAccessStatus = map.get(viewCapability); - if (createAccessStatus.equals(AccessStatus.ALLOWED) && viewAccessStatus.equals(AccessStatus.ALLOWED)) - { - canView = true; - } - } - } - } - - return isCorrectType && canView; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/RMNodes.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/RMNodes.java deleted file mode 100644 index 7f12760ac3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/RMNodes.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api; - -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.servlet.FormData; - -/** - * RM Nodes API - * - * @author Ana Bozianu - * @since 2.6 - */ -@Deprecated -public interface RMNodes extends Nodes -{ - public static String PATH_FILE_PLAN = "-filePlan-"; - public static String PATH_TRANSFERS = "-transfers-"; - public static String PATH_UNFILED = "-unfiled-"; - public static String PATH_HOLDS = "-holds-"; - - public static String PARAM_INCLUDE_HAS_RETENTION_SCHEDULE = "hasRetentionSchedule"; - public static String PARAM_INCLUDE_IS_CLOSED = "isClosed"; - public static String PARAM_INCLUDE_IS_COMPLETED = "isCompleted"; - public static String PARAM_INCLUDE_TRANSFER_PDF_INDICATOR = "transferPDFIndicator"; - public static String PARAM_INCLUDE_TRANSFER_LOCATION = "transferLocation"; - public static String PARAM_INCLUDE_TRANSFER_ACCESSION_INDICATOR = "transferAccessionIndicator"; - - /** - * Gets or creates the relative path starting from the provided parent folder. - * The method decides the type of the created elements considering the - * parent container's type and the type of the node to be created. - * @param parentFolderNodeId the parent folder to start from - * @param relativePath the relative path - * @param nodeTypeQName the type of the node to be created - * @return reference to the last element of the created path - */ - public NodeRef getOrCreatePath(String parentFolderNodeId, String relativePath, QName nodeTypeQName); - - /** - * Validates if the component with provided id and provided parameters belongs to the current endpoint. - * - * @param filePlanComponentId - file plan component id to check - * @param parameters - provided parameters - * @param requestedTypeQName - the requested type that identifies the endpoint we are in - */ - public void validateNodeType(String filePlanComponentId, Parameters parameters, QName requestedTypeQName); - - /** - * Validates if the component with provided id and provided parameters from formData belongs to the current endpoint. - * - * @param filePlanComponentId - file plan component id to check - * @param formData - provided formData - * @param requestedTypeQName - the requested type that identifies the endpoint we are in - */ - public void validateNodeType(String filePlanComponentId, FormData formData, QName requestedTypeQName); - - /** - * Validates if the component with provided id, relativePath from new created filePlanComponent and provided parameters belongs to the current endpoint. - * - * @param filePlanComponentId - file plan component id to check - * @param filePlanComponentInfo - new created file plan component info - * @param parameters - provided parameters - * @param requestedTypeQName - the requested type that identifies the endpoint we are in - */ - public void validateNodeType(String filePlanComponentId, Node filePlanComponentInfo, Parameters parameters, QName requestedTypeQName); - - /** - * Validates if the filePlanComponent with provided id is a record. - * - * @param filePlanComponentId - */ - public void validateRecord(String filePlanComponentId); - - /** - * Helper method to obtain file plan type or null if the rm site does not exist. - * - * @return file plan type or null - */ - public QName getFilePlanType(); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/RMSites.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/RMSites.java deleted file mode 100644 index 912ded1078..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/RMSites.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api; - -import org.alfresco.rest.api.Sites; -import org.alfresco.rest.api.model.SiteUpdate; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.model.RMSite; - -/** - * RM Sites API - * - * @author Silviu Dinuta - * @since 2.6 - */ -public interface RMSites extends Sites -{ - /** - * Creates RM site - * - * @param site - * @param parameters - * @return - */ - RMSite createRMSite(RMSite site, Parameters parameters); - - /** - * Gets RM site - * @param siteId - * @return - */ - RMSite getRMSite(String siteId); - - /** - * Updates RM site - * @param siteId - * @param site - * @param parameters - * @return - */ - RMSite updateRMSite(String siteId, SiteUpdate site, Parameters parameters); - - /** - * Deletes RM site - * - * @param siteId - * @param parameters - */ - void deleteRMSite(String siteId, Parameters parameters); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java deleted file mode 100644 index 45bcebd18e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanChildrenRelation.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.fileplans; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.query.PagingResults; -import org.alfresco.repo.node.getchildren.FilterProp; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.FilePlan; -import org.alfresco.rm.rest.api.model.RecordCategory; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.extensions.webscripts.servlet.FormData; - -/** - * File plan children relation - * - * @author Ramona Popa - * @since 2.6 - */ -@RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan") -public class FilePlanChildrenRelation implements RelationshipResourceAction.Read, - RelationshipResourceAction.Create, - MultiPartRelationshipResourceAction.Create, - InitializingBean -{ - /** Record category type */ - public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory"; - - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private SearchTypesFactory searchTypesFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - ParameterCheck.mandatory("apiUtils", this.apiUtils); - ParameterCheck.mandatory("fileFolderService", this.fileFolderService); - ParameterCheck.mandatory("nodesModelFactory", this.nodesModelFactory); - ParameterCheck.mandatory("searchTypesFactory", this.searchTypesFactory); - } - - @Override - @WebApiDescription(title = "Return a paged list of file plan children (record categories) for the container identified by 'filePlanId'") - public CollectionWithPagingInfo readAll(String filePlanId, Parameters parameters) - { - // validate parameters - checkNotBlank("filePlanId", filePlanId); - mandatory("parameters", parameters); - - QName filePlanType = apiUtils.getFilePlanType(); - if(filePlanType == null)// rm site not created - { - throw new EntityNotFoundException(filePlanId); - } - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType); - - // list record categories - Set searchTypeQNames = searchTypesFactory.buildSearchTypesForFilePlanEndpoint(); - - //FIXME this param null - List filterProps = apiUtils.getListChildrenFilterProps(parameters, null); - - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, - null, - searchTypeQNames, - null, - apiUtils.getSortProperties(parameters), - filterProps, - Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public RecordCategory get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createRecordCategory(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - FilePlan sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createFilePlan(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), - pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } - - @Override - @WebApiDescription(title="Create one (or more) record categories as children of container identified by 'filePlanId'") - public List create(String filePlanId, List nodeInfos, Parameters parameters) - { - checkNotBlank("filePlanId", filePlanId); - mandatory("nodeInfos", nodeInfos); - mandatory("parameters", parameters); - - QName filePlanType = apiUtils.getFilePlanType(); - if (filePlanType == null)// rm site not created - { - throw new EntityNotFoundException(filePlanId); - } - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType); - - RetryingTransactionCallback> callback = new RetryingTransactionCallback>() - { - public List execute() - { - List createdNodes = new LinkedList<>(); - for (RecordCategory nodeInfo : nodeInfos) - { - // Create the node - nodeInfo.setNodeType(RECORD_CATEGORY_TYPE); - NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters); - createdNodes.add(newNodeRef); - } - return createdNodes; - } - }; - List createdNodes = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Get the nodes info - List result = new ArrayList<>(nodeInfos.size()); - Map mapUserInfo = new HashMap<>(); - for (NodeRef newNodeRef : createdNodes) - { - FileInfo info = fileFolderService.getFileInfo(newNodeRef); - result.add(nodesModelFactory.createRecordCategory(info, parameters, mapUserInfo, false)); - } - - return result; - } - - /** - * @see org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction.Create#create(java.lang.String, org.springframework.extensions.webscripts.servlet.FormData, org.alfresco.rest.framework.resource.parameters.Parameters, org.alfresco.rest.framework.webscripts.WithResponse) - */ - @Override - public RecordCategory create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse) - { - throw new IntegrityException("Uploading records into file plan root is not allowed.", null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java deleted file mode 100644 index cf45f2190b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/FilePlanEntityResource.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.fileplans; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.FilePlan; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.springframework.beans.factory.InitializingBean; - -/** - * File plan entity resource - * - * @author Ramona Popa - * @since 2.6 - */ -@EntityResource(name = "file-plans", title = "File plans") -public class FilePlanEntityResource implements EntityResourceAction.ReadById, - EntityResourceAction.Update, - InitializingBean -{ - - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - ParameterCheck.mandatory("apiUtils", this.apiUtils); - ParameterCheck.mandatory("fileFolderService", this.fileFolderService); - ParameterCheck.mandatory("nodesModelFactory", this.nodesModelFactory); - } - - @WebApiDescription(title = "Get file plan information", description = "Get information for a file plan with id 'filePlanId'") - @WebApiParam(name = "filePlanId", title = "The file plan id") - public FilePlan readById(String filePlanId, Parameters parameters) - { - checkNotBlank("filePlanId", filePlanId); - mandatory("parameters", parameters); - - QName filePlanType = apiUtils.getFilePlanType(); - if(filePlanType == null)// rm site not created - { - throw new EntityNotFoundException(filePlanId); - } - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createFilePlan(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Update file plan", description = "Updates a filePlan with id 'filePlanId'") - public FilePlan update(String filePlanId, FilePlan filePlanInfo, Parameters parameters) - { - checkNotBlank("filePlanId", filePlanId); - mandatory("filePlanInfo", filePlanInfo); - mandatory("parameters", parameters); - - QName filePlanType = apiUtils.getFilePlanType(); - if(filePlanType == null)// rm site not created - { - throw new EntityNotFoundException(filePlanId); - } - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, filePlanType); - - RetryingTransactionCallback updateCallback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateNode(nodeRef, filePlanInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(updateCallback, false, true); - - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(nodeRef); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - return nodesModelFactory.createFilePlan(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/package-info.java deleted file mode 100644 index 98ec778e47..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/fileplans/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance File Plans REST API - * - * @author Ramona Popa - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.fileplans; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/files/FilesEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/files/FilesEntityResource.java deleted file mode 100644 index bd50b7a359..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/files/FilesEntityResource.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.files; - -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.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.framework.Operation; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.Record; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.springframework.beans.factory.InitializingBean; - -/** - * An implementation of an Entity Resource for a file - * - * @author Ana Bozianu - * @since 2.6 - */ -@EntityResource(name="files", title = "Files") -public class FilesEntityResource implements InitializingBean -{ - private ApiNodesModelFactory nodesModelFactory; - private FilePlanComponentsApiUtils apiUtils; - private AuthenticationUtil authenticationUtil; - private FilePlanService filePlanService; - private FileFolderService fileFolderService; - private RecordService recordService; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Operation("declare") - @WebApiDescription(title = "Declare as record", description="Declare a file as record.") - public Record declareAsRecord(String fileId, Void body, Parameters parameters, WithResponse withResponse) - { - // Get fileplan - NodeRef filePlan = authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - }); - - // default false (if not provided) - boolean hideRecord = Boolean.valueOf(parameters.getParameter(Record.PARAM_HIDE_RECORD)); - - // Get record folder, if provided - final NodeRef targetRecordFolder = extractAndValidateTargetRecordFolder(parameters); - - // Create the record - NodeRef file = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, fileId); - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - recordService.createRecord(filePlan, file, targetRecordFolder, !hideRecord); - if (targetRecordFolder != null) - { - recordService.file(file); - } - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Return record state - FileInfo info = fileFolderService.getFileInfo(file); - return nodesModelFactory.createRecord(info, parameters, null, false); - } - - /* Helper method to determine the target record folder, if given */ - private NodeRef extractAndValidateTargetRecordFolder(Parameters parameters) - { - // Get record folder, if provided - NodeRef targetParent = null; - final String targetParentId = parameters.getParameter(RMNode.PARAM_PARENT_ID); - if (targetParentId != null) - { - targetParent = apiUtils.lookupAndValidateNodeType(targetParentId, RecordsManagementModel.TYPE_RECORD_FOLDER); - } - return targetParent; - } - - @Override - public void afterPropertiesSet() throws Exception - { - ParameterCheck.mandatory("nodesModelFactory", nodesModelFactory); - ParameterCheck.mandatory("authenticationUtil", authenticationUtil); - ParameterCheck.mandatory("filePlanService", filePlanService); - ParameterCheck.mandatory("fileFolderService", fileFolderService); - ParameterCheck.mandatory("recordService", recordService); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/files/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/files/package-info.java deleted file mode 100644 index 8f4528e6d4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/files/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance Files REST API - * - * @author Ana Bozianu - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.files; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java deleted file mode 100644 index 30da06b969..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/ApiNodesModelFactory.java +++ /dev/null @@ -1,878 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -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.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.api.model.AssocChild; -import org.alfresco.rest.api.model.ContentInfo; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.jacksonextensions.BeanPropertiesFilter; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.model.FilePlan; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.Record; -import org.alfresco.rm.rest.api.model.RecordCategory; -import org.alfresco.rm.rest.api.model.RecordCategoryChild; -import org.alfresco.rm.rest.api.model.RecordFolder; -import org.alfresco.rm.rest.api.model.Transfer; -import org.alfresco.rm.rest.api.model.TransferChild; -import org.alfresco.rm.rest.api.model.TransferContainer; -import org.alfresco.rm.rest.api.model.UnfiledChild; -import org.alfresco.rm.rest.api.model.UnfiledContainer; -import org.alfresco.rm.rest.api.model.UnfiledContainerChild; -import org.alfresco.rm.rest.api.model.UnfiledRecordFolder; -import org.alfresco.rm.rest.api.model.UnfiledRecordFolderChild; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Utility class containing Alfresco and RM java services required by the API - * endpoints - * - * @author Ana Bozianu - * @since 2.6 - */ -public class ApiNodesModelFactory -{ - - // excluded namespaces (aspects, properties, assoc types) - public static final List EXCLUDED_NS = Arrays.asList(NamespaceService.SYSTEM_MODEL_1_0_URI); - - // excluded aspects - public static final List EXCLUDED_ASPECTS = Arrays.asList(); - - // excluded properties - public static final List EXCLUDED_PROPS = Arrays.asList( - // top-level minimal info - ContentModel.PROP_NAME, ContentModel.PROP_MODIFIER, ContentModel.PROP_MODIFIED, ContentModel.PROP_CREATOR, - ContentModel.PROP_CREATED, ContentModel.PROP_CONTENT, - // other - TBC - ContentModel.PROP_INITIAL_VERSION, ContentModel.PROP_AUTO_VERSION_PROPS, ContentModel.PROP_AUTO_VERSION); - - private NodeService nodeService; - private NamespaceService namespaceService; - private Nodes nodes; - private FilePlanComponentsApiUtils apiUtils; - private PersonService personService; - private DispositionService dispositionService; - private ServiceRegistry serviceRegistry; - - public NodeService getNodeService() - { - return nodeService; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public NamespaceService getNamespaceService() - { - return namespaceService; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - public void setNodes(Nodes nodes) - { - this.nodes = nodes; - } - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - public DispositionService getDispositionService() - { - return dispositionService; - } - - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - public void setServiceRegistry(ServiceRegistry serviceRegistry) - { - this.serviceRegistry = serviceRegistry; - } - - /** - * Helper method that sets the basic information for most of the node types. - * - * @param rmNode - * @param info - * @param propertyFilter - * @param isMinimalInfo - */ - private void mapBasicInfo(RMNode rmNode, FileInfo info, BeanPropertiesFilter propertyFilter, Map mapUserInfo, - boolean isMinimalInfo) - { - if (propertyFilter.isAllowed(RMNode.PARAM_ID)) - { - rmNode.setNodeRef(info.getNodeRef()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_PARENT_ID)) - { - rmNode.setParentId(nodeService.getPrimaryParent(info.getNodeRef()).getParentRef()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_NAME)) - { - rmNode.setName(info.getName()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_NODE_TYPE)) - { - rmNode.setNodeType(info.getType().toPrefixString(namespaceService)); - } - if (propertyFilter.isAllowed(RMNode.PARAM_MODIFIED_AT)) - { - rmNode.setModifiedAt(info.getModifiedDate()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_MODIFIED_BY_USER)) - { - if (mapUserInfo == null) - { - mapUserInfo = new HashMap<>(2); - } - UserInfo modifer = Node.lookupUserInfo((String) info.getProperties().get(ContentModel.PROP_MODIFIER), mapUserInfo, - personService); - rmNode.setModifiedByUser(modifer); - } - if (propertyFilter.isAllowed(RMNode.PARAM_CREATED_AT)) - { - rmNode.setCreatedAt(info.getCreatedDate()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_CREATED_BY_USER)) - { - if (mapUserInfo == null) - { - mapUserInfo = new HashMap<>(2); - } - UserInfo creator = Node.lookupUserInfo((String) info.getProperties().get(ContentModel.PROP_CREATOR), mapUserInfo, - personService); - rmNode.setCreatedByUser(creator); - } - if (!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_ASPECT_NAMES)) - { - rmNode.setAspectNames(mapFromNodeAspects(nodeService.getAspects(info.getNodeRef()))); - } - if (!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_PROPERTIES)) - { - rmNode.setProperties(mapFromNodeProperties(info.getProperties())); - } - } - - /** - * Helper method that sets the optional information for most of the node types. - * - * @param rmNode - * @param info - * @param includeParam - * @param isMinimalInfo - */ - private void mapOptionalInfo(RMNode rmNode, FileInfo info, List includeParam, boolean isMinimalInfo) - { - if (includeParam == null || includeParam.isEmpty()) - { - return; - } - if (includeParam.contains(RMNode.PARAM_ALLOWABLE_OPERATIONS)) - { - rmNode.setAllowableOperations(apiUtils.getAllowableOperations(info.getNodeRef(), info.getType())); - } - if (includeParam.contains(RMNode.PARAM_PATH)) - { - rmNode.setPath(nodes.lookupPathInfo(info.getNodeRef(), null)); - } - if (isMinimalInfo && includeParam.contains(RMNode.PARAM_ASPECT_NAMES)) - { - rmNode.setAspectNames(mapFromNodeAspects(nodeService.getAspects(info.getNodeRef()))); - } - if (isMinimalInfo && includeParam.contains(RMNode.PARAM_PROPERTIES)) - { - rmNode.setProperties(mapFromNodeProperties(info.getProperties())); - } - } - - /** - * Helper method that sets the information for unfiled child type. - * - * @param unfiledChild - * @param info - * @param propertyFilter - */ - private void mapUnfiledChildInfo(UnfiledChild unfiledChild, FileInfo info, BeanPropertiesFilter propertyFilter) - { - if (RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(info.getType())) - { - if (propertyFilter.isAllowed(UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER)) - { - unfiledChild.setIsUnfiledRecordFolder(true); - } - if (propertyFilter.isAllowed(UnfiledChild.PARAM_IS_RECORD)) - { - unfiledChild.setIsRecord(false); - } - } - else - { - if (propertyFilter.isAllowed(UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER)) - { - unfiledChild.setIsUnfiledRecordFolder(false); - } - if (propertyFilter.isAllowed(UnfiledChild.PARAM_IS_RECORD)) - { - unfiledChild.setIsRecord(true); - } - } - } - - /** - * Helper method that sets the information for transfer container type. - * - * @param transferContainer - * @param info - * @param propertyFilter - */ - private void mapTransferContainerInfo(TransferContainer transferContainer, FileInfo info, Map mapUserInfo, BeanPropertiesFilter propertyFilter, List includeParam, boolean isMinimalInfo) - { - if (propertyFilter.isAllowed(RMNode.PARAM_ID)) - { - transferContainer.setNodeRef(info.getNodeRef()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_PARENT_ID)) - { - transferContainer.setParentId(nodeService.getPrimaryParent(info.getNodeRef()).getParentRef()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_NAME)) - { - transferContainer.setName(info.getName()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_NODE_TYPE)) - { - transferContainer.setNodeType(info.getType().toPrefixString(namespaceService)); - } - if (propertyFilter.isAllowed(RMNode.PARAM_MODIFIED_AT)) - { - transferContainer.setModifiedAt(info.getModifiedDate()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_MODIFIED_BY_USER)) - { - if (mapUserInfo == null) - { - mapUserInfo = new HashMap<>(2); - } - UserInfo modifer = Node.lookupUserInfo((String) info.getProperties().get(ContentModel.PROP_MODIFIER), mapUserInfo, - personService); - transferContainer.setModifiedByUser(modifer); - } - if (propertyFilter.isAllowed(RMNode.PARAM_CREATED_AT)) - { - transferContainer.setCreatedAt(info.getCreatedDate()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_CREATED_BY_USER)) - { - if (mapUserInfo == null) - { - mapUserInfo = new HashMap<>(2); - } - UserInfo creator = Node.lookupUserInfo((String) info.getProperties().get(ContentModel.PROP_CREATOR), mapUserInfo, - personService); - transferContainer.setCreatedByUser(creator); - } - if (!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_ASPECT_NAMES)) - { - transferContainer.setAspectNames(mapFromNodeAspects(nodeService.getAspects(info.getNodeRef()))); - } - if (!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_PROPERTIES)) - { - transferContainer.setProperties(mapFromNodeProperties(info.getProperties())); - } - - //optional parameters - if (includeParam == null || includeParam.isEmpty()) - { - return; - } - if (includeParam.contains(RMNode.PARAM_ALLOWABLE_OPERATIONS)) - { - transferContainer.setAllowableOperations(apiUtils.getAllowableOperations(info.getNodeRef(), info.getType())); - } - if (isMinimalInfo && includeParam.contains(RMNode.PARAM_ASPECT_NAMES)) - { - transferContainer.setAspectNames(mapFromNodeAspects(nodeService.getAspects(info.getNodeRef()))); - } - if (isMinimalInfo && includeParam.contains(RMNode.PARAM_PROPERTIES)) - { - transferContainer.setProperties(mapFromNodeProperties(info.getProperties())); - } - } - - /** - * Helper method that sets the information for transfer type. - * - * @param transfer - * @param info - * @param propertyFilter - */ - private void mapTransferInfo(Transfer transfer, FileInfo info, Map mapUserInfo, BeanPropertiesFilter propertyFilter, List includeParam, boolean isMinimalInfo) - { - if (propertyFilter.isAllowed(RMNode.PARAM_ID)) - { - transfer.setNodeRef(info.getNodeRef()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_PARENT_ID)) - { - transfer.setParentId(nodeService.getPrimaryParent(info.getNodeRef()).getParentRef()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_NAME)) - { - transfer.setName(info.getName()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_NODE_TYPE)) - { - transfer.setNodeType(info.getType().toPrefixString(namespaceService)); - } - if (propertyFilter.isAllowed(RMNode.PARAM_CREATED_AT)) - { - transfer.setCreatedAt(info.getCreatedDate()); - } - if (propertyFilter.isAllowed(RMNode.PARAM_CREATED_BY_USER)) - { - if (mapUserInfo == null) - { - mapUserInfo = new HashMap<>(2); - } - UserInfo creator = Node.lookupUserInfo((String) info.getProperties().get(ContentModel.PROP_CREATOR), mapUserInfo, - personService); - transfer.setCreatedByUser(creator); - } - if (!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_ASPECT_NAMES)) - { - transfer.setAspectNames(mapFromNodeAspects(nodeService.getAspects(info.getNodeRef()))); - } - if (!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_PROPERTIES)) - { - transfer.setProperties(mapFromNodeProperties(info.getProperties())); - } - - //optional parameters - if (isMinimalInfo && includeParam == null || includeParam.isEmpty()) - { - return; - } - if (includeParam.contains(RMNode.PARAM_ALLOWABLE_OPERATIONS)) - { - transfer.setAllowableOperations(apiUtils.getAllowableOperations(info.getNodeRef(), info.getType())); - } - if (isMinimalInfo && includeParam.contains(RMNode.PARAM_ASPECT_NAMES)) - { - transfer.setAspectNames(mapFromNodeAspects(nodeService.getAspects(info.getNodeRef()))); - } - if (isMinimalInfo && includeParam.contains(RMNode.PARAM_PROPERTIES)) - { - transfer.setProperties(mapFromNodeProperties(info.getProperties())); - } - if ((!isMinimalInfo && propertyFilter.isAllowed(Transfer.PARAM_TRANSFER_ACCESSION_INDICATOR)) || (isMinimalInfo && includeParam.contains(Transfer.PARAM_TRANSFER_ACCESSION_INDICATOR))) - { - transfer.setTransferAccessionIndicator((Boolean) nodeService.getProperty(info.getNodeRef(), RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)); - } - if ((!isMinimalInfo && propertyFilter.isAllowed(Transfer.PARAM_TRANSFER_LOCATION)) || (isMinimalInfo && includeParam.contains(Transfer.PARAM_TRANSFER_LOCATION))) - { - transfer.setTransferLocation((String) nodeService.getProperty(info.getNodeRef(), RecordsManagementModel.PROP_TRANSFER_LOCATION)); - } - if ((!isMinimalInfo && propertyFilter.isAllowed(Transfer.PARAM_TRANSFER_PDF_INDICATOR)) || (isMinimalInfo && includeParam.contains(Transfer.PARAM_TRANSFER_PDF_INDICATOR))) - { - transfer.setTransferPDFIndicator((Boolean) nodeService.getProperty(info.getNodeRef(), RecordsManagementModel.PROP_TRANSFER_PDF_INDICATOR)); - } - } - - /** - * Helper method that sets the information for transfer child type. - * - * @param transferChild - * @param info - * @param propertyFilter - */ - private void mapTransferChildInfo(TransferChild transferChild, FileInfo info, List includeParam, boolean isMinimalInfo) - { - if (includeParam == null || includeParam.isEmpty()) - { - return; - } - if (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(info.getType())) - { - if (isMinimalInfo && includeParam.contains(TransferChild.PARAM_IS_RECORD_FOLDER)) - { - transferChild.setIsRecordFolder(true); - } - if (isMinimalInfo && includeParam.contains(TransferChild.PARAM_IS_RECORD)) - { - transferChild.setIsRecord(false); - } - if(isMinimalInfo && includeParam.contains(RMNode.PARAM_IS_CLOSED)) - { - transferChild.setIsClosed((Boolean) nodeService.getProperty(info.getNodeRef(), RecordsManagementModel.PROP_IS_CLOSED)); - } - } - else - { - if (isMinimalInfo && includeParam.contains(TransferChild.PARAM_IS_RECORD_FOLDER)) - { - transferChild.setIsRecordFolder(false); - } - if (isMinimalInfo && includeParam.contains(TransferChild.PARAM_IS_RECORD)) - { - transferChild.setIsRecord(true); - } - if(isMinimalInfo && includeParam.contains(RMNode.PARAM_IS_CLOSED)) - { - transferChild.setIsClosed(null); - } - } - } - - /** - * Helper method that sets the information for record category child type. - * - * @param recordCategoryChild the record category child to set the fields to - * @param info info of the record category child - * @param includeParam the requested include parameters - * @param propertyFilter - */ - private void mapRecordCategoryChildInfo(RecordCategoryChild recordCategoryChild, FileInfo info, List includeParam, BeanPropertiesFilter propertyFilter, boolean isMinimalInfo) - { - if (isMinimalInfo && (includeParam == null || includeParam.isEmpty())) - { - return; - } - if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(info.getType())) - { - if((!isMinimalInfo && propertyFilter.isAllowed(RecordCategoryChild.PARAM_IS_RECORD_FOLDER)) || (isMinimalInfo && includeParam.contains(RecordCategoryChild.PARAM_IS_RECORD_FOLDER))) - { - recordCategoryChild.setIsRecordFolder(true); - } - if((!isMinimalInfo && propertyFilter.isAllowed(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY)) || (isMinimalInfo && includeParam.contains(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY))) - { - recordCategoryChild.setIsRecordCategory(false); - } - if((!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_IS_CLOSED)) || (isMinimalInfo && includeParam.contains(RMNode.PARAM_IS_CLOSED))) - { - recordCategoryChild.setIsClosed((Boolean) nodeService.getProperty(info.getNodeRef(), RecordsManagementModel.PROP_IS_CLOSED)); - } - if (includeParam.contains(RMNode.PARAM_HAS_RETENTION_SCHEDULE)) - { - recordCategoryChild.setHasRetentionSchedule(null); - } - } - else - { - if((!isMinimalInfo && propertyFilter.isAllowed(RecordCategoryChild.PARAM_IS_RECORD_FOLDER)) || (isMinimalInfo && includeParam.contains(RecordCategoryChild.PARAM_IS_RECORD_FOLDER))) - { - recordCategoryChild.setIsRecordFolder(false); - } - if((!isMinimalInfo && propertyFilter.isAllowed(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY)) || (isMinimalInfo && includeParam.contains(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY))) - { - recordCategoryChild.setIsRecordCategory(true); - } - if (includeParam.contains(RMNode.PARAM_HAS_RETENTION_SCHEDULE)) - { - DispositionSchedule ds = dispositionService.getDispositionSchedule(info.getNodeRef()); - recordCategoryChild.setHasRetentionSchedule(ds != null); - } - if((!isMinimalInfo && propertyFilter.isAllowed(RMNode.PARAM_IS_CLOSED)) || (isMinimalInfo && includeParam.contains(RMNode.PARAM_IS_CLOSED))) - { - recordCategoryChild.setIsClosed(null); - } - } - } - - - /** - * Utility method that maps record specific fields - * - * @param record the record to set the fields to - * @param info info of the record - * @param includeParam the requested include parameters - */ - private void mapRecordInfo(Record record, FileInfo info, List includeParam) - { - if (includeParam == null || includeParam.isEmpty()) - { - return; - } - if (includeParam.contains(Record.PARAM_IS_COMPLETED)) - { - record.setIsCompleted(nodeService.hasAspect(info.getNodeRef(), RecordsManagementModel.ASPECT_DECLARED_RECORD)); - } - if(includeParam.contains(Record.PARAM_CONTENT)) - { - Serializable val = info.getProperties().get(ContentModel.PROP_CONTENT); - - if ((val != null) && (val instanceof ContentData)) { - ContentData cd = (ContentData)val; - String mimeType = cd.getMimetype(); - String mimeTypeName = serviceRegistry.getMimetypeService().getDisplaysByMimetype().get(mimeType); - ContentInfo contentInfo = new ContentInfo(mimeType, mimeTypeName, cd.getSize(), cd.getEncoding()); - record.setContent(contentInfo); - } - } - } - - /** - * Helper method that converts a set of QName aspects into a list of String aspects - * - * @param properties - */ - private List mapFromNodeAspects(Set nodeAspects) - { - return nodes.mapFromNodeAspects(nodeAspects, EXCLUDED_NS, EXCLUDED_ASPECTS); - } - - /** - * Helper method that converts a map of QName properties into a map of String properties - * - * @param properties - * @return a map of String properties - */ - private Map mapFromNodeProperties(Map properties) - { - return nodes.mapFromNodeProperties(properties, new ArrayList<>(), new HashMap<>(), EXCLUDED_NS, EXCLUDED_PROPS); - } - - /** - * Utility method that maps associations, applicable only for records - * - * @param rmNode - * @param info - * @param includeParam - */ - private void mapAssociations(RMNode rmNode, FileInfo info, List includeParam) - { - if (includeParam.contains(RMNode.PARAM_INCLUDE_ASSOCIATION)) - { - NodeRef nodeRef = info.getNodeRef(); - ChildAssociationRef parentAssocRef = nodeService.getPrimaryParent(nodeRef); - - if ((parentAssocRef == null) || (parentAssocRef.getParentRef() == null) - || (!parentAssocRef.getParentRef().equals(rmNode.getParentId()))) - { - List parentAssocRefs = nodeService.getParentAssocs(nodeRef); - for (ChildAssociationRef pAssocRef : parentAssocRefs) - { - if (pAssocRef.getParentRef().equals(rmNode.getParentId())) - { - // for now, assume same parent/child cannot appear more than once (due to unique name) - parentAssocRef = pAssocRef; - break; - } - } - } - - if (parentAssocRef != null) - { - QName assocTypeQName = parentAssocRef.getTypeQName(); - if ((assocTypeQName != null) && (!EXCLUDED_NS.contains(assocTypeQName.getNamespaceURI()))) - { - AssocChild childAssoc = new AssocChild(assocTypeQName.toPrefixString(namespaceService), parentAssocRef.isPrimary()); - - rmNode.setAssociation(childAssoc); - } - } - } - } - - /** - * Creates an object of type FilePlan - * - * @param info info of the file plan - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return FilePlan object - */ - public FilePlan createFilePlan(FileInfo info, Parameters parameters, Map mapUserInfo, boolean isMinimalInfo) - { - FilePlan filePlan = new FilePlan(); - mapBasicInfo(filePlan, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(filePlan, info, parameters.getInclude(), isMinimalInfo); - return filePlan; - } - - /** - * Creates an object of type RecordCategory - * - * @param info info of the record category - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return RecordCategory object - */ - public RecordCategory createRecordCategory(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - RecordCategory recordCategory = new RecordCategory(); - mapBasicInfo(recordCategory, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(recordCategory, info, parameters.getInclude(), isMinimalInfo); - - if (parameters.getInclude().contains(RMNode.PARAM_HAS_RETENTION_SCHEDULE)) - { - DispositionSchedule ds = dispositionService.getDispositionSchedule(info.getNodeRef()); - recordCategory.setHasRetentionSchedule(ds != null); - } - - return recordCategory; - } - - /** - * Creates an object of type RecordCategory - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return RecordCategory object - */ - public RecordFolder createRecordFolder(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - RecordFolder recordFolder = new RecordFolder(); - mapBasicInfo(recordFolder, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(recordFolder, info, parameters.getInclude(), isMinimalInfo); - - if (parameters.getInclude().contains(RMNode.PARAM_IS_CLOSED)) - { - recordFolder.setIsClosed((Boolean) nodeService.getProperty(info.getNodeRef(), RecordsManagementModel.PROP_IS_CLOSED)); - } - - return recordFolder; - } - - /** - * Creates an object of type UnfiledContainer - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledContainer object - */ - public UnfiledContainer createUnfiledContainer(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - UnfiledContainer unfiledContainer = new UnfiledContainer(); - mapBasicInfo(unfiledContainer, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(unfiledContainer, info, parameters.getInclude(), isMinimalInfo); - return unfiledContainer; - } - - /** - * Creates an object of type TransferContainer - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledContainer object - */ - public TransferContainer createTransferContainer(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - TransferContainer transferContainer = new TransferContainer(); - mapTransferContainerInfo(transferContainer, info, mapUserInfo, parameters.getFilter(), parameters.getInclude(), isMinimalInfo); - return transferContainer; - } - - /** - * Creates an object of type Transfer - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledContainer object - */ - public Transfer createTransfer(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - Transfer transfer = new Transfer(); - mapTransferInfo(transfer, info, mapUserInfo, parameters.getFilter(), parameters.getInclude(), isMinimalInfo); - return transfer; - } - - /** - * Creates an object of type TransferChild - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledContainer object - */ - public TransferChild createTransferChild(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - TransferChild transferChild = new TransferChild(); - mapBasicInfo(transferChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(transferChild, info, parameters.getInclude(), isMinimalInfo); - mapTransferChildInfo(transferChild, info, parameters.getInclude(), isMinimalInfo); - return transferChild; - } - - /** - * Creates an object of type UnfiledContainerChild - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledContainerChild object - */ - public UnfiledContainerChild createUnfiledContainerChild(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - UnfiledContainerChild unfiledContainerChild = new UnfiledContainerChild(); - mapBasicInfo(unfiledContainerChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(unfiledContainerChild, info, parameters.getInclude(), isMinimalInfo); - mapUnfiledChildInfo(unfiledContainerChild, info, parameters.getFilter()); - if (unfiledContainerChild.getIsRecord()) - { - mapAssociations(unfiledContainerChild, info, parameters.getInclude()); - } - return unfiledContainerChild; - } - - /** - * Creates an object of type UnfiledRecordFolder - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledRecordFolder object - */ - public UnfiledRecordFolder createUnfiledRecordFolder(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - UnfiledRecordFolder unfiledChild = new UnfiledRecordFolder(); - mapBasicInfo(unfiledChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(unfiledChild, info, parameters.getInclude(), isMinimalInfo); - return unfiledChild; - } - - /** - * Creates an object of type UnfiledRecordFolderChild - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return UnfiledRecordFolderChild object - */ - public UnfiledRecordFolderChild createUnfiledRecordFolderChild(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - UnfiledRecordFolderChild unfiledRecordFolderChild = new UnfiledRecordFolderChild(); - mapBasicInfo(unfiledRecordFolderChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(unfiledRecordFolderChild, info, parameters.getInclude(), isMinimalInfo); - mapUnfiledChildInfo(unfiledRecordFolderChild, info, parameters.getFilter()); - if (unfiledRecordFolderChild.getIsRecord()) - { - mapAssociations(unfiledRecordFolderChild, info, parameters.getInclude()); - } - return unfiledRecordFolderChild; - } - - /** - * Creates an object of type RecordCategoryChild - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return - */ - public RecordCategoryChild createRecordCategoryChild(FileInfo info, Parameters parameters, Map mapUserInfo, - boolean isMinimalInfo) - { - RecordCategoryChild recordCategoryChild = new RecordCategoryChild(); - mapBasicInfo(recordCategoryChild, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(recordCategoryChild, info, parameters.getInclude(), isMinimalInfo); - mapRecordCategoryChildInfo(recordCategoryChild, info, parameters.getInclude(), parameters.getFilter(), isMinimalInfo); - return recordCategoryChild; - } - - /** - * Create an object of type Record - * - * @param info - * @param parameters - * @param mapUserInfo - * @param isMinimalInfo - * @return - */ - public Record createRecord(FileInfo info, Parameters parameters, Map mapUserInfo, boolean isMinimalInfo) - { - Record record = new Record(); - mapBasicInfo(record, info, parameters.getFilter(), mapUserInfo, isMinimalInfo); - mapOptionalInfo(record, info, parameters.getInclude(), isMinimalInfo); - mapRecordInfo(record, info, parameters.getInclude()); - mapAssociations(record, info, parameters.getInclude()); - return record; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java deleted file mode 100644 index 43c7a89e34..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java +++ /dev/null @@ -1,1039 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.impl; - -import static org.alfresco.model.ContentModel.TYPE_FOLDER; -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -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.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.content.ContentLimitViolationException; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.model.filefolder.FileFolderServiceImpl.InvalidTypeException; -import org.alfresco.repo.node.getchildren.FilterProp; -import org.alfresco.repo.node.getchildren.FilterPropBoolean; -import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.tenant.TenantUtil; -import org.alfresco.rest.antlr.WhereClauseParser; -import org.alfresco.rest.api.Activities; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException; -import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; -import org.alfresco.rest.framework.core.exceptions.InsufficientStorageException; -import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; -import org.alfresco.rest.framework.core.exceptions.NotFoundException; -import org.alfresco.rest.framework.core.exceptions.RequestEntityTooLargeException; -import org.alfresco.rest.framework.resource.content.BinaryResource; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.resource.parameters.where.Query; -import org.alfresco.rest.framework.resource.parameters.where.QueryHelper; -import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker; -import org.alfresco.rm.rest.api.RMSites; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.RMSite; -import org.alfresco.rm.rest.api.model.TransferContainer; -import org.alfresco.rm.rest.api.model.UploadInfo; -import org.alfresco.service.cmr.activities.ActivityInfo; -import org.alfresco.service.cmr.activities.ActivityPoster; -import org.alfresco.service.cmr.attributes.DuplicateAttributeException; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.lock.NodeLockedException; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ContentIOException; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; -import org.alfresco.service.cmr.repository.MimetypeService; -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.security.PermissionService; -import org.alfresco.service.cmr.usage.ContentQuotaException; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Utility class that handles common api endpoint tasks - * - * @author Ana Bozianu - * @since 2.6 - */ -public class FilePlanComponentsApiUtils -{ - private static final Logger LOGGER = LoggerFactory.getLogger(SearchTypesFactory.class); - - public static final String FILE_PLAN_ALIAS = "-filePlan-"; - public static final String TRANSFERS_ALIAS = "-transfers-"; - public static final String UNFILED_ALIAS = "-unfiled-"; - public static final String HOLDS_ALIAS = "-holds-"; - public static final String RM_SITE_ID = "rm"; - public static final List CONTAINERS_FOR_CLASSIFIABLE_CHILDREN_ALIAS = Arrays.asList( - FILE_PLAN_ALIAS, UNFILED_ALIAS); - //public static String PARAM_RELATIVE_PATH = "relativePath"; - - // excluded properties - public static final List TYPES_CAN_CREATE = Arrays.asList( - RecordsManagementModel.TYPE_FILE_PLAN, - RecordsManagementModel.TYPE_RECORD_CATEGORY, - RecordsManagementModel.TYPE_RECORD_FOLDER, - RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER, - RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, - RecordsManagementModel.TYPE_HOLD_CONTAINER); - - /** RM Nodes API */ - private Nodes nodes; - private FileFolderService fileFolderService; - private FilePlanService filePlanService; - private NodeService nodeService; - private ContentService contentService; - private MimetypeService mimetypeService; - private DictionaryService dictionaryService; - private CapabilityService capabilityService; - private PermissionService permissionService; - private RecordService recordService; - private AuthenticationUtil authenticationUtil; - private ActivityPoster activityPoster; - private RMSites sites; - - public void setNodes(Nodes nodes) - { - this.nodes = nodes; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - public void setMimetypeService(MimetypeService mimetypeService) - { - this.mimetypeService = mimetypeService; - } - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - public void setActivityPoster(ActivityPoster poster) - { - this.activityPoster = poster; - } - - public void setSites(RMSites sites) - { - this.sites = sites; - } - - /** - * lookup node and validate type - * - * @param nodeId - * @param expectedNodeType - * @return - * @throws EntityNotFoundException - */ - public NodeRef lookupAndValidateNodeType(String nodeId, QName expectedNodeType) throws EntityNotFoundException - { - return lookupAndValidateNodeType(nodeId, expectedNodeType, null); - } - - /** - * lookup node by id and relative path and validate type - * - * @param nodeId - * @param expectedNodeType - * @param relativePath - * @return - * @throws EntityNotFoundException - */ - public NodeRef lookupAndValidateNodeType(String nodeId, QName expectedNodeType, String relativePath) throws EntityNotFoundException - { - return lookupAndValidateNodeType(nodeId, expectedNodeType, relativePath, false); - } - - /** - * lookup node by id and relative path and validate type - * - * @param nodeId - * @param expectedNodeType - * @param relativePath - * @return - * @throws EntityNotFoundException - */ - public NodeRef lookupAndValidateNodeType(String nodeId, QName expectedNodeType, String relativePath, boolean readOnlyRelativePath) throws EntityNotFoundException - { - ParameterCheck.mandatoryString("nodeId", nodeId); - ParameterCheck.mandatory("expectedNodeType", expectedNodeType); - - NodeRef nodeRef = lookupByPlaceholder(nodeId); - - QName nodeType = nodeService.getType(nodeRef); - if (!nodeType.equals(expectedNodeType)) - { - throw new InvalidArgumentException("The given id:'" + nodeId + "' (nodeType:" + nodeType.toString() - + ") is not valid for this endpoint. Expected nodeType is:" + expectedNodeType.toString()); - } - - if(StringUtils.isNotBlank(relativePath)) - { - nodeRef = lookupAndValidateRelativePath(nodeRef, relativePath, readOnlyRelativePath, expectedNodeType); - } - return nodeRef; - } - - /** - * look up node by id and validate node type is suitable container - * - * @param nodeId - * @return - */ - public NodeRef validateAndLookUpContainerNode(String nodeId, List allowedPlaceholders) - { - ParameterCheck.mandatoryString("nodeId", nodeId); - - NodeRef nodeRef = lookupByAllowedPlaceholders(nodeId, allowedPlaceholders); - QName nodeType = nodeService.getType(nodeRef); - if(!dictionaryService.isSubClass(nodeType, TYPE_FOLDER)) - { - throw new InvalidArgumentException("The given id:'" + nodeId + "' (nodeType:" + nodeType.toString() - + ") is not valid for this endpoint. Expected nodeType is:" + TYPE_FOLDER.toString()); - } - - return nodeRef; - } - /** - * Lookup node by placeholder from allowed placeholder list - * - * @param nodeId - * @param allowedPlaceholders - * @return NodeRef for corresponding id - */ - public NodeRef lookupByAllowedPlaceholders(String nodeId, List allowedPlaceholders) - { - NodeRef nodeRef; - if (allowedPlaceholders.contains(nodeId)) - { - nodeRef = lookupByPlaceholder(nodeId); - } - else - { - nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId); - } - return nodeRef; - } - - /** - * Lookup node by placeholder - * - * @param nodeId - * @return NodeRef for corresponding id - */ - public NodeRef lookupByPlaceholder(String nodeId) - { - NodeRef nodeRef; - if (nodeId.equals(FILE_PLAN_ALIAS)) - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan != null) - { - nodeRef = filePlan; - } - else - { - throw new EntityNotFoundException(nodeId); - } - } - else if (nodeId.equals(TRANSFERS_ALIAS)) - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan != null) - { - nodeRef = filePlanService.getTransferContainer(filePlan); - } - else - { - throw new EntityNotFoundException(nodeId); - } - } - else if (nodeId.equals(UNFILED_ALIAS)) - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan != null) - { - nodeRef = filePlanService.getUnfiledContainer(filePlan); - } - else - { - throw new EntityNotFoundException(nodeId); - } - } - else if (nodeId.equals(HOLDS_ALIAS)) - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan != null) - { - nodeRef = filePlanService.getHoldContainer(filePlan); - } - else - { - throw new EntityNotFoundException(nodeId); - } - } - else - { - nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId); - } - - return nodeRef; - } - - /** - * TODO - * @param parameters - * @return - */ - public List> getSortProperties(Parameters parameters) - { - List> sortProps = new ArrayList<>(); - sortProps.add(new Pair<>(GetChildrenCannedQuery.SORT_QNAME_NODE_TYPE, true)); - sortProps.add(new Pair<>(ContentModel.PROP_NAME, true)); - return sortProps; - } - - /** - * Write content to file - * - * @param nodeRef the node to write the content to - * @param fileName the name of the file (used for guessing the file's mimetype) - * @param stream the input stream to write - * @param guessEncoding whether to guess stream encoding - */ - public void writeContent(NodeRef nodeRef, String fileName, InputStream stream, boolean guessEncoding) - { - try - { - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - - String mimeType = mimetypeService.guessMimetype(fileName); - if ((mimeType != null) && (!mimeType.equals(MimetypeMap.MIMETYPE_BINARY))) - { - // quick/weak guess based on file extension - writer.setMimetype(mimeType); - } else - { - // stronger guess based on file stream - writer.guessMimetype(fileName); - } - - InputStream is = null; - - if (guessEncoding) - { - is = new BufferedInputStream(stream); - is.mark(1024); - writer.setEncoding(guessEncoding(is, mimeType, false)); - try - { - is.reset(); - } catch (IOException ioe) - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Failed to reset stream after trying to guess encoding: " + ioe.getMessage()); - } - } - } else - { - is = stream; - } - - writer.putContent(is); - } - catch (ContentQuotaException cqe) - { - throw new InsufficientStorageException(); - } - catch (ContentLimitViolationException clv) - { - throw new RequestEntityTooLargeException(clv.getMessage()); - } - catch (ContentIOException cioe) - { - if (cioe.getCause() instanceof NodeLockedException) - { - throw (NodeLockedException)cioe.getCause(); - } - throw cioe; - } - } - - /** - * Helper method that guesses the encoding of a stream of data - * @param in the stream to guess the encoding for - * @param mimeType the mimetype of the file - * @param close if true the stream will be closed at the end - * @return the stream encoding - */ - private String guessEncoding(InputStream in, String mimeType, boolean close) - { - String encoding = "UTF-8"; - try - { - if (in != null) - { - Charset charset = mimetypeService.getContentCharsetFinder().getCharset(in, mimeType); - encoding = charset.name(); - } - } - finally - { - try - { - if (close && (in != null)) - { - in.close(); - } - } - catch (IOException ioe) - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Failed to close stream after trying to guess encoding: " + ioe.getMessage()); - } - } - } - return encoding; - } - - /** - * Helper method that creates a relative path if it doesn't already exist - * The relative path will be build with nodes of the type specified in nodesType - * If the relative path already exists the method validates if the last element is of type nodesType - * The method does not validate the type of parentNodeRef - * - * @param parentNodeRef the first node of the path - * @param relativePath a string representing the relative path in the format "Folder1/Folder2/Folder3" - * @param nodesType the type of all the containers in the path - * @return the last element of the relative path - */ - public NodeRef lookupAndValidateRelativePath(final NodeRef parentNodeRef, String relativePath, QName nodesType) - { - return lookupAndValidateRelativePath(parentNodeRef, relativePath, false, nodesType); - } - - /** - * Helper method that creates a relative path if it doesn't already exist and if relative path is not read only. - * If relative path is read only an exception will be thrown if the provided relative path does not exist. - * The relative path will be build with nodes of the type specified in nodesType - * If the relative path already exists the method validates if the last element is of type nodesType - * The method does not validate the type of parentNodeRef - * - * @param parentNodeRef the first node of the path - * @param relativePath a string representing the relative path in the format "Folder1/Folder2/Folder3" - * @param readOnlyRelativePath the flag that indicates if the relativePath should be created if doesn't exist or not - * @param nodesType the type of all the containers in the path - * @return the last element of the relative path - */ - public NodeRef lookupAndValidateRelativePath(final NodeRef parentNodeRef, String relativePath, boolean readOnlyRelativePath, QName nodesType) - { - mandatory("parentNodeRef", parentNodeRef); - mandatory("nodesType", nodesType); - if (StringUtils.isBlank(relativePath)) - { - return parentNodeRef; - } - List pathElements = getPathElements(relativePath); - if (pathElements.isEmpty()) - { - return parentNodeRef; - } - - /* - * Get the latest existing path element - */ - NodeRef lastNodeRef = parentNodeRef; - int i = 0; - for (; i < pathElements.size(); i++) - { - final String pathElement = pathElements.get(i); - final NodeRef contextParentNodeRef = lastNodeRef; - // Navigation should not check permissions - NodeRef child = authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() throws Exception - { - return nodeService.getChildByName(contextParentNodeRef, ContentModel.ASSOC_CONTAINS, pathElement); - } - }); - - if(child == null) - { - break; - } - lastNodeRef = child; - } - if(i == pathElements.size()) - { - QName nodeType = nodeService.getType(lastNodeRef); - if(!nodeType.equals(nodesType)) - { - throw new InvalidArgumentException("The given id:'"+ parentNodeRef.getId() +"' and the relative path '"+ relativePath + "' reach a node type invalid for this endpoint." - + " Expected nodeType is:" + nodesType.toString() + ". Actual nodeType is:" + nodeType); - } - return lastNodeRef; - } - else - { - if(!readOnlyRelativePath) - { - pathElements = pathElements.subList(i, pathElements.size()); - } - else - { - throw new NotFoundException("The entity with relativePath: " + relativePath + " was not found."); - } - } - - /* - * Starting from the latest existing element create the rest of the elements - */ - if(nodesType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER)) - { - for (String pathElement : pathElements) - { - lastNodeRef = fileFolderService.create(lastNodeRef, pathElement, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); - } - } - else if(nodesType.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY)) - { - for (String pathElement : pathElements) - { - lastNodeRef = filePlanService.createRecordCategory(lastNodeRef, pathElement); - } - } - else - { - // Throw internal error as this method should not be called for other types - throw new InvalidArgumentException("Creating relative path of type '" + nodesType + "' not suported for this endpoint"); - } - - return lastNodeRef; - } - - /** - * Helper method that parses a string representing a file path and returns a list of element names - * @param path the file path represented as a string - * @return a list of file path element names - */ - private List getPathElements(String path) - { - final List pathElements = new ArrayList<>(); - if (path != null && path.trim().length() > 0) - { - // There is no need to check for leading and trailing "/" - final StringTokenizer tokenizer = new StringTokenizer(path, "/"); - while (tokenizer.hasMoreTokens()) - { - pathElements.add(tokenizer.nextToken().trim()); - } - } - return pathElements; - } - /** - * Helper method that converts a map of String properties into a map of QName properties - * @param properties - * @return a map of properties - */ - public Map mapToNodeProperties(Map properties) - { - Map response = null; - if(properties != null) - { - response = nodes.mapToNodeProperties(properties); - } - return response; - } - - /** - * Create an RM node - * - * @param parentNodeRef the parent of the node - * @param nodeInfo the node infos to create - * @param parameters the object to get the parameters passed into the request - * @return the new node - */ - public NodeRef createRMNode(NodeRef parentNodeRef, RMNode nodeInfo, Parameters parameters) - { - mandatory("parentNodeRef", parentNodeRef); - mandatory("nodeInfo", nodeInfo); - mandatory("parameters", parameters); - - String nodeName = nodeInfo.getName(); - String nodeType = nodeInfo.getNodeType(); - checkNotBlank(RMNode.PARAM_NAME, nodeName); - checkNotBlank(RMNode.PARAM_NODE_TYPE, nodeType); - - // Create the node - NodeRef newNodeRef = null; - boolean autoRename = Boolean.valueOf(parameters.getParameter(RMNode.PARAM_AUTO_RENAME)); - - try - { - QName typeQName = nodes.createQName(nodeType); - - // Existing file/folder name handling - if (autoRename) - { - NodeRef existingNode = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, nodeName); - if (existingNode != null) - { - // File already exists, find a unique name - nodeName = findUniqueName(parentNodeRef, nodeName); - } - } - newNodeRef = fileFolderService.create(parentNodeRef, nodeName, typeQName).getNodeRef(); - - // Set the provided properties if any - Map qnameProperties = mapToNodeProperties(nodeInfo.getProperties()); - if (qnameProperties != null) - { - nodeService.addProperties(newNodeRef, qnameProperties); - } - - // If electronic record create empty content - if (!typeQName.equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT) - && dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT)) - { - writeContent(newNodeRef, nodeName, new ByteArrayInputStream("".getBytes()), false); - } - - // Add the provided aspects if any - List aspectNames = nodeInfo.getAspectNames(); - if (aspectNames != null) - { - nodes.addCustomAspects(newNodeRef, aspectNames, ApiNodesModelFactory.EXCLUDED_ASPECTS); - } - } - catch (InvalidTypeException ex) - { - throw new InvalidArgumentException("The given type:'" + nodeType + "' is invalid '"); - } - catch(DuplicateAttributeException ex) - { - // This exception can occur when setting a custom identifier that already exists - throw new IntegrityException(ex.getMessage(), null); - } - - return newNodeRef; - } - - /** - * Upload a record - * - * @param parentNodeRef the parent of the record - * @param uploadInfo the infos of the uploaded record - * @param parameters the object to get the parameters passed into the request - * @return the new record - */ - public NodeRef uploadRecord(NodeRef parentNodeRef, UploadInfo uploadInfo, Parameters parameters) - { - mandatory("parentNodeRef", parentNodeRef); - mandatory("uploadInfo", uploadInfo); - mandatory("parameters", parameters); - - String nodeName = uploadInfo.getFileName(); - String nodeType = uploadInfo.getNodeType(); - InputStream stream = uploadInfo.getContent().getInputStream(); - mandatory("stream", stream); - checkNotBlank(RMNode.PARAM_NAME, nodeName); - - // Create the node - QName typeQName = StringUtils.isBlank(nodeType) ? ContentModel.TYPE_CONTENT : nodes.createQName(nodeType); - if (!dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT)) - { - throw new InvalidArgumentException("Can only upload type of cm:content: " + typeQName); - } - - // Existing file/folder name handling - boolean autoRename = Boolean.valueOf(parameters.getParameter(RMNode.PARAM_AUTO_RENAME)); - if (autoRename) - { - NodeRef existingNode = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, nodeName); - if (existingNode != null) - { - // File already exists, find a unique name - nodeName = findUniqueName(parentNodeRef, nodeName); - } - } - - NodeRef newNodeRef = fileFolderService.create(parentNodeRef, nodeName, typeQName).getNodeRef(); - - // Write content - writeContent(newNodeRef, nodeName, stream, true); - - // Set the provided properties if any - Map qnameProperties = mapToNodeProperties(uploadInfo.getProperties()); - if (qnameProperties != null) - { - nodeService.addProperties(newNodeRef, qnameProperties); - } - - return newNodeRef; - } - - /** - * Returns a List of filter properties specified by request parameters. - * @param parameters The {@link Parameters} object to get the parameters passed into the request - * including: - * - filter, sort & paging params (where, orderBy, skipCount, maxItems) - * @return The list of {@link FilterProp}. Can be null. - */ - public List getListChildrenFilterProps(Parameters parameters, Set listFolderChildrenEqualsQueryProperties) - { - - List filterProps = null; - Query q = parameters.getQuery(); - if (q != null) - { - MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(listFolderChildrenEqualsQueryProperties, null); - QueryHelper.walk(q, propertyWalker); - - Boolean isPrimary = propertyWalker.getProperty(RMNode.PARAM_ISPRIMARY, WhereClauseParser.EQUALS, Boolean.class); - - if (isPrimary != null) - { - filterProps = new ArrayList<>(1); - filterProps.add(new FilterPropBoolean(GetChildrenCannedQuery.FILTER_QNAME_NODE_IS_PRIMARY, isPrimary)); - } - Boolean isClosed = propertyWalker.getProperty(RMNode.PARAM_IS_CLOSED, WhereClauseParser.EQUALS, Boolean.class); - if (isClosed != null) - { - filterProps = new ArrayList<>(1); - filterProps.add(new FilterPropBoolean(RecordsManagementModel.PROP_IS_CLOSED, isClosed)); - } - //TODO see how we can filter for categories that have retention schedule -// Boolean hasRetentionSchedule = propertyWalker.getProperty(RMNode.PARAM_HAS_RETENTION_SCHEDULE, WhereClauseParser.EQUALS, Boolean.class); -// if (hasRetentionSchedule != null) -// { -// filterProps = new ArrayList<>(1); -// } - } - return filterProps; - } - - /** - * Utility method that updates a node's name and properties - * @param nodeRef the node to update - * @param updateInfo information to update the record with - * @param parameters request parameters - */ - public void updateNode(NodeRef nodeRef, RMNode updateInfo, Parameters parameters) - { - Map props = new HashMap<>(0); - - if (updateInfo.getProperties() != null) - { - props = mapToNodeProperties(updateInfo.getProperties()); - } - - String name = updateInfo.getName(); - if ((name != null) && (!name.isEmpty())) - { - // update node name if needed - props.put(ContentModel.PROP_NAME, name); - } - - try - { - // update node properties - note: null will unset the specified property - nodeService.addProperties(nodeRef, props); - } - catch (DuplicateChildNodeNameException dcne) - { - throw new ConstraintViolatedException(dcne.getMessage()); - } - - // update aspects - List aspectNames = updateInfo.getAspectNames(); - nodes.updateCustomAspects(nodeRef, aspectNames, ApiNodesModelFactory.EXCLUDED_ASPECTS); - } - - /** - * Validates a record - * - * @param recordId the id of the record to validate - * @return - */ - public NodeRef validateRecord(String recordId) throws InvalidArgumentException - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, recordId); - if(!recordService.isRecord(nodeRef)) - { - throw new IllegalArgumentException("The given id:'"+ recordId +"' is not valid for this endpoint. This endpoint only supports records."); - } - return nodeRef; - } - - public BinaryResource getContent(NodeRef nodeRef, Parameters parameters, boolean recordActivity) - { - return nodes.getContent(nodeRef, parameters, recordActivity); - } - - /** - * Utility method that updates a transfer container's name and properties - * - * @param nodeRef the node to update - * @param transferContainerInfo information to update the transfer container with - * @param parameters request parameters - */ - public void updateTransferContainer(NodeRef nodeRef, TransferContainer transferContainerInfo, Parameters parameters) - { - Map props = new HashMap<>(0); - - if (transferContainerInfo.getProperties() != null) - { - props = mapToNodeProperties(transferContainerInfo.getProperties()); - } - - String name = transferContainerInfo.getName(); - if ((name != null) && (!name.isEmpty())) - { - // update node name if needed - props.put(ContentModel.PROP_NAME, name); - } - - try - { - // update node properties - note: null will unset the specified property - nodeService.addProperties(nodeRef, props); - } - catch (DuplicateChildNodeNameException dcne) - { - throw new ConstraintViolatedException(dcne.getMessage()); - } - } - - /** - * Helper method that generates allowable operation for the provided node - * @param nodeRef the node to get the allowable operations for - * @param typeQName the type of the provided nodeRef - * @return a sublist of [{@link Nodes#OP_DELETE}, {@link Nodes#OP_CREATE}, {@link Nodes#OP_UPDATE}] representing - * the allowable operations for the provided node - */ - protected List getAllowableOperations(NodeRef nodeRef, QName typeQName) - { - List allowableOperations = new ArrayList<>(); - - boolean isFilePlan = typeQName.equals(RecordsManagementModel.TYPE_FILE_PLAN); - boolean isTransferContainer = typeQName.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER); - boolean isUnfiledContainer = typeQName.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - boolean isHoldsContainer = typeQName.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER); - boolean isSpecialContainer = isFilePlan || isTransferContainer || isUnfiledContainer || isHoldsContainer; - - // DELETE - if(!isSpecialContainer && - capabilityService.getCapability("Delete").evaluate(nodeRef) == AccessDecisionVoter.ACCESS_GRANTED) - { - allowableOperations.add(Nodes.OP_DELETE); - } - - // CREATE - if(TYPES_CAN_CREATE.contains(typeQName) && - capabilityService.getCapability("FillingPermissionOnly").evaluate(nodeRef) == AccessDecisionVoter.ACCESS_GRANTED) - { - allowableOperations.add(Nodes.OP_CREATE); - } - - // UPDATE - if (capabilityService.getCapability("Update").evaluate(nodeRef) == AccessDecisionVoter.ACCESS_GRANTED) - { - allowableOperations.add(Nodes.OP_UPDATE); - } - - return allowableOperations; - } - - /** - * Helper method to obtain file plan type or null if the rm site does not exist. - * - * @return file plan type or null - */ - public QName getFilePlanType() - { - NodeRef filePlanNodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if(filePlanNodeRef != null) - { - return nodeService.getType(filePlanNodeRef); - } - return null; - } - /** - * Posts activities for given fileInfo - * - * @param fileInfo - * @param parentNodeRef - * @param activityType - */ - public void postActivity(FileInfo fileInfo, NodeRef parentNodeRef, String activityType) - { - ActivityInfo activityInfo = null; - RMSite rmSite = sites.getRMSite(RM_SITE_ID); - if (rmSite != null && !rmSite.getId().equals("")) - { - if (fileInfo != null) - { - boolean isContent = dictionaryService.isSubClass(fileInfo.getType(), ContentModel.TYPE_CONTENT); - - if (isContent) - { - activityInfo = new ActivityInfo(null, parentNodeRef, RM_SITE_ID, fileInfo); - } - } - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Non-site activity, so ignored " + fileInfo.getNodeRef()); - } - } - - if (activityInfo == null) - return; // Nothing to do. - - if (activityType != null) - { - activityPoster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(), activityInfo.getSiteId(), - activityInfo.getParentNodeRef(), activityInfo.getNodeRef(), activityInfo.getFileName(), Activities.APP_TOOL, - Activities.RESTAPI_CLIENT, activityInfo.getFileInfo()); - } - } - /** - * Creates a unique file name, if the upload component was configured to - * find a new unique name for clashing filenames. - * - * @param parentNodeRef the parent node - * @param fileName the original fileName - * @return a new file name - */ - private String findUniqueName(NodeRef parentNodeRef, String fileName) - { - int counter = 1; - String tmpFilename; - NodeRef existingFile; - do - { - int dotIndex = fileName.lastIndexOf('.'); - if (dotIndex == 0) - { - // File didn't have a proper 'name' instead it - // had just a suffix and started with a ".", create "1.txt" - tmpFilename = counter + fileName; - } - else if (dotIndex > 0) - { - // Filename contained ".", create "fileName-1.txt" - tmpFilename = fileName.substring(0, dotIndex) + "-" + counter + fileName.substring(dotIndex); - } - else - { - // Filename didn't contain a dot at all, create "fileName-1" - tmpFilename = fileName + "-" + counter; - } - existingFile = nodeService.getChildByName(parentNodeRef, ContentModel.ASSOC_CONTAINS, tmpFilename); - counter++; - - } while (existingFile != null); - - return tmpFilename; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/RMSitesImpl.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/RMSitesImpl.java deleted file mode 100644 index fd74ecff0a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/RMSitesImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.impl; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.rest.api.impl.SitesImpl; -import org.alfresco.rest.api.model.Site; -import org.alfresco.rest.api.model.SiteUpdate; -import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.RMSites; -import org.alfresco.rm.rest.api.model.RMSite; -import org.alfresco.rm.rest.api.model.RMSiteCompliance; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.QName; - -/** - * Centralizes access to site services. - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class RMSitesImpl extends SitesImpl implements RMSites -{ - private static final String RM_SITE_PRESET = "rm-site-dashboard"; - private static final String RM_SITE_ID = "rm"; - private static final int SITE_MAXLEN_TITLE = 256; - private static final int SITE_MAXLEN_DESCRIPTION = 512; - - @Override - public RMSite createRMSite(RMSite rmSite, Parameters parameters) - { - RMSiteCompliance compliance = rmSite.getCompliance(); - if (compliance == null) - { - compliance = RMSiteCompliance.STANDARD; - } - Site site = createSite(rmSite, parameters); - return new RMSite(site, compliance); - } - - @Override - protected SiteInfo createSite(Site site) - { - return siteService.createSite(RM_SITE_PRESET, RM_SITE_ID, site.getTitle(), site.getDescription(), SiteVisibility.PUBLIC, getRMSiteType((RMSite) site)); - } - - /** - * Even if the method it will be protected in core, we still need to override since we don't need to check if the visibility is set since for RM site it is always PUBLIC. - * We also don't need to generate the id from title, or to check the id, since the id is always rm. - * @param site - * @return - */ - @Override - protected Site validateSite(Site site) - { - // site title - mandatory - String siteTitle = site.getTitle(); - if ((siteTitle == null) || siteTitle.isEmpty()) - { - throw new InvalidArgumentException("Site title is expected: "+siteTitle); - } - else if (siteTitle.length() > SITE_MAXLEN_TITLE) - { - throw new InvalidArgumentException("Site title exceeds max length of "+SITE_MAXLEN_TITLE+" characters"); - } - - String siteDescription = site.getDescription(); - - if (siteDescription == null) - { - // workaround: to avoid Share error (eg. in My Sites dashlet / freemarker template) - site.setDescription(""); - } - - if ((siteDescription != null) && (siteDescription.length() > SITE_MAXLEN_DESCRIPTION)) - { - throw new InvalidArgumentException("Site description exceeds max length of "+SITE_MAXLEN_DESCRIPTION+" characters"); - } - - return site; - } - - /** - * Updates the RM site - */ - public RMSite updateRMSite(String siteId, SiteUpdate update, Parameters parameters) - { - Site updatedSite = updateSite(siteId, update, parameters); - SiteInfo siteInfo = siteService.getSite(siteId); - RMSiteCompliance compliance = getCompliance(siteInfo); - return new RMSite(updatedSite, compliance); - } - - /** - * Obtain compliance from site info - * - * @param siteInfo - * @return - */ - private RMSiteCompliance getCompliance(SiteInfo siteInfo) - { - NodeRef nodeRef = siteInfo.getNodeRef(); - QName siteType = nodeService.getType(nodeRef); - RMSiteCompliance compliance; - if (RecordsManagementModel.TYPE_RM_SITE.equals(siteType)) - { - compliance = RMSiteCompliance.STANDARD; - } - else - { - compliance = RMSiteCompliance.DOD5015; - } - return compliance; - } - - /** - * Gets RM site type based on compliance. - * - * @param rmSite - * @return - */ - private QName getRMSiteType(RMSite rmSite) - { - RMSiteCompliance compliance = rmSite.getCompliance(); - if (compliance == null || compliance.equals(RMSiteCompliance.STANDARD)) - { - return RecordsManagementModel.TYPE_RM_SITE; - } - else - { - return DOD5015Model.TYPE_DOD_5015_SITE; - } - } - - @Override - public RMSite getRMSite(String siteId) - { - Site site = getSite(siteId); - SiteInfo siteInfo = siteService.getSite(siteId); - RMSiteCompliance compliance = getCompliance(siteInfo); - return new RMSite(site, compliance); - } - - @Override - public void deleteRMSite(String siteId, Parameters parameters) - { - deleteSite(siteId, parameters); - solveRMSiteNodeRefCaching(); - } - - /** - * Method used for solving rm site nodeRef caching problem that affected rm site update and get from rest api, after site deletion from rest api. - * See RM-4289 issue for details. - * - */ - private void solveRMSiteNodeRefCaching() - { - //since we do not have access to SiteServiceImpl.getSiteNodeRef(String shortName, boolean enforcePermissions) method we can use hasSite method to solve caching problem - siteService.hasSite(RM_SITE_ID); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java deleted file mode 100644 index 8e0de07295..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/SearchTypesFactory.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.impl; - -import java.security.InvalidParameterException; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.rest.antlr.WhereClauseParser; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.resource.parameters.where.Query; -import org.alfresco.rest.framework.resource.parameters.where.QueryHelper; -import org.alfresco.rest.workflow.api.impl.MapBasedQueryWalker; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.RecordCategoryChild; -import org.alfresco.rm.rest.api.model.UnfiledChild; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; - -/** - * Utility class that handles common api endpoint tasks - * - * @author Ana Bozianu - * @since 2.6 - */ -public class SearchTypesFactory -{ - private DictionaryService dictionaryService; - private Nodes nodes; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setNodes(Nodes nodes) - { - this.nodes = nodes; - } - - public Set buildSearchTypesForFilePlanEndpoint() - { - Set searchTypeQNames = new HashSet<>(); - searchTypeQNames.add(RecordsManagementModel.TYPE_RECORD_CATEGORY); - return searchTypeQNames; - } - - /** - * Helper method to build search types for unfiled container and unfiled record folders endpoints - * @param parameters - * @param listFolderChildrenEqualsQueryProperties - * @return - */ - public Set buildSearchTypesForUnfiledEndpoint(Parameters parameters, Set listFolderChildrenEqualsQueryProperties) - { - Set searchTypeQNames = new HashSet<>(); - - Query q = parameters.getQuery(); - - boolean includeUnfiledRecordFolders = false; - boolean includeRecords = false; - boolean includeSubTypes = false; - - if (q != null) - { - // filtering via "where" clause - MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(listFolderChildrenEqualsQueryProperties, null); - QueryHelper.walk(q, propertyWalker); - - Boolean isUnfiledRecordFolder = propertyWalker.getProperty(UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER, - WhereClauseParser.EQUALS, Boolean.class); - Boolean isRecord = propertyWalker.getProperty(UnfiledChild.PARAM_IS_RECORD, WhereClauseParser.EQUALS, Boolean.class); - if ((isUnfiledRecordFolder != null && isUnfiledRecordFolder.booleanValue()) || (isRecord != null && !isRecord.booleanValue())) - { - includeUnfiledRecordFolders = true; - } - else if ((isUnfiledRecordFolder != null && !isUnfiledRecordFolder.booleanValue()) || (isRecord != null && isRecord.booleanValue())) - { - includeRecords = true; - } - - String nodeTypeQNameStr = propertyWalker.getProperty(UnfiledChild.PARAM_NODE_TYPE, WhereClauseParser.EQUALS, String.class); - QName filterNodeTypeQName; - if (nodeTypeQNameStr != null) - { - if ((isUnfiledRecordFolder != null) || (isRecord != null)) - { - throw new InvalidArgumentException("Invalid filter - nodeType and isUnfiledRecordFolder/isRecord are mutually exclusive"); - } - - Pair pair = parseNodeTypeFilter(nodeTypeQNameStr); - filterNodeTypeQName = pair.getFirst(); - includeSubTypes = pair.getSecond(); - - if (filterNodeTypeQName.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER)) - { - includeUnfiledRecordFolders = true; - } - else if (filterNodeTypeQName.equals(ContentModel.TYPE_CONTENT)) - { - includeRecords = true; - } - else if (dictionaryService.isSubClass(filterNodeTypeQName, ContentModel.TYPE_CONTENT)) - { - searchTypeQNames.add(filterNodeTypeQName); - if (includeSubTypes) - { - Collection qnames = dictionaryService.getSubTypes(filterNodeTypeQName, true); - searchTypeQNames.addAll(qnames); - } - } - else - { - throw new InvalidParameterException("Filter nodeType: " + nodeTypeQNameStr + " is invalid for this endpoint"); - } - } - } - else - { - includeRecords = true; - includeUnfiledRecordFolders = true; - includeSubTypes = true; - } - - if (includeUnfiledRecordFolders) - { - searchTypeQNames.add(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - } - if (includeRecords) - { - - if (includeSubTypes) - { - Collection qnames = dictionaryService.getSubTypes(ContentModel.TYPE_CONTENT, true); - searchTypeQNames.addAll(qnames); - } - else - { - searchTypeQNames.add(ContentModel.TYPE_CONTENT); - searchTypeQNames.add(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT); - } - } - return searchTypeQNames; - } - - /** - * Helper method to build search types for categories endpoint - * @param parameters - * @param listRecordCategoryChildrenEqualsQueryProperties - * @return - */ - public Set buildSearchTypesCategoriesEndpoint(Parameters parameters, Set listRecordCategoryChildrenEqualsQueryProperties) - { - Set searchTypeQNames = new HashSet<>(); - - Query q = parameters.getQuery(); - - boolean includeRecordFolders = false; - boolean includeRecordCategories = false; - - if (q != null) - { - // filtering via "where" clause - MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(listRecordCategoryChildrenEqualsQueryProperties, null); - QueryHelper.walk(q, propertyWalker); - - Boolean isRecordFolder = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_FOLDER, - WhereClauseParser.EQUALS, Boolean.class); - Boolean isRecordCategory = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, WhereClauseParser.EQUALS, Boolean.class); - - if ((isRecordFolder != null && isRecordFolder.booleanValue()) || (isRecordCategory != null && !isRecordCategory.booleanValue())) - { - includeRecordFolders = true; - } - else if ((isRecordFolder != null && !isRecordFolder.booleanValue()) || (isRecordCategory != null && isRecordCategory.booleanValue())) - { - includeRecordCategories = true; - } - - String nodeTypeQNameStr = propertyWalker.getProperty(RecordCategoryChild.PARAM_NODE_TYPE, WhereClauseParser.EQUALS, String.class); - QName filterNodeTypeQName; - if (nodeTypeQNameStr != null) - { - if ((isRecordFolder != null) || (isRecordCategory != null)) - { - throw new InvalidArgumentException("Invalid filter - nodeType and isRecordFolder/isRecordCategory are mutually exclusive"); - } - - Pair pair = parseNodeTypeFilter(nodeTypeQNameStr); - filterNodeTypeQName = pair.getFirst(); - if (filterNodeTypeQName.equals(RecordsManagementModel.TYPE_RECORD_FOLDER)) - { - includeRecordFolders = true; - - } - else if (filterNodeTypeQName.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY)) - { - includeRecordCategories = true; - } - else - { - throw new InvalidParameterException("Filter nodeType: " + nodeTypeQNameStr + " is invalid for this endpoint"); - } - } - } - else - { - includeRecordCategories = true; - includeRecordFolders = true; - } - - if (includeRecordFolders) - { - searchTypeQNames.add(RecordsManagementModel.TYPE_RECORD_FOLDER); - } - if (includeRecordCategories) - { - searchTypeQNames.add(RecordsManagementModel.TYPE_RECORD_CATEGORY); - } - return searchTypeQNames; - } - - /** - * Helper method to build search types for transfer containers endpoint - * @return - */ - public Set buildSearchTypesForTransferContainersEndpoint() - { - Set searchTypeQNames = new HashSet<>(); - searchTypeQNames.add(RecordsManagementModel.TYPE_TRANSFER); - return searchTypeQNames; - } - - /** - * Helper method to parse the nodeType filter - * default nodeType filtering is without subTypes (unless nodeType value is suffixed with ' INCLUDESUBTYPES') - * @param nodeTypeStr - * @return - */ - private Pair parseNodeTypeFilter(String nodeTypeStr) - { - boolean filterIncludeSubTypes = false; - - int idx = nodeTypeStr.lastIndexOf(' '); - if (idx > 0) - { - String suffix = nodeTypeStr.substring(idx); - if (suffix.equalsIgnoreCase(" " + RMNode.PARAM_INCLUDE_SUBTYPES)) - { - filterIncludeSubTypes = true; - nodeTypeStr = nodeTypeStr.substring(0, idx); - } - } - - QName filterNodeTypeQName = nodes.createQName(nodeTypeStr); - if (dictionaryService.getType(filterNodeTypeQName) == null) - { - throw new InvalidParameterException("Filter nodeType: " + nodeTypeStr + " is invalid"); - } - - return new Pair<>(filterNodeTypeQName, filterIncludeSubTypes); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/FilePlan.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/FilePlan.java deleted file mode 100644 index c2159e1856..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/FilePlan.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Concrete class carrying general information for an unfiled container - * - * @author Ana Bozianu - * @since 2.6 - */ -public class FilePlan extends RMNode -{ - public FilePlan() - { - super(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java deleted file mode 100644 index 9b8f4c5391..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMNode.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.api.model.Assoc; -import org.alfresco.rest.api.model.PathInfo; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.resource.UniqueId; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Abstract base class carrying general information for an RM node - * - * @author Ana Bozianu - * @since 2.6 - */ -public abstract class RMNode -{ - public static final String PARAM_ID = "id"; - public static final String PARAM_PARENT_ID = "parentId"; - public static final String PARAM_NAME = "name"; - public static final String PARAM_NODE_TYPE = "nodeType"; - public static final String PARAM_CREATED_AT = "createdAt"; - public static final String PARAM_MODIFIED_AT = "modifiedAt"; - public static final String PARAM_CREATED_BY_USER = "createdByUser"; - public static final String PARAM_MODIFIED_BY_USER = "modifiedByUser"; - - public static final String PARAM_ASPECT_NAMES = "aspectNames"; - public static final String PARAM_PROPERTIES = "properties"; - public static final String PARAM_PATH = "path"; - public static final String PARAM_ALLOWABLE_OPERATIONS = "allowableOperations"; - public static final String PARAM_AUTO_RENAME = "autoRename"; - - public static final String PARAM_ISPRIMARY = "isPrimary"; - - public static final String PARAM_INCLUDE_SUBTYPES = "INCLUDESUBTYPES"; - - public static final String PARAM_HAS_RETENTION_SCHEDULE = "hasRetentionSchedule"; - public static final String PARAM_IS_CLOSED = "isClosed"; - public static final String PARAM_INCLUDE_ASSOCIATION = "association"; - - public static final String FILE_PLAN_TYPE = "rma:filePlan"; - public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory"; - public static final String RECORD_FOLDER_TYPE = "rma:recordFolder"; - public static final String RECORD_TYPE = "rma:record"; // generic record type - public static final String UNFILED_RECORD_FOLDER_TYPE = "rma:unfiledRecordFolder"; - public static final String TRANSFER_TYPE = "rma:transfer"; - public static final String TRANSFER_CONTAINER_TYPE = "rma:transferContainer"; - public static final String UNFILED_CONTAINER_TYPE = "rma:unfiledRecordContainer"; - public static final String FOLDER_TYPE = "cm:folder"; - public static final String CONTENT_TYPE = "cm:content"; - public static final String NON_ELECTRONIC_RECORD_TYPE = "rma:nonElectronicDocument"; - - // required properties - protected NodeRef nodeRef; - protected NodeRef parentNodeRef; - protected String name; - protected String nodeType; - - protected Date createdAt; - protected Date modifiedAt; - protected UserInfo createdByUser; - protected UserInfo modifiedByUser; - - // optional properties - protected List aspectNames; - protected Map properties; - protected PathInfo path; - protected List allowableOperations; - protected Assoc association; - - public RMNode() - { - - } - - @JsonProperty ("id") - @UniqueId - public NodeRef getNodeRef() - { - return nodeRef; - } - - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - public NodeRef getParentId() - { - return parentNodeRef; - } - - public void setParentId(NodeRef parentNodeRef) - { - this.parentNodeRef = parentNodeRef; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getNodeType() - { - return nodeType; - } - - public void setNodeType(String nodeType) - { - this.nodeType = nodeType; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getModifiedAt() - { - return modifiedAt; - } - - public void setModifiedAt(Date modifiedAt) - { - this.modifiedAt = modifiedAt; - } - - public UserInfo getCreatedByUser() - { - return createdByUser; - } - - public void setCreatedByUser(UserInfo createdByUser) - { - this.createdByUser = createdByUser; - } - - public UserInfo getModifiedByUser() - { - return modifiedByUser; - } - - public void setModifiedByUser(UserInfo modifiedByUser) - { - this.modifiedByUser = modifiedByUser; - } - - public List getAspectNames() - { - return aspectNames; - } - - public void setAspectNames(List aspectNames) - { - this.aspectNames = aspectNames; - } - - public Map getProperties() - { - return properties; - } - - public void setProperties(Map properties) - { - this.properties = properties; - } - - public PathInfo getPath() - { - return path; - } - - public void setPath(PathInfo path) - { - this.path = path; - } - - public List getAllowableOperations() - { - return allowableOperations; - } - - public void setAllowableOperations(List allowableOperations) - { - this.allowableOperations = allowableOperations; - } - - public Assoc getAssociation() - { - return association; - } - - public void setAssociation(Assoc association) - { - this.association = association; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMSite.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMSite.java deleted file mode 100644 index 8f920ff600..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMSite.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.rest.api.model.Site; -import org.alfresco.service.cmr.site.SiteInfo; - -/** - * Concrete class carrying general information for RM site - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class RMSite extends Site -{ - public static final String COMPLIANCE = "compliance"; - private RMSiteCompliance compliance; - private Map setRMFields = new HashMap<>(7); - - public RMSiteCompliance getCompliance() - { - return compliance; - } - - public void setCompliance(RMSiteCompliance compliance) - { - this.compliance = compliance; - setRMFields.put(COMPLIANCE, true); - } - - @Override - public boolean wasSet(String fieldName) - { - if(COMPLIANCE.equalsIgnoreCase(fieldName)) - { - Boolean b = setRMFields.get(fieldName); - return (b != null ? b : false); - } - return super.wasSet(fieldName); - } - - public RMSite() - { - super(); - } - - public RMSite(Site site, RMSiteCompliance compliance) - { - setId(site.getId()); - setGuid(site.getGuid()); - setTitle(site.getTitle()); - setDescription(site.getDescription()); - setVisibility(site.getVisibility()); - setRole(site.getRole()); - setCompliance(compliance); - } - - public RMSite(SiteInfo siteInfo, String role, RMSiteCompliance compliance) - { - super(siteInfo, role); - setCompliance(compliance); - } - - @Override - public String toString() - { - return "RMSite [id=" + id + ", guid=" + guid + ", title=" - + title + ", description=" + description + ", visibility=" - + visibility + ", role=" + role + ", compliance="+ compliance +"]"; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMSiteCompliance.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMSiteCompliance.java deleted file mode 100644 index 3b9feedc35..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RMSiteCompliance.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Enumeration representing RM site compliance - * - * @author Silviu Dinuta - * @since 2.6 - */ -public enum RMSiteCompliance -{ - STANDARD, - DOD5015 -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Record.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Record.java deleted file mode 100644 index f3edb00f8e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Record.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.model; - -import org.alfresco.rest.api.model.ContentInfo; - -/** - * Concrete class carrying information for a record - * - * @author Ana Bozianu - * @since 2.6 - */ -public class Record extends RMNode -{ - public static final String PARAM_HIDE_RECORD = "hideRecord"; - public static final String PARAM_IS_COMPLETED = "isCompleted"; - public static final String PARAM_CONTENT = "content"; - - protected Boolean isCompleted; - protected ContentInfo content; - - public Boolean getIsCompleted() - { - return isCompleted; - } - - public void setIsCompleted(Boolean isCompleted) - { - this.isCompleted = isCompleted; - } - - public ContentInfo getContent() - { - return content; - } - - public void setContent(ContentInfo content) - { - this.content = content; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategory.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategory.java deleted file mode 100644 index 12cadcf8e9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategory.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Concrete class carrying general information for an record category - * - * @author Ramona Popa - * @since 2.6 - */ -public class RecordCategory extends RMNode -{ - - protected Boolean hasRetentionSchedule; - - public RecordCategory() - { - super(); - } - - public Boolean getHasRetentionSchedule() - { - return hasRetentionSchedule; - } - - public void setHasRetentionSchedule(Boolean hasRetentionSchedule) - { - this.hasRetentionSchedule = hasRetentionSchedule; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java deleted file mode 100644 index 9d4c383f9b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordCategoryChild.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Concrete class carrying information for a record category child. - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class RecordCategoryChild extends RMNode -{ - public static final String PARAM_IS_RECORD_FOLDER = "isRecordFolder"; - public static final String PARAM_IS_RECORD_CATEGORY = "isRecordCategory"; - public static final String PARAM_IS_CLOSED = "isClosed"; - public static final String PARAM_HAS_RETENTION_SCHEDULE = "hasRetentionSchedule"; - - private Boolean isRecordCategory; - private Boolean isRecordFolder; - private Boolean hasRetentionSchedule; - private String relativePath; - private Boolean isClosed; - - public RecordCategoryChild() - { - //Default constructor - } - - public Boolean getIsRecordCategory() - { - return isRecordCategory; - } - - public void setIsRecordCategory(Boolean isRecordCategory) - { - this.isRecordCategory = isRecordCategory; - } - - public Boolean getIsRecordFolder() - { - return isRecordFolder; - } - - public void setIsRecordFolder(Boolean isRecordFolder) - { - this.isRecordFolder = isRecordFolder; - } - - public Boolean getHasRetentionSchedule() - { - return hasRetentionSchedule; - } - - public void setHasRetentionSchedule(Boolean hasRetentionSchedule) - { - this.hasRetentionSchedule = hasRetentionSchedule; - } - - public String getRelativePath() - { - return relativePath; - } - - public void setRelativePath(String relativePath) - { - this.relativePath = relativePath; - } - - public Boolean getIsClosed() - { - return isClosed; - } - - public void setIsClosed(Boolean isClosed) - { - this.isClosed = isClosed; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordFolder.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordFolder.java deleted file mode 100644 index 38356913ab..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/RecordFolder.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Concrete class carrying general information for a record folder - * - * @author Ramona Popa - * @since 2.6 - */ -public class RecordFolder extends RMNode -{ - public static final String PARAM_IS_CLOSED = "isClosed"; - - private Boolean isClosed; - - public RecordFolder() - { - super(); - } - - public Boolean getIsClosed() - { - return isClosed; - } - - public void setIsClosed(Boolean isClosed) - { - this.isClosed = isClosed; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/SecurityControlSetting.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/SecurityControlSetting.java deleted file mode 100644 index c2da5d3f17..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/SecurityControlSetting.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * POJO representing a setting/property key/value in the alfresco-global.properties file - * - * @author Tuna Aksoy - * @author Ramona Popa - * @since 2.6 - */ -public class SecurityControlSetting -{ - /** - * Setting key - */ - private String key = null; - - /** - * Setting value - */ - private Object value = null; - - /** - * Empty constructor needed for the REST API - */ - public SecurityControlSetting() - { - } - - /** - * Constructor - */ - public SecurityControlSetting(String key, Object value) - { - this.key = key; - this.value = value; - } - - /** - * Gets the property key - * - * @return The property key - */ - public String getKey() - { - return key; - } - - /** - * Sets the setting key - * - * @param key The property key to set - */ - public void setKey(String key) - { - this.key = key; - } - - /** - * Get the setting value - * - * @return The property value - */ - public Object getValue() - { - return value; - } - - /** - * Sets the setting value - * - * @param value The setting value - */ - public void setValue(Object value) - { - this.value = value; - } - - /** - * Equals implementation for the property - */ - @Override - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - SecurityControlSetting setting = (SecurityControlSetting) o; - - if (!key.equals(setting.key)) - { - return false; - } - return value.equals(setting.value); - } - - /** - * hashCode implementation for the property - */ - @Override - public int hashCode() - { - int result = key.hashCode(); - result = 31 * result + value.hashCode(); - return result; - } - /** - * toString implementation for the property - */ - @Override - public String toString() - { - return "Setting{" + "key='" + key + '\'' + ", value=" + value + '}'; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java deleted file mode 100644 index fa95f7a29a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TargetContainer.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * A target container object - * - * @author Ana Bozianu - * @since 2.6 - */ -public class TargetContainer -{ - String targetParentId; - - public TargetContainer() - { - //Default constructor - } - - public String getTargetParentId() - { - return targetParentId; - } - - public void setTargetParentId(String targetParentId) - { - this.targetParentId = targetParentId; - } - - @Override - public String toString() - { - final StringBuilder sb = new StringBuilder("TargetContainer{"); - sb.append("targetParentId=").append(targetParentId); - sb.append('}'); - return sb.toString(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java deleted file mode 100644 index 27be2e1542..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/Transfer.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.resource.UniqueId; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * POJO object carrying information of a transfer node - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -public class Transfer -{ - public static final String PARAM_TRANSFER_ACCESSION_INDICATOR = "transferAccessionIndicator"; - public static final String PARAM_TRANSFER_LOCATION = "transferLocation"; - public static final String PARAM_TRANSFER_PDF_INDICATOR = "transferPDFIndicator"; - - protected NodeRef nodeRef; - protected NodeRef parentNodeRef; - protected String name; - protected String nodeType; - - protected Date createdAt; - protected UserInfo createdByUser; - // optional properties - protected List aspectNames; - protected Map properties; - protected List allowableOperations; - private Boolean transferPDFIndicator; - private String transferLocation; - private Boolean transferAccessionIndicator; - - public Transfer() - { - //Default constructor - } - - @JsonProperty ("id") - @UniqueId - public NodeRef getNodeRef() - { - return nodeRef; - } - - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - public NodeRef getParentId() - { - return parentNodeRef; - } - - public void setParentId(NodeRef parentNodeRef) - { - this.parentNodeRef = parentNodeRef; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getNodeType() - { - return nodeType; - } - - public void setNodeType(String nodeType) - { - this.nodeType = nodeType; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public UserInfo getCreatedByUser() - { - return createdByUser; - } - - public void setCreatedByUser(UserInfo createdByUser) - { - this.createdByUser = createdByUser; - } - - public List getAspectNames() - { - return aspectNames; - } - - public void setAspectNames(List aspectNames) - { - this.aspectNames = aspectNames; - } - - public Map getProperties() - { - return properties; - } - - public void setProperties(Map properties) - { - this.properties = properties; - } - - public List getAllowableOperations() - { - return allowableOperations; - } - - public void setAllowableOperations(List allowableOperations) - { - this.allowableOperations = allowableOperations; - } - - public Boolean getTransferPDFIndicator() - { - return transferPDFIndicator; - } - - public void setTransferPDFIndicator(Boolean transferPDFIndicator) - { - this.transferPDFIndicator = transferPDFIndicator; - } - - public String getTransferLocation() - { - return transferLocation; - } - - public void setTransferLocation(String transferLocation) - { - this.transferLocation = transferLocation; - } - - public Boolean getTransferAccessionIndicator() - { - return transferAccessionIndicator; - } - - public void setTransferAccessionIndicator(Boolean transferAccessionIndicator) - { - this.transferAccessionIndicator = transferAccessionIndicator; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java deleted file mode 100644 index d568c9d00f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferChild.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * POJO object carrying information of a transfer child - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferChild extends RMNode -{ - public static final String PARAM_IS_COMPLETED = "isCompleted"; - public static final String PARAM_IS_RECORD_FOLDER = "isRecordFolder"; - public static final String PARAM_IS_RECORD = "isRecord"; - - protected Boolean isClosed; - protected Boolean isRecordFolder; - protected Boolean isRecord; - - public TransferChild() - { - //Default constructor - } - - public Boolean getIsClosed() - { - return isClosed; - } - - public void setIsClosed(Boolean isClosed) - { - this.isClosed = isClosed; - } - - public Boolean getIsRecordFolder() - { - return isRecordFolder; - } - - public void setIsRecordFolder(Boolean isRecordFolder) - { - this.isRecordFolder = isRecordFolder; - } - - public Boolean getIsRecord() - { - return isRecord; - } - - public void setIsRecord(Boolean isRecord) - { - this.isRecord = isRecord; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java deleted file mode 100644 index 89b94e0991..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/TransferContainer.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.resource.UniqueId; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferContainer -{ - protected NodeRef nodeRef; - protected NodeRef parentNodeRef; - protected String name; - protected String nodeType; - - protected Date createdAt; - protected UserInfo createdByUser; - protected Date modifiedAt; - protected UserInfo modifiedByUser; - // optional properties - protected List aspectNames; - protected Map properties; - protected List allowableOperations; - - public TransferContainer() - { - //Default constructor - } - - @JsonProperty ("id") - @UniqueId - public NodeRef getNodeRef() - { - return nodeRef; - } - - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - public NodeRef getParentId() - { - return parentNodeRef; - } - - public void setParentId(NodeRef parentNodeRef) - { - this.parentNodeRef = parentNodeRef; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getNodeType() - { - return nodeType; - } - - public void setNodeType(String nodeType) - { - this.nodeType = nodeType; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getModifiedAt() - { - return modifiedAt; - } - - public void setModifiedAt(Date modifiedAt) - { - this.modifiedAt = modifiedAt; - } - - public UserInfo getCreatedByUser() - { - return createdByUser; - } - - public void setCreatedByUser(UserInfo createdByUser) - { - this.createdByUser = createdByUser; - } - - public UserInfo getModifiedByUser() - { - return modifiedByUser; - } - - public void setModifiedByUser(UserInfo modifiedByUser) - { - this.modifiedByUser = modifiedByUser; - } - - public List getAspectNames() - { - return aspectNames; - } - - public void setAspectNames(List aspectNames) - { - this.aspectNames = aspectNames; - } - - public Map getProperties() - { - return properties; - } - - public void setProperties(Map properties) - { - this.properties = properties; - } - - public List getAllowableOperations() - { - return allowableOperations; - } - - public void setAllowableOperations(List allowableOperations) - { - this.allowableOperations = allowableOperations; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledChild.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledChild.java deleted file mode 100644 index ed7433bdd3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledChild.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Abstract class carrying information for an unfiled container or unfiled record folder child - * - * @author Ana Bozianu - * @since 2.6 - */ -public abstract class UnfiledChild extends RMNode -{ - public static final String PARAM_IS_UNFILED_RECORD_FOLDER = "isUnfiledRecordFolder"; - public static final String PARAM_IS_RECORD = "isRecord"; - - protected Boolean isUnfiledRecordFolder; - protected Boolean isRecord; - - @JsonProperty (PARAM_IS_UNFILED_RECORD_FOLDER) - public Boolean getIsUnfiledRecordFolder() - { - return isUnfiledRecordFolder; - } - - @JsonIgnore - public void setIsUnfiledRecordFolder(Boolean isUnfiledRecordFolder) - { - this.isUnfiledRecordFolder = isUnfiledRecordFolder; - } - - @JsonProperty (PARAM_IS_RECORD) - public Boolean getIsRecord() - { - return isRecord; - } - - @JsonIgnore - public void setIsRecord(Boolean isRecord) - { - this.isRecord = isRecord; - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledContainer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledContainer.java deleted file mode 100644 index 2edf5bfd33..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledContainer.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Concrete class carrying general information for an unfiled container - * - * @author Ana Bozianu - * @since 2.6 - */ -public class UnfiledContainer extends RMNode -{ - public UnfiledContainer() - { - super(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledContainerChild.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledContainerChild.java deleted file mode 100644 index 41370c87a7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledContainerChild.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.model; - -/** - * Specific POJO object carrying information for an unfiled container child - * - * @author Ana Bozianu - * @since 2.6 - */ -public class UnfiledContainerChild extends UnfiledChild -{ -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledRecordFolder.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledRecordFolder.java deleted file mode 100644 index b6dbf92479..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledRecordFolder.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.model; - -/** - * Concrete class carrying specific information for an unfiled record folder - * - * @author Ramona Popa - * @since 2.6 - */ -public class UnfiledRecordFolder extends RMNode -{ - public UnfiledRecordFolder() - { - super(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledRecordFolderChild.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledRecordFolderChild.java deleted file mode 100644 index f388ac759c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UnfiledRecordFolderChild.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.model; - -/** - * Specific POJO object carrying information for an unfiled record folder child - * - * @author Ana Bozianu - * @since 2.6 - */ -public class UnfiledRecordFolderChild extends UnfiledChild -{ - protected String relativePath; - - public UnfiledRecordFolderChild() - { - super(); - } - - public void setRelativePath(String relativePath) - { - this.relativePath = relativePath; - } - - public String getRelativePath() - { - return relativePath; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java deleted file mode 100644 index 9880847090..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/model/UploadInfo.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.model; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.surf.util.Content; -import org.springframework.extensions.webscripts.servlet.FormData; - -/** - * Encapsulates the elements of an upload request - * - * @author Ana Bozianu - * @since 2.6 - */ -public class UploadInfo -{ - private String fileName; - private String nodeType; - private String relativePath; - private Content content; - private Map properties; - - public UploadInfo(FormData formData) - { - properties = new HashMap<>(); - - for (FormData.FormField field : formData.getFields()) - { - switch (field.getName().toLowerCase()) - { - case "name": - fileName = getStringOrNull(field.getValue()); - break; - case "nodetype": - nodeType = getStringOrNull(field.getValue()); - break; - case "relativepath": - relativePath = getStringOrNull(field.getValue()); - break; - case "filedata": - if (field.getIsFile()) - { - fileName = (fileName != null ? fileName : field.getFilename()); - content = field.getContent(); - } - break; - - default: - { - final String propName = field.getName(); - if (propName.indexOf(QName.NAMESPACE_PREFIX) > -1) - { - properties.put(propName, field.getValue()); - } - } - } - } - - if (StringUtils.isBlank(fileName) || content == null) - { - throw new InvalidArgumentException("Required parameters are missing"); - } - } - - private String getStringOrNull(String value) - { - if (StringUtils.isNotEmpty(value)) - { - return value.equalsIgnoreCase("null") ? null : value; - } - return null; - } - - public String getFileName() - { - return fileName; - } - - public String getNodeType() - { - return nodeType; - } - - public String getRelativePath() - { - return relativePath; - } - - public Content getContent() - { - return content; - } - - public Map getProperties() - { - return properties; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java deleted file mode 100644 index 8da95ff072..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoriesEntityResource.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.recordcategories; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.RecordCategory; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.beans.factory.InitializingBean; - -/** - * Record category entity resource - * - * @author Ana Bozianu - * @author Tuna Aksoy - * @since 2.6 - */ -@EntityResource(name="record-categories", title = "Record Categories") -public class RecordCategoriesEntityResource implements - EntityResourceAction.ReadById, - EntityResourceAction.Delete, - EntityResourceAction.Update, - InitializingBean -{ - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - mandatory("apiUtils", apiUtils); - mandatory("fileFolderService", fileFolderService); - mandatory("apiNodesModelFactory", nodesModelFactory); - } - - @WebApiDescription(title = "Get record category information", description = "Gets information for a record category with id 'recordCategoryId'") - @WebApiParam(name = "recordCategoryId", title = "The record category id") - public RecordCategory readById(String recordCategoryId, Parameters parameters) - { - checkNotBlank("recordCategoryId", recordCategoryId); - mandatory("parameters", parameters); - - String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY, relativePath, true); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createRecordCategory(info, parameters, null, false); - } - - @Override - @WebApiDescription(title="Update record category", description = "Updates a record category with id 'recordCategoryId'") - public RecordCategory update(String recordCategoryId, RecordCategory recordCategoryInfo, Parameters parameters) - { - checkNotBlank("recordCategoryId", recordCategoryId); - mandatory("recordCategoryInfo", recordCategoryInfo); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY); - - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateNode(nodeRef, recordCategoryInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(nodeRef); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - return nodesModelFactory.createRecordCategory(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Delete record category", description="Deletes a record category with id 'recordCategoryId'") - public void delete(String recordCategoryId, Parameters parameters) - { - checkNotBlank("recordCategoryId", recordCategoryId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY); - - fileFolderService.delete(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java deleted file mode 100644 index e7409b6ffd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/RecordCategoryChildrenRelation.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.recordcategories; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -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.model.RecordsManagementModel; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.node.getchildren.FilterProp; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.RecordCategory; -import org.alfresco.rm.rest.api.model.RecordCategoryChild; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.servlet.FormData; - -/** - * Record category children relation - * - * @author Ana Bozianu - * @author Tuna Aksoy - * @since 2.6 - */ -@RelationshipResource(name="children", entityResource = RecordCategoriesEntityResource.class, title = "Children of a record category") -public class RecordCategoryChildrenRelation implements RelationshipResourceAction.Read, - RelationshipResourceAction.Create, - MultiPartRelationshipResourceAction.Create -{ - private final static Set LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays - .asList(new String[] { RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, RecordCategoryChild.PARAM_IS_RECORD_FOLDER, - RecordCategoryChild.PARAM_IS_CLOSED, RecordCategoryChild.PARAM_HAS_RETENTION_SCHEDULE, RMNode.PARAM_NODE_TYPE })); - - private FilePlanComponentsApiUtils apiUtils; - private SearchTypesFactory searchTypesFactory; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - @WebApiDescription(title = "Return a paged list of record category children for the container identified by 'recordCategoryId'") - public CollectionWithPagingInfo readAll(String recordCategoryId, Parameters parameters) - { - checkNotBlank("recordCategoryId", recordCategoryId); - mandatory("parameters", parameters); - - String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH); - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY, relativePath, true); - - // list record categories and record folders - Set searchTypeQNames = searchTypesFactory.buildSearchTypesCategoriesEndpoint(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES); - Set assocTypeQNames = Collections.singleton(ContentModel.ASSOC_CONTAINS); - List filterProps = apiUtils.getListChildrenFilterProps(parameters, LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES); - - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, - assocTypeQNames, - searchTypeQNames, - null, - apiUtils.getSortProperties(parameters), - filterProps, - Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public RecordCategoryChild get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createRecordCategoryChild(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - RecordCategory sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createRecordCategory(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } - - @Override - @WebApiDescription(title="Create one (or more) nodes as children of a record category identified by 'recordCategoryId'") - public List create(String recordCategoryId, List nodeInfos, Parameters parameters) - { - checkNotBlank("recordCategoryId", recordCategoryId); - mandatory("nodeInfos", nodeInfos); - mandatory("parameters", parameters); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId, RecordsManagementModel.TYPE_RECORD_CATEGORY); - - List result = new ArrayList<>(nodeInfos.size()); - Map mapUserInfo = new HashMap<>(); - - RetryingTransactionCallback> callback = new RetryingTransactionCallback>() - { - public List execute() - { - List createdNodes = new LinkedList<>(); - for (RecordCategoryChild nodeInfo : nodeInfos) - { - // Resolve the parent node - NodeRef nodeParent = parentNodeRef; - if (StringUtils.isNoneBlank(nodeInfo.getRelativePath())) - { - nodeParent = apiUtils.lookupAndValidateRelativePath(parentNodeRef, nodeInfo.getRelativePath(), - RecordsManagementModel.TYPE_RECORD_CATEGORY); - } - // Create the node - NodeRef newNode = apiUtils.createRMNode(nodeParent, nodeInfo, parameters); - createdNodes.add(newNode); - } - return createdNodes; - } - }; - List createdNodes = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - for (NodeRef nodeInfo : createdNodes) - { - FileInfo info = fileFolderService.getFileInfo(nodeInfo); - result.add(nodesModelFactory.createRecordCategoryChild(info, parameters, mapUserInfo, false)); - } - - return result; - } - - @Override - public RecordCategoryChild create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse) - { - throw new IntegrityException("Uploading records into record categories is not allowed.", null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/package-info.java deleted file mode 100644 index 7a92fbf3ea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordcategories/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance Record Categories REST API - * - * @author Ana Bozianu - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.recordcategories; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java deleted file mode 100644 index edf71d0955..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderChildrenRelation.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.recordfolders; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.activities.ActivityType; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.Record; -import org.alfresco.rm.rest.api.model.RecordFolder; -import org.alfresco.rm.rest.api.model.UploadInfo; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.extensions.webscripts.servlet.FormData; - -/** - * Record folder children relation - * - * @author Ramona Popa - * @since 2.6 - */ -@RelationshipResource(name = "records", entityResource = RecordFolderEntityResource.class, title = "Children of a record folder") -public class RecordFolderChildrenRelation implements RelationshipResourceAction.Read, RelationshipResourceAction.Create, - MultiPartRelationshipResourceAction.Create -{ - private FilePlanComponentsApiUtils apiUtils; - private SearchTypesFactory searchTypesFactory; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - @WebApiDescription(title = "Return a paged list of records for the record folder identified by 'recordFolderId'") - public CollectionWithPagingInfo readAll(String recordFolderId, Parameters parameters) - { - checkNotBlank("recordFolderId", recordFolderId); - mandatory("parameters", parameters); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER); - - // list record folders - // FIXME searchParam - Set searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, null); - - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, null, searchTypeQNames, null, - apiUtils.getSortProperties(parameters), null, Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public Record get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createRecord(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - RecordFolder sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createRecordFolder(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), - pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } - - @Override - @WebApiDescription(title = "Create one (or more) records as children of a record folder identified by 'recordFolderId'") - public List create(String recordFolderId, List nodeInfos, Parameters parameters) - { - checkNotBlank("recordFolderId", recordFolderId); - mandatory("nodeInfos", nodeInfos); - mandatory("parameters", parameters); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER); - - RetryingTransactionCallback> callback = new RetryingTransactionCallback>() - { - public List execute() - { - List createdNodes = new LinkedList<>(); - for (Record nodeInfo : nodeInfos) - { - NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters); - createdNodes.add(newNodeRef); - } - return createdNodes; - } - }; - List createdNodes = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Get the nodes info - List result = new LinkedList<>(); - Map mapUserInfo = new HashMap<>(); - for(NodeRef newNodeRef : createdNodes) - { - FileInfo info = fileFolderService.getFileInfo(newNodeRef); - apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED); - result.add(nodesModelFactory.createRecord(info, parameters, mapUserInfo, false)); - } - - return result; - } - - @Override - @WebApiDescription(title = "Upload file content and meta-data into the repository.") - @WebApiParam(name = "formData", title = "A single form data", description = "A single form data which holds FormFields.") - public Record create(String recordFolderId, FormData formData, Parameters parameters, WithResponse withResponse) - { - checkNotBlank("recordFolderId", recordFolderId); - mandatory("formData", formData); - mandatory("parameters", parameters); - - // Retrieve the input data and resolve the parent node - final UploadInfo uploadInfo = new UploadInfo(formData); - final NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER, - uploadInfo.getRelativePath()); - - // Create the record - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public NodeRef execute() - { - return apiUtils.uploadRecord(parentNodeRef, uploadInfo, parameters); - } - }; - NodeRef newNode = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Get file info for response - FileInfo info = fileFolderService.getFileInfo(newNode); - apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED); - return nodesModelFactory.createRecord(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java deleted file mode 100644 index 01848dec49..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/RecordFolderEntityResource.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.recordfolders; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.RecordFolder; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.beans.factory.InitializingBean; - -/** - * Record folder entity resource - * - * @author Ana Bozianu - * @author Tuna Aksoy - * @since 2.6 - */ -@EntityResource(name = "record-folders", title = "Record Folders") -public class RecordFolderEntityResource implements EntityResourceAction.ReadById, EntityResourceAction.Delete, - EntityResourceAction.Update, InitializingBean -{ - - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - mandatory("apiUtils", apiUtils); - mandatory("fileFolderService", fileFolderService); - mandatory("apiNodesModelFactory", nodesModelFactory); - } - - @WebApiDescription(title = "Get record folder information", description = "Gets information for a record folder with id 'recordFolderId'") - @WebApiParam(name = "recordFolderId", title = "The record folder id") - public RecordFolder readById(String recordFolderId, Parameters parameters) - { - checkNotBlank("recordFolderId", recordFolderId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createRecordFolder(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Update record folder", description = "Updates a record folder with id 'recordFolderId'") - public RecordFolder update(String recordFolderId, RecordFolder recordFolderInfo, Parameters parameters) - { - checkNotBlank("recordFolderId", recordFolderId); - mandatory("recordFolderInfo", recordFolderInfo); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER); - - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateNode(nodeRef, recordFolderInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(nodeRef); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - return nodesModelFactory.createRecordFolder(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Delete record folder", description = "Deletes a record folder with id 'recordFolderId'") - public void delete(String recordFolderId, Parameters parameters) - { - checkNotBlank("recordFolderId", recordFolderId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(recordFolderId, RecordsManagementModel.TYPE_RECORD_FOLDER); - - fileFolderService.delete(nodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/package-info.java deleted file mode 100644 index 398d9d62a3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/recordfolders/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance Record Folders REST API - * - * @author Ana Bozianu - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.recordfolders; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java deleted file mode 100644 index 10a25daf94..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/RecordsEntityResource.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.records; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordMissingMetadataException; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.activities.ActivityType; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.framework.BinaryProperties; -import org.alfresco.rest.framework.Operation; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAction; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.content.BinaryResource; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.Record; -import org.alfresco.rm.rest.api.model.TargetContainer; -import org.alfresco.service.cmr.activities.ActivityPoster; -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.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.dao.ConcurrencyFailureException; - -/** - * An implementation of an Entity Resource for a record - * - * @author Ana Bozianu - * @author Tuna Aksoy - * @since 2.6 - */ -@EntityResource(name="records", title = "Records") -public class RecordsEntityResource implements BinaryResourceAction.Read, - EntityResourceAction.ReadById, - EntityResourceAction.Delete, - EntityResourceAction.Update, - InitializingBean -{ - - private ApiNodesModelFactory nodesModelFactory; - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private RecordService recordService; - private NodeService nodeService; - private TransactionService transactionService; - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Download content - * - * @param recordId the id of the record to get the content from - * @param parameters {@link Parameters} - * @return binary content resource - * @throws EntityNotFoundException - */ - @Override - @WebApiDescription(title = "Download content", description = "Download content for a record with id 'recordId'") - @BinaryProperties({"content"}) - public BinaryResource readProperty(String recordId, Parameters parameters) throws EntityNotFoundException - { - checkNotBlank("recordId", recordId); - mandatory("parameters", parameters); - - NodeRef record = apiUtils.validateRecord(recordId); - if(nodeService.getType(record).equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)) - { - throw new IllegalArgumentException("Cannot read content from Non-electronic record " + recordId + "."); - } - BinaryResource content = apiUtils.getContent(record, parameters, true); - NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef(); - FileInfo info = fileFolderService.getFileInfo(record); - apiUtils.postActivity(info, primaryParent, ActivityPoster.DOWNLOADED); - return content; - } - - @Operation("file") - @WebApiDescription(title = "File record", description="File a record into fileplan.") - public Record fileRecord(String recordId, TargetContainer target, Parameters parameters, WithResponse withResponse) - { - checkNotBlank("recordId", recordId); - mandatory("target", target); - mandatory("targetParentId", target.getTargetParentId()); - mandatory("parameters", parameters); - - // Get record and target folder - NodeRef record = apiUtils.validateRecord(recordId); - NodeRef targetRecordFolder = apiUtils.lookupAndValidateNodeType(target.getTargetParentId(), RecordsManagementModel.TYPE_RECORD_FOLDER); - - // Get the current parent type to decide if we link or move the record - NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef(); - if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(primaryParent))) - { - recordService.link(record, targetRecordFolder); - } - else - { - try - { - fileFolderService.moveFrom(record, primaryParent, targetRecordFolder, null); - } - catch (FileExistsException e) - { - throw new IntegrityException(e.getMessage(), null); - } - catch (FileNotFoundException e) - { - throw new ConcurrencyFailureException("The record was deleted while filing it", e); - } - } - - // return record state - FileInfo info = fileFolderService.getFileInfo(record); - return nodesModelFactory.createRecord(info, parameters, null, false); - } - - @WebApiDescription(title = "Get record information", description = "Gets information for a record with id 'recordId'") - @WebApiParam(name = "recordId", title = "The record id") - public Record readById(String recordId, Parameters parameters) - { - checkNotBlank("recordId", recordId); - mandatory("parameters", parameters); - - NodeRef record = apiUtils.validateRecord(recordId); - FileInfo info = fileFolderService.getFileInfo(record); - return nodesModelFactory.createRecord(info, parameters, null, false); - } - - @Override - @WebApiDescription(title="Update record", description = "Updates a record with id 'recordId'") - public Record update(String recordId, Record recordInfo, Parameters parameters) - { - checkNotBlank("recordId", recordId); - mandatory("recordInfo", recordInfo); - mandatory("parameters", parameters); - - // Get record - NodeRef record = apiUtils.validateRecord(recordId); - - // update info - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateNode(record, recordInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // return record state - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(record); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - apiUtils.postActivity(info, recordInfo.getParentId(), ActivityType.FILE_UPDATED); - return nodesModelFactory.createRecord(info, parameters, null, false); - } - - @Operation ("complete") - @WebApiDescription (title = "Complete record", description = "Complete a record.") - public Record completeRecord(String recordId, Void body, Parameters parameters, WithResponse withResponse) - { - checkNotBlank("recordId", recordId); - mandatory("parameters", parameters); - - // Get record - NodeRef record = apiUtils.validateRecord(recordId); - - // Complete the record - try - { - recordService.complete(record); - } - catch (RecordMissingMetadataException e) - { - throw new IntegrityException("The record has missing mandatory properties.", null); - } - - // return record state - FileInfo info = fileFolderService.getFileInfo(record); - return nodesModelFactory.createRecord(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Delete record", description="Deletes a record with id 'recordId'") - public void delete(String recordId, Parameters parameters) - { - checkNotBlank("recordId", recordId); - mandatory("parameters", parameters); - - NodeRef record = apiUtils.validateRecord(recordId); - fileFolderService.delete(record); - } - - @Override - public void afterPropertiesSet() throws Exception - { - ParameterCheck.mandatory("nodesModelFactory", nodesModelFactory); - ParameterCheck.mandatory("apiUtils", apiUtils); - ParameterCheck.mandatory("fileFolderService", fileFolderService); - ParameterCheck.mandatory("recordService", recordService); - ParameterCheck.mandatory("nodeService", nodeService); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/package-info.java deleted file mode 100644 index 8c7a83190e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/records/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance Records REST API - * - * @author Ana Bozianu - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.records; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/sites/RMSiteEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/sites/RMSiteEntityResource.java deleted file mode 100644 index 8a4a72e653..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/sites/RMSiteEntityResource.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.sites; - -import java.security.InvalidParameterException; -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.rest.api.model.Site; -import org.alfresco.rest.api.model.SiteUpdate; -import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.RMSites; -import org.alfresco.rm.rest.api.model.RMSite; - -/** - * RM Site operations - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -@EntityResource(name = "gs-sites", title = "GS Sites") -public class RMSiteEntityResource implements EntityResourceAction.Delete, EntityResourceAction.Create, - EntityResourceAction.Update, EntityResourceAction.ReadById -{ - private static final String RM_SITE_ID = "rm"; - private RMSites sites; - private String PARAM_PERMANENT = "permanent"; - - public void setSites(RMSites sites) - { - this.sites = sites; - } - - @Override - public List create(List entity, Parameters parameters) - { - List result = new ArrayList<>(1); - result.add(sites.createRMSite(entity.get(0), parameters)); - return result; - } - - @Override - public void delete(String siteId, Parameters parameters) - { - if (!RM_SITE_ID.equals(siteId)) - { - throw new InvalidParameterException("The Deletion is supported only for siteId = rm."); - } - String permanentParameter = parameters.getParameter(PARAM_PERMANENT); - if(permanentParameter != null) - { - throw new InvalidArgumentException("DELETE does not support parameter: permanent"); - } - sites.deleteRMSite(siteId, parameters); - } - - @Override - public RMSite update(String siteId, RMSite site, Parameters parameters) - { - if (!RM_SITE_ID.equals(siteId)) - { - throw new InvalidParameterException("The Update is supported only for siteId = rm."); - } - - return sites.updateRMSite(siteId, convert(site), parameters); - } - - @Override - public RMSite readById(String siteId, Parameters parameters) - { - if (!RM_SITE_ID.equals(siteId)) - { - throw new InvalidParameterException("GET is supported only for siteId = rm."); - } - return sites.getRMSite(siteId); - } - - protected SiteUpdate convert(RMSite site) - { - // Until REPO-110 is solved, we need to explicitly test for the presence of fields - // on the Site object that aren't valid SiteUpdate fields. Once REPO-110 is solved, - // the update method will take a SiteUpdate as a parameter rather than a Site - // and only the correct fields will be exposed. Any attempt to access illegal fields - // should then result in the framework returning a 400 automatically. - if (site.wasSet(Site.ID)) - { - throw new InvalidArgumentException("Site update does not support field: id"); - } - if (site.wasSet(Site.GUID)) - { - throw new InvalidArgumentException("Site update does not support field: guid"); - } - if (site.wasSet(Site.ROLE)) - { - throw new InvalidArgumentException("Site update does not support field: role"); - } - if (site.wasSet(Site.PRESET)) - { - throw new InvalidArgumentException("Site update does not support field: preset"); - } - if (site.wasSet(RMSite.COMPLIANCE)) - { - throw new InvalidArgumentException("Site update does not support field: compliance"); - } - if (site.wasSet(Site.VISIBILITY)) - { - throw new InvalidArgumentException("Site update does not support field: visibility"); - } - - // Bind valid fields to a SiteUpdate instance. - SiteUpdate siteUpdate = new SiteUpdate(); - if (site.wasSet(Site.TITLE)) - { - siteUpdate.setTitle(site.getTitle()); - } - if (site.wasSet(Site.DESCRIPTION)) - { - siteUpdate.setDescription(site.getDescription()); - } - - return siteUpdate; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/sites/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/sites/package-info.java deleted file mode 100644 index 74cf42763e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/sites/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance sites REST API - * - * @author Silviu Dinuta - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.sites; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerChildrenRelation.java deleted file mode 100644 index d6b8b6096b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerChildrenRelation.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.transfercontainers; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.PagingResults; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.Transfer; -import org.alfresco.rm.rest.api.model.TransferContainer; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** -* Transfer Container children relation -* -* @author Silviu Dinuta -* @since 2.6 -*/ -@RelationshipResource(name="transfers", entityResource = TransferContainerEntityResource.class, title = "Children of a transfer container") -public class TransferContainerChildrenRelation implements RelationshipResourceAction.Read -{ - private FilePlanComponentsApiUtils apiUtils; - private SearchTypesFactory searchTypesFactory; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - @Override - @WebApiDescription(title = "Return a paged list of transfers for the transfer container identified by 'transferContainerId'") - public CollectionWithPagingInfo readAll(String transferContainerId, Parameters parameters) - { - checkNotBlank("transferContainerId", transferContainerId); - mandatory("parameters", parameters); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(transferContainerId, RecordsManagementModel.TYPE_TRANSFER_CONTAINER); - - // list transfers - Set searchTypeQNames = searchTypesFactory.buildSearchTypesForTransferContainersEndpoint(); - - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, - null, - searchTypeQNames, - null, - apiUtils.getSortProperties(parameters), - null, - Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public Transfer get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createTransfer(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - TransferContainer sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createTransferContainer(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), - pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java deleted file mode 100644 index 95fedc88c3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/TransferContainerEntityResource.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.transfercontainers; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.TransferContainer; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.beans.factory.InitializingBean; - -/** - * Transfer Container entity resource - * - * @author Silviu Dinuta - * @since 2.6 - */ -@EntityResource(name="transfer-containers", title = "Transfer Containers") -public class TransferContainerEntityResource implements - EntityResourceAction.ReadById, - EntityResourceAction.Update, - InitializingBean -{ - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - mandatory("apiUtils", apiUtils); - mandatory("fileFolderService", fileFolderService); - mandatory("apiNodesModelFactory", nodesModelFactory); - } - - @WebApiDescription(title = "Get transfer container information", description = "Gets information for a transfer container with id 'transferContainerId'") - @WebApiParam(name = "transferContainerId", title = "The transfer container id") - @Override - public TransferContainer readById(String transferContainerId, Parameters parameters) throws EntityNotFoundException - { - checkNotBlank("transferContainerId", transferContainerId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(transferContainerId, RecordsManagementModel.TYPE_TRANSFER_CONTAINER); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createTransferContainer(info, parameters, null, false); - } - - @Override - @WebApiDescription(title="Update transfer container", description = "Updates a transfer container with id 'transferContainerId'") - public TransferContainer update(String transferContainerId, TransferContainer transferContainerInfo, Parameters parameters) - { - checkNotBlank("transferContainerId", transferContainerId); - mandatory("transferContainerInfo", transferContainerInfo); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(transferContainerId, RecordsManagementModel.TYPE_TRANSFER_CONTAINER); - - // update info - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateTransferContainer(nodeRef, transferContainerInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(nodeRef); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - return nodesModelFactory.createTransferContainer(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/package-info.java deleted file mode 100644 index 905059ffb7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfercontainers/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines Alfresco Governance Services transfer-containers REST API - * - * @author Silviu Dinuta - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.transfercontainers; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/TransferChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/TransferChildrenRelation.java deleted file mode 100644 index 70403b843e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/TransferChildrenRelation.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.transfers; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.PagingResults; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.Transfer; -import org.alfresco.rm.rest.api.model.TransferChild; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; - -/** -* Transfer children relation -* -* @author Silviu Dinuta -* @since 2.6 -*/ -@RelationshipResource(name="children", entityResource = TransferEntityResource.class, title = "Children of a transfer") -public class TransferChildrenRelation implements RelationshipResourceAction.Read -{ - private FilePlanComponentsApiUtils apiUtils; - private SearchTypesFactory searchTypesFactory; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - @Override - @WebApiDescription(title = "Return a paged list of record folders or records for the transfer identified by 'transferId'") - public CollectionWithPagingInfo readAll(String transferId, Parameters parameters) - { - checkNotBlank("transferId", transferId); - mandatory("parameters", parameters); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(transferId, RecordsManagementModel.TYPE_TRANSFER); - - // list record folder, electronic record or non electronic record - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, - null, - null, - null, - apiUtils.getSortProperties(parameters), - null, - Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public TransferChild get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createTransferChild(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - Transfer sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createTransfer(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), - pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/TransferEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/TransferEntityResource.java deleted file mode 100644 index 6628f1f6a8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/TransferEntityResource.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.transfers; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.Transfer; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.beans.factory.InitializingBean; - -/** - * Transfer entity resource - * - * @author Silviu Dinuta - * @since 2.6 - */ -@EntityResource(name="transfers", title = "Transfers") -public class TransferEntityResource implements - EntityResourceAction.ReadById, - InitializingBean -{ - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - @Override - public void afterPropertiesSet() throws Exception - { - mandatory("apiUtils", apiUtils); - mandatory("fileFolderService", fileFolderService); - mandatory("apiNodesModelFactory", nodesModelFactory); - } - - @Override - @WebApiDescription(title = "Get transfer information", description = "Gets information for a transfer with id 'transferId'") - @WebApiParam(name = "transferId", title = "The transfer id") - public Transfer readById(String transferId, Parameters parameters) throws EntityNotFoundException - { - checkNotBlank("transferId", transferId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(transferId, RecordsManagementModel.TYPE_TRANSFER); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createTransfer(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/package-info.java deleted file mode 100644 index 9b844907e5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/transfers/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines Alfresco Governance Services transfers REST API - * - * @author Silviu Dinuta - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.transfers; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java deleted file mode 100644 index 23e836e927..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerChildrenRelation.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.unfiledcontainers; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.activities.ActivityType; -import org.alfresco.repo.node.getchildren.FilterProp; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.UnfiledChild; -import org.alfresco.rm.rest.api.model.UnfiledContainer; -import org.alfresco.rm.rest.api.model.UnfiledContainerChild; -import org.alfresco.rm.rest.api.model.UploadInfo; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.extensions.webscripts.servlet.FormData; - - -/** - * Unfiled container children relation - * - * @author Tuna Aksoy - * @author Ana Bozianu - * @since 2.6 - */ -@RelationshipResource(name="children", entityResource = UnfiledContainerEntityResource.class, title = "Children of an unfiled container") -public class UnfiledContainerChildrenRelation implements RelationshipResourceAction.Read, - RelationshipResourceAction.Create, - MultiPartRelationshipResourceAction.Create -{ - - private final static Set LIST_UNFILED_CONTAINER_CHILDREN_EQUALS_QUERY_PROPERTIES = - new HashSet<>(Arrays.asList(new String[] {UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER, UnfiledChild.PARAM_IS_RECORD, RMNode.PARAM_NODE_TYPE})); - - private FilePlanComponentsApiUtils apiUtils; - private SearchTypesFactory searchTypesFactory; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - @WebApiDescription(title = "Return a paged list of unfiled container children for the container identified by 'unfiledContainerId'") - public CollectionWithPagingInfo readAll(String unfiledContainerId, Parameters parameters) - { - // validate parameters - checkNotBlank("unfiledContainerId", unfiledContainerId); - mandatory("parameters", parameters); - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - - // list unfiled record folders and records - Set searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, LIST_UNFILED_CONTAINER_CHILDREN_EQUALS_QUERY_PROPERTIES); - - List filterProps = apiUtils.getListChildrenFilterProps(parameters, LIST_UNFILED_CONTAINER_CHILDREN_EQUALS_QUERY_PROPERTIES); - - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, - null, - searchTypeQNames, - null, - apiUtils.getSortProperties(parameters), - filterProps, - Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public UnfiledContainerChild get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createUnfiledContainerChild(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - UnfiledContainer sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createUnfiledContainer(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), - pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } - - @Override - @WebApiDescription(title="Create one (or more) nodes as children of a unfiled container identified by 'unfiledContainerId'") - public List create(String unfiledContainerId, final List nodeInfos, Parameters parameters) - { - checkNotBlank("unfiledContainerId", unfiledContainerId); - mandatory("nodeInfos", nodeInfos); - mandatory("parameters", parameters); - - final NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - - // Create the nodes - RetryingTransactionCallback> callback = new RetryingTransactionCallback>() - { - public List execute() - { - List createdNodes = new LinkedList<>(); - for (UnfiledContainerChild nodeInfo : nodeInfos) - { - NodeRef newNodeRef = apiUtils.createRMNode(parentNodeRef, nodeInfo, parameters); - createdNodes.add(newNodeRef); - } - return createdNodes; - } - }; - List createdNodes = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Get the nodes info - List result = new LinkedList<>(); - Map mapUserInfo = new HashMap<>(); - for(NodeRef newNodeRef : createdNodes) - { - FileInfo info = fileFolderService.getFileInfo(newNodeRef); - apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED); - result.add(nodesModelFactory.createUnfiledContainerChild(info, parameters, mapUserInfo, false)); - } - - return result; - } - - @Override - @WebApiDescription(title = "Upload file content and meta-data into a unfiled record container identified by 'unfiledContainerId'.") - @WebApiParam(name = "formData", title = "A single form data", description = "A single form data which holds FormFields.") - public UnfiledContainerChild create(String unfiledContainerId, FormData formData, Parameters parameters, WithResponse withResponse) - { - checkNotBlank("unfiledContainerId", unfiledContainerId); - mandatory("formData", formData); - mandatory("parameters", parameters); - - UploadInfo uploadInfo = new UploadInfo(formData); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public NodeRef execute() - { - return apiUtils.uploadRecord(parentNodeRef, uploadInfo, parameters); - } - }; - NodeRef newNode = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Get file info for response - FileInfo info = fileFolderService.getFileInfo(newNode); - apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED); - return nodesModelFactory.createUnfiledContainerChild(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java deleted file mode 100644 index 45b15e2da9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/UnfiledContainerEntityResource.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.unfiledcontainers; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.activities.ActivityType; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.UnfiledContainer; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.beans.factory.InitializingBean; - -/** - * Unfiled container entity resource - * - * @author Ana Bozianu - * @author Tuna Aksoy - * @since 2.6 - */ -@EntityResource(name = "unfiled-containers", title = "Unfiled containers") -public class UnfiledContainerEntityResource - implements EntityResourceAction.ReadById, EntityResourceAction.Update, InitializingBean -{ - - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - mandatory("apiUtils", apiUtils); - mandatory("fileFolderService", fileFolderService); - mandatory("apiNodesModelFactory", nodesModelFactory); - } - - @WebApiDescription(title = "Get unfiled container information", description = "Gets information for a unfiled container with id 'unfiledContainerId'") - @WebApiParam(name = "unfiledContainerId", title = "The unfiled container id") - public UnfiledContainer readById(String unfiledContainerId, Parameters parameters) - { - checkNotBlank("unfiledContainerId", unfiledContainerId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createUnfiledContainer(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Update unfiled record container", description = "Updates an unfiled record container with id 'unfiledContainerId'") - public UnfiledContainer update(String unfiledContainerId, UnfiledContainer unfiledContainerInfo, Parameters parameters) - { - checkNotBlank("unfiledContainerId", unfiledContainerId); - mandatory("unfiledContainerInfo", unfiledContainerInfo); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledContainerId, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateNode(nodeRef, unfiledContainerInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(nodeRef); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - apiUtils.postActivity(info, unfiledContainerInfo.getParentId(), ActivityType.FILE_UPDATED); - return nodesModelFactory.createUnfiledContainer(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/package-info.java deleted file mode 100644 index 36767dec2f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledcontainers/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance Unfiled Containers REST API - * - * @author Tuna Aksoy - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.unfiledcontainers; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java deleted file mode 100644 index 587f16cc7b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderChildrenRelation.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.unfiledrecordfolders; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import java.util.AbstractList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.activities.ActivityType; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.api.impl.Util; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.webscripts.WithResponse; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.impl.SearchTypesFactory; -import org.alfresco.rm.rest.api.model.RMNode; -import org.alfresco.rm.rest.api.model.UnfiledChild; -import org.alfresco.rm.rest.api.model.UnfiledRecordFolder; -import org.alfresco.rm.rest.api.model.UnfiledRecordFolderChild; -import org.alfresco.rm.rest.api.model.UploadInfo; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.servlet.FormData; - -/** - * Unfiled Record folder children relation - * - * @author Ramona Popa - * @since 2.6 - */ -@RelationshipResource(name="children", entityResource = UnfiledRecordFolderEntityResource.class, title = "Children of an unfiled record folder") -public class UnfiledRecordFolderChildrenRelation implements RelationshipResourceAction.Read, - RelationshipResourceAction.Create, - MultiPartRelationshipResourceAction.Create -{ - private final static Set LIST_UNFILED_RECORD_FOLDER_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays - .asList(new String[] { UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER, UnfiledChild.PARAM_IS_RECORD, RMNode.PARAM_NODE_TYPE })); - - private FilePlanComponentsApiUtils apiUtils; - private SearchTypesFactory searchTypesFactory; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setSearchTypesFactory(SearchTypesFactory searchTypesFactory) - { - this.searchTypesFactory = searchTypesFactory; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - @WebApiDescription(title = "Return a paged list of unfiled container children for the container identified by 'unfiledContainerId'") - public CollectionWithPagingInfo readAll(String unfileRecordFolderId, Parameters parameters) - { - checkNotBlank("unfileRecordFolderId", unfileRecordFolderId); - mandatory("parameters", parameters); - - String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH); - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfileRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, relativePath, true); - - // list unfiled record folders and records - Set searchTypeQNames = searchTypesFactory.buildSearchTypesForUnfiledEndpoint(parameters, LIST_UNFILED_RECORD_FOLDER_CHILDREN_EQUALS_QUERY_PROPERTIES); - - final PagingResults pagingResults = fileFolderService.list(parentNodeRef, - null, - searchTypeQNames, - null, - apiUtils.getSortProperties(parameters), - null, - Util.getPagingRequest(parameters.getPaging())); - - final List page = pagingResults.getPage(); - Map mapUserInfo = new HashMap<>(); - List nodes = new AbstractList() - { - @Override - public UnfiledRecordFolderChild get(int index) - { - FileInfo info = page.get(index); - return nodesModelFactory.createUnfiledRecordFolderChild(info, parameters, mapUserInfo, true); - } - - @Override - public int size() - { - return page.size(); - } - }; - - UnfiledRecordFolder sourceEntity = null; - if (parameters.includeSource()) - { - FileInfo info = fileFolderService.getFileInfo(parentNodeRef); - sourceEntity = nodesModelFactory.createUnfiledRecordFolder(info, parameters, mapUserInfo, true); - } - - return CollectionWithPagingInfo.asPaged(parameters.getPaging(), nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity); - } - - @Override - @WebApiDescription(title = "Create one (or more) nodes as children of a unfiled record folder identified by 'unfiledRecordFolderId'") - public List create(String unfiledRecordFolderId, final List nodeInfos, Parameters parameters) - { - checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId); - mandatory("nodeInfos", nodeInfos); - mandatory("parameters", parameters); - - NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - - // Create the children - RetryingTransactionCallback> callback = new RetryingTransactionCallback>() - { - public List execute() - { - List createdNodes = new LinkedList<>(); - for (UnfiledRecordFolderChild nodeInfo : nodeInfos) - { - NodeRef nodeParent; - if(StringUtils.isNoneBlank(nodeInfo.getRelativePath())) - { - nodeParent = apiUtils.lookupAndValidateRelativePath(parentNodeRef, nodeInfo.getRelativePath(), RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - } - else - { - nodeParent = parentNodeRef; - } - - NodeRef newNodeRef = apiUtils.createRMNode(nodeParent, nodeInfo, parameters); - createdNodes.add(newNodeRef); - } - return createdNodes; - } - }; - List createdNodes = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - // Get the nodes info - List result = new LinkedList<>(); - Map mapUserInfo = new HashMap<>(); - for(NodeRef newNodeRef : createdNodes) - { - FileInfo info = fileFolderService.getFileInfo(newNodeRef); - apiUtils.postActivity(info, parentNodeRef, ActivityType.FILE_ADDED); - result.add(nodesModelFactory.createUnfiledRecordFolderChild(info, parameters, mapUserInfo, false)); - } - - return result; - } - - @Override - @WebApiDescription(title = "Upload file content and meta-data into the repository.") - @WebApiParam(name = "formData", title = "A single form data", description = "A single form data which holds FormFields.") - public UnfiledRecordFolderChild create(String unfiledRecordFolderId, FormData formData, Parameters parameters, WithResponse withResponse) - { - checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId); - mandatory("formData", formData); - mandatory("parameters", parameters); - - // Retrieve the input data and resolve the parent node - final UploadInfo uploadInfo = new UploadInfo(formData); - - // Create the record - returns pair(newNode,parentNode) - RetryingTransactionCallback> callback = new RetryingTransactionCallback>() - { - public Pair execute() - { - final NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, uploadInfo.getRelativePath()); - NodeRef newNode = apiUtils.uploadRecord(parentNodeRef, uploadInfo, parameters); - return new Pair<>(newNode, parentNodeRef); - } - }; - Pair nodeAndParentInfo = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - NodeRef newNode = nodeAndParentInfo.getFirst(); - NodeRef parent = nodeAndParentInfo.getSecond(); - - // Get file info for response - FileInfo info = fileFolderService.getFileInfo(newNode); - apiUtils.postActivity(info, parent, ActivityType.FILE_ADDED); - - return nodesModelFactory.createUnfiledRecordFolderChild(info, parameters, null, false); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java deleted file mode 100644 index c6f6bee703..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/UnfiledRecordFolderEntityResource.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.unfiledrecordfolders; - -import static org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck.checkNotBlank; -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.activities.ActivityType; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.framework.WebApiDescription; -import org.alfresco.rest.framework.WebApiParam; -import org.alfresco.rest.framework.resource.EntityResource; -import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory; -import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils; -import org.alfresco.rm.rest.api.model.UnfiledRecordFolder; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.beans.factory.InitializingBean; - -/** - * Unfiled record folder entity resource - * - * @author Ramona Popa - * @since 2.6 - */ -@EntityResource(name = "unfiled-record-folders", title = "Unfiled Record Folders") -public class UnfiledRecordFolderEntityResource implements EntityResourceAction.ReadById, - EntityResourceAction.Delete, - EntityResourceAction.Update, InitializingBean - -{ - private FilePlanComponentsApiUtils apiUtils; - private FileFolderService fileFolderService; - private ApiNodesModelFactory nodesModelFactory; - private TransactionService transactionService; - - public void setApiUtils(FilePlanComponentsApiUtils apiUtils) - { - this.apiUtils = apiUtils; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setNodesModelFactory(ApiNodesModelFactory nodesModelFactory) - { - this.nodesModelFactory = nodesModelFactory; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - @Override - public void afterPropertiesSet() throws Exception - { - mandatory("apiUtils", apiUtils); - mandatory("fileFolderService", fileFolderService); - mandatory("apiNodesModelFactory", nodesModelFactory); - } - - @WebApiDescription(title = "Get unfiled record folder information", description = "Gets information for an unfiled record folder with id 'unfiledRecordFolderId'") - @WebApiParam(name = "unfiledRecordFolderId", title = "The unfiled record folder id") - public UnfiledRecordFolder readById(String unfiledRecordFolderId, Parameters parameters) - { - checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId); - mandatory("parameters", parameters); - - String relativePath = parameters.getParameter(Nodes.PARAM_RELATIVE_PATH); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER, relativePath, true); - - FileInfo info = fileFolderService.getFileInfo(nodeRef); - - return nodesModelFactory.createUnfiledRecordFolder(info, parameters, null, false); - - } - - @Override - @WebApiDescription(title = "Update unfiled record folder", description = "Updates an unfiled record folder with id 'unfiledRecordFolderId'") - public UnfiledRecordFolder update(String unfiledRecordFolderId, UnfiledRecordFolder unfiledRecordFolderInfo, Parameters parameters) - { - checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId); - mandatory("unfiledRecordFolderInfo", unfiledRecordFolderInfo); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - apiUtils.updateNode(nodeRef, unfiledRecordFolderInfo, parameters); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); - - RetryingTransactionCallback readCallback = new RetryingTransactionCallback() - { - public FileInfo execute() - { - return fileFolderService.getFileInfo(nodeRef); - } - }; - FileInfo info = transactionService.getRetryingTransactionHelper().doInTransaction(readCallback, false, true); - - apiUtils.postActivity(info, unfiledRecordFolderInfo.getParentId(), ActivityType.FILE_UPDATED); - return nodesModelFactory.createUnfiledRecordFolder(info, parameters, null, false); - } - - @Override - @WebApiDescription(title = "Delete unfiled record folder", description = "Deletes an unfiled record folder with id 'unfiledRecordFolderId'") - public void delete(String unfiledRecordFolderId, Parameters parameters) - { - checkNotBlank("unfiledRecordFolderId", unfiledRecordFolderId); - mandatory("parameters", parameters); - - NodeRef nodeRef = apiUtils.lookupAndValidateNodeType(unfiledRecordFolderId, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - - fileFolderService.delete(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/package-info.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/package-info.java deleted file mode 100644 index 5328252283..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/unfiledrecordfolders/package-info.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -/** - * Package info that defines the Information Governance Unfiled Record Folders REST API - * - * @author Ramona Popa - * @since 2.6 - */ -@WebApi(name="gs", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.rm.rest.api.unfiledrecordfolders; -import org.alfresco.rest.framework.Api; -import org.alfresco.rest.framework.WebApi; \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomDateTimeSerializer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomDateTimeSerializer.java deleted file mode 100644 index 2571da5f87..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomDateTimeSerializer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.util; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; - -/** - * Custom Date Time serializer for formatting org.joda.time.DateTime - * - * @author Rodica Sutu - * @since 3.0 - */ -public class CustomDateTimeSerializer extends StdSerializer -{ - /** Date time format */ - private final static DateTimeFormatter DATE_TIME_FORMAT = ISODateTimeFormat.dateTime(); - - public CustomDateTimeSerializer() - { - super(DateTime.class); - } - - protected CustomDateTimeSerializer(Class t) - { - super(t); - } - - /** - * Custom serialize method to convert the org.joda.time.DateTime into string value using the DATE_TIME_FORMAT - * - * @param value datetime value - * @param jgen - * @param provider - * @throws IOException - */ - @Override - public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException - { - jgen.writeString(DATE_TIME_FORMAT.print(value)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateDeserializer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateDeserializer.java deleted file mode 100644 index a843b3ad46..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateDeserializer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.util; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; - -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; - - -/** - * Custom Local Date deserializer converting a string to org.joda.time.LocalDate when the time is optional; - * - * @author Rodica Sutu - * @since 3.0 - */ -public class CustomLocalDateDeserializer extends StdDeserializer -{ - /** Date time format with time optional */ - private final static DateTimeFormatter LOCAL_DATE_OPTIONAL_TIME_PARSER = ISODateTimeFormat.localDateOptionalTimeParser(); - - public CustomLocalDateDeserializer() - { - super(LocalDate.class); - } - - /** - * Custom deserialize method to convert string to the org.joda.time.LocalDate type with LOCAL_DATE_OPTIONAL_TIME_PARSER - * - * @param jp local date value - * @param ctxt - * @throws IOException - */ - @Override - public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException - { - String str = jp.getText().trim(); - if (str.length() == 0) - { - return null; - } - return LOCAL_DATE_OPTIONAL_TIME_PARSER.parseLocalDate(str); - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateSerializer.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateSerializer.java deleted file mode 100644 index d9ea3fc40f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/util/CustomLocalDateSerializer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.util; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; - -/** - * Custom Local Date serializer for formatting org.joda.time.LocalDate - * - * @author Rodica Sutu - * @since 3.0 - */ -public class CustomLocalDateSerializer extends StdSerializer -{ - /** Local date format yyyy-MM-dd*/ - private final static DateTimeFormatter DATE_FORMAT = ISODateTimeFormat.date(); - - public CustomLocalDateSerializer() - { - super(LocalDate.class); - } - - protected CustomLocalDateSerializer(Class t) - { - super(t); - } - - /** - * Custom serialize method to convert the org.joda.time.LocalDate into string value using the DATE_FORMAT - * - * @param value local date value - * @param jgen - * @param provider - * @throws IOException - */ - @Override - public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) throws IOException - { - jgen.writeString(DATE_FORMAT.print(value)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/LockCallback.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/LockCallback.java deleted file mode 100644 index ae87470fa3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/LockCallback.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.util; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.alfresco.repo.lock.JobLockService.JobLockRefreshCallback; - -public class LockCallback implements JobLockRefreshCallback -{ - private final AtomicBoolean running = new AtomicBoolean(true); - - @Override - public boolean isActive() - { - return running.get(); - } - - @Override - public void lockReleased() - { - running.set(false); - } - - public void setIsRunning(boolean isRunning) - { - this.running.set(isRunning); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java deleted file mode 100644 index 08f90c360a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.alfresco.util; - -import org.alfresco.api.AlfrescoPublicApi; - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * Enumeration for sort direction. - * - * @author Tuna Aksoy - * @since 2.5 - */ -@AlfrescoPublicApi -public enum SortDirection -{ - ASC ("asc"), - DESC ("desc"); - - /** A string representation of the sort direction. */ - private final String sortDirection; - - private SortDirection(String sortDirection) - { - this.sortDirection = sortDirection; - } - - /** - * Get the appropriate {@code SortDirection} from a string representation. - * - * @param sortDirectionString A string representation (case will be ignored). - * @return The {@code SortDirection} value. - */ - public static SortDirection getSortDirection(String sortDirectionString) - { - SortDirection sortDirection = null; - - for (SortDirection value : values()) - { - if (value.sortDirection.equalsIgnoreCase(sortDirectionString)) - { - sortDirection = value; - break; - } - } - - if (sortDirection == null) - { - throw new AlfrescoRuntimeException("Sort direction unknown."); - } - - return sortDirection; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/SortUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/SortUtils.java deleted file mode 100644 index e15f76d5fa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/SortUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.util; - -import java.text.Collator; -import java.text.ParseException; -import java.text.RuleBasedCollator; - -/** - * Helper class to provide functionality related to sorting. - * - * @author Tom Page - * @since 2.6 - */ -public class SortUtils -{ - /** The collator used for comparing Strings. */ - private static Collator collator; - - /** Private constructor for util class. */ - private SortUtils() - { - } - - /** - * Get a string comparator that sorts strings according to the locale of the server, and which treats spaces as - * earlier than alphanumeric characters. - * - * @return The comparator. - */ - public static synchronized Collator getStringComparator() - { - if (collator == null) - { - String rules = ((RuleBasedCollator) Collator.getInstance()).getRules(); - try - { - collator = new RuleBasedCollator(rules.replaceAll("<'\u005f'", "<' '<'\u005f'")); - } - catch (ParseException e) - { - throw new IllegalStateException(e); - } - } - return collator; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java deleted file mode 100644 index 76f19d3e63..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/StringUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.util; - -/** - * String utility methods. - * - * @author Tom Page - * @since 2.6 - */ -public class StringUtils -{ - /** Private constructor for the helper class. */ - private StringUtils() {} - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - public static String toIndentedString(Object o) - { - if (o == null) - { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java deleted file mode 100644 index 61f238a754..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java +++ /dev/null @@ -1,429 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.util; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -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 (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 an 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.get(key).toString(); - if (checkValue && isBlank(value)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The value 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; - } - - /** - * Creates a json array from the given {@link String} - * - * @param json The json array as {@link String} - * @return The json array created from the given {@link String} - */ - public static JSONArray createJSONArray(String json) - { - mandatory("json", json); - - JSONArray jsonArray; - - try - { - jsonArray = new JSONArray(json); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json array from the given string '" + json + "'.", error); - } - - return jsonArray; - } - - /** - * Gets the {@link JSONArray} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @return The {@link JSONArray} value of the given key from the json object - */ - public static JSONArray getJSONArrayFromJSONObject(JSONObject jsonObject, String key) - { - JSONArray jsonArray; - - mandatory("jsonObject", jsonObject); - mandatory("key", key); - - try - { - jsonArray = jsonObject.getJSONArray(key); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get the json array for the key '" + key + "'.", error); - } - - return jsonArray; - } - - /** - * Returns {@code true} if the provided {@link WebScriptException} - * represents an HTTP 4xx error, else {@code false}. - */ - public static boolean is4xxError(WebScriptException e) - { - return isStatusInRange(e, 400, 500); - } - - /** - * Returns {@code true} if the provided {@link WebScriptException} - * represents an HTTP 5xx error, else {@code false}. - */ - public static boolean is5xxError(WebScriptException e) - { - return isStatusInRange(e, 500, 600); - } - - private static boolean isStatusInRange(WebScriptException e, int lowerLimitInclusive, int upperLimitExclusive) - { - final int status = e.getStatus(); - return status >= lowerLimitInclusive && status < upperLimitExclusive; - } - - /** - * Gets the {@link JSONObject} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @return The {@link JSONObject} value of the given key from the json object - */ - public static JSONObject getValueFromJSONObject(JSONObject jsonObject, String key) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - - JSONObject value = null; - - try - { - value = jsonObject.getJSONObject(key); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error); - } - - return value; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java deleted file mode 100644 index fc6ed0dfea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.workflow; - -import org.alfresco.service.namespace.QName; - -/** - * Workflow Constants for Records Management - * - * @author Tuna Aksoy - * @since 2.1 - */ -public interface RMWorkflowModel -{ - // Namespace URI - String RM_WORKFLOW_URI = "http://www.alfresco.org/model/rmworkflow/1.0"; - - // Namespace prefix - String RM_WORKFLOW_PREFIX = "rmwf"; - - // Mixed Assignees - QName RM_MIXED_ASSIGNEES = QName.createQName(RM_WORKFLOW_URI, "mixedAssignees"); - - // Requested Information - QName RM_REQUESTED_INFORMATION = QName.createQName(RM_WORKFLOW_URI, "requestedInformation"); - - // Rule creator - QName RM_RULE_CREATOR = QName.createQName(RM_WORKFLOW_URI, "ruleCreator"); -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java deleted file mode 100644 index 3a9c29d8a8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.workflow.requestInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.delegate.TaskListener; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.workflow.activiti.ActivitiScriptNode; -import org.alfresco.repo.workflow.activiti.ActivitiScriptNodeList; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * An assignment handler for the request info workflow. - * An RM manager/admin can select one or more user(s) and/or - * one or more group(s) when starting the request info workflow. - * This assignment handler assigns for everyone a task (it is a pooled task). - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoAssignmentHandler implements TaskListener -{ - private static final long serialVersionUID = -3179929030094957978L; - - /** - * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) - */ - @Override - public void notify(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - // Set the workflow description for the task - delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(RequestInfoUtils.getRecordName(delegateTask))); - - // Get the list of user(s) and/or group(s) - ActivitiScriptNodeList usersAndGroups = (ActivitiScriptNodeList) delegateTask.getVariable("rmwf_mixedAssignees"); - - // Check if it was possible to extract the user(s) and/or group(s) - if (usersAndGroups == null) - { - throw new AlfrescoRuntimeException("It was not possible to extract the user(s) and/or group(s)!!!"); - } - - // Define lists for candidate user(s)/group(s) - List candidateUsers = new ArrayList<>(); - List candidateGroups = new ArrayList<>(); - - // Iterate through the list add user(s)/group(s) to the lists - for (ActivitiScriptNode activitiScriptNode : usersAndGroups) - { - // Get the node type - String type = activitiScriptNode.getType(); - // Get the properties - Map properties = activitiScriptNode.getProperties(); - - // Check if it is a user or a group - if (type.equalsIgnoreCase(ContentModel.TYPE_PERSON.toString())) - { - // Add the user - candidateUsers.add((String) properties.get(ContentModel.PROP_USERNAME.toString())); - } - else if (type.equalsIgnoreCase(ContentModel.TYPE_AUTHORITY_CONTAINER.toString())) - { - // Add the group - candidateGroups.add((String) properties.get(ContentModel.PROP_AUTHORITY_NAME.toString())); - } - else - { - throw new AlfrescoRuntimeException("The type '" + type + "' is neither a user nor a group!!!"); - } - } - - // Check if there is at least one user or one group - if (candidateUsers.size() == 0 && candidateGroups.size() == 0) - { - throw new AlfrescoRuntimeException("Neither a user nor a group was found!!!"); - } - - // Add the user(s) to the task - if (candidateUsers.size() > 0) - { - delegateTask.addCandidateUsers(candidateUsers); - } - - // Add the group(s) to the task - if (candidateGroups.size() > 0) - { - delegateTask.addCandidateGroups(candidateGroups); - } - } - - /** - * Helper method for building the workflow description - * - * @param recordName The name of the record - * @return Returns the workflow description - */ - private String getWorkflowDescription(String recordName) - { - StringBuilder sb = new StringBuilder(); - sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.requested")); - sb.append(" '"); - sb.append(recordName); - sb.append("'"); - return sb.toString(); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java deleted file mode 100644 index d6f65561fb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.workflow.requestInfo; - -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.delegate.TaskListener; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Request info workflow notifier. - * After the pooled task has been finished the initiator of the workflow will - * get a task to verify the information. The initiator will also receive an email. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoNotifier implements TaskListener -{ - private static final long serialVersionUID = -7169400062409052556L; - - /** - * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) - */ - @Override - public void notify(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - // Get the record name - String recordName = RequestInfoUtils.getRecordName(delegateTask); - - // Set the workflow description for the task - delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(recordName)); - - // Assign the task to the initiator - String initiator = RequestInfoUtils.getInitiator(delegateTask); - delegateTask.setAssignee(initiator); - } - - /** - * Helper method for building the workflow description - * - * @param recordName The name of the record - * @return Returns the workflow description - */ - private String getWorkflowDescription(String recordName) - { - StringBuilder sb = new StringBuilder(); - sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.provided")); - sb.append(" '"); - sb.append(recordName); - sb.append("'"); - return sb.toString(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java deleted file mode 100644 index c65c200d37..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.workflow.requestInfo; - -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; -import org.alfresco.repo.workflow.activiti.ActivitiScriptNode; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang3.StringUtils; - -/** - * Util class for the request info workflow - * - * @author Tuna Aksoy - * @since 2.1 - */ -public final class RequestInfoUtils -{ - private RequestInfoUtils() - { - // Will not be called - } - - /** - * Helper method to get the service registry in order to call services - * - * @return Returns the service registry - */ - public static ServiceRegistry getServiceRegistry() - { - ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); - if (config != null) - { - // Fetch the registry that is injected in the activiti spring-configuration - ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); - if (registry == null) - { - throw new AlfrescoRuntimeException( - "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" + - ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); - } - return registry; - } - throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context"); - } - - /** - * Helper method to extract the record name from the task - * - * @param delegateTask The delegate task - * @return Returns the name of the record or an empty string if the record name could not be found - (may be because the record has been deleted in the mean time) - */ - public static String getRecordName(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - String recordName = StringUtils.EMPTY; - - NodeService nodeService = getServiceRegistry().getNodeService(); - ActivitiScriptNode scriptNode = (ActivitiScriptNode) delegateTask.getVariable("bpm_package"); - List childAssocs = nodeService.getChildAssocs(scriptNode.getNodeRef()); - - if (childAssocs.size() > 0) - { - NodeRef docRef= childAssocs.get(0).getChildRef(); - recordName = (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME); - } - - return recordName; - } - - /** - * Helper method to extract the initiator from the task - * - * @param delegateTask The delegate task - * @return Returns the initiator of the workflow. First it will be checked if - * a rule creator exists, which means the the workflow was started via rule. - * In this case the creator of the rule will receive the review task. - * If a rule creator cannot be found the code will try to find the initiator - * of the workflow. If also this is not the case the admin user will be returned. - */ - public static String getInitiator(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - String userName = null; - - String ruleCreator = (String) delegateTask.getVariable("rmwf_ruleCreator"); - if (StringUtils.isBlank(ruleCreator)) - { - ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator"); - if (initiator.exists()) - { - userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString()); - } - else - { - userName = AuthenticationUtil.getAdminUserName(); - } - } - else - { - userName = ruleCreator; - } - - return userName; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java deleted file mode 100644 index 60ed1923b2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.workflow.requestInfo; - -import org.activiti.engine.delegate.DelegateExecution; -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.delegate.TaskListener; -import org.alfresco.util.ParameterCheck; - -/** - * A variable handler for saving the task variables to the execution context. - * Some of the information will be needed in other tasks (e.g. "rmwf_message"). - * This variable handler saves the local task variable to the execution context. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoVariableHandler implements TaskListener -{ - private static final long serialVersionUID = -1759557028641631768L; - - /** - * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) - */ - @Override - public void notify(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - // Save the variable from the task - DelegateExecution execution = delegateTask.getExecution(); - execution.setVariable("rmwf_message", delegateTask.getVariable("rmwf_message")); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties b/amps/ags/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties deleted file mode 100644 index 956533c7fe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties +++ /dev/null @@ -1,73 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# RUN TIME PROPERTIES -# ------------------- - -######################################################################################################################## -# Alfresco configuration for running locally -# -# Configuration when running Tomcat embedded from Maven. -# This will create the alf_data_dev directory relative to Tomcat run folder. -# Property values from the POM but it can also be edited here. -######################################################################################################################## - -dir.root=${alfresco.data.location} - -# Alfresco Repo Webapp (alfresco.war) context, ports etc -alfresco.context=alfresco -alfresco.host=localhost -alfresco.port=8080 -alfresco.protocol=http - -# Alfresco Share Webapp (share.war) context, ports etc -share.context=share -share.host=localhost -share.port=8080 -share.protocol=http - -# Validates and auto-recover if validation fails -index.recovery.mode=AUTO - -# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date -# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597 -# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene -wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060 -wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060 -wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060 - -# Fail or not when there are node integrity checker errors -integrity.failOnError=true - -# Database connection properties -db.driver=${alfresco.db.datasource.class} -db.url=${alfresco.db.url} -db.username=${alfresco.db.username} -db.password=${alfresco.db.password} -db.pool.initial=10 -db.pool.max=100 -hibernate.dialect=${alfresco.db.hibernate.dialect} - -# File servers related properties -# For local runs we disable CIFS and FTP -cifs.enabled=false -ftp.enabled=false - -# Solr config -index.subsystem.name=solr6 -solr.secureComms=none -solr.port=8983 - -#By default the basic auth is on false - REPO-2575 -alfresco.restApi.basicAuthScheme=true \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java deleted file mode 100644 index 1c3b93e44e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test; - -import org.junit.extensions.cpsuite.ClasspathSuite; -import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters; -import org.junit.extensions.cpsuite.ClasspathSuite.SuiteTypes; -import org.junit.extensions.cpsuite.SuiteType; -import org.junit.runner.RunWith; - -/** - * Convenience test suite that runs all the tests. - * - * @author Roy Wetherall - * @since 2.1 - */ -@RunWith(ClasspathSuite.class) -@SuiteTypes({SuiteType.TEST_CLASSES, SuiteType.RUN_WITH_CLASSES, SuiteType.JUNIT38_TEST_CLASSES}) -@ClassnameFilters({ - // Execute all test classes ending with "Test" - ".*Test", - // Exclude the ones ending with "UnitTest" - "!.*UnitTest", - // Put the test classes you want to exclude here - "!.*DataLoadSystemTest", - "!.*RM2072Test", - "!.*RM2190Test", - "!.*RM981SystemTest", - "!.*RM3993Test", - "!.*RM4163Test", - "!.*RecordsManagementEventServiceImplTest", - "!.*RmRestApiTest", - "!.*NotificationServiceHelperSystemTest", - "!.*RetryingTransactionHelperBaseTest", - "!.*RMCaveatConfigServiceImplTest", - // This test is running successfully locally but not on bamboo (if executed as a single test). - // The problem can be reproduced if the whole test suite is run locally as well. - // Tests should not be dependant on other test classes and should run in any order without any problems. - "!.*EmailMapScriptTest" -}) -public class AllTestSuite -{ -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java deleted file mode 100644 index 9e5615c860..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.destroy; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.content.ContentDestructionComponent; -import org.alfresco.module.org_alfresco_module_rm.content.EagerContentStoreCleaner; -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.module.org_alfresco_module_rm.test.util.TestContentCleanser; -import org.alfresco.repo.content.ContentStore; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.rendition.RenditionService; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Acceptance criteria for content destruction and content cleansing. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class DestroyContentTest extends BaseRMTestCase -{ - private static final String BEAN_NAME_CONTENT_CLEANSER = "contentCleanser.test"; - - protected ContentStore contentStore; - protected TestContentCleanser contentCleanser; - protected ContentDestructionComponent contentDestructionComponent; - private EagerContentStoreCleaner eagerContentStoreCleaner; - @SuppressWarnings("unused") - private RenditionService renditionService; - - @Override - protected void initServices() - { - super.initServices(); - contentStore = (ContentStore)applicationContext.getBean("fileContentStore"); - contentCleanser = (TestContentCleanser)applicationContext.getBean(BEAN_NAME_CONTENT_CLEANSER); - eagerContentStoreCleaner = (EagerContentStoreCleaner)applicationContext.getBean("eagerContentStoreCleaner"); - contentDestructionComponent = (ContentDestructionComponent)applicationContext.getBean("contentDestructionComponent"); - renditionService = (RenditionService)applicationContext.getBean("renditionService"); - - // set the test content store cleaner - eagerContentStoreCleaner.setContentCleanser(contentCleanser); - } - - /** - * Given that a record folder is eligible for destruction - * And record ghosting is applied - * When the record folder is destroyed - * Then the record folder and records are ghosted - * And the content is destroyed - */ - public void testRecordFolderDestroy() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordCategoryFolderLevel; - private NodeRef destroyableFolder; - private NodeRef subRecord; - - public void given() throws Exception - { - // create destroyable record folder that contains a record - recordCategoryFolderLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule( - recordCategoryFolderLevel, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - false, - true); - destroyableFolder = recordFolderService.createRecordFolder(recordCategoryFolderLevel, GUID.generate()); - - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_TITLE, GUID.generate()); - InputStream is = DestroyContentTest.class.getResourceAsStream("/alfresco/test/content/Image.jpg"); - - subRecord = utils.createRecord(destroyableFolder, GUID.generate(), props, MimetypeMap.MIMETYPE_IMAGE_JPEG, is); - - // Commented out, because Bamboo doesn't currently support rendition creation - // TODO figure out a way to create renditions that is supported on Bamboo - /* - renditionService.render(subRecord, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "medium")); - */ - - utils.completeRecord(subRecord); - utils.completeEvent(destroyableFolder, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(destroyableFolder, CutOffAction.NAME); - - // assert things are as we expect - assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableFolder).getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(destroyableFolder)); - - // reset test content cleanser - contentCleanser.reset(); - assertFalse(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // destroy the folder - rmActionService.executeRecordsManagementAction(destroyableFolder, DestroyAction.NAME); - } - - public void then() throws Exception - { - // folder and record exist and are ghosted - assertTrue(nodeService.exists(destroyableFolder)); - assertTrue(nodeService.hasAspect(destroyableFolder, ASPECT_GHOSTED)); - assertTrue(nodeService.exists(subRecord)); - assertTrue(nodeService.hasAspect(subRecord, ASPECT_GHOSTED)); - - // record content is destroyed - ContentReader reader = contentService.getReader(subRecord, PROP_CONTENT); - assertNull(reader); - - // content cleansing hasn't taken place - assertFalse(contentCleanser.hasCleansed()); - - // ensure the record isn't in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, subRecord.getId()); - assertFalse(nodeService.exists(archiveNodeRef)); - } - }); - } - - /** - * Given that a record is eligible for destruction - * And record ghosting is applied - * When the record is destroyed - * Then the record is ghosted - * And the content is destroyed - */ - public void testRecordDestroy() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordCategoryRecordLevel; - private NodeRef recordFolder; - private NodeRef destroyableRecord; - - public void given() throws Exception - { - // create destroyable record - recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule( - recordCategoryRecordLevel, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - true, - true); - recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); - destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); - utils.completeRecord(destroyableRecord); - utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); - - // assert things are as we expect - assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); - - // reset test content cleanser - contentCleanser.reset(); - assertFalse(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // destroy the folder - rmActionService.executeRecordsManagementAction(destroyableRecord, DestroyAction.NAME); - } - - public void then() throws Exception - { - // show that record still exists and has the ghosted aspect applied - assertTrue(nodeService.exists(destroyableRecord)); - assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); - - // record content is destroyed - ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); - assertNull(reader); - - // content cleansing hasn't taken place - assertFalse(contentCleanser.hasCleansed()); - - // ensure the record isn't in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); - assertFalse(nodeService.exists(archiveNodeRef)); - - } - }); - } - - /** - * Given that a record is eligible for destruction - * And record ghosting is applied - * And cleansing is configured on - * When the record is destroyed - * Then the record is ghosted - * And the content is cleansed - * And then content is destroyed - */ - public void testRecordDestroyAndCleanse() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordCategoryRecordLevel; - private NodeRef recordFolder; - private NodeRef destroyableRecord; - - public void given() throws Exception - { - // create destroyable record - recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule( - recordCategoryRecordLevel, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - true, - true); - recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); - destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); - utils.completeRecord(destroyableRecord); - utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); - - // assert things are as we expect - assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); - - // reset test content cleanser and configure on - contentCleanser.reset(); - contentDestructionComponent.setCleansingEnabled(true); - assertTrue(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // destroy the folder - rmActionService.executeRecordsManagementAction(destroyableRecord, DestroyAction.NAME); - } - - public void then() throws Exception - { - // show that record still exists and has the ghosted aspect applied - assertTrue(nodeService.exists(destroyableRecord)); - assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); - - // record content is destroyed - ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); - assertNull(reader); - - // content cleansing has taken place - assertTrue(contentCleanser.hasCleansed()); - - // ensure the record isn't in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); - assertFalse(nodeService.exists(archiveNodeRef)); - } - - public void after() throws Exception - { - // reset cleansing to default - contentDestructionComponent.setCleansingEnabled(false); - } - }); - } - - /** - * When a unclassified document (non-record) is deleted - * Then it is deleted but the the content is not immediately destroyed - */ - public void testContentDelete() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef deleteableContent; - private ContentData contentData; - - public void given() throws Exception - { - // create deletable content - assertTrue(nodeService.exists(folder)); - deleteableContent = fileFolderService.create(folder, "myDocument.txt", TYPE_CONTENT).getNodeRef(); - ContentWriter writer = fileFolderService.getWriter(deleteableContent); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(GUID.generate()); - - contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT); - - // assert things are as we expect - assertNotNull(contentData); - assertTrue(contentStore.exists(contentData.getContentUrl())); - - // reset test content cleanser - contentCleanser.reset(); - assertFalse(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // delete the content - nodeService.deleteNode(deleteableContent); - } - - public void then() throws Exception - { - // content deleted but not destroyed - assertFalse(nodeService.exists(deleteableContent)); - assertTrue(contentStore.exists(contentData.getContentUrl())); - - // content cleansing hasn't taken place - assertFalse(contentCleanser.hasCleansed()); - - // ensure the content is in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId()); - assertTrue(nodeService.exists(archiveNodeRef)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java deleted file mode 100644 index a24ae9e424..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -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.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Cut off integration tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class CutOffTest extends BaseRMTestCase -{ - /** - * given we have a record folder that is eligible for cutoff ensure that the - * record can be cut off successfully. - */ - public void testCutOffRecordFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - @Override - public void when() - { - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - - } - - /** - * given that we have a closed record folder eligible for cut off ensure that it can - * be cut off. - *

- * relates to https://issues.alfresco.com/jira/browse/RM-1340 - */ - public void testCutOffClosedRecordFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - - // close the record folder - recordFolderService.closeRecordFolder(recordFolder); - } - - @Override - public void when() - { - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - } - - /** - * given we have a record folder that is eligible for cutoff ensure that the - * record can be cut off successfully. - */ - public void testCutOffUncutOffRecordFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - nodeService.addAspect(recordFolder, ASPECT_UNCUT_OFF, null); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - @Override - public void when() - { - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - - } - - /** - * given we have a record folder that is eligible for cutoff ensure that the - * record can be cut off successfully. - */ - public void testCutOffUncutOffRecordFolderFromSchedule() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - nodeService.addAspect(recordFolder, ASPECT_UNCUT_OFF, null); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - @Override - public void when() - { - // complete event - Map params = new HashMap<>(1); - params.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE); - try - { - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, params); - } - catch(AlfrescoRuntimeException e) { } // expected - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertFalse(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionScheduleInheritanceTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionScheduleInheritanceTest.java deleted file mode 100644 index eae04fb59e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionScheduleInheritanceTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.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.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.RetainAction; -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; - -/** - * Inherit disposition schedule on record level when moving categories. - * - * @author Roxana Lucanu - * @since 2.5 - */ -public class DispositionScheduleInheritanceTest extends BaseRMTestCase -{ - /** - * Given a root record category with a retention schedule - * and another root record category - * When moving the second record category into the first one (with the disposition) - * Then records under the second record category inherit the retention schedule of the parent record category - *

- * relates to https://issues.alfresco.com/jira/browse/RM-7065 - */ - public void testRetentionScheduleInheritance_RM7065() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef category1; - NodeRef subcategory2; - NodeRef record; - - @Override - public void given() - { - // create root category1 - category1 = filePlanService.createRecordCategory(filePlan, generate()); - - // create record level disposition schedule for category1 - createDispositionSchedule(category1); - - // create subcategory1 under category1 - NodeRef subcategory1 = filePlanService.createRecordCategory(category1, generate()); - - // create root category2 - NodeRef category2 = filePlanService.createRecordCategory(filePlan, generate()); - - // create subcategory2 under category2 - subcategory2 = filePlanService.createRecordCategory(category2, generate()); - - // create folder under subcategory2 - folder = recordFolderService.createRecordFolder(subcategory2, generate()); - - // file record in folder and complete it - record = utils.createRecord(folder, generate(), generate()); - utils.completeRecord(record); - } - - @Override - public void when() throws Exception - { - // move subcategory2 under category1 - fileFolderService.move(subcategory2, category1, null); - } - - @Override - public void then() throws Exception - { - dispositionService.getDispositionSchedule(record); - // check for the lifecycle aspect - assertTrue("Record " + record + " doesn't have the disposition lifecycle aspect.", nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - } - - private void createDispositionSchedule(NodeRef category) - { - DispositionSchedule ds = utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_DESCRIPTION, true, false, false); - - // CUTOFF immediately - Map cutOff = new HashMap(3); - cutOff.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - cutOff.put(PROP_DISPOSITION_DESCRIPTION, generate()); - cutOff.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(ds, cutOff); - - // RETAIN immediately - Map retain = new HashMap(3); - retain.put(PROP_DISPOSITION_ACTION_NAME, RetainAction.NAME); - retain.put(PROP_DISPOSITION_DESCRIPTION, generate()); - retain.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(ds, retain); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/MultipleSchedulesTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/MultipleSchedulesTest.java deleted file mode 100644 index 4dff5967b5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/MultipleSchedulesTest.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.Date; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -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.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ApplicationContextHelper; -import org.springframework.extensions.webscripts.GUID; - -import com.google.common.collect.ImmutableMap; - -/** - * Integration tests for records linked to multiple disposition schedules. - * - * @author Tom Page - * @since 2.3.1 - */ -public class MultipleSchedulesTest extends BaseRMTestCase -{ - /** A unique prefix for the constants in this test. */ - protected static final String TEST_PREFIX = MultipleSchedulesTest.class.getName() + GUID.generate() + "_"; - /** The name to use for the first category. */ - protected static final String CATEGORY_A_NAME = TEST_PREFIX + "CategoryA"; - /** The name to use for the folder within the first category. */ - protected static final String FOLDER_A_NAME = TEST_PREFIX + "FolderA"; - /** The name to use for the second category. */ - protected static final String CATEGORY_B_NAME = TEST_PREFIX + "CategoryB"; - /** The name to use for the folder within the second category. */ - protected static final String FOLDER_B_NAME = TEST_PREFIX + "FolderB"; - /** The name to use for the third category. */ - protected static final String CATEGORY_C_NAME = TEST_PREFIX + "CategoryC"; - /** The name to use for the folder within the third category. */ - protected static final String FOLDER_C_NAME = TEST_PREFIX + "FolderC"; - /** The name to use for the record. */ - protected static final String RECORD_NAME = TEST_PREFIX + "Record"; - - /** The internal disposition service is used to avoid permissions issues when updating the record. */ - private DispositionService internalDispositionService; - - /** The first category node. */ - private NodeRef categoryA; - /** The folder node within the first category. */ - private NodeRef folderA; - /** The second category node. */ - private NodeRef categoryB; - /** The folder node within the second category. */ - private NodeRef folderB; - /** The third category node. */ - private NodeRef categoryC; - /** The folder node within the third category. */ - private NodeRef folderC; - /** The record node. */ - private NodeRef record; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - BehaviourTest.initBehaviourTests(retryingTransactionHelper); - - // Get the application context - applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); - internalDispositionService = (DispositionService) applicationContext.getBean("dispositionService"); - - // Ensure different records are used for each test. - record = null; - } - - /** - * Create two categories each containing a folder. Set up a schedule on category A that applies to records (cutoff - * immediately, destroy immediately). Set up a schedule on category B that is the same, but with a week delay before - * destroy becomes eligible. - */ - private void setUpFilePlan() - { - // Only set up the file plan if it hasn't already been done. - if (categoryA != null) - { - return; - } - - // Create two categories. - categoryA = filePlanService.createRecordCategory(filePlan, CATEGORY_A_NAME); - categoryB = filePlanService.createRecordCategory(filePlan, CATEGORY_B_NAME); - categoryC = filePlanService.createRecordCategory(filePlan, CATEGORY_C_NAME); - // Create a disposition schedule for category A (Cut off immediately, then Destroy immediately). - DispositionSchedule dispSchedA = utils.createBasicDispositionSchedule(categoryA, "instructions", "authority", true, false); - Map cutOffParamsA = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dispSchedA, cutOffParamsA); - Map destroyParamsA = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dispSchedA, destroyParamsA); - // Create a disposition schedule for category B (Cut off immediately, then Destroy one week after cutoff). - DispositionSchedule dispSchedB = utils.createBasicDispositionSchedule(categoryB, "instructions", "authority", true, false); - Map cutOffParamsB = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dispSchedB, cutOffParamsB); - Map destroyParamsB = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_WEEK, - PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE); - dispositionService.addDispositionActionDefinition(dispSchedB, destroyParamsB); - // Create a disposition schedule for category C (Cut off immediately, then Destroy one year after cutoff). - DispositionSchedule dispSchedC = utils.createBasicDispositionSchedule(categoryC, "instructions", "authority", true, false); - Map cutOffParamsC = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dispSchedC, cutOffParamsC); - Map destroyParamsC = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_YEAR, - PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE); - dispositionService.addDispositionActionDefinition(dispSchedC, destroyParamsC); - // Create a folder within each category. - folderA = recordFolderService.createRecordFolder(categoryA, FOLDER_A_NAME); - folderB = recordFolderService.createRecordFolder(categoryB, FOLDER_B_NAME); - folderC = recordFolderService.createRecordFolder(categoryC, FOLDER_C_NAME); - } - - /** - * RM-2526 - *

-     * Given a record subject to a disposition schedule
-     * And it is linked to a disposition schedule with the same step order, but a longer destroy step
-     * When the record is moved onto the destroy step
-     * Then the "as of" date is calculated using the longer period.
-     * 
- */ - public void testLinkedToLongerSchedule() - { - Calendar calendar = Calendar.getInstance(); - test() - .given(() -> { - setUpFilePlan(); - - // Create a record filed under category A and linked to category B. - record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.link(record, folderB); - }) - .when(() -> { - // Cut off the record. - dispositionService.cutoffDisposableItem(record); - // Ensure the update has been applied to the record. - internalDispositionService.updateNextDispositionAction(record); - calendar.setTime((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE)); - calendar.add(Calendar.WEEK_OF_YEAR, 1); - }) - .then() - .expect(calendar.getTime()) - .from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate()) - .because("Record should follow largest rentention schedule period, which is one week."); - } - - /** - * RM-2526 - *

-     * Given a record subject to a disposition schedule
-     * And it is linked to a disposition schedule with the same step order, but a shorter destroy step
-     * When the record is moved onto the destroy step
-     * Then the "as of" date is calculated using the longer period.
-     * 
- */ - public void testLinkedToShorterSchedule() - { - Calendar calendar = Calendar.getInstance(); - test() - .given(() -> { - setUpFilePlan(); - // Create a record filed under category B and linked to category A. - record = fileFolderService.create(folderB, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.link(record, folderA); - }) - .when(() -> { - // Cut off the record. - dispositionService.cutoffDisposableItem(record); - // Ensure the update has been applied to the record. - internalDispositionService.updateNextDispositionAction(record); - calendar.setTime((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE)); - calendar.add(Calendar.WEEK_OF_YEAR, 1); - }) - .then() - .expect(calendar.getTime()) - .from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate()) - .because("Record should follow largest rentention schedule period, which is one week."); - } - - /** - * RM-4292 - *

-     * Given a record subject to a mixed disposition schedule
-     * When the record is unlinked from one of its secondary parents
-     * Then the next disposition action is recalculated.
-     * 
- */ - public void testRecalculateDispositionWhenUnlinking() - { - test() - .given(() -> { - setUpFilePlan(); - // Create a record filed under category A and linked to category B and C. - record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.link(record, folderB); - recordService.link(record, folderC); - // Cut off the record. - dispositionService.cutoffDisposableItem(record); - // Ensure the update has been applied to the record. - internalDispositionService.updateNextDispositionAction(record); - }) - .when(() -> { - // Unlink the record from folder B. - recordService.unlink(record, folderB); - }) - .then() - .expect(false) - .from(() -> dispositionService.isNextDispositionActionEligible(record)) - .because("Destroy action shouldn't be available, as the record should follow disposition schedule from category C."); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateDispositionScheduleTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateDispositionScheduleTest.java deleted file mode 100644 index 212f3248ab..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateDispositionScheduleTest.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -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.job.publish.DispositionActionDefinitionPublishExecutor; -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.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ApplicationContextHelper; -import org.springframework.extensions.webscripts.GUID; - -/** - * Integration tests for updating the disposition schedule. - * - * @author Tom Page - * @since 2.3.1 - */ -public class UpdateDispositionScheduleTest extends BaseRMTestCase -{ - /** A unique prefix for the constants in this test. */ - protected static final String TEST_PREFIX = UpdateDispositionScheduleTest.class.getName() + GUID.generate() + "_"; - /** The name to use for the category. */ - protected static final String CATEGORY_NAME = TEST_PREFIX + "Category"; - /** The name to use for the folder. */ - protected static final String FOLDER_NAME = TEST_PREFIX + "Folder"; - /** The name to use for the record. */ - protected static final String RECORD_NAME = TEST_PREFIX + "Record"; - - /** The executor for the disposition update job. */ - private DispositionActionDefinitionPublishExecutor dispositionActionDefinitionPublishExecutor; - /** The internal disposition service is used to avoid permissions issues when updating the record. */ - private DispositionService internalDispositionService; - - /** The category node. */ - private NodeRef category; - /** The folder node. */ - private NodeRef folder; - /** The record node. */ - private NodeRef record; - /** The 'disposition as of' date from before the 'when' step. */ - private Date originalAsOfDate; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - BehaviourTest.initBehaviourTests(retryingTransactionHelper); - - // Get the application context - applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); - dispositionActionDefinitionPublishExecutor = applicationContext.getBean(DispositionActionDefinitionPublishExecutor.class); - internalDispositionService = (DispositionService) applicationContext.getBean("dispositionService"); - } - - /** - * RM-3386 - *

-     * Given a record subject to a disposition schedule
-     * And the next step is due to run at some period after the date the content was created
-     * When I update the period of the next step (and wait for this to be processed)
-     * Then the "as of" date is updated to be at the new period after the creation date.
-     * 
- */ - public void testUpdatePeriod() - { - test() - .given(() -> { - // Create a category. - category = filePlanService.createRecordCategory(filePlan, CATEGORY_NAME); - // Create a disposition schedule for the category (Cut off immediately, then Destroy 1 year after the creation date). - DispositionSchedule dispSched = utils.createBasicDispositionSchedule(category, "instructions", "authority", true, false); - Map cutOffParams = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dispSched, cutOffParams); - Map destroyParams = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_YEAR, - PROP_DISPOSITION_PERIOD_PROPERTY, ContentModel.PROP_CREATED); - dispositionService.addDispositionActionDefinition(dispSched, destroyParams); - // Create a folder containing a record within the category. - folder = recordFolderService.createRecordFolder(category, FOLDER_NAME); - record = fileFolderService.create(folder, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef(); - - dispositionService.cutoffDisposableItem(record); - // Ensure the update has been applied to the record. - internalDispositionService.updateNextDispositionAction(record); - - originalAsOfDate = dispositionService.getNextDispositionAction(record).getAsOfDate(); - }) - .when(() -> { - // Update the Destroy step to be 3 years after the creation date. - DispositionSchedule dispSched = dispositionService.getDispositionSchedule(category); - DispositionActionDefinition destroy = dispSched.getDispositionActionDefinitionByName(DestroyAction.NAME); - Map destroyParams = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME, - PROP_DISPOSITION_DESCRIPTION, "description", - PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_THREE_YEARS, - PROP_DISPOSITION_PERIOD_PROPERTY, ContentModel.PROP_CREATED); - dispositionService.updateDispositionActionDefinition(destroy, destroyParams); - - // Make the disposition action definition update job run. - dispositionActionDefinitionPublishExecutor.publish(destroy.getNodeRef()); - }) - .then() - .expect(true) - .from(() -> aboutTwoYearsApart(originalAsOfDate, dispositionService.getNextDispositionAction(record).getAsOfDate())) - .because("Increasing the destroy period by two years should increase the 'as of' date by two years."); - } - - /** - * Check that the two given dates are approximately two years apart. - *

- * This actually just checks that they're more than one and less than three years apart, because leap years make - * things hard to calculate. - * - * @return true if the two dates are about two years apart. - */ - private boolean aboutTwoYearsApart(Date start, Date end) - { - long days = daysBetween(start, end); - long yearInDays = 365; - return (yearInDays < days) && (days < 3 * yearInDays); - } - - /** Find the number of days between the two dates. */ - private long daysBetween(Date start, Date end) - { - return TimeUnit.MILLISECONDS.toDays(end.getTime() - start.getTime()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java deleted file mode 100644 index 7dddbc3288..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.PERIOD_ONE_WEEK; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** -* Update next disposition step integration tests. -* -* @author Roxana Lucanu -* @since 2.3.1 -*/ -public class UpdateNextDispositionActionTest extends BaseRMTestCase -{ - /** - * Given a record with multiple dispositions - * When updating the next step - * Then the action is available - *

- * relates to https://issues.alfresco.com/jira/browse/RM-3060 - */ - public void testUpdateNextDispositionAction_RM3060() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef record; - NodeRef folder2; - - @Override - public void given() - { - // create category1 - NodeRef category1 = filePlanService.createRecordCategory(filePlan, generate()); - - // create disposition schedule for category1 - createDispositionSchedule(category1); - - // create category2 - NodeRef category2 = filePlanService.createRecordCategory(filePlan, generate()); - - // create disposition schedule for category2 - createDispositionSchedule(category2); - - // create folder2 inside category2 - folder2 = recordFolderService.createRecordFolder(category2, generate()); - - // create folder1 inside category1 - NodeRef folder1 = recordFolderService.createRecordFolder(category1, generate()); - - // create record inside folder1 - record = utils.createRecord(folder1, generate(), generate()); - - } - @Override - public void when() throws Exception - { - // link the record to folder2 - recordService.link(record, folder2); - - // complete record - utils.completeRecord(record); - - // cut off - rmActionService.executeRecordsManagementAction(record, CutOffAction.NAME, null); - } - - @Override - public void then() throws Exception - { - assertTrue("Record " + record + " doesn't have the cutOff aspect.", nodeService.hasAspect(record, ASPECT_CUT_OFF)); - } - }); - } - - private void createDispositionSchedule(NodeRef category) - { - DispositionSchedule ds = utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_DESCRIPTION, true, false, false); - - // create the properties for CUTOFF action and add it to the disposition action definition - Map cutOff = new HashMap<>(3); - cutOff.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - cutOff.put(PROP_DISPOSITION_DESCRIPTION, generate()); - cutOff.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(ds, cutOff); - - // create the properties for TRANSFER action and add it to the disposition action definition - Map transfer = new HashMap<>(3); - transfer.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); - transfer.put(PROP_DISPOSITION_DESCRIPTION, generate()); - transfer.put(PROP_DISPOSITION_EVENT, (Serializable)Collections.singletonList(DEFAULT_EVENT_NAME)); - dispositionService.addDispositionActionDefinition(ds, transfer); - - // create the properties for DESTROY action and add it to the disposition action definition - Map destroy = new HashMap<>(3); - destroy.put(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME); - destroy.put(PROP_DISPOSITION_DESCRIPTION, generate()); - destroy.put(PROP_DISPOSITION_PERIOD, PERIOD_ONE_WEEK); - dispositionService.addDispositionActionDefinition(ds, destroy); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java deleted file mode 100644 index c2a5cff099..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.dod; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.util.GUID; - - -/** - * Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RM1147DODRMSiteTest extends BaseRMTestCase implements DOD5015Model -{ - /** - * Don't create a RM test site in setup - */ - @Override - protected boolean isRMSiteTest() - { - return false; - } - - /** - * Test the creation of a DOD file plan via the file plan service - */ - public void testCreateDODFilePlan() - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return filePlanService.createFilePlan(folder, "myDODfileplan", TYPE_DOD_5015_FILE_PLAN); - } - - @Override - public void test(NodeRef filePlan) throws Exception - { - assertNotNull(filePlan); - assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan)); - assertTrue(filePlanService.isFilePlanComponent(filePlan)); - assertTrue(filePlanService.isFilePlan(filePlan)); - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertNotNull(filePlanService.getUnfiledContainer(filePlan)); - assertNotNull(filePlanService.getHoldContainer(filePlan)); - assertNotNull(filePlanService.getTransferContainer(filePlan)); - assertTrue(filePlanService.getFilePlans().contains(filePlan)); - assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty()); - } - }); - } - - /** - * Test the creation of a DOD site via the site service - */ - public void testCreateDODRMSite() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public SiteInfo run() throws Exception - { - return siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); - } - - @Override - public void test(SiteInfo siteInfo) throws Exception - { - assertNotNull(siteInfo); - assertEquals(TYPE_DOD_5015_SITE, nodeService.getType(siteInfo.getNodeRef())); - - NodeRef filePlan = siteService.getContainer(siteId, "documentLibrary"); - assertNotNull(filePlan); - assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan)); - assertTrue(filePlanService.isFilePlanComponent(filePlan)); - assertTrue(filePlanService.isFilePlan(filePlan)); - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertNotNull(filePlanService.getUnfiledContainer(filePlan)); - assertNotNull(filePlanService.getHoldContainer(filePlan)); - assertNotNull(filePlanService.getTransferContainer(filePlan)); - assertTrue(filePlanService.getFilePlans().contains(filePlan)); - assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty()); - } - }); - } - - /** - * Test to ensure that a record created in the a DOD site does have the DOD meta-data attached - */ - public void testDODRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - assertTrue(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD)); - } - }); - } - - /** - * Test to ensure a record created in a vanilla site does not have the DOD meta-data attached - */ - public void testVanillaRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - assertFalse(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java deleted file mode 100644 index f89645054c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.dod; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - - -/** - * Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RM1194ExcludeDoDRecordTypesTest extends BaseRMTestCase implements DOD5015Model -{ - /** - * Don't create a RM test site in setup - */ - @Override - protected boolean isRMSiteTest() - { - return false; - } - - /** - * Ensure that the correct record metadata aspects are available for a DoD record. - */ - public void testDODRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - Set aspects = recordService.getRecordMetadataAspects(record); - assertNotNull(aspects); - assertEquals(5, aspects.size()); - } - }); - } - - /** - * Ensure that the correct record metadata aspects are available for a vanilla record. - */ - public void testVanillaRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - Set aspects = recordService.getRecordMetadataAspects(record); - assertNotNull(aspects); - assertEquals(2, aspects.size()); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java deleted file mode 100644 index a0d7e3c2e1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.event; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -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.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -/** - * Complete events integration tests. - *

- * Relates to: - * - https://issues.alfresco.com/jira/browse/RM-1341 - * - * @author Roy Wetherall - * @since 2.2 - */ -public class CompleteEventsTest extends BaseRMTestCase -{ - private static final String ANOTHER_EVENT = "abolished"; - - /** - * test completion of a single event on a record level disposition schedule - */ - public void testCompleteSingleEventRecordLevel() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", true, true); - - // create record folder - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - } - - public void when() - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(record, CompleteEventAction.NAME, params); - - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test completion of a single event at the record level - */ - public void testCompleteSimpleSingleEventRecordFolderLevel() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordFolder; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, true); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - - } - - public void when() - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test complete event given at least one event is needed for the disposition action to be eligible - */ - public void testAtLeastOneEventToBeEligible() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); - - Map adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); - - List events = new ArrayList<>(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add(ANOTHER_EVENT); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - dispositionService.addDispositionActionDefinition(mySchedule, adParams); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - - } - public void when() - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); - assertNotNull(eventDetails); - assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); - assertFalse(eventDetails.isEventComplete()); - assertNull(eventDetails.getEventCompletedAt()); - assertNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test that disposition action is not eligible given all events need to be completed and only has been - */ - public void testOnlyOneOfAllEventsSoNotEligible() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); - - Map adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_EVENT_COMBINATION, "and"); - - List events = new ArrayList<>(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add(ANOTHER_EVENT); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - dispositionService.addDispositionActionDefinition(mySchedule, adParams); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - } - - public void when() - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - assertFalse(dispositionService.isNextDispositionActionEligible(recordFolder)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); - assertNotNull(eventDetails); - assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); - assertFalse(eventDetails.isEventComplete()); - assertNull(eventDetails.getEventCompletedAt()); - assertNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test event complete makes disposition eligible given that all events are complete and required - */ - public void testAllEventsSoEligible() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); - - Map adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_EVENT_COMBINATION, "and"); - - List events = new ArrayList<>(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add(ANOTHER_EVENT); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - dispositionService.addDispositionActionDefinition(mySchedule, adParams); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - } - - public void when() - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - - // build action properties - params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, ANOTHER_EVENT); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); - assertNotNull(eventDetails); - assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - } - }); - } - - /** - * test complete event works for multi-filed record - */ - public void testCompleteEventWhenCutoffMultiFiled_RM1341() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef recordCategory2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", true, true); - - // create record folder - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - NodeRef recordFolder2 = recordFolderService.createRecordFolder(recordCategory2, GUID.generate()); - - // file record - String recordName = GUID.generate(); - record = utils.createRecord(recordFolder, recordName, "title"); - utils.completeRecord(record); - - // link record to second record folder - nodeService.addChild(recordFolder2, record, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, recordName)); - } - - public void when() - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(record, CompleteEventAction.NAME, params); - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java deleted file mode 100644 index 742bb6428d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddActiveContentToHoldTest.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.site.SiteModel.SITE_MANAGER; - -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.repo.security.permissions.AccessDeniedException; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Add Active Content To Hold Integration Tests - * - * @author Claudia Agache - * @since 3.2 - */ -public class AddActiveContentToHoldTest extends BaseRMTestCase -{ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * Given active content - * And file permission on the hold - * And the appropriate capability to add to hold - * When I try to add the active content to the hold - * Then the active content is frozen - * And the active content is contained within the hold - */ - public void testAddDocumentToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - } - - public void when() - { - // add the active content to hold - holdService.addToHold(hold, dmDocument); - } - - public void then() - { - // active content is held - assertTrue(freezeService.isFrozen(dmDocument)); - - // collaboration folder has frozen children - assertFalse(freezeService.isFrozen(dmFolder)); - assertTrue(freezeService.hasFrozenChildren(dmFolder)); - - // collaboration folder is not held - assertFalse(holdService.getHeld(hold).contains(dmFolder)); - assertFalse(holdService.heldBy(dmFolder, true).contains(hold)); - - // hold contains active content - assertTrue(holdService.getHeld(hold).contains(dmDocument)); - assertTrue(holdService.heldBy(dmDocument, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(dmFolder, ASPECT_HELD_CHILDREN)); - assertEquals(1, nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - /** - * Given active content - * And a non rm user with write permission on active content - * When user tries to add the active content to hold - * Then AccessDeniedException is thrown - */ - public void testAddDocumentToHoldAsNonRMUser() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - private NodeRef hold; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - } - - public void when() - { - // add the active content to hold as a non RM user - AuthenticationUtil.runAs( - (RunAsWork) () -> { - holdService.addToHold(hold, dmDocument); - return null; - }, dmCollaborator); - } - }); - } - - /** - * Given active content - * And a rm user with Filing permission on hold and Add to Hold Capability, but only read permission on active content - * When user tries to add the active content to hold - * Then an exception is thrown - */ - public void testAddDocumentToHoldNoWritePermissionOnDoc() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - private NodeRef hold; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - //add rm Admin as consumer in collaboration site to have read permissions on dmDocument - siteService.setMembership(collabSiteId, rmAdminName, SiteModel.SITE_CONSUMER); - } - - public void when() - { - // add the active content to hold as a RM admin who has Add to Hold Capability and filing permission on - // hold, but no Write permissions on doc - AuthenticationUtil.runAs( - (RunAsWork) () -> { - holdService.addToHold(hold, dmDocument); - return null; - }, rmAdminName); - } - }); - } - - /** - * Given active content - * And a rm user with Add to Hold Capability, write permission on active content and only Read permission on hold - * When user tries to add the active content to hold - * Then AccessDeniedException is thrown - */ - public void testAddDocumentToHoldNoFilingPermissionOnHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class, recordsManagerName, false) - { - private NodeRef hold; - - public void given() - { - AuthenticationUtil.runAs( - (RunAsWork) () -> { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - //add Read permission on hold - filePlanPermissionService.setPermission(hold, recordsManagerName, RMPermissionModel.READ_RECORDS); - - //add recordsManagerPerson as manager in collaboration site to have write permissions on dmDocument - siteService.setMembership(collabSiteId, recordsManagerName, SITE_MANAGER); - return null; - }, getAdminUserName()); - } - - public void when() - { - // add the active content to hold as a RM manager who has Add to Hold Capability and write permission on - // doc, but no filing permission on hold - holdService.addToHold(hold, dmDocument); - } - }); - } - - /** - * Given active content - * And a rm user with write permission on active content and Filing permission on hold, but no Add to Hold Capability - * When user tries to add the active content to hold - * Then AccessDeniedException is thrown - */ - public void testAddDocumentToHoldNoCapability() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class, powerUserName, false) - { - private NodeRef hold; - - public void given() - { - AuthenticationUtil.runAs( - (RunAsWork) () -> { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - //add powerUserPerson as manager in collaboration site to have write permissions on dmDocument - siteService.setMembership(collabSiteId, powerUserName, SiteModel.SITE_MANAGER); - - //assign powerUserPerson filing permission on hold - filePlanPermissionService.setPermission(hold, powerUserName, FILING); - return null; - }, getAdminUserName()); - } - - public void when() - { - // add the active content to hold as a RM power user who has write permission on doc and filing - // permission on hold, but no Add To Hold capability - holdService.addToHold(hold, dmDocument); - } - }); - } - - /** - * Given active content on hold - * When I try to add content to another hold - * And I have file permission on the other hold - * And I have the appropriate capability to add to hold - * Then the active content is contained within both holds - * And the active content remains frozen - */ - public void testAddDocumentToAnotherHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef hold2; - - public void given() - { - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, dmDocument); - } - - public void when() - { - holdService.addToHold(hold2, dmDocument); - } - - public void then() - { - assertTrue(freezeService.isFrozen(dmDocument)); - assertTrue(holdService.heldBy(dmDocument, true).contains(hold)); - assertTrue(holdService.heldBy(dmDocument, true).contains(hold2)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddToHoldTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddToHoldTest.java deleted file mode 100644 index 33dc11537e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddToHoldTest.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeAddToHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnAddToHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.BehaviourDefinition; -import org.alfresco.repo.policy.ClassBehaviourBinding; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Add To Hold Integration Tests - * - * @author Roy Wetherall - * @since 2.2 - */ - -public class AddToHoldTest extends BaseRMTestCase implements BeforeAddToHoldPolicy, OnAddToHoldPolicy -{ - private static final int RECORD_COUNT = 10; - - private boolean beforeAddToHoldFlag = false; - private boolean onAddToHoldFlag = false; - - public void testAddRecordToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private NodeRef record; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - record = recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null); - - // assert current states - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.isFrozen(record)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - - public void when() throws Exception - { - // add the record to hold - holdService.addToHold(hold, record); - } - - public void then() - { - // record is held - assertTrue(freezeService.isFrozen(record)); - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // hold contains record - assertTrue(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(1, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - - } - - public void testAddRecordsToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList<>(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // assert current states - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - } - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - - public void when() throws Exception - { - // add the record to hold - holdService.addToHold(hold, records); - } - - public void then() - { - // record is held - for (NodeRef record : records) - { - assertTrue(freezeService.isFrozen(record)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - for (NodeRef record : records) - { - // hold contains record - assertTrue(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - } - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(RECORD_COUNT, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testAddRecordFolderToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList<>(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // assert current states - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - } - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - - public void when() throws Exception - { - // add the record to hold - holdService.addToHold(hold, recordFolder); - } - - public void then() - { - for (NodeRef record : records) - { - // record is held - assertTrue(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertTrue(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // hold contains record folder - assertTrue(holdService.getHeld(hold).contains(recordFolder)); - assertTrue(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(RECORD_COUNT, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - - } - - public void testPolicyNotificationForAddToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - BehaviourDefinition beforeAddToHoldBehaviour; - BehaviourDefinition onAddToHoldBehaviour; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - // create a record category -> record folder - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - beforeAddToHoldBehaviour = policyComponent.bindClassBehaviour(BeforeAddToHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD, new JavaBehaviour(AddToHoldTest.this, "beforeAddToHold", NotificationFrequency.EVERY_EVENT)); - - onAddToHoldBehaviour = policyComponent.bindClassBehaviour(OnAddToHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD, new JavaBehaviour(AddToHoldTest.this, "onAddToHold", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeAddToHoldFlag); - assertFalse(onAddToHoldFlag); - } - - public void when() throws Exception - { - // add the record folder to hold - holdService.addToHold(hold, recordFolder); - } - - public void then() - { - assertTrue(beforeAddToHoldFlag); - assertTrue(onAddToHoldFlag); - } - - public void after() - { - policyComponent.removeClassDefinition(beforeAddToHoldBehaviour); - policyComponent.removeClassDefinition(onAddToHoldBehaviour); - } - }); - } - - @Override - public void beforeAddToHold(NodeRef hold, NodeRef contentNodeRef) - { - beforeAddToHoldFlag = true; - } - - @Override - public void onAddToHold(NodeRef hold, NodeRef contentNodeRef) - { - onAddToHoldFlag = true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java deleted file mode 100644 index fc80eb7310..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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.hold.HoldServicePolicies.BeforeCreateHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnCreateHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.BehaviourDefinition; -import org.alfresco.repo.policy.ClassBehaviourBinding; -import org.alfresco.repo.policy.JavaBehaviour; -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 implements BeforeCreateHoldPolicy, OnCreateHoldPolicy -{ - // Test user - private String testUser = null; - - private boolean beforeCreateHoldFlag = false; - private boolean onCreateHoldFlag = false; - - /** - * @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)); - } - }); - } - - public void testPolicyNotificationForCreateHold() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - BehaviourDefinition beforeCreateHoldBehaviour; - BehaviourDefinition onCreateHoldBehaviour; - - public void given() - { - beforeCreateHoldBehaviour = policyComponent.bindClassBehaviour(BeforeCreateHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD_CONTAINER, - new JavaBehaviour(CreateHoldTest.this, "beforeCreateHold", NotificationFrequency.EVERY_EVENT)); - - onCreateHoldBehaviour = policyComponent.bindClassBehaviour(OnCreateHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD, - new JavaBehaviour(CreateHoldTest.this, "onCreateHold", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeCreateHoldFlag); - assertFalse(onCreateHoldFlag); - } - - public void when() - { - // Create a hold - NodeRef hold = holdService.createHold(filePlan, generate(), generate(), generate()); - } - - public void then() - { - assertTrue(beforeCreateHoldFlag); - assertTrue(onCreateHoldFlag); - } - - public void after() - { - policyComponent.removeClassDefinition(beforeCreateHoldBehaviour); - policyComponent.removeClassDefinition(onCreateHoldBehaviour); - } - }); - - } - - @Override - public void beforeCreateHold(String name, String reason) - { - beforeCreateHoldFlag = true; - } - - @Override - public void onCreateHold(NodeRef hold) - { - onCreateHoldFlag = true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java deleted file mode 100644 index 713702537f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import static org.alfresco.util.GUID.generate; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeDeleteHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnDeleteHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.BehaviourDefinition; -import org.alfresco.repo.policy.ClassBehaviourBinding; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hold service integration test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DeleteHoldTest extends BaseRMTestCase implements BeforeDeleteHoldPolicy, OnDeleteHoldPolicy -{ - /** Constants for the holds */ - protected static final String HOLD1_NAME = "hold one"; - protected static final String HOLD2_NAME = "hold two"; - protected static final String HOLD1_REASON = "I have my reasons"; - protected static final String HOLD2_REASON = "secrets are everything"; - protected static final String HOLD1_DESC = "but I'll not describe them here!"; - protected static final String HOLD2_DESC = "no then! that's just not on!"; - - private boolean beforeDeleteHoldFlag = false; - private boolean onDeleteHoldFlag = false; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * Creates a hold and checks if the hold is null or not - * - * @return {@link NodeRef} Node reference of the hold. - */ - protected NodeRef createAndCheckHold() - { - NodeRef hold = holdService.createHold(filePlan, HOLD1_NAME, HOLD1_REASON, HOLD1_DESC); - assertNotNull(hold); - return hold; - } - - /** - * Creates two holds and checks them if they are null or not - * - * @return List of {@link NodeRef}s of the holds. - */ - protected List createAndCheckHolds() - { - List holds = new ArrayList<>(2); - holds.add(createAndCheckHold()); - NodeRef hold2 = holdService.createHold(filePlan, HOLD2_NAME, HOLD2_REASON, HOLD2_DESC); - assertNotNull(hold2); - holds.add(hold2); - assertEquals(2, holds.size()); - return holds; - } - - public void testDeleteHoldBehaviourForRecordFolder() - { - NodeRef hold1 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create test holds - NodeRef newHold = createAndCheckHold(); - // add the record folder to hold1 - holdService.addToHold(newHold, rmFolder); - - return newHold; - } - }); - //Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // assert that the folder and records are frozen - assertTrue(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(recordDeclaredOne)); - - // check the contents of the hold - List frozenNodes = holdService.getHeld(hold1); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - assertEquals(rmFolder, frozenNodes.get(0)); - - // delete the hold - holdService.deleteHold(hold1); - - // assert that the folder and records no longer frozen - assertFalse(freezeService.isFrozen(rmFolder)); - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordDeclaredOne)); - - // confirm the hold has been deleted - assertNull(holdService.getHold(filePlan, "hold one")); - - return null; - } - }); - } - - public void testDeleteHoldBehaviourForMultipleHolds() - { - List holds = doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - // create test holds - return createAndCheckHolds(); - } - }); - //Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - NodeRef hold1 = holds.get(0); - NodeRef hold2 = holds.get(1); - - // add the record folder to hold1 - holdService.addToHold(hold1, rmFolder); - - // assert that the folder and records are frozen - assertTrue(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(recordDeclaredOne)); - - // check the contents of the hold - List frozenNodes = holdService.getHeld(hold1); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - assertEquals(rmFolder, frozenNodes.get(0)); - - holdService.addToHold(hold2, recordOne); - - // assert that the folder and records are frozen - assertTrue(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(recordDeclaredOne)); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - NodeRef hold1 = holds.get(0); - NodeRef hold2 = holds.get(1); - // delete the hold - holdService.deleteHold(hold1); - - // assert that the folder and records no longer frozen - assertFalse(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordDeclaredOne)); - - // confirm the hold has been deleted - assertNull(holdService.getHold(filePlan, "hold one")); - - // delete the hold - holdService.deleteHold(hold2); - - // assert that the folder and records no longer frozen - assertFalse(freezeService.isFrozen(rmFolder)); - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordDeclaredOne)); - - // confirm the hold has been deleted - assertNull(holdService.getHold(filePlan, "hold two")); - - return null; - } - }); - } - - public void testHeldByNothing() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Create the test holds - createAndCheckHolds(); - - // Check that the record folder isn't held by anything - List holds = new ArrayList<>(); - holds.addAll(holdService.heldBy(rmFolder, true)); - assertTrue(holds.isEmpty()); - holds.clear(); - holds.addAll(holdService.heldBy(rmFolder, false)); - assertEquals(2, holds.size()); - - // Check that record isn't held by anything (recordOne is a child of the rmFolder) - holds.clear(); - holds.addAll(holdService.heldBy(recordOne, true)); - assertTrue(holds.isEmpty()); - holds.clear(); - holds.addAll(holdService.heldBy(recordOne, false)); - assertEquals(2, holds.size()); - - return null; - } - }); - } - - public void testPolicyNotificationForDeleteHold() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - BehaviourDefinition beforeDeleteHoldBehaviour; - BehaviourDefinition onDeleteHoldBehaviour; - NodeRef hold; - - public void given() - { - beforeDeleteHoldBehaviour = policyComponent.bindClassBehaviour(BeforeDeleteHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD, - new JavaBehaviour(DeleteHoldTest.this, "beforeDeleteHold", NotificationFrequency.EVERY_EVENT)); - - onDeleteHoldBehaviour = policyComponent.bindClassBehaviour(OnDeleteHoldPolicy.QNAME, RecordsManagementModel.TYPE_HOLD, - new JavaBehaviour(DeleteHoldTest.this, "onDeleteHold", NotificationFrequency.EVERY_EVENT)); - - // Create a hold - hold = holdService.createHold(filePlan, generate(), generate(), generate()); - - assertFalse(beforeDeleteHoldFlag); - assertFalse(beforeDeleteHoldFlag); - } - - public void when() - { - // Delete the hold - holdService.deleteHold(hold); - - } - - public void then() - { - assertTrue(beforeDeleteHoldFlag); - assertTrue(onDeleteHoldFlag); - } - - public void after() - { - policyComponent.removeClassDefinition(beforeDeleteHoldBehaviour); - policyComponent.removeClassDefinition(onDeleteHoldBehaviour); - } - }); - - } - - @Override - public void beforeDeleteHold(NodeRef hold) - { - beforeDeleteHoldFlag = true; - } - - @Override - public void onDeleteHold(String holdName) - { - onDeleteHoldFlag = true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java deleted file mode 100644 index 470e03bda9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; - -import java.util.ArrayList; -import java.util.List; - -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.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Remove active content from hold integration tests - * - * @author Ross Gale - * @since 3.2 - */ -public class RemoveActiveContentFromHoldTest extends BaseRMTestCase -{ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * Given a piece of active content on hold - * When I try to remove the active content from the hold - * Then the active content is unfrozen - * And the active content is not contained within the hold - */ - public void testRemoveDocumentFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - Integer before; - - public void given() - { - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, dmDocument); - } - - public void when() - { - before = (Integer) nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT); - holdService.removeFromHold(hold, dmDocument); - } - - public void then() - { - // active content is no longer frozen - assertFalse(freezeService.isFrozen(dmDocument)); - - // check the content is no longer held - assertFalse(holdService.getHeld(hold).contains(dmDocument)); - assertFalse(holdService.heldBy(dmDocument, true).contains(hold)); - - // check the held count on the folder has been reduced - assertTrue(before > (Integer) nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - /** - * Given a piece of active content in multiple holds - * When I try to remove the active content from a single hold - * Then the active content is still frozen - * And the active content is not contained within the specified hold - * And is still added to any other holds - */ - public void testRemoveDocumentFromASingleHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef hold2; - - public void given() - { - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - final List holds = new ArrayList<>(2); - holds.add(hold); - holds.add(hold2); - holdService.addToHolds(holds, dmDocument); - } - - public void when() - { - holdService.removeFromHold(hold, dmDocument); - } - - public void then() - { - assertTrue(freezeService.isFrozen(dmDocument)); - assertFalse(holdService.heldBy(dmDocument, true).contains(hold)); - assertTrue(holdService.heldBy(dmDocument, true).contains(hold2)); - } - }); - } - - /** - * Given a piece of active content on hold - * When I try to remove the active content from the hold without permission - * Then an access denied exception is thrown - */ - public void testRemoveDocumentFromHoldFailsWithoutFilingPermission() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - private NodeRef hold; - - public void given() - { - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, dmDocument); - } - - public void when() - { - AuthenticationUtil.runAs( - (RunAsWork) () -> { - holdService.removeFromHold(hold, dmDocument); - return null; - }, recordsManagerName); - } - }); - } - - /** - * Given a piece of active content on hold - * When I try to remove the active content from the hold without the remove hold capability - * Then an access denied exception is thrown - */ - public void testRemoveDocumentFromHoldFailsWithoutRemoveHoldPermission() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class, powerUserName, false) - { - private NodeRef hold; - - public void given() - { - AuthenticationUtil.runAs( - (RunAsWork) () -> { - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, dmDocument); - return null; - }, getAdminUserName()); - } - - public void when() - { - holdService.removeFromHold(hold, dmDocument); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveFromHoldTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveFromHoldTest.java deleted file mode 100644 index 04211d0cdc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveFromHoldTest.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.BeforeRemoveFromHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies.OnRemoveFromHoldPolicy; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.BehaviourDefinition; -import org.alfresco.repo.policy.ClassBehaviourBinding; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Remove From Hold integration tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RemoveFromHoldTest extends BaseRMTestCase implements BeforeRemoveFromHoldPolicy, OnRemoveFromHoldPolicy -{ - private static final int RECORD_COUNT = 10; - - private boolean beforeRemoveFromHoldFlag = false; - private boolean onRemoveFromHoldFlag = false; - - public void testRemoveRecordsFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList<>(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // add records to hold - holdService.addToHold(hold, records); - } - - public void when() throws Exception - { - // remove *some* of the records - holdService.removeFromHold(hold, records.subList(0, 5)); - } - - public void then() - { - // check record state (no longer held) - for (NodeRef record : records.subList(0, 5)) - { - assertFalse(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertFalse(holdService.heldBy(record, true).contains(hold)); - } - - // check record state (still held) - for (NodeRef record : records.subList(5, 10)) - { - assertTrue(freezeService.isFrozen(record)); - assertTrue(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(5, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testRemoveAllRecordsFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList<>(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // add records to hold - holdService.addToHold(hold, records); - } - - public void when() throws Exception - { - // remove all of the records - holdService.removeFromHold(hold, records); - } - - public void then() - { - // check record state (no longer held) - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertFalse(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testRemoveRecordFolderFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList<>(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // add record folder to hold - holdService.addToHold(hold, recordFolder); - } - - public void when() throws Exception - { - // remove record folder from hold - holdService.removeFromHold(hold, recordFolder); - } - - public void then() - { - // check record states - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertFalse(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testPolicyNotificationForRemoveFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - BehaviourDefinition beforeRemoveFromHoldBehaviour; - BehaviourDefinition onRemoveFromHoldBehaviour; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - // create a record category -> record folder - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - // add the record folder to hold - holdService.addToHold(hold, recordFolder); - - beforeRemoveFromHoldBehaviour = policyComponent.bindClassBehaviour(BeforeRemoveFromHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD, new JavaBehaviour(RemoveFromHoldTest.this, "beforeRemoveFromHold", NotificationFrequency.EVERY_EVENT)); - - onRemoveFromHoldBehaviour = policyComponent.bindClassBehaviour(OnRemoveFromHoldPolicy.QNAME, - RecordsManagementModel.TYPE_HOLD, new JavaBehaviour(RemoveFromHoldTest.this, "onRemoveFromHold", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeRemoveFromHoldFlag); - assertFalse(onRemoveFromHoldFlag); - } - - public void when() throws Exception - { - // remove the record folder from the hold - holdService.removeFromHold(hold, recordFolder); - } - - public void then() - { - assertTrue(beforeRemoveFromHoldFlag); - assertTrue(onRemoveFromHoldFlag); - } - - public void after() - { - policyComponent.removeClassDefinition(beforeRemoveFromHoldBehaviour); - policyComponent.removeClassDefinition(onRemoveFromHoldBehaviour); - } - }); - } - - @Override - public void beforeRemoveFromHold(NodeRef hold, NodeRef contentNodeRef) - { - beforeRemoveFromHoldFlag = true; - } - - @Override - public void onRemoveFromHold(NodeRef hold, NodeRef contentNodeRef) - { - onRemoveFromHoldFlag = true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/UpdateHeldActiveContentTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/UpdateHeldActiveContentTest.java deleted file mode 100644 index 18bbfc3745..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/UpdateHeldActiveContentTest.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.webscripts.GUID; - -/** - * Prevent Updating Held Active Content Integration Tests - * - * @author Claudia Agache - * @since 3.2 - */ -public class UpdateHeldActiveContentTest extends BaseRMTestCase -{ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Given active content on hold - * When I try to delete the content - * Then I am not successful - */ - public void testDeleteHeldDocument() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // create a hold - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // add the active content to hold - holdService.addToHold(hold, dmDocument); - } - - public void when() - { - try - { - fileFolderService.delete(dmDocument); - fail("Expected PermissionDeniedException to be thrown"); - } - catch (PermissionDeniedException pde) - { - assertTrue(pde.getMessage().contains(I18NUtil.getMessage("rm.hold.delete-frozen-node"))); - } - } - }); - } - - /** - * Given active content on hold - * When I try to copy the content - * Then I am not successful - */ - public void testCopyHeldDocument() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - public void given() - { - // create a hold - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // add the active content to hold - holdService.addToHold(hold, dmDocument); - } - - public void when() throws FileNotFoundException - { - fileFolderService.copy(dmDocument, dmFolder1, null); - } - }); - } - - /** - * Given active content on hold - * When I try to move the content - * Then I am not successful - */ - public void testMoveHeldDocument() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // create a hold - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // add the active content to hold - holdService.addToHold(hold, dmDocument); - } - - public void when() throws FileNotFoundException - { - try - { - fileFolderService.move(dmDocument, dmFolder1, null); - fail("Expected PermissionDeniedException to be thrown"); - } - catch (PermissionDeniedException pde) - { - assertTrue(pde.getMessage().contains(I18NUtil.getMessage("rm.hold.move-frozen-node"))); - } - } - }); - } - - /** - * Given active content on hold - * When I try to edit the properties - * Or perform an action that edits the properties - * Then I am not successful - */ - public void testUpdateHeldDocumentProperties() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // create a hold - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // add the active content to hold - holdService.addToHold(hold, dmDocument); - } - - public void when() - { - try - { - nodeService.setProperty(dmDocument, ContentModel.PROP_DESCRIPTION, "description"); - fail("Expected PermissionDeniedException to be thrown"); - } - catch (PermissionDeniedException pde) - { - assertTrue(pde.getMessage().contains(I18NUtil.getMessage("rm.hold.update-frozen-node"))); - } - } - }); - } - - /** - * Given active content on hold - * When I try to update the content - * Then I am not successful - */ - public void testUpdateHeldDocumentContent() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // create a hold - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // add the active content to hold - holdService.addToHold(hold, dmDocument); - } - - public void when() - { - try - { - ContentData content = (ContentData) nodeService.getProperty(dmDocument, PROP_CONTENT); - nodeService.setProperty(dmDocument, PROP_CONTENT, ContentData.setMimetype(content, - MimetypeMap.MIMETYPE_TEXT_PLAIN)); - fail("Expected PermissionDeniedException to be thrown"); - } - catch (PermissionDeniedException pde) - { - assertTrue(pde.getMessage().contains(I18NUtil.getMessage("rm.hold.update-frozen-node"))); - } - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/MNT19114Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/MNT19114Test.java deleted file mode 100644 index 6fe2462a4c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/MNT19114Test.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import static org.alfresco.repo.site.SiteServiceImpl.getSiteContainer; -import static org.alfresco.util.GUID.generate; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteVisibility; - -/** - * Test class for MNT 19114, wiki page can not be created under RM site - */ -public class MNT19114Test extends BaseRMTestCase -{ - public static final String PARENT_NODE = "RMSite"; - public static final String DOCUMENT_LIBRARY_FOLDER_TYPE = "documentLibrary"; - public static final String SURF_CONFIG_FOLDER_TYPE = "surfConfigFolder"; - public static final String WIKI_PAGE_FOLDER_TYPE = "wikiPage"; - - @Override - protected boolean isRMSiteTest() - { - return true; - } - - /** - * Given a RM site and two folder type children - * When creating a third folder type child as a Wiki page - * The page will be created and no exception will be thrown. - */ - public void testCreateWikiPageInRmSite() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef wikiPage; - - public void given() - { - // Creating a Records Management site - siteService.createSite("rmSite", PARENT_NODE, generate(), generate(), SiteVisibility.PUBLIC, TYPE_RM_SITE); - - // Adding two immediate folder type children - getSiteContainer( - PARENT_NODE, - DOCUMENT_LIBRARY_FOLDER_TYPE, - true, - siteService, - transactionService, - taggingService); - getSiteContainer( - PARENT_NODE, - SURF_CONFIG_FOLDER_TYPE, - true, - siteService, - transactionService, - taggingService); - } - - public void when() throws Exception - { - - wikiPage = getSiteContainer( - PARENT_NODE, - WIKI_PAGE_FOLDER_TYPE, - true, - siteService, - transactionService, - taggingService); - - } - - public void then() throws Exception - { - // Check if the new folder type wiki page has been created - assertEquals(true, nodeService.exists(wikiPage)); - } - - public void after() - { - siteService.deleteSite(PARENT_NODE); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java deleted file mode 100644 index 91eb0225aa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.disposition.DispositionSchedule; -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.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.GUID; - - -/** - * Test for RM-1008 - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1008Test extends BaseRMTestCase -{ - private String myUser; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - myUser = GUID.generate(); - createPerson(myUser); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, myUser); - } - - public void testContainers() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(holdContainer)); - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transferContainer)); - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(holdContainer)); - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transferContainer)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - } - - public void testHold() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create hold object - NodeRef hold = holdService.createHold(filePlan, "my hold", "my reason", "my description"); - holdService.addToHold(hold, rmFolder); - return hold; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.deletePermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - } - - public void testTransfer() - { - final NodeRef transferFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef transferCat = filePlanService.createRecordCategory(filePlan, "transferCat"); - - Map dsProps = new HashMap<>(3); - dsProps.put(PROP_DISPOSITION_AUTHORITY, "test"); - dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, "test"); - dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, false); - DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(transferCat, dsProps); - - Map adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff"); - adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); - adParams.put(PROP_DISPOSITION_PERIOD, "immediately|0"); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - - adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, "transfer"); - adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); - adParams.put(PROP_DISPOSITION_PERIOD, "immediately|0"); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - - return recordFolderService.createRecordFolder(transferCat, "transferFolder"); - } - }); - - final NodeRef transfer = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - rmActionService.executeRecordsManagementAction(transferFolder, "cutoff"); - rmActionService.executeRecordsManagementAction(transferFolder, "transfer"); - - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - List childAssocs = nodeService.getChildAssocs(transferContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - return childAssocs.get(0).getChildRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertEquals(TYPE_TRANSFER, nodeService.getType(result)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.deletePermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java deleted file mode 100644 index 0749bba543..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; - - -/** - * Unit test for RM-1027 .. can't copy a closed folder - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1027Test extends BaseRMTestCase -{ - public void testCopyingAClosedFolder() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a folder and close it - NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, "My Closed Record Folder"); - utils.closeFolder(recordFolder); - - assertTrue((Boolean)nodeService.getProperty(recordFolder, PROP_IS_CLOSED)); - - return recordFolder; - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create a destination for the copy - NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination"); - - // try and copy the closed record folder - FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null); - - return copyInfo.getNodeRef(); - } - - @Override - public void test(NodeRef copy) throws Exception - { - assertNotNull(copy); - - assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER)); - assertFalse((Boolean)nodeService.getProperty(copy, PROP_IS_CLOSED)); - } - }); - } - - public void testCopyingAFolderWithADispositionSchedule() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a folder - NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, "My Closed Record Folder"); - - // show that the default disposition schedule has been applied - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - return recordFolder; - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create a destination for the copy - NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination"); - - // try and copy the closed record folder - FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null); - - return copyInfo.getNodeRef(); - } - - @Override - public void test(NodeRef copy) throws Exception - { - assertNotNull(copy); - - assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER)); - assertFalse(nodeService.hasAspect(copy, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java deleted file mode 100644 index fccd549073..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import 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; - - -/** - * Unit test for RM-1030 .. can't freeze a record folder that already has a frozen record contained within - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1030Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM1030() throws Exception - { - final NodeRef recordHold = doTestInTransaction(new Test() - { - @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); - assertEquals(0, holds.size()); - - // freeze record contained within the record folder - NodeRef hold = holdService.createHold(filePlan, "my hold 2", "in true life for serious", "my decription"); - holdService.addToHold(hold, recordOne); - assertNotNull(hold); - - return hold; - } - - @Override - public void test(NodeRef hold) throws Exception - { - // show the record is frozen - assertTrue(freezeService.isFrozen(recordOne)); - - // count the number of holds - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(1, holds.size()); - } - - }); - - final NodeRef recordFolderHold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // freeze the record folder that contains the frozen record - NodeRef folderHold = holdService.createHold(filePlan, "my hold 3", "innit but", "my decription"); - holdService.addToHold(folderHold, rmFolder); - assertNotNull(folderHold); - - return folderHold; - } - - @Override - public void test(NodeRef hold) throws Exception - { - // show that the record and the record folder are frozen - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(rmFolder)); - - // count the number of holds - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(2, holds.size()); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // relinquish the record folder hold - holdService.deleteHold(recordFolderHold); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertTrue(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(rmFolder)); - - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(1, holds.size()); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // relinquish the record hold - holdService.deleteHold(recordHold); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(rmFolder)); - - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(0, holds.size()); - } - }); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java deleted file mode 100644 index 68a9d7ca3b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1424 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1424Test extends DeleteHoldTest -{ - public void testGettingHolds() - { - final List listWithTwoHolds = new ArrayList<>(2); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // No holds - List emptyHoldList = holdService.getHolds(filePlan); - assertNotNull(emptyHoldList); - assertTrue(emptyHoldList.isEmpty()); - - // Create 2 holds - createAndCheckHolds(); - - // Check the list of holds - listWithTwoHolds.addAll(holdService.getHolds(filePlan)); - assertNotNull(listWithTwoHolds); - assertEquals(2, listWithTwoHolds.size()); - - // Check the first hold - NodeRef hold1 = listWithTwoHolds.get(0); - assertEquals(RecordsManagementModel.TYPE_HOLD, nodeService.getType(hold1)); - assertEquals(HOLD1_NAME, (String) nodeService.getProperty(hold1, PROP_NAME)); - assertEquals(HOLD1_REASON, (String) nodeService.getProperty(hold1, PROP_HOLD_REASON)); - assertEquals(HOLD1_DESC, (String) nodeService.getProperty(hold1, PROP_DESCRIPTION)); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Get the holds the test user without having any permissions on the holds - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(0, holds.size()); - - return null; - } - }, userName); - - final NodeRef hold2 = listWithTwoHolds.get(1); - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Give the user read permissions on the hold - permissionService.setPermission(hold2, userName, RMPermissionModel.FILING, true); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(1, holds.size()); - assertEquals(RecordsManagementModel.TYPE_HOLD, nodeService.getType(hold2)); - assertEquals(HOLD2_NAME, (String) nodeService.getProperty(hold2, PROP_NAME)); - assertEquals(HOLD2_REASON, (String) nodeService.getProperty(hold2, PROP_HOLD_REASON)); - assertEquals(HOLD2_DESC, (String) nodeService.getProperty(hold2, PROP_DESCRIPTION)); - - return null; - } - }, userName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java deleted file mode 100644 index 799e60c49e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.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.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1429 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1429Test extends DeleteHoldTest -{ - public void testDeleteHoldWithoutPermissionsOnChildren() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create the test hold - NodeRef hold = createAndCheckHold(); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - // Give the user filing permissions on the hold - permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true); - - // Give the user read permissions on the record folder - permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true); - - // Add record folder to the hold - holdService.addToHold(hold, rmFolder); - - return hold; - } - }); - - doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) - { - @Override - public void run() - { - holdService.deleteHold(hold); - } - }, userName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java deleted file mode 100644 index 3018cee644..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.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.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1463 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1463Test extends DeleteHoldTest -{ - public void testAddRecordFolderToHoldWithoutFilingPermissionOnRecordFolder() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create hold - NodeRef hold = createAndCheckHold(); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - // Give the user filing permissions on the hold - permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true); - - // Give the user only read permissions on the record folder - permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true); - - return hold; - } - }); - - doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) - { - @Override - public void run() - { - holdService.addToHold(hold, rmFolder); - } - }, userName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java deleted file mode 100644 index 23a27a7c94..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.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.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1464 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1464Test extends DeleteHoldTest -{ - public void testAddRecordFolderToHoldWithoutFilingPermissionOnHold() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create hold - NodeRef hold = createAndCheckHold(); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - // Give the user read permissions on the hold - permissionService.setPermission(hold, userName, RMPermissionModel.READ_RECORDS, true); - - // Give the user filing permissions on the record folder - permissionService.setPermission(rmFolder, userName, RMPermissionModel.FILING, true); - - return hold; - } - }); - - doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) - { - @Override - public void run() - { - holdService.addToHold(hold, rmFolder); - } - }, userName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java deleted file mode 100644 index af6bb9ff69..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.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() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - //set read and file permissions for folder - filePlanPermissionService.setPermission(folder, myUser, RMPermissionModel.FILING); - return null; - } - }); - - 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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java deleted file mode 100644 index 2f958666a5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.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.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.util.GUID; - -/** - * Test for RM-1799 - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RM1799Test extends BaseRMTestCase -{ - private String myUser; - private NodeRef category; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - myUser = GUID.generate(); - createPerson(myUser); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, myUser); - } - - public void testRM1799() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(filePlan, myUser, RMPermissionModel.FILING); - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - category = filePlanService.createRecordCategory(filePlan, GUID.generate()); - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category, RMPermissionModel.FILING)); - return null; - } - }, myUser); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java deleted file mode 100644 index 64ef681677..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java deleted file mode 100644 index cd656a7d9b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java deleted file mode 100644 index f8701d09ea..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import 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.lang3.StringUtils; -import org.junit.Before; - -/** - * - * @author Ana Bozianu - * @since 2.3 - */ -public class RM1914Test extends BaseRMTestCase -{ - //Fields required across transactions - NodeRef record1, transferFolder; - - public void testRM1914() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - - public void given(){ - - // create test holds - NodeRef category1 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef category2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - 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); - NodeRef folder1 = recordFolderService.createRecordFolder(category1, GUID.generate()); - - // - 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 - 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()); - NodeRef 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); - // 8. Cut off and transfer Record2 - rmActionService.executeRecordsManagementAction(record2, CutOffAction.NAME, null); - - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(record2, TransferAction.NAME) - .getValue(); - - } - - public void when() - { - - - rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - - } - - public void then() - { - // 9. Verify Record1 - assertTrue(dispositionService.isNextDispositionActionEligible(record1)); - - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java deleted file mode 100644 index 00e23ed8e7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -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.impl.FileToAction; -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; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; - -/** - * System test for RM-2072: Concurrency exceptions and deadlocks on Records Management "File to" rule - * - * @author Roy Wetherall - * @since 2.2.1.1 - */ -public class RM2072Test extends BaseRMTestCase -{ - private static final int NUMBER_OF_BATCHES = 1; - private static final int NUMBER_IN_BATCH = 500; - - private RuleService ruleService; - private NodeRef ruleFolder; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService)applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given that I have auto declare configured - * And that I have auto file configured to a path where only the record folder needs to be created - * When I add lots of documents in the same transaction - * Then the rules should fire - * And the documents should be filed in the new record folder - */ - public void testAutoDeclareAutoFileCreateRecordFolderOnly() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // create the folder - ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER).getNodeRef(); - - // create record category - NodeRef nodeRefA = filePlanService.createRecordCategory(filePlan, "A"); - NodeRef nodeRefB = filePlanService.createRecordCategory(nodeRefA, "B"); - filePlanService.createRecordCategory(nodeRefB, "C"); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule rule = new Rule(); - rule.setRuleType(RuleType.INBOUND); - rule.setTitle("my rule"); - rule.setAction(action); - rule.setExecuteAsynchronously(true); - ruleService.saveRule(ruleFolder, rule); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, "/A/B/C/{date.year.long}/{date.month.long}/{date.day.month}"); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(RuleType.INBOUND); - fileRule.setTitle("my rule"); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(ruleFolder).isEmpty()); - } - }); - - List records = new ArrayList<>(NUMBER_OF_BATCHES * NUMBER_IN_BATCH); - - for (int i = 0; i < NUMBER_OF_BATCHES; i++) - { - final int finali = i; - records.addAll(doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - List records = new ArrayList<>(NUMBER_IN_BATCH); - for (int j = 0; j < NUMBER_IN_BATCH; j++) - { - int count = (finali+1)*(j+1); - String name = "content" + count + ".txt"; - System.out.println(name + " - creating"); - - NodeRef record = fileFolderService.create(ruleFolder, name, ContentModel.TYPE_CONTENT).getNodeRef(); - records.add(record); - } - return records; - } - })); - } - - try - { - while(!records.isEmpty()) - { - Thread.sleep(1000); - - final Iterator temp = records.iterator(); - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - while (temp.hasNext()) - { - NodeRef record = temp.next(); - if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) - { - String name = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - System.out.println(name + " - complete"); - temp.remove(); - } - } - - return null; - } - }); - } - } - catch (Exception exception) - { - exception.printStackTrace(); - throw exception; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java deleted file mode 100644 index 1d87e36b30..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import static java.util.Arrays.asList; - -import static org.alfresco.service.cmr.rule.RuleType.INBOUND; -import static org.alfresco.util.GUID.generate; -import static org.springframework.util.StringUtils.tokenizeToStringArray; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; - -/** - * System test for RM-2190: Concurrency exception when upload document to several folders with rules configured to file records - * - * @author Tuna Aksoy - * @since 2.2.1.1 - */ -public class RM2190Test extends BaseRMTestCase -{ - private static final int NUMBER_OF_BATCHES = 1; - private static final int NUMBER_IN_BATCH = 10; - - private static final String PATH = "/111/222/333"; - - private RuleService ruleService; - - private NodeRef rootFolder; - private NodeRef folder1; - private NodeRef folder2; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testUploadDocumentsSimultaneouslyWithRules() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - rootFolder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); - - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule declareRule = new Rule(); - declareRule.setRuleType(INBOUND); - declareRule.setTitle(generate()); - declareRule.setAction(createAction); - declareRule.setExecuteAsynchronously(true); - declareRule.applyToChildren(true); - ruleService.saveRule(rootFolder, declareRule); - - folder1 = fileFolderService.create(rootFolder, generate(), TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(rootFolder, generate(), TYPE_FOLDER).getNodeRef(); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, PATH); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(INBOUND); - fileRule.setTitle(generate()); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(unfiledContainer, fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(rootFolder).isEmpty()); - assertFalse(ruleService.getRules(unfiledContainer).isEmpty()); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws FileNotFoundException, InterruptedException - { - Thread thread1 = new Thread() - { - public void run() { - List files = addFilesToFolder(folder1); - waitForFilesToBeDeclared(files); - } - }; - - Thread thread2 = new Thread() - { - public void run() { - List files = addFilesToFolder(folder2); - waitForFilesToBeDeclared(files); - } - }; - - thread1.start(); - thread2.start(); - - thread1.join(300000); - thread2.join(300000); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - FileInfo category = fileFolderService.resolveNamePath(filePlan, asList(tokenizeToStringArray(PATH, "/", false, true))); - assertEquals(NUMBER_IN_BATCH * 2, nodeService.getChildAssocs(category.getNodeRef()).size()); - } - }); - } - - private List addFilesToFolder(final NodeRef folder) - { - List records = new ArrayList<>(NUMBER_OF_BATCHES * NUMBER_IN_BATCH); - - for (int i = 0; i < NUMBER_OF_BATCHES; i++) - { - final int finali = i; - records.addAll(doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - List files = new ArrayList<>(NUMBER_IN_BATCH); - for (int j = 0; j < NUMBER_IN_BATCH; j++) - { - int count = (finali+1)*(j+1); - String name = folder.getId() + " - content" + count + ".txt"; - System.out.println(name + " - creating"); - - NodeRef file = fileFolderService.create(folder, name, TYPE_CONTENT).getNodeRef(); - files.add(file); - } - return files; - } - })); - } - - return records; - } - - private void waitForFilesToBeDeclared(List files) - { - while (!files.isEmpty()) - { - final Iterator temp = files.iterator(); - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - while (temp.hasNext()) - { - NodeRef record = temp.next(); - if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) - { - String name = (String) nodeService.getProperty(record, PROP_NAME); - System.out.println(name + " - complete"); - temp.remove(); - } - } - - return null; - } - }); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java deleted file mode 100644 index ecd20e2531..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.repo.site.SiteModel.SITE_MANAGER; -import static org.alfresco.repo.site.SiteServiceImpl.getSiteContainer; -import static org.alfresco.service.cmr.rule.RuleType.INBOUND; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.service.cmr.site.SiteService.DOCUMENT_LIBRARY; -import static org.alfresco.service.cmr.site.SiteVisibility.PUBLIC; -import static org.alfresco.util.GUID.generate; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.jscript.app.JSONConversionComponent; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; - -/** - * Integration test for RM-2192 - * - * @author Tuna Aksoy - * @since 2.2.1.1 - */ -public class RM2192Test extends BaseRMTestCase -{ - private static final String PATH = "/111/222/333"; - - private RuleService ruleService; - private JSONConversionComponent converter; - - private NodeRef folder; - private String user; - private NodeRef documentLibrary2; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - converter = (JSONConversionComponent) applicationContext.getBean("jsonConversionComponent"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupCollaborationSiteTestDataImpl() - { - super.setupCollaborationSiteTestDataImpl(); - - String collabSiteId2 = generate(); - siteService.createSite("site-dashboard", collabSiteId2, generate(), generate(), PUBLIC); - documentLibrary2 = getSiteContainer( - collabSiteId2, - DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2); - - user = generate(); - createPerson(user); - - siteService.setMembership(collabSiteId2, user, SITE_MANAGER); - - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, user); - } - - public void testAccessToRecordAfterDeclaring() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - folder = fileFolderService.create(documentLibrary2, generate(), TYPE_FOLDER).getNodeRef(); - - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule declareRule = new Rule(); - declareRule.setRuleType(INBOUND); - declareRule.setTitle(generate()); - declareRule.setAction(createAction); - declareRule.setExecuteAsynchronously(true); - declareRule.applyToChildren(true); - ruleService.saveRule(folder, declareRule); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, PATH); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(INBOUND); - fileRule.setTitle(generate()); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(unfiledContainer, fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(folder).isEmpty()); - assertFalse(ruleService.getRules(unfiledContainer).isEmpty()); - } - }); - - doTestInTransaction(new Test() - { - NodeRef document; - - @Override - public Void run() - { - document = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); - - return null; - } - - @Override - public void test(Void result) throws InterruptedException - { - Thread.sleep(10000); - - assertEquals(permissionService.hasPermission(document, READ_RECORDS), ALLOWED); - assertTrue(recordService.isFiled(document)); - assertNotNull(converter.toJSON(document, true)); - } - }, user); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java deleted file mode 100644 index 162dd2f44f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - * - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Unit test for RM-3341 .. can copy to hold and transfer folder - * - * @since 2.4 - */ -public class RM3341Test extends BaseRMTestCase -{ - public void testCopyingContentsInHoldandTransfer() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - assertEquals(AccessStatus.ALLOWED, - permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, - permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - - public Void run() - { - - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - - try - { - fileFolderService.create(holdContainer, "test file", ContentModel.TYPE_CONTENT); - fail("This should have thrown an exception"); - } - catch (IntegrityException e) - { - // ("Content can't be added to a hold container. Use record folders to file content.") - } - return null; - } - - }); - doTestInTransaction(new Test() - { - @Override - - public Void run() - { - - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - try - { - - fileFolderService.create(transferContainer, "test content", ContentModel.TYPE_CONTENT); - - fail("This should have thrown an exception"); - - } - catch (IntegrityException e) - { - // ("Content can't be added to a transfer container. Use record folders to file content.") - } - return null; - } - - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3450Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3450Test.java deleted file mode 100644 index d0c6a1efce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3450Test.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.util.GUID; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Integration test for RM-3450 - * - * @author Roxana Lucanu - * @since 2.4.1 - */ -public class RM3450Test extends BaseRMTestCase -{ - - private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type"; - - public void testRM3450() throws Exception - { - doTestInTransaction(new FailureTest - ( - I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE), - IntegrityException.class - ) - { - @Override - public void run() throws Exception - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Object execute() throws Exception - { - fileFolderService.create(unfiledContainer, GUID.generate(), TestModel.NOT_RM_FOLDER_TYPE).getNodeRef(); - return null; - } - }, false, true); - } - }, ADMIN_USER); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3993Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3993Test.java deleted file mode 100644 index c9271b85a8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3993Test.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; - -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.impl.FileToAction; -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.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * System test for RM-3993: Exceptions thrown when concurrently creating identical folder structure - * - * @author Silviu Dinuta - * @since 2.3.0.7 - */ -public class RM3993Test extends BaseRMTestCase -{ - private static final int NUMBER_OF_BATCHES = 4; - private static final int NUMBER_IN_BATCH = 500; - - private RuleService ruleService; - private NodeRef ruleFolder; - private NodeRef nodeRefCategory1; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given that I have auto declare configured And that I have auto file configured to a path where only the record - * folder needs to be created When I add lots of documents in the same transaction Then the rules should fire And - * the documents should be filed in the new record folder - */ - public void testAutoDeclareAutoFileCreateRecordFolderOnly() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // create the folder - ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER) - .getNodeRef(); - - // create record category - nodeRefCategory1 = filePlanService.createRecordCategory(filePlan, "category1"); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule rule = new Rule(); - rule.setRuleType(RuleType.INBOUND); - rule.setTitle("my rule"); - rule.setAction(action); - rule.setExecuteAsynchronously(true); - ruleService.saveRule(ruleFolder, rule); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, - "/category1/{node.cm:description}"); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(RuleType.INBOUND); - fileRule.setTitle("my rule"); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(ruleFolder).isEmpty()); - } - }); - - List records = new ArrayList<>(NUMBER_OF_BATCHES * NUMBER_IN_BATCH); - - for (int i = 0; i < NUMBER_OF_BATCHES; i++) - { - final int finali = i; - records.addAll(doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - List records = new ArrayList<>(NUMBER_IN_BATCH); - for (int j = 0; j < NUMBER_IN_BATCH; j++) - { - int count = (finali)* NUMBER_IN_BATCH + (j + 1); - String name = "content" + count + ".txt"; - System.out.println(name + " - creating"); - - Random rand = new Random(); - int descInt = rand.nextInt(2)+1; - NodeRef record = createFile(ruleFolder, name, Integer.toString(descInt), ContentModel.TYPE_CONTENT); - records.add(record); - } - return records; - } - })); - } - - try - { - while (!records.isEmpty()) - { - Thread.sleep(1000); - - final Iterator temp = records.iterator(); - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - while (temp.hasNext()) - { - NodeRef record = temp.next(); - if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) - { - String name = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - System.out.println(name + " - complete"); - temp.remove(); - } - } - - return null; - } - }); - } - } - catch (Exception exception) - { - exception.printStackTrace(); - throw exception; - } - - Integer numberOfRecords = AuthenticationUtil.runAsSystem(new RunAsWork() - { - - @Override - public Integer doWork() throws Exception - { - List containedRecordFolders = filePlanService.getContainedRecordFolders(nodeRefCategory1); - int numberOfRecords = 0; - for(NodeRef recordFolder : containedRecordFolders) - { - numberOfRecords = numberOfRecords + fileFolderService.list(recordFolder).size(); - } - return numberOfRecords; - } - }); - assertTrue(numberOfRecords == NUMBER_OF_BATCHES * NUMBER_IN_BATCH); - } - - private NodeRef createFile(NodeRef parentNodeRef, String name, String descrption, QName typeQName) - { - Map properties = new HashMap<>(11); - properties.put(ContentModel.PROP_NAME, (Serializable) name); - properties.put(ContentModel.PROP_DESCRIPTION, (Serializable) descrption); - QName assocQName = QName.createQName( - NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(name)); - ChildAssociationRef assocRef = nodeService.createNode( - parentNodeRef, - ContentModel.ASSOC_CONTAINS, - assocQName, - typeQName, - properties); - NodeRef nodeRef = assocRef.getChildRef(); - return nodeRef; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4101Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4101Test.java deleted file mode 100644 index a9fc61efa0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4101Test.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.util.UUID; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.LinkToAction; -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; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; - -/** - * Tests issue #4101: Link to, Copy to and File to rules fail when not run in background - * - * @author Tuna Aksoy - * @since 2.3.0.8 - */ -public class RM4101Test extends BaseRMTestCase -{ - private RuleService ruleService; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRunRuleNotInBackground() throws Exception - { - final String categoryName = "category1" + UUID.randomUUID().toString(); - final NodeRef category1 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return filePlanService.createRecordCategory(filePlan, categoryName); - } - }); - - final NodeRef folder1 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return recordFolderService.createRecordFolder(category1, "folder1WithRule" + UUID.randomUUID().toString()); - } - }); - - final String folder2Name = "folder2FolderToLinkTo" + UUID.randomUUID().toString(); - final NodeRef folder2 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return recordFolderService.createRecordFolder(category1, folder2Name); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Action linkToAction = actionService.createAction(LinkToAction.NAME); - linkToAction.setParameterValue(LinkToAction.PARAM_PATH, "/" + categoryName + "/" + folder2Name); - - Rule rule = new Rule(); - rule.setRuleType(RuleType.INBOUND); - rule.setTitle("LinkTo"); - rule.setAction(linkToAction); - rule.setExecuteAsynchronously(false); - ruleService.saveRule(folder1, rule); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - utils.createRecord(folder1, "record1" + UUID.randomUUID().toString()); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertEquals(1, nodeService.getChildAssocs(folder2).size()); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4163Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4163Test.java deleted file mode 100644 index c7908cca02..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4163Test.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -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.impl.FileToAction; -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.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * System test for RM-4163 - * - * @author Silviu Dinuta - * @since 2.4.1 - */ -public class RM4163Test extends BaseRMTestCase -{ - private RuleService ruleService; - private NodeRef ruleFolder; - private NodeRef nodeRefCategory1; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testDeclareRecordsConcurently() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // create the folder - ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER) - .getNodeRef(); - - // create record category - nodeRefCategory1 = filePlanService.createRecordCategory(filePlan, "category1"); - - //define declare as record rule and apply it to the created folder from documentLibrary - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule rule = new Rule(); - rule.setRuleType(RuleType.INBOUND); - rule.setTitle("declareAsRecordRule"); - rule.setAction(action); - rule.setExecuteAsynchronously(true); - ruleService.saveRule(ruleFolder, rule); - - //define filing rule and apply it to unfiled record container - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, - "/category1/{node.cm:description}"); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(RuleType.INBOUND); - fileRule.setTitle("filingRule"); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(ruleFolder).isEmpty()); - } - }); - - //create 4 documents in documentLibrary - List documents = new ArrayList<>(4); - documents.addAll(doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - List documents = new ArrayList<>(4); - NodeRef document = createFile(documentLibrary, "document1.txt", "desc1", ContentModel.TYPE_CONTENT); - documents.add(document); - document = createFile(documentLibrary, "document2.txt", "desc2", ContentModel.TYPE_CONTENT); - documents.add(document); - document = createFile(documentLibrary, "document3.txt", "desc1", ContentModel.TYPE_CONTENT); - documents.add(document); - document = createFile(documentLibrary, "document4.txt", "desc1", ContentModel.TYPE_CONTENT); - documents.add(document); - return documents; - } - })); - - //move created documents in the folder that has Declare as Record rule - final Iterator temp = documents.iterator(); - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - while (temp.hasNext()) - { - NodeRef document = temp.next(); - fileFolderService.move(document, ruleFolder, null); - } - return null; - } - }); - - //give enough time for filing all records - Thread.sleep(5000); - - //check that target category has in created record folders 4 records - Integer numberOfRecords = AuthenticationUtil.runAsSystem(new RunAsWork() - { - - @Override - public Integer doWork() throws Exception - { - List containedRecordFolders = filePlanService.getContainedRecordFolders(nodeRefCategory1); - int numberOfRecords = 0; - for(NodeRef recordFolder : containedRecordFolders) - { - numberOfRecords = numberOfRecords + fileFolderService.list(recordFolder).size(); - } - return numberOfRecords; - } - }); - assertEquals(4, numberOfRecords.intValue()); - } - - private NodeRef createFile(NodeRef parentNodeRef, String name, String descrption, QName typeQName) - { - Map properties = new HashMap<>(11); - properties.put(ContentModel.PROP_NAME, (Serializable) name); - properties.put(ContentModel.PROP_DESCRIPTION, (Serializable) descrption); - QName assocQName = QName.createQName( - NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(name)); - ChildAssociationRef assocRef = nodeService.createNode( - parentNodeRef, - ContentModel.ASSOC_CONTAINS, - assocQName, - typeQName, - properties); - NodeRef nodeRef = assocRef.getChildRef(); - return nodeRef; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4293Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4293Test.java deleted file mode 100644 index 85c4120fa0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4293Test.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - * - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test for RM-4293 - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -public class RM4293Test extends BaseRMTestCase -{ - public void testDeleteSpecialContainers() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - - try - { - fileFolderService.delete(holdContainer); - fail("This should have thrown an exception"); - } - catch (IntegrityException e) - { - // ("Hold Container can't be deleted.") - } - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - try - { - fileFolderService.delete(transferContainer); - fail("This should have thrown an exception"); - } - catch (IntegrityException e) - { - // ("Transfer Container can't be deleted.") - } - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); - assertNotNull(unfiledRecordContainer); - - try - { - fileFolderService.delete(unfiledRecordContainer); - fail("This should have thrown an exception"); - } - catch (IntegrityException e) - { - // ("Unfiled Record Container can't be deleted.") - } - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - try - { - fileFolderService.delete(filePlan); - fail("This should have thrown an exception"); - } - catch (IntegrityException e) - { - // ("FilePlan can't be deleted.") - } - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java deleted file mode 100644 index 05ec2a25d3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestService; - -/** - * System test for RM-452 - * - * See alfresco.extension.rm-method-security.properties - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM452Test extends BaseRMTestCase -{ - private TestService testService; - - @Override - protected void initServices() - { - super.initServices(); - - testService = (TestService)applicationContext.getBean("TestService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM452() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertNotNull(folder); - assertNotNull(recordOne); - assertFalse(filePlanService.isFilePlanComponent(folder)); - assertTrue(filePlanService.isFilePlanComponent(recordOne)); - - // call methodOne with non-RM artifact .. expect success - testService.testMethodOne(folder); - - // call methodTwo with non-RM artifact .. expect success - testService.testMethodTwo(folder); - - // call methodOne with an RM artifact .. expect success - testService.testMethodOne(recordOne); - - return null; - } - }); - - doTestInTransaction(new FailureTest - ( - "Shouldn't be able to call testMethodTwo on TestService, because override RM security for method is not configred.", - AlfrescoRuntimeException.class - ) - { - - @Override - public void run() throws Exception - { - // call methodTwo with an RM artifact .. expect failure - testService.testMethodTwo(recordOne); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4619Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4619Test.java deleted file mode 100644 index 84edb87891..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4619Test.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Unit test for RM-4619 - * - * When creating regular folders through clients that are not RM aware - * the folders must be converted to the appropriate RM container - * - * @author Ana Bozianu - * @since 2.6 - */ -public class RM4619Test extends BaseRMTestCase -{ - - /** - * Given the RM site is created - * When we create a regular folder in the fileplan - * Then the folder is immediately converted to a record category - */ - public void testConvertFolderToCategory() throws Exception - { - /* - * Create a folder in the unfiled record container and check it is immediately converted - */ - final NodeRef recordCategory = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - FileInfo info = fileFolderService.create(filePlan, GUID.generate(), TYPE_FOLDER); - return info.getNodeRef(); - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertEquals(TYPE_RECORD_CATEGORY, nodeService.getType(recordCategory)); - assertNotNull(nodeService.getProperty(recordCategory, PROP_IDENTIFIER)); - return null; - } - }, ADMIN_USER); - } - - /** - * Given an existing category - * When we create a regular folder in the category - * Then the folder is immediately converted to a record folder - */ - public void testConvertFolderToRecordFolder() throws Exception - { - /* - * Create a folder in a record category and check it is converted - */ - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - FileInfo info = fileFolderService.create(rmContainer, GUID.generate(), TYPE_FOLDER); - return info.getNodeRef(); - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertEquals(TYPE_RECORD_FOLDER, nodeService.getType(recordFolder)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_IDENTIFIER)); - return null; - } - }, ADMIN_USER); - - /* - * Check that when the transaction ends the identifier is no longer editable - * And the record folder has the ASPECT_RM_SEARCH aspect - */ - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - return null; - } - - }, ADMIN_USER); - } - - /** - * Given the RM site is created - * When we create a regular folder in the unfiled record container - * Then the folder is converted to a unfiled record folder - * - * And when we create another regular folder in that unfiled record folder - * Then the folder is also converted to a unfiled record folder - */ - public void testConvertFolderToUnfiledRecordFolder() throws Exception - { - /* - * Create a folder in the unfiled record container and check it is converted - */ - final NodeRef folder1 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - FileInfo folder = fileFolderService.create(unfiledContainer, GUID.generate(), TYPE_FOLDER); - return folder.getNodeRef(); - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertEquals(TYPE_UNFILED_RECORD_FOLDER, nodeService.getType(folder1)); - assertNotNull(nodeService.getProperty(folder1, PROP_IDENTIFIER)); - return null; - } - }, ADMIN_USER); - - /* - * Create a folder in the unfiled record folder and check it is immediately converted - */ - final NodeRef folder2 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - FileInfo folder = fileFolderService.create(folder1, GUID.generate(), TYPE_FOLDER); - return folder.getNodeRef(); - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertEquals(TYPE_UNFILED_RECORD_FOLDER, nodeService.getType(folder2)); - assertNotNull(nodeService.getProperty(folder2, PROP_IDENTIFIER)); - return null; - } - }, ADMIN_USER); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4804Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4804Test.java deleted file mode 100644 index 837bc100bc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM4804Test.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.GUID; - - -/** - * Integration test for RM-4804 - * - * Completed records of type pdf can be transferred - * - * @author Ramona Popa - * @since 2.6 - */ -public class RM4804Test extends BaseRMTestCase -{ - //Fields required across transactions - NodeRef record; - NodeRef transferFolder; - - /** - * Given a category with disposition schedule applied on folder with Cut Of and Transfer, a record folder and a file PDF document - * to folder, complete the record - * When execute disposition schedule steps - * Then the Transfer step is successfully finished - */ - @org.junit.Test - public void testTransferCompletedRecordOfTypePDF() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // category is created - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create a disposition schedule for category, applied on folder - 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, false); - - DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(recordCategory, - dsProps); - - // cutoff immediately - Map dispositionActionCutOff = new HashMap<>(3); - dispositionActionCutOff.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - dispositionActionCutOff.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - dispositionActionCutOff.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, dispositionActionCutOff); - - // transfer immediately - Map dispositionActionTransfer = new HashMap<>(4); - dispositionActionTransfer.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); - dispositionActionTransfer.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - dispositionActionTransfer.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionActionTransfer.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, dispositionActionTransfer); - - // add folder under category - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - // add record of type PDF under folder - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_TITLE, GUID.generate()); - InputStream inputStream = IOUtils.toInputStream(GUID.generate()); - record = utils.createRecord(recordFolder, GUID.generate(), props, MimetypeMap.MIMETYPE_PDF, inputStream); - - // complete the record - utils.completeRecord(record); - // cut off and transfer record - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordFolder, - TransferAction.NAME) - .getValue(); - } - - public void when() - { - rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - } - - public void then() - { - // verify record is transferred - assertTrue(nodeService.hasAspect(record, ASPECT_TRANSFERRED)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM5225Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM5225Test.java deleted file mode 100644 index 2d8d5501f5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM5225Test.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Integration test for RM-5225 - * - * Copy of record from a RM site does not append the correct id at the end of the record name. - */ -public class RM5225Test extends BaseRMTestCase -{ - /** - * Given the RM site, a record category created in the fileplan, a record folder containing a record - * When we create a copy from the existing record - * Then the created record name contains both the name of the record from which it was created and the unique identifier of the current record. - */ - public void testCopyToRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private NodeRef copiedRecord; - - public void given() - { - - /** Create record category. */ - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - /** Create record folder. */ - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - /** File record. */ - record = utils.createRecord(recordFolder, GUID.generate()); - } - - public void when() - { - /** Create a copy of the original record */ - copiedRecord = recordService.createRecordFromCopy(filePlan, record); - } - - public void then() - { - /** Check if the copied record contains the name of the record from which is copied. */ - assertTrue(nodeService.getProperty(copiedRecord, PROP_NAME).toString().contains(nodeService.getProperty(record, PROP_NAME).toString())); - /** Check if the copied record name contains its unique id. */ - assertTrue(nodeService.getProperty(copiedRecord, PROP_NAME).toString().contains(nodeService.getProperty(copiedRecord, PROP_IDENTIFIER).toString())); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java deleted file mode 100644 index 5c4cf967fe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.site.SiteRole; - -/** - * Unit test for RM-804 .. site managers are able to delete file plans - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM804Test extends BaseRMTestCase -{ - @Override - protected void initServices() - { - super.initServices(); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - public void testUsersHaveDeletePermissionsOnFilePlan() throws Exception - { - // as rmuser - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, rmUserName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, userName); - } - - public void testTryAndDeleteSiteAsSiteManagerOnly() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - siteService.setMembership(siteId, userName, SiteRole.SiteManager.toString()); - - return null; - } - }, "admin"); - - doTestInTransaction(new FailureTest - ( - "Should not be able to delete site as a site manager only.", - AlfrescoRuntimeException.class - ) - { - @Override - public void run() throws Exception - { - siteService.deleteSite(siteId); - - } - }, userName); - - // give the user a RM role (but not sufficient to delete the file plan node ref) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, userName); - - return null; - } - }, "admin"); - - doTestInTransaction(new FailureTest - ( - "Should not be able to delete site as a site manager with an RM role that doesn't have the capability.", - AlfrescoRuntimeException.class - ) - { - @Override - public void run() throws Exception - { - siteService.deleteSite(siteId); - - } - }, userName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, userName); - - return null; - } - }, "admin"); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - siteService.deleteSite(siteId); - - return null; - } - }, userName); - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java deleted file mode 100644 index bf9f6f4f16..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java +++ /dev/null @@ -1,880 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import 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.model.RecordsManagementModel; -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 recordIdentifier = (String) nodeService.getProperty(movedDocument, RecordsManagementModel.PROP_IDENTIFIER); - assertNotNull(recordIdentifier); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name + " (" + recordIdentifier + ")", 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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java deleted file mode 100644 index 179f690be5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.security.SecureRandom; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -import junit.framework.TestCase; - -/** - * See https://issues.alfresco.com/jira/browse/RM-981. - * - * Instance of the repository needs to be running on localhost:8080 before executing this - * system test. - * - * @author Roy Wetherall - */ -public class RM981SystemTest extends TestCase -{ - public void testRM981() throws Exception - { - ExecutorService pool = Executors.newFixedThreadPool(2); - SecureRandom rnd = new SecureRandom(); - List data = new ArrayList<>(); - for (int i = 0; i < 100; i++) - { - String definitionname = "test_" + i + "_" + rnd.nextInt(Integer.MAX_VALUE); - data.add(definitionname); - } - - for (String definitionname : data) - { - pool.submit(new SendRequest(definitionname)); - } - pool.shutdown(); - pool.awaitTermination(60L, TimeUnit.SECONDS); - } - - - class SendRequest implements Runnable - { - - private String definitionname; - - public SendRequest(String definitionname) - { - this.definitionname = definitionname; - } - - @Override - public void run() - { - try - { - URL url = new URL("http://localhost:8080/alfresco/service/api/rma/admin/customreferencedefinitions"); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("POST"); - conn.setDoOutput(true); - conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); - conn.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4="); - String body = "{\"referenceType\":\"bidirectional\",\"label\":\"" + definitionname + "\"}"; - OutputStream out = conn.getOutputStream(); - - out.write(body.getBytes("UTF-8")); - out.flush(); - out.close(); - - int status = conn.getResponseCode(); - - if (status != 200) - { - System.out.println("Reproduced"); - System.out.println("---------------------------------"); - String line; - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - while ((line = reader.readLine()) != null) - { - System.out.println(line); - } - reader.close(); - System.exit(0); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java deleted file mode 100644 index 29d4f862df..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; - -/** - * System test for RM-994 - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM994Test extends BaseRMTestCase -{ - @Override - protected void initServices() - { - super.initServices(); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM944() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - checkVitalRecordNotSet(rmContainer); - checkVitalRecordNotSet(rmFolder); - checkVitalRecordNotSet(recordOne); - assertNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF)); - - vitalRecordService.setVitalRecordDefintion(rmContainer, true, new Period("month|1")); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - checkVitalRecordSet(rmContainer); - checkVitalRecordSet(rmFolder); - checkVitalRecordSet(recordOne); - assertNotNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF)); - - recordService.createRecord(filePlan, dmDocument, true); - - assertTrue(recordService.isRecord(dmDocument)); - checkVitalRecordNotSet(dmDocument); - - fileFolderService.move(dmDocument, rmFolder, null); - - checkVitalRecordSet(dmDocument); - - return null; - } - }, "admin"); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - checkVitalRecordSet(dmDocument); - - return null; - } - }); - - } - - private void checkVitalRecordSet(NodeRef nodeRef) - { - VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef); - assertNotNull(def); - assertTrue(def.isEnabled()); - assertEquals("month", def.getReviewPeriod().getPeriodType()); - assertEquals("1", def.getReviewPeriod().getExpression()); - } - - private void checkVitalRecordNotSet(NodeRef nodeRef) - { - VitalRecordDefinition recordDef = vitalRecordService.getVitalRecordDefinition(nodeRef); - if (recordDef != null) - { - assertFalse(recordDef.isEnabled()); - assertEquals("none", recordDef.getReviewPeriod().getPeriodType()); - assertNull(recordDef.getNextReviewDate()); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java deleted file mode 100644 index b6a57e39dd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue.rm3314; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.apache.commons.lang3.ArrayUtils; - -/** - * Test for https://issues.alfresco.com/jira/browse/RM-3114 - * - * @author Roy Wetherall - * @since 2.2.1.5 - */ -public class RM3314Test extends BaseRMTestCase -{ - /** Application context */ - protected String[] getConfigLocations() - { - return ArrayUtils.add(super.getConfigLocations(), "classpath:test-rm3314-context.xml"); - } - - /** registry to record callback from test beans "test.rm3114.1" and "test.rm3114.2" */ - public static Map callback = new HashMap<>(2); - - /** - * Given that the custom model hasn't been initialised - * When an aspect is added - * Then nothing happens - * - * Given that the custom model has been initialised - * When an aspect is added - * Then something happens - */ - public void testListenersExecutedInTheCorrectOrder() - { - /** - * The related test beans will call back into the callback map showing - * whether at the end of their execution whether the custom model has been - * initialised or not. Given the order in which these test beans are executed - * on spring context load, we would expect that .1 executes with the custom - * map unloaded, and the .2 with it loaded. - */ - - assertFalse(callback.isEmpty()); - assertFalse(callback.get("test.rm3314.1")); - assertTrue(callback.get("test.rm3314.2")); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java deleted file mode 100644 index adec013e96..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue.rm3314; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.Ordered; -import org.springframework.jdbc.BadSqlGrammarException; - -/** - * Simple bean used to test RM-3314 - * - * @author rwetherall - * @since 2.2.1.5 - */ -public class RM3314TestListener implements ApplicationListener, - Ordered, - BeanNameAware -{ - private RecordsManagementAdminServiceImpl recordsManagementAdminService; - private NodeService nodeService; - private FileFolderService fileFolderService; - private Repository repository; - - private String name; - private int order = Ordered.LOWEST_PRECEDENCE; - - public void setRecordsManagementAdminService(RecordsManagementAdminServiceImpl recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setRepository(Repository repository) - { - this.repository = repository; - } - - @Override - public void setBeanName(String name) - { - this.name = name; - } - - public void setOrder(int order) - { - this.order = order; - } - - @Override - public void onApplicationEvent(ContextRefreshedEvent event) - { - // call back to show whether the custom map is initialised or not - RM3314Test.callback.put(name, recordsManagementAdminService.isCustomMapInit()); - - // Do some work on a node to show that reguardless of whether the custom map is - // init or not, things still work. - // Note: using public services to ensure new transaction for each service call - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - try - { - NodeRef companyHome = repository.getCompanyHome(); - - if (fileFolderService.searchSimple(companyHome, name) == null) - { - // create node - NodeRef folder = fileFolderService.create( - repository.getCompanyHome(), - name, - ContentModel.TYPE_FOLDER).getNodeRef(); - try - { - // add aspect - nodeService.addAspect(folder, ContentModel.ASPECT_CLASSIFIABLE, null); - - // remove aspect - nodeService.removeAspect(folder, ContentModel.ASPECT_CLASSIFIABLE); - } - finally - { - // delete node - nodeService.deleteNode(folder); - } - } - } - catch (BadSqlGrammarException e) - { - // ignore and carry on - } - - return null; - } - }); - } - - @Override - public int getOrder() - { - return order; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java deleted file mode 100644 index 8faba945ca..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java +++ /dev/null @@ -1,623 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -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"); - private static final QName CUSTOM_ELECTRONIC_TEST = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "rmarecordCustomProperties"); - private static final QName CUSTOM_NON_ELECTRONIC_TEST = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "rmanonElectronicDocumentCustomProperties"); - private static final boolean MANDATORY_METADATA = true; - private static final boolean OPTIONAL_METADATA = false; - - /** - * Record service impl - */ - private RecordServiceImpl recordServiceImpl; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - // get the record service - recordServiceImpl = (RecordServiceImpl) applicationContext.getBean("recordService"); - } - - /** - * @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 - recordServiceImpl.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 - recordServiceImpl.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 - recordServiceImpl.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 to check for mandatory values before complete - * And a filed record is missing custom 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 testCheckForCustomMandatoryValuesMissing() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // create the custom metadata definition (that has a mandatory property) for electronic records - defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA); - - // create an electronic record - record = utils.createRecord(rmFolder, "electronicRecord.txt", "title"); - } - - 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)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_ELECTRONIC_TEST); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And a filed record has all custom mandatory values - * When I try to complete the record - * Then the record is completed - */ - public void testCheckForCustomMandatoryValuePresent() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // define the custom metadata definition (that has a mandatory property) - defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA); - - // create a record - record = utils.createRecord(rmFolder, "customrecord.txt", "title"); - - // populate the custom metadata mandatory property for the record - populateCustomMetadata(record, CUSTOM_ELECTRONIC_TEST); - } - - 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)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_ELECTRONIC_TEST); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And a non-electronic record is missing custom 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 testCheckForCustomMandatoryValuesMissingInNonElectronicRecord() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef nonElectronicRecord; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // create the custom metadata definition (that has a mandatory property) for non-electronic records - defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA); - - // create a non-electronic record - nonElectronicRecord = utils.createNonElectronicRecord(rmFolder, "non-electronicRecord.txt", "title"); - } - - public void when() - { - // complete non-electronic record - result = rmActionService.executeRecordsManagementAction(nonElectronicRecord, - "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNotNull(result.getValue()); - assertFalse(nodeService.hasAspect(nonElectronicRecord, ASPECT_DECLARED_RECORD)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And a non-electronic record has all custom mandatory values - * When I try to complete the record - * Then the record is completed - */ - public void testCheckForCustomMandatoryValuePresentInNonElectronicRecord() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef nonElectronicRecord; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // create the custom metadata definition (that has a mandatory property) - defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA); - - // create a non-electronic record - nonElectronicRecord = utils.createNonElectronicRecord(rmFolder, "non-electronicRecord.txt", "title"); - - // populate the custom metadata mandatory property for the record - populateCustomMetadata(nonElectronicRecord, CUSTOM_NON_ELECTRONIC_TEST); - } - - public void when() - { - // complete record - result = rmActionService.executeRecordsManagementAction(nonElectronicRecord, "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNull(result.getValue()); - assertTrue(nodeService.hasAspect(nonElectronicRecord, ASPECT_DECLARED_RECORD)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And a filed record is missing custom non-mandatory values - * When I try to complete the record - * Then the record is completed - */ - public void testCheckForCustomOptionalValuesMissing() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // create the custom metadata definition (that does not have a mandatory property) - defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, OPTIONAL_METADATA); - - // create a record - record = utils.createRecord(rmFolder, "customrecord.txt", "title"); - } - - 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)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_ELECTRONIC_TEST); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And custom mandatory metadata is required for electronic records - * And a non-electronic record has no custom mandatory values - * When I try to complete the non-electronic record - * Then the record is completed - */ - public void testElectronicRecordCustomMandatoryNotAppliedToNonElectronicRecord() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef nonElectronicRecord; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // create the record custom metadata definition (that has a mandatory property) - defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA); - - // create a non-electronic record - nonElectronicRecord = utils.createNonElectronicRecord(rmFolder, "non-electronicRecord.txt", "title"); - } - - public void when() - { - // complete record - result = rmActionService.executeRecordsManagementAction(nonElectronicRecord, "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNull(result.getValue()); - assertTrue(nodeService.hasAspect(nonElectronicRecord, ASPECT_DECLARED_RECORD)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_ELECTRONIC_TEST); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And custom mandatory metadata is required for non-electronic records - * And an electronic record has no custom mandatory values - * When I try to complete the electronic record - * Then the record is completed - */ - public void testNonElectronicRecordCustomMandatoryNotAppliedToElectronicRecord() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() throws Exception - { - // enable mandatory parameter check - recordServiceImpl.setCheckMandatoryPropertiesEnabled(true); - - // create the non-electronic record custom metadata definition (that has a mandatory property) - defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA); - - // create a electronic record - record = utils.createRecord(rmFolder, "electronicRecord.txt", "title"); - } - - 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)); - } - - public void after() - { - // remove the custom metadata definition - removeCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST); - } - }); - } - - /** - * 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 - recordServiceImpl.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 - recordServiceImpl.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)); - } - }); - } - - /** - * Helper method to create a Custom Metadata definition in the RM custom model - * - * @param mandatory specifies if metadata is mandatory - */ - private void defineCustomMetadata(QName propId, QName typeName, boolean mandatory) throws Exception - { - rmAdminService.addCustomPropertyDefinition( - propId, - typeName, - "SomeCustomDefLabel", - DataTypeDefinition.TEXT, - null, - null, - null, - false, - mandatory, - false, - null - ); - } - - /** - * Helper method to populate the Custom Metadata for the record - */ - private void populateCustomMetadata(NodeRef record, QName propId) - { - Map properties = new HashMap<>(1); - properties.put(propId, "SomeCustomValue"); - nodeService.addAspect(record, propId, properties); - } - - /** - * Helper method to remove the Custom Metadata definition in the RM custom model - */ - private void removeCustomMetadata(QName propId) - { - rmAdminService.removeCustomPropertyDefinition(propId); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateInplaceRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateInplaceRecordTest.java deleted file mode 100644 index 31883f4aa8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateInplaceRecordTest.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import org.alfresco.model.QuickShareModel; -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.node.integrity.IntegrityException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.quickshare.QuickShareService; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Create Inplace Record Test - * - * @author Roy Wetherall - */ -public class CreateInplaceRecordTest extends BaseRMTestCase -{ - private QuickShareService quickShareService; - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - quickShareService = (QuickShareService) applicationContext.getBean("quickShareService"); - } - - /** - * Given a document in a collaboration site - * When the document is declared by a site collaborator - * Then the document becomes a record - * And the site users have the appropriate in-place permissions on the record - */ - public void testCreateInplaceRecordFromCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // Check that the document is not a record - assertFalse("The document should not be a record", recordService.isRecord(dmDocument)); - } - - public void when() - { - // Declare the document as a record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Declare record - recordService.createRecord(filePlan, dmDocument); - - return null; - } - }, dmCollaborator); - } - - public void then() - { - // Check that the document is a record now - assertTrue("The document should now be a record", recordService.isRecord(dmDocument)); - - // Check that the record is in the unfiled container - - // Check that the record is still a child of the collaboration folder - - // Check that the collaborator has filling permissions on the record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - return null; - } - }, dmCollaborator); - - - // Check that the consumer has read permissions on the record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - return null; - } - }, dmConsumer); - - } - }); - } - - public void testFileInplaceRecordFromCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // Check that the document is not a record - assertFalse("The document should not be a record", 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 - assertTrue("The document should be a record", recordService.isRecord(dmDocument)); - assertFalse("The record should not be filed", recordService.isFiled(dmDocument)); - } - - public void when() throws FileExistsException, FileNotFoundException - { - // file the document to a location in the file plan - fileFolderService.move(dmDocument, rmFolder, null); - } - - public void then() - { - // Check that the document is a record now - assertTrue("The document should be a record", recordService.isRecord(dmDocument)); - assertTrue("The record hsould be filed", recordService.isFiled(dmDocument)); - - // Check that the record is in the unfiled container - // TODO - - // Check that the record is still a child of the collaboration folder - // TODO - - // Check that the collaborator has filling permissions on the record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - return null; - } - }, dmCollaborator); - - - // Check that the consumer has read permissions on the record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - return null; - } - }, dmConsumer); - - } - }); - } - - /** - * Given a shared document in a collaboration site - * When the document is declared as record by a site collaborator - * Then the document becomes a record and is not shared anymore - */ - public void testCreateInplaceRecordFromCollabSiteRemovesSharedLink() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // Check that the document is not a record - assertFalse("The document should not be a record", recordService.isRecord(dmDocument)); - - quickShareService.shareContent(dmDocument); - // Check the document is shared - assertTrue("The document is shared", nodeService.hasAspect(dmDocument, QuickShareModel.ASPECT_QSHARE)); - } - - public void when() - { - // Declare the document as a record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Declare record - recordService.createRecord(filePlan, dmDocument); - - return null; - } - }, dmCollaborator); - } - - public void then() - { - // Check that the document is a record now - assertTrue("The document should now be a record", recordService.isRecord(dmDocument)); - - // Check that the record is not shared anymore - assertFalse("The document should not be shared anymore", nodeService.hasAspect(dmDocument, QuickShareModel.ASPECT_QSHARE)); - } - }); - } - - /** - * Given a document in a collaboration site declared as record - * When I try to share the document - * Then it fails - */ - public void testRecordsFromCollabSiteCannotBeShared() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(IntegrityException.class) - { - public void given() - { - // Check that the document is not a record - assertFalse("The document should not be a record", 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); - } - - public void when() - { - // Try to share document - quickShareService.shareContent(dmDocument); - } - - public void after() - { - // Check that the record is not shared - assertFalse("The document should not be shared", nodeService.hasAspect(dmDocument, QuickShareModel.ASPECT_QSHARE)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java deleted file mode 100644 index 6a8404a8b5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -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.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(); - NodeRef recordFolder; - NodeRef record; - - public void given() - { - // create role - 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); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); - - return null; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - } - }); - } - - /** - * - */ - public void testCreateRecordCapabilityOnlyFromFileFolderService() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef recordFolder; - NodeRef record; - - public void given() - { - // create role - 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); - - 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); - } - - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/DownloadAsZipRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/DownloadAsZipRecordTest.java deleted file mode 100644 index 968b7d7b4b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/DownloadAsZipRecordTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import net.sf.acegisecurity.Authentication; -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.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.download.DownloadService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Download as zip record test. - *
Tests for MNT-21292 
- * @author Rodica Sutu - * @since 3.2.0.1 - */ -public class DownloadAsZipRecordTest extends BaseRMTestCase -{ - private DownloadService downloadService; - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - downloadService = (DownloadService) applicationContext.getBean("DownloadService"); - } - - /** - * Given a record and a user without view record capability - * When the user downloads the record - * Then Access Denied exception is thrown - */ - public void testDownloadRecordUserNoReadCapability() - { - - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** user with no view record capability */ - String userDownload; - Authentication previousAuthentication; - - public void given() - { - // create an inplace record - AuthenticationUtil.runAs((RunAsWork) () -> { - recordService.createRecord(filePlan, dmDocument); - return null; - }, AuthenticationUtil.getAdminUserName()); - // create user - userDownload = GUID.generate(); - createPerson(userDownload); - } - - public void when() - { - previousAuthentication = AuthenticationUtil.getFullAuthentication(); - AuthenticationUtil.setFullyAuthenticatedUser(userDownload); - downloadService.createDownload(new NodeRef[] { dmDocument }, true); - } - - public void after() - { - AuthenticationUtil.setFullAuthentication(previousAuthentication); - personService.deletePerson(userDownload); - } - }); - } - - /** - * Given a record and a user with view record capability - * When the user downloads the record - * Then download node is created - */ - public void testDownloadRecordUserWithReadCapability() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef downloadStorageNode; - - public void given() - { - // Create an inplace record - AuthenticationUtil.runAs((RunAsWork) () -> { - // Declare record - recordService.createRecord(filePlan, dmDocument); - return null; - }, dmCollaborator); - } - - public void when() - { - Authentication previousAuthentication = AuthenticationUtil.getFullAuthentication(); - AuthenticationUtil.setFullyAuthenticatedUser(dmCollaborator); - // request to download the record - downloadStorageNode = downloadService.createDownload(new NodeRef[] { dmDocument }, true); - AuthenticationUtil.setFullAuthentication(previousAuthentication); - } - - public void then() - { - // check the download storage node is created - assertTrue(nodeService.exists(downloadStorageNode)); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java deleted file mode 100644 index f540e9ac5d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java deleted file mode 100644 index a59153cd80..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java +++ /dev/null @@ -1,947 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -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.role.FilePlanRoleService; -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.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.GUID; - -/** - * In-place record permission integration test. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class InplaceRecordPermissionTest extends BaseRMTestCase -{ - /** capability list */ - private static final List CAPABILITIES = Stream - .of(RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_NON_RECORD_METADATA, - RMPermissionModel.EDIT_RECORD_METADATA) - .collect(Collectors.toList()); - - /** test data */ - private NodeRef contribDoc; - private NodeRef deleteUserDoc; - private NodeRef copiedDoc; - private NodeRef copyDoc; - private String deletedUser; - - /** services */ - private NodeService dbNodeService; - - /** capabilities */ - private Capability viewRecordsCapability; - private Capability editNonRecordMetadataCapability; - private Capability editRecordMetadataCapability; - - /** test characteristics */ - @Override protected boolean isCollaborationSiteTest() { return true; } - @Override protected boolean isUserTest() { return true; } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - // initialise behaviour tests - BehaviourTest.initBehaviourTests(retryingTransactionHelper); - - // get services - dbNodeService = (NodeService)applicationContext.getBean("dbNodeService"); - - // get capability references - viewRecordsCapability = capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS); - editNonRecordMetadataCapability = capabilityService.getCapability(RMPermissionModel.EDIT_NON_RECORD_METADATA); - editRecordMetadataCapability = capabilityService.getCapability(RMPermissionModel.EDIT_RECORD_METADATA); - } - - /** - * Given a document in a collaboration site - * When a user without write permissions on the document tries to declare it as a record - * Then the declaration fails - * And the document does not become a record - */ - public void testUserWithOutWriteCantDeclareInPlaceRecord() - { - test() - .given() - - // Given a document in a collaboration site that is not a record - .expect(false) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is not a record.") - - // And a user with no write permission on the document - .as(userName) - .expect(AccessStatus.DENIED.toString()) - .from(() -> permissionService.hasPermission(dmDocument, PermissionService.WRITE).toString()) - .because("User does not have write access to document.") - - // When the user tries to declare the record - // Then we expect this to fail - .when() - .as(userName) - .expectException(AccessDeniedException.class) - .from(() -> recordService.createRecord(filePlan, dmDocument)) - .because("The user does not have write permission on the document."); - } - - /** - * Given a document in a collaboration site that is not a record - * And a contributor the didn't create the document - * When the contributor tries to declare the document as a record - * Then the document does not become a record - */ - public void testContributorThatIsntOwnerDeclareInPlaceRecord() - { - test() - .given() - - // Given a document in a collaboration site that is not a record - .expect(false) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is not a record.") - - // And a contributor the didn't create the document - .as(dmContributor) - .expect(AccessStatus.DENIED.toString()) - .from(() -> permissionService.hasPermission(dmDocument, PermissionService.WRITE).toString()) - .because("Contributor does not have write access to document.") - - // When the user tries to declare the record - // When the contributor tries to declare the document as a record - .when() - .as(dmContributor) - .expectException(AccessDeniedException.class) - .from(() -> recordService.createRecord(filePlan, dmDocument)) - .because("The contributor does not have write permission on the document."); - } - - /** - * Given a document in a collaboration site is not a record - * When the document is declared by a site collaborator - * Then the document becomes a record - * And the site users have the appropriate in-place permissions on the record - */ - public void testCreateInplaceRecordFromCollabSite() - { - test() - - // Given that a document in a collaboration site is not a record - .given() - .asAdmin() - .expect(false) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is not a record") - - // When it is declared as an inplace record - .when() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - - .then() - .asAdmin() - // Then it becomes a record - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is a record") - - // And it isn't filed - .expect(false) - .from(() -> recordService.isFiled(dmDocument)) - .because("The record is not filed") - - // And a site collaborator has filling permissions and filling capability on the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not a member of the site has no access to the inplace record - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Helper method to check in place access for a user on a record. - */ - private void checkInPlaceAccess(NodeRef nodeRef, AccessStatus ... accessStatus) - { - // check permission access - assertEquals("Incorrect read record permission access.", accessStatus[0], permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS)); - assertEquals("Incorrect filling permission access.", accessStatus[1], permissionService.hasPermission(nodeRef, RMPermissionModel.FILING)); - - // check capability access - Map access = capabilityService.getCapabilitiesAccessState(nodeRef, CAPABILITIES); - assertEquals("Incorrect view records capability access", accessStatus[2], access.get(viewRecordsCapability)); - assertEquals("Incorrect edit non record metadata capability access", accessStatus[3], access.get(editNonRecordMetadataCapability)); - assertEquals("Incorrect edit record metadata capability access", accessStatus[4], access.get(editRecordMetadataCapability)); - } - - /** - * Given that a document is created by contributor - * When it is declared as an inplace record - * Then it becomes a record - * And it isn't filed - * And a site collaborator has filling permissions and filling capability on the record - * And a site contributor has filling capability and permissions - * And a site consumer has read permissions and view record capability on the record - * And a user that is not a member of the site has no access to the inplace record - */ - public void testCreateInplaceRecordFromCollabSiteWhenContribIsCreatorOfDocument() - { - test() - - // Given that a document is created by contributor - .given() - .as(dmContributor) - .perform(() -> - { - contribDoc = fileFolderService.create(dmFolder, "contrib.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); - dbNodeService.addAspect(contribDoc, ContentModel.ASPECT_AUDITABLE, null); - }) - .expect(false) - .from(() -> recordService.isRecord(contribDoc)) - .because("It is not a record.") - .asAdmin() - .expect(dmContributor) - .from(() -> ownableService.getOwner(contribDoc)) - .because("As the creator of the document the contributor is also the owner") - .as(dmContributor) - .expect(AccessStatus.ALLOWED.toString()) - .from(() -> permissionService.hasPermission(contribDoc, PermissionService.WRITE).toString()) - .because("Contrib user has write permissions on created document as the owner.") - - // When it is declared as an inplace record - .when() - .as(dmContributor) - .perform(() -> recordService.createRecord(filePlan, contribDoc)) - - .then() - .asAdmin() - // Then it becomes a record - .expect(true) - .from(() -> recordService.isRecord(contribDoc)) - .because("The document is a record") - - // And it isn't filed - .expect(false) - .from(() -> recordService.isFiled(contribDoc)) - .because("The record is not filed") - - // And a site collaborator has filling permissions and filling capability on the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has filling capability and permissions - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not a member of the site has no access to the inplace record - .as(userName) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an unfiled in-place record - * When the record is moved to the file plan (ie filed) - * Then the site users still have the appropriate in-place permissions on the record - */ - public void testFileInplaceRecordFromCollabSite() throws Exception - { - test() - - // Given an unfiled inplace record - .given() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is a record.") - .expect(false) - .from(() -> recordService.isFiled(dmDocument)) - .because("The record is not filed") - - // When the record is filed - .when() - .asAdmin() - .perform(() -> fileFolderService.move(dmDocument, rmFolder, null)) - - .then() - - // Then the record is filed - .asAdmin() - .expect(true) - .from(() -> recordService.isFiled(dmDocument)) - .because("The record is filed.") - - // And the collaborator has filling permissions and filling capability on the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions on the record - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an incomplete inplace record - * When it is completed - * Then the inplace users still have access to the record - * And can't edit the records meta-data - */ - public void testCompletedInPlaceRecord() - { - test() - - // Given an incomplete record - .given() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(false) - .from(() -> recordService.isDeclared(dmDocument)) - .because("Record is not complete.") - - // When it is completed - .when() - .asAdmin() - .perform(() -> rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME)) - .expect(true) - .from(() -> recordService.isDeclared(dmDocument)) - .because("Record is complete.") - - .then() - - // Then the collaborator has filling permissions, view record capability, but not edit non-record metadata - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions on the record - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an inplace record ready for destruction - * When it is destroyed - * And it's metadata is maintained - * Then the inplace users will no longer see the record - */ - public void testDestroyedRecordInplacePermissions() - { - test() - .given() - - // Given that a record is declared by a collaborator - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - - // And it is filed into the file plan - // And eligible for destruction - .asAdmin() - .perform(() -> - { - // create record category and disposition schedule - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(recordCategory, GUID.generate(), GUID.generate(), true, true); - - // create record folder and file record - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - fileFolderService.move(dmDocument, recordFolder, null); - - // cut off record - rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME); - utils.completeEvent(dmDocument, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(dmDocument, CutOffAction.NAME); - }) - .expect("destroy") - .from(() -> dispositionService.getNextDispositionAction(dmDocument).getName()) - .because("The next action is destroy.") - .expect(true) - .from(() -> dispositionService.isNextDispositionActionEligible(dmDocument)) - .because("The next action is eligible.") - - // When the record is destroyed - .when(() -> rmActionService.executeRecordsManagementAction(dmDocument, DestroyAction.NAME)) - - .then() - .expect(true) - .from(() -> recordService.isMetadataStub(dmDocument)) - .because("The record has been destroyed and the meta-stub remains.") - - // Then the collaborator has no permissions or capabilities - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has no permissions or capabilities - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no permissions or capabilities - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions or capabilities - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an inplace record - * And the collaborator has view and edit non-record capability - * And doesn't have edit record capability - * When we add edit record metadata capability to the extended writer role - * Then the collaborator now has edit record metadata capability - */ - public void testAddUserToRole() - { - test() - .given() - .as(dmCollaborator) - - // Given an inplace record - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - - // And the collaborator has view and edit non-record capability - // And doesn't have edit record capability - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - .when() - .asAdmin() - - // When we add edit record metadata capability to the extended writer role - .perform(() -> filePlanRoleService.updateRole(filePlan, - FilePlanRoleService.ROLE_EXTENDED_WRITERS, - "", - Stream - .of(viewRecordsCapability, editNonRecordMetadataCapability, editRecordMetadataCapability) - .collect(Collectors.toSet()))) - - .then() - .as(dmCollaborator) - - // Then the collaborator now has edit record metadata capability - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.ALLOWED)) // edit record metadata capability - ; - } - - /** - * Given an inplace record - * When the record is hidden - * Then the collaborator has no access to the record - * And the consumer has no access to the record - * And a user that is not in the site has no permissions or capabilities - */ - public void testNoPermissionsAfterHide() - { - test() - .given() - .as(dmCollaborator) - - // Given an inplace record - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - .when() - .asAdmin() - - // When the record is hidden - .perform(() -> inplaceRecordService.hideRecord(dmDocument)) - - .then() - - // Then the collaborator has no access to the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no access to the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions or capabilities - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an inplace record - * When the record is rejected - * Then the collaborator has no access to the record - * And the consumer has no access to the record - * And a user that is not in the site has no permissions or capabilities - */ - public void testNoPermissionsAfterReject() - { - test() - .given() - .as(dmCollaborator) - - // Given an inplace record - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - .when() - .asAdmin() - - // When the record is rejected - .perform(() -> recordService.rejectRecord(dmDocument, GUID.generate())) - - .then() - - // Then the collaborator has no access to the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no access to the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions or capabilities - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given a user is the cm:creator of a document - * And the user is deleted - * When the document is declared as a record by a manager - * Then it successfully becomes a record - */ - public void testCmCreatorDeletedBeforeRecordDeclaration() - { - test() - .given() - .asAdmin() - .perform(() -> - { - deletedUser = GUID.generate(); - createPerson(deletedUser); - siteService.setMembership(collabSiteId, deletedUser, SiteModel.SITE_CONTRIBUTOR); - }) - .as(deletedUser) - .perform(() -> - { - deleteUserDoc = fileFolderService.create(dmFolder, "deleteUserDoc.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); - dbNodeService.addAspect(deleteUserDoc, ContentModel.ASPECT_AUDITABLE, null); - }) - .asAdmin() - .perform(() -> personService.deletePerson(deletedUser)) - .when() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, deleteUserDoc)) - .then() - .expect(true) - .from(() -> recordService.isRecord(deleteUserDoc)) - .because("The document is now a record.") - ; - } - - /** - * Given a document created by the collaborator - * And declared as a record by the collaborator - * And filed by the records manager - * When the records manager copies the record - * Then the collaborator has no access to the record copy - * And a site contributor has no access to the record copy - * And the consumer has no access to the record copy - * And a user that is not in the site has no access to the record copy - */ - public void testNoPermissionsOnCopy() - { - test() - .given() - .as(dmCollaborator) - .perform(() -> - { - // Given a document created by the collaborator - copiedDoc = fileFolderService.create(dmFolder, "copiedDoc.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); - dbNodeService.addAspect(copiedDoc, ContentModel.ASPECT_AUDITABLE, null); - - // And declared as a record by the collaborator - recordService.createRecord(filePlan, copiedDoc); - }) - .asAdmin() - - // And filed by the records manager - .perform(() -> fileFolderService.move(copiedDoc, rmFolder, null)) - - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(copiedDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - .when() - .asAdmin() - - // When the records manager copies the record - .perform(() -> copyDoc = fileFolderService.copy(copiedDoc, rmFolder, "newRecord.txt").getNodeRef()) - - .then() - - // Then the collaborator has no access to the record copy - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - .perform(() -> - checkInPlaceAccess(copiedDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has no access to the record copy - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no access to the record copy - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no access to the record copy - .as(userName) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Test group reuse - */ - public void testGroupReuse() - { - test() - .when() - .as(dmCollaborator) - .perform(50, () -> - { - NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.createRecord(filePlan, newDocument); - }) - .as(dmContributor) - .perform(50, () -> - { - NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.createRecord(filePlan, newDocument); - }) - .then() - .asAdmin() - .expect(101) - .from(() -> nodeService.getChildAssocs(dmFolder).size()) - .because("One hundred inplace records have been created.") - .expect(3) - .from(() -> authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true).size()) - .because("The read and write groups are reused."); - } - - /** - * Test tear down - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // clear up groups - authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true) - .stream() - .forEach((group) -> authorityService.deleteAuthority(group)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java deleted file mode 100644 index 3c3a4e9ee1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java deleted file mode 100644 index 87c892aee3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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; - - // primary parent of record - private NodeRef primaryParentBeforeMove; - - 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.getReaders(dmDocument); - extendedWritersBeforeMove = extendedSecurityService.getWriters(dmDocument); - - // get the primary parent and assert that it's a record management artifact - primaryParentBeforeMove = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertTrue("Primary parent of newly created should be a records management artifact.", - filePlanService.isFilePlanComponent(primaryParentBeforeMove)); - - } - - 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() - { - // assert that the document is still a record - assertTrue("After move the document should still be a record.", - recordService.isRecord(dmDocument)); - - // 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 that the primary parent of the record has remained unchanged - NodeRef primaryParentAfterMove = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertTrue("Primary parent of record after inplace move should be a records management artifact.", - filePlanService.isFilePlanComponent(primaryParentAfterMove)); - assertEquals("Primary parent of record after inplace move should remain the same.", - primaryParentBeforeMove, - primaryParentAfterMove); - - // Check extended readers/writers - Set extendedReadersAfterMove = extendedSecurityService.getReaders(dmDocument); - Set extendedWritersAfterMove = extendedSecurityService.getWriters(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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java deleted file mode 100644 index c7d2f07346..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import java.io.Serializable; -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.disposition.DispositionAction; -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.springframework.extensions.webscripts.GUID; - -/** - * Move record tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -@SuppressWarnings("unchecked") -public class MoveRecordTest extends BaseRMTestCase -{ - private static final String OTHER_EVENT = "abolished"; - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Given a record is filed in a event disposition and moved then the - * record no longer has any disposition. - * - * @see https://issues.alfresco.com/jira/browse/RM-1540 - */ - public void testMoveRecordEventDispositinoToNoDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - - // create record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - } - - public void when() throws Exception - { - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // move record - fileFolderService.move(record, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(record)); - - // check the search aspect properties - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - - } - }); - } - - /** - * Given a record in a event disposition, when it moved to another event disposition then the record should have the - * new events, rather than the old ones. - */ - public void testMoveRecordEventDisToEventDis() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, true, false, OTHER_EVENT); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - - // create record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - assertNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); - } - - public void when() throws Exception - { - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // move record - fileFolderService.move(record, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - assertNotNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); - - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(OTHER_EVENT)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY)); - assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE)); - } - }); - - } - - /** - * Given a record in a event disposition, when it moved to a time disposition then the record should have the correct as of - * date and no longer have the events. - */ - public void testMoveRecordEventDisToTimeDis() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, 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); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - - // create record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - assertNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); - } - - public void when() throws Exception - { - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // move record - fileFolderService.move(record, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertNull(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS))); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY)); - assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE)); - } - }); - } - - /** - * See https://issues.alfresco.com/jira/browse/RM-1502 - */ - public void testMoveDMtoRM() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - - public void given() - { - // destination category - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, 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); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - } - - public void when() throws Exception - { - // move document to record folder - fileFolderService.move(dmDocument, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(dmDocument); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(dmDocument)); - assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // check the search aspect details - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertNull(((List)nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_EVENTS))); - assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_INSTRUCTIONS)); - assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_AUTHORITY)); - assertTrue((Boolean)nodeService.getProperty(dmDocument, PROP_RS_HAS_DISPOITION_SCHEDULE)); - } - }); - } - - // TODO moveRecordNoDisToEventDis - // TODO moveRecordRecordDisToFolderDis -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java deleted file mode 100644 index 454499f092..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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; - -/** - * reject record tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -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() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected void initServices() - { - super.initServices(); - - versionService = (VersionService) applicationContext.getBean("VersionService"); - checkOutCheckInService = (CheckOutCheckInService) applicationContext.getBean("CheckOutCheckInService"); - } - - /** - * - */ - public void testRejectedRecordInCorrectState() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - assertFalse(recordService.isRecord(dmDocument)); - ownableService.setOwner(dmDocument, userName); - - // document is declared as a record by user - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // declare record - recordService.createRecord(filePlan, dmDocument); - return null; - } - }, userName); - } - - public void when() - { - // sanity checks - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(permissionService.getInheritParentPermissions(dmDocument)); - - // reject record - recordService.rejectRecord(dmDocument, REASON); - } - - public void then() - { - // document is no longer a record - assertFalse(recordService.isRecord(dmDocument)); - - // expected owner has be re-set - assertEquals(userName, ownableService.getOwner(dmDocument)); - assertTrue(permissionService.getInheritParentPermissions(dmDocument)); - assertFalse(nodeService.hasAspect(dmDocument, ASPECT_FILE_PLAN_COMPONENT)); - } - }); - } - - /** - * - */ - public void testRevertAfterReject() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef document; - - public void given() - { - NodeRef folder = fileFolderService.create(documentLibrary, GUID.generate(), TYPE_FOLDER).getNodeRef(); - document = fileFolderService.create(folder, GUID.generate(), TYPE_CONTENT).getNodeRef(); - - assertFalse(recordService.isRecord(document)); - ownableService.setOwner(document, userName); - versionService.ensureVersioningEnabled(document, null); - - // document is declared as a record by user - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // declare record - recordService.createRecord(filePlan, document); - return null; - } - }, userName); - - assertTrue(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - } - - public void when() - { - // reject the record - recordService.rejectRecord(document, REASON); - assertFalse(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - - // upload a new version of the document - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - ContentWriter writer = contentService.getWriter(document, ContentModel.PROP_CONTENT, true); - writer.putContent("This is a change to the content and should force a new version"); - versionService.createVersion(document, null); - - return null; - } - }, userName); - - assertFalse(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - - VersionHistory history = versionService.getVersionHistory(document); - assertEquals(2, history.getAllVersions().size()); - final Version initial = history.getRootVersion(); - - assertFalse(nodeService.hasAspect(initial.getFrozenStateNodeRef(), ASPECT_FILE_PLAN_COMPONENT)); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // revert the document to a previous version - versionService.revert(document, initial); - - return null; - } - }, userName); - } - - public void then() - { - // document is no longer a record - assertFalse(recordService.isRecord(document)); - - // expected owner has be re-set - assertEquals(userName, ownableService.getOwner(document)); - } - }); - } - - 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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/UpdateRecordAspectsTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/UpdateRecordAspectsTest.java deleted file mode 100644 index a1e0897233..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/UpdateRecordAspectsTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * remove aspects test - * - * @author Ramona Popa - * @since 2.6 - */ -public class UpdateRecordAspectsTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * RM-4926 - * RM specific aspects can be removed only by System user - */ - public void testRemoveRMAspectsFromElectronicRecord() throws Exception - { - final NodeRef record = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create file plan structure and a record - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); - - return recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); - } - }); - - doTestInTransaction(new FailureTest(IntegrityException.class) - { - @Override - public void run() - { - nodeService.removeAspect(record, ASPECT_RECORD); - } - }); - - doTestInTransaction(new FailureTest(IntegrityException.class) - { - @Override - public void run() - { - nodeService.removeAspect(record, ASPECT_FILE_PLAN_COMPONENT); - } - }); - - doTestInTransaction(new FailureTest(IntegrityException.class) - { - @Override - public void run() - { - nodeService.removeAspect(record, ASPECT_RECORD_COMPONENT_ID); - } - }); - - doTestInTransaction(new FailureTest(IntegrityException.class) - { - @Override - public void run() - { - nodeService.removeAspect(record, ASPECT_COMMON_RECORD_DETAILS); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - nodeService.removeAspect(record, ASPECT_RECORD); - nodeService.removeAspect(record, ASPECT_FILE_PLAN_COMPONENT); - nodeService.removeAspect(record, ASPECT_RECORD_COMPONENT_ID); - nodeService.removeAspect(record, ASPECT_COMMON_RECORD_DETAILS); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java deleted file mode 100644 index d82699ee30..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/DeleteRecordFolderTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/DeleteRecordFolderTest.java deleted file mode 100644 index 5c9caf9c61..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/DeleteRecordFolderTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.recordfolder; - -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.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -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 net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Delete record folder test. - * - * @author Roxana Lucanu - * @since 2.4 - * - */ -public class DeleteRecordFolderTest extends BaseRMTestCase -{ - // delete a destroyed record folder - public void testDeleteDestroyedRecordFolder() throws Exception - { - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); - - // complete event - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); - - // cutoff folder - rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); - - // destroy folder - rmActionService.executeRecordsManagementAction(testFolder, DestroyAction.NAME); - - return testFolder; - } - - @Override - public void test(NodeRef testFolder) throws Exception - { - // take a look at delete capability - Capability deleteCapability = capabilityService.getCapability("DeleteRecordFolder"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, deleteCapability.evaluate(testFolder)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - fileFolderService.delete(testFolder); - return null; - } - }); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java deleted file mode 100644 index 83516c9211..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java +++ /dev/null @@ -1,565 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.recordfolder; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -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.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Move record folder tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class MoveRecordFolderTest extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given two categories, both with cut off immediately schedules, when the record is move then all the parts of the - * record should be correct based on the new schedule. - * - * @see https://issues.alfresco.com/jira/browse/RM-1345 - */ - public void testMoveRecordFolderBeforeCutOffFolderLevelDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) - { - NodeRef recordFolder; - NodeRef destinationRecordCategory; - - public void given() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - NodeRef rcOne = createRecordCategory(false); - destinationRecordCategory = createRecordCategory(false); - recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); - - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - } - }); - - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - - public void when() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // move record folder - fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); - } - }); - } - - public void then() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - }); - } - - /** - * - */ - public void testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) - { - NodeRef recordFolder; - NodeRef destinationRecordCategory; - - public void given() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - NodeRef rcOne = createRecordCategory(false); - destinationRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); - - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - } - }); - - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - - public void when() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // move record folder - fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); - } - }); - } - - public void then() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(recordFolder)); - - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - } - }); - } - }); - } - - /** - * - */ - public void testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) - { - NodeRef record; - NodeRef recordFolder; - NodeRef destinationRecordCategory; - - public void given() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - NodeRef rcOne = createRecordCategory(true); - destinationRecordCategory = createRecordCategory(true); - recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); - record = utils.createRecord(recordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(recordFolder)); - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - } - }); - - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check the search aspect properties - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - - public void when() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // move record folder - fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); - } - }); - } - - public void then() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(recordFolder)); - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - - // check the search aspect properties - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - }); - } - - /** - * Try and move a folder from no disposition schedule to a disposition schedule - * - * @see https://issues.alfresco.com/jira/browse/RM-1039 - */ - public void testMoveRecordFolderFromNoDisToDis() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - - // create a record folder - return recordFolderService.createRecordFolder(recordCategory, "Grace Wetherall"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNull(dispositionService.getDispositionSchedule(result)); - assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING)); - } - }); - - final NodeRef record = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record - return fileFolderService.create(recordFolder, "mytest.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNull(dispositionService.getDispositionSchedule(result)); - assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - Capability capability = capabilityService.getCapability("CreateModifyDestroyFolders"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder, rmContainer)); - - // take a look at the move capability - Capability moveCapability = capabilityService.getCapability("Move"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(recordFolder, rmContainer)); - - // move the node - return fileFolderService.move(recordFolder, rmContainer, null).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNotNull(dispositionService.getDispositionSchedule(result)); - assertTrue(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(result); - assertNotNull(dispositionAction); - - assertNull(dispositionAction.getAsOfDate()); - assertEquals("cutoff", dispositionAction.getName()); - assertEquals(1, dispositionAction.getEventCompletionDetails().size()); - - // take a look at the record and check things are as we would expect - assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - } - - /** - * Try and move a cutoff folder - * - * @see https://issues.alfresco.com/jira/browse/RM-1039 - */ - public void testMoveCutoffRecordFolder() throws Exception - { - final NodeRef destination = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - } - }); - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); - - // complete event - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); - - // cutoff folder - rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); - - return testFolder; - } - - @Override - public void test(NodeRef testFolder) throws Exception - { - // take a look at the move capability - Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(testFolder, destination)); - } - }); - - doTestInTransaction(new FailureTest() - { - @Override - public void run() throws Exception - { - fileFolderService.move(testFolder, destination, null).getNodeRef(); - } - }); - } - - // try and move a destroyed folder - public void testMoveDestroyedRecordFolder() throws Exception - { - final NodeRef destination = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - } - }); - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); - - // complete event - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); - - // cutoff & destroy folder - rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); - rmActionService.executeRecordsManagementAction(testFolder, DestroyAction.NAME); - - return testFolder; - } - - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(testFolder, destination)); - - return fileFolderService.move(testFolder, destination, null).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - } - }); - - } - - /** - * Given a closed folder - * When we evaluate the move capability on it - * The access is denied - */ - public void testMoveClosedFolder() - { - final NodeRef destination = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category - return filePlanService.createRecordCategory(filePlan, GUID.generate()); - } - }); - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // close folder - recordFolderService.closeRecordFolder(testFolder); - - return testFolder; - } - - @Override - public void test(NodeRef testFolder) throws Exception - { - Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(testFolder, destination)); - } - }); - } - - private NodeRef createRecordCategory(boolean recordLevel) - { - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(rc, GUID.generate(), GUID.generate(), - recordLevel, 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); - return rc; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java deleted file mode 100644 index 6583ddfee8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java deleted file mode 100644 index e9ee087eac..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java deleted file mode 100644 index be3dab5cd0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.report; - -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -/** - * Hold report integration tests. - *

- * Relates to: - * - https://issues.alfresco.com/jira/browse/RM-1211 - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldReportTest extends BaseRMTestCase implements ReportModel -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * ensure that 'rmr:holdReport' is in the list of those available - */ - public void testHoldReportTypeAvailable() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private Set reportTypes; - - public void when() - { - reportTypes = reportService.getReportTypes(); - } - - public void then() - { - assertNotNull(reportTypes); - assertTrue(reportTypes.contains(TYPE_HOLD_REPORT)); - } - }); - } - - /** - * given that the reported upon node is not a hold, ensure that an error is raised when - * the report is generated. - */ - public void testReportedUponNodeIsNotAHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class) - { - private NodeRef reportedUponNodeRef; - - public void given() - { - reportedUponNodeRef = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - } - - public void when() - { - reportService.generateReport(TYPE_HOLD_REPORT, reportedUponNodeRef); - } - - public void after() - { - // remove created folder - nodeService.deleteNode(reportedUponNodeRef); - } - }); - } - - /** - * Given a hold that contains items, ensure the report is generated as expected - */ - public void testGenerateHoldReport() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private static final String HOLD_NAME = "holdName"; - private static final String HOLD_REASON = "holdReason"; - private static final String HOLD_DESCRIPTION = "holdDescription"; - private static final String FOLDER1_NAME = "folder1Name"; - - private NodeRef hold; - private NodeRef folder1; - private Report report; - - public void given() - { - // crate a hold - hold = holdService.createHold(filePlan, HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); - - // add some items to the hold - folder1 = recordFolderService.createRecordFolder(rmContainer, FOLDER1_NAME); - holdService.addToHold(hold, folder1); - holdService.addToHold(hold, recordOne); - } - - public void when() - { - report = reportService.generateReport(TYPE_HOLD_REPORT, hold, MimetypeMap.MIMETYPE_HTML); - } - - public void then() - { - assertNotNull(report); - assertEquals(TYPE_HOLD_REPORT, report.getReportType()); - assertTrue(report.getReportProperties().isEmpty()); - - // check the name has been generated correctly - assertNotNull(report.getReportName()); - assertTrue(report.getReportName().contains("Hold Report")); - assertTrue(report.getReportName().contains(HOLD_NAME)); - assertTrue(report.getReportName().contains(".html")); - - // check the content reader - ContentReader reader = report.getReportContent(); - assertNotNull(reader); - assertEquals(MimetypeMap.MIMETYPE_HTML, reader.getMimetype()); - - // check the content - String reportContent = reader.getContentString(); - assertNotNull(reportContent); - assertTrue(reportContent.contains(HOLD_NAME)); - assertTrue(reportContent.contains(HOLD_REASON)); - assertTrue(reportContent.contains(HOLD_DESCRIPTION)); - assertTrue(reportContent.contains(FOLDER1_NAME)); - assertTrue(reportContent.contains("one")); - } - - public void after() - { - holdService.deleteHold(hold); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java deleted file mode 100644 index ec42ff6408..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.rule; - -import java.util.List; - -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.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.springframework.extensions.webscripts.GUID; - -/** - * File plan rule inheritance test - * - * @author Roy Wetherall - * @since 2.4 - */ -public class FilePlanRuleInheritanceTest extends BaseRMTestCase -{ - private RuleService ruleService; - - @Override - protected void initServices() - { - super.initServices(); - ruleService = (RuleService)applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isRMSiteTest() - { - return false; - } - - private NodeRef createFilePlan() - { - return filePlanService.createFilePlan(folder, "My File Plan"); - } - - /** - * Given that a single rule is set on the parent folder of the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the file plan, including those inherited - * Then it will not include those defined on the parent folder - */ - public void testFilePlanDoesNotInheritRulesFromParentFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private Rule rule = null; - private List rules = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - } - - public void when() - { - // save rule on file plan root parent folder - ruleService.saveRule(folder, rule); - } - - public void then() - { - // get rules, including those inherited - rules = ruleService.getRules(filePlan, true); - - // rules aren't inhreited from file plan root parent folder - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the unfiled record container including those inherited - * Then it will not include those defined on the file plan root - * - * See https://issues.alfresco.com/jira/browse/RM-3148 - */ - public void testFilePlanRulesInheritedInUnfiledContainer() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - private Rule rule = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - } - - public void when() - { - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void then() - { - // get rules, including those inherited - NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); - rules = ruleService.getRules(unfiledRecordContainer, true); - - // rules aren't inhreited from file plan root - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the hold container including those inherited - * Then it will not include those defined on the file plan root - */ - public void testFilePlanRulesInheritedInHoldContainer() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - private Rule rule = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - } - - public void when() - { - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void then() - { - // get rules, including those inherited - NodeRef container = filePlanService.getHoldContainer(filePlan); - rules = ruleService.getRules(container, true); - - // rules aren't inhreited from file plan root - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the transfer container including those inherited - * Then it will not include those defined on the file plan root - */ - public void testFilePlanRulesInheritedInTransferContainer() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - private Rule rule = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - } - - public void when() - { - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void then() - { - // get rules, including those inherited - NodeRef container = filePlanService.getTransferContainer(filePlan); - rules = ruleService.getRules(container, true); - - // rules aren't inhreited from file plan root - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on a record category including those inherited - * Then it will include those defined on the file plan root - */ - public void testFilePlanRulesInheritedOnRecordCategory() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private NodeRef recordCategory = null; - private List rules = null; - private Rule rule = null; - - public void given() - { - filePlan = createFilePlan(); - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - } - - public void when() - { - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void then() - { - // get rules, including those inherited - rules = ruleService.getRules(recordCategory, true); - - // rules aren't inhreited from file plan root - assertEquals(1, rules.size()); - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java deleted file mode 100644 index 94a08ebc9b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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 CreateTransferFolderAsNonAdminUserTest 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()". - // See RM-3931 - 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?!? See RM-3931 - //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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java deleted file mode 100644 index 2b93b3f7f2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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 FilingPermissionsOnTransferFolderTest 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()". - // See RM-3931 - 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. See RM-3931 - //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. See RM-3931 - // 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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java deleted file mode 100644 index 1f633dbf85..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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 NoPermissionsOnTransferFolderTest 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()". - // See RM-3931 - 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. See RM-3931 - //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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java deleted file mode 100644 index b19d74ef32..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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 ReadPermissionsOnTransferFolderTest 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()". - // See RM-3931 - 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. See RM-3931 - //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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java deleted file mode 100644 index c731df47ba..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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 = recordableVersionService.getVersionRecord(version); - 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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java deleted file mode 100644 index 9d52ab08b1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.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.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 = recordableVersionService.getVersionRecord(version); - - 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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java deleted file mode 100644 index 203ede1708..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.version.ExtendedVersionableAspect; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Test recorded version histories when interacting with cm:versionable aspect - * and the auto-version behvaiour. - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class AutoVersionTest extends RecordableVersionsBaseTest -{ - /** - * Given a versionable document - * When I specialise the type of the document - * Then the version history has only one initial version - * And it does not represent the current type of the document - */ - public void testSpecialisedNodeInitialVersionCreated() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); - assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - } - }); - } - - /** - * Given a versionable document with initial version turned off - * When I specialise the type of the document - * Then the version history remains empty - */ - public void testSpecialisedNodeInitialVersionNotCreated() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNull(versionHistory); - } - }); - } - - /** - * Given a versionable document with initial version turned off - * And auto version on type change is set on - * When I specialise the type of the document - * Then the version history contains the initial version - */ - public void testSpecialisedNodeInitialVersionNotCreatedOnTypeChangeOn() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private ExtendedVersionableAspect extendedVersionableAspect; - private NodeRef myDocument; - - public void given() throws Exception - { - // turn auto version on type change on - extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect"); - assertNotNull(extendedVersionableAspect); - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - } - - public void after() throws Exception - { - // reset auto version on type to default off - extendedVersionableAspect.setAutoVersionOnTypeChange(false); - } - }); - } - - /** - * Given a versionable document with initial version turned on - * And auto version on type change is set on - * When I specialise the type of the document - * Then the version history contains the initial version - */ - public void testSpecialisedNodeInitialVersionCreatedOnTypeChangeOn() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private ExtendedVersionableAspect extendedVersionableAspect; - private NodeRef myDocument; - - public void given() throws Exception - { - // turn auto version on type change on - extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect"); - assertNotNull(extendedVersionableAspect); - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_INITIAL_VERSION, true); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(2, versionHistory.getAllVersions().size()); - - NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - - frozenState = versionHistory.getVersion("1.0").getFrozenStateNodeRef(); - assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - } - - public void after() throws Exception - { - // reset auto version on type to default off - extendedVersionableAspect.setAutoVersionOnTypeChange(false); - } - }); - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java deleted file mode 100644 index 868138f339..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -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; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * 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); - - //remove the content property as ContentPropertyRestrictionInterceptor will not allow update of - // content property via NodeService.addProperties - nodeService.removeProperty(dmDocument, ContentModel.PROP_CONTENT); - - // 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 declare 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"); - } - }); - } - - /** - * Given that a document is a specialized type - * When version is declared as a record - * Then the record is the same type as the source document - * - * @see https://issues.alfresco.com/jira/browse/RM-2194 - */ - public void testSpecializedContentType() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef customDocument; - private NodeRef versionRecord; - private Map versionProperties; - - public void given() throws Exception - { - // create content - customDocument = fileFolderService.create(dmFolder, GUID.generate(), TYPE_CUSTOM_TYPE).getNodeRef(); - prepareContent(customDocument); - - // setup version properties - versionProperties = new HashMap<>(2); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - //remove the content property as ContentPropertyRestrictionInterceptor will not allow update of - // content property via NodeService.addProperties - nodeService.removeProperty(customDocument, PROP_CONTENT); - // create version - versionService.createVersion(customDocument, versionProperties); - - // assert that the latest version is not recorded - assertFalse(recordableVersionService.isCurrentVersionRecorded(customDocument)); - } - - public void when() - { - // create version record from latest version - versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, customDocument); - } - - public void then() - { - // check the created record - assertNotNull(versionRecord); - assertTrue(recordService.isRecord(versionRecord)); - - // check the record type is correct - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionRecord)); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(customDocument)); - - // check the recorded version - checkRecordedVersion(customDocument, DESCRIPTION, "0.1"); - } - }); - - } - - /** - * Given versionable content with a recorded latest version and autoversion is true - * When I declare this version record and contains local modifications - * Then a new minor version is created for document - * - * @see https://issues.alfresco.com/jira/browse/RM-2368 - */ - public void testCreateRecordFromLatestVersionAutoTrue() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef myDocument; - private NodeRef versionedRecord; - private Map versionProperties; - private Date createdDate; - private Date modificationDate; - private String record_name = "initial_name"; - private String AUTO_VERSION_DESCRIPTION = "Auto Version on Record Creation"; - private boolean autoVersion = true; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - createdDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_CREATED); - modificationDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_MODIFIED); - assertTrue("Modified date must be after or on creation date", createdDate.getTime() == modificationDate.getTime()); - - // Set initial set of properties - Map properties = new HashMap<>(3); - // Ensure default behaviour autoversion on change properties is set to false - properties.put(ContentModel.PROP_AUTO_VERSION_PROPS, false); - // Set initial name - properties.put(ContentModel.PROP_NAME, "initial_name"); - nodeService.setProperties(myDocument, properties); - nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION); - nodeService.addAspect(myDocument, ContentModel.ASPECT_OWNABLE, null); - // make sure document is versionable - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - // Change Type to a custom document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - - // setup version properties - versionProperties = new HashMap<>(2); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // create initial version - versionService.createVersion(myDocument, versionProperties); - } - - public void when() - { - // Apply a custom aspect - nodeService.addAspect(myDocument, ContentModel.ASPECT_TITLED, null); - // Update properties - nodeService.setProperty(myDocument, ContentModel.PROP_NAME, "updated_name"); - nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION); - // test RM-2368 - versionedRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, myDocument, autoVersion); - } - - public void then() - { - // Properties updated / flag as modified - // check the created record - assertNotNull(versionedRecord); - assertTrue(recordService.isRecord(versionedRecord)); - - // check the record type is correct - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionedRecord)); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(myDocument)); - - // get name of record - record_name = (String) nodeService.getProperty(versionedRecord, ContentModel.PROP_NAME); - - // new version is create, current node was modified - assertTrue("Name was updated:", record_name.contains("updated_name")); - // check record - checkRecordedVersion(myDocument, AUTO_VERSION_DESCRIPTION, "1.1"); - - } - - }); - - } - - - /** - * - * Given versionable content with a recorded latest version and autoversion is false - * When I declare this version record and contains local modifications - * Then a record is created from latest version - * - * @see https://issues.alfresco.com/jira/browse/RM-2368 - */ - public void testCreateRecordFromLatestVersion() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef myDocument; - private NodeRef versionedRecord; - private Map versionProperties; - private Date createdDate; - private Date modificationDate; - private String record_name = "initial_name"; - private boolean autoVersion = false; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - createdDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_CREATED); - modificationDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_MODIFIED); - assertTrue("Modified date must be after or on creation date", createdDate.getTime() == modificationDate.getTime()); - - // Set initial set of properties - Map properties = new HashMap<>(3); - // Ensure default behaviour autoversion on change properties is set to false - properties.put(ContentModel.PROP_AUTO_VERSION_PROPS, false); - // Set initial name - properties.put(ContentModel.PROP_NAME, "initial_name"); - nodeService.setProperties(myDocument, properties); - nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION); - nodeService.addAspect(myDocument, ContentModel.ASPECT_OWNABLE, null); - // make sure document is versionable - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - // Change Type to a custom document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - - // setup version properties - versionProperties = new HashMap<>(2); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // create initial version - versionService.createVersion(myDocument, versionProperties); - } - - public void when() - { - // Apply a custom aspect - nodeService.addAspect(myDocument, ContentModel.ASPECT_TITLED, null); - // Update properties - nodeService.setProperty(myDocument, ContentModel.PROP_NAME, "initial_name"); - nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION); - // test RM-2368 - versionedRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, myDocument, autoVersion); - } - - public void then() - { - // Properties updated / flag as modified - // check the created record - assertNotNull(versionedRecord); - assertTrue(recordService.isRecord(versionedRecord)); - - // check the record type is correct - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionedRecord)); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(myDocument)); - - // get name of record - record_name = (String) nodeService.getProperty(versionedRecord, ContentModel.PROP_NAME); - - // record is created based on existing frozen, which does not contain any modification of node - assertTrue("Name is not modified: ", record_name.contains("initial_name")); - checkRecordedVersion(myDocument, DESCRIPTION, "1.0"); - - } - - - }); - - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java deleted file mode 100644 index cbaefc5cfd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java +++ /dev/null @@ -1,513 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -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.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -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.QName; -import org.alfresco.util.GUID; - -/** - * Recordable version history integration tests. - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class DeleteRecordVersionTest extends RecordableVersionsBaseTest -{ - /** - * Given that a document is created - * And the initial version is record - * When I delete the version record - * Then the version is deleted - * And the version history is not deleted - * - * @see https://issues.alfresco.com/jira/browse/RM-2562 - */ - public void testDeleteFirstRecordedVersion() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap<>(2); - props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); - nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - } - - public void when() - { - // check the initial version label - assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); - - // check that the version history contains a single version that is recorded - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - // check the recorded version is not marked as destroyed - Version head = versionHistory.getHeadVersion(); - assertNotNull(head); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(head)); - - // check the version record - NodeRef record = recordableVersionService.getVersionRecord(head); - assertTrue(recordService.isRecord(record)); - - // record should not have a version history because it is immutable - assertFalse(nodeService.hasAspect(record, ContentModel.ASPECT_VERSIONABLE)); - VersionHistory recordVersionHistory = versionService.getVersionHistory(record); - assertNull(recordVersionHistory); - - // destroy record - nodeService.deleteNode(record); - } - - public void then() - { - // document is still versionable - assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE)); - - // check the initial version label - assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); - - // still has a version history, but the version is marked as destroyed - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - // check the recorded version is marked as destroyed and the record version is not longer available - Version version = versionHistory.getHeadVersion(); - assertNotNull(version); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version)); - assertNull(recordableVersionService.getVersionRecord(version)); - } - }); - } - - /** - * Given that a document is created - * And the initial version is record - * And the associated version record is deleted - * When a new version is created - * Then a new associated version record is created - * And the version is 1.1 (not 1.0 since this was deleted, but the version history maintained) - * - * @see https://issues.alfresco.com/jira/browse/RM-2562 - */ - public void testDeleteFirstRecordedVersionAndCreateNewVersion() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(GUID.generate()); - - // make versionable - Map props = new HashMap<>(2); - props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); - nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - } - - public void when() - { - // get the created version record - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - Version head = versionHistory.getHeadVersion(); - NodeRef record = recordableVersionService.getVersionRecord(head); - - // destroy record - nodeService.deleteNode(record); - - // update the content to create a new version (and version record) - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.putContent(GUID.generate()); - } - - public void then() - { - // document is still versionable - assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE)); - - // check the version number has been incremented - assertEquals("1.1", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); - - // still has a version history, with 2 enties - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(2, versionHistory.getAllVersions().size()); - - // latest version is current - Version head = versionHistory.getHeadVersion(); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(head)); - assertNotNull(recordableVersionService.getVersionRecord(head)); - - // first version is destroyed - Version destroyed = versionHistory.getPredecessor(head); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(destroyed)); - assertNull(recordableVersionService.getVersionRecord(destroyed)); - - // get the version record for the current version - NodeRef versionRecord = recordableVersionService.getVersionRecord(head); - assertNotNull(versionRecord); - assertTrue(nodeService.exists(versionRecord)); - - Set from = relationshipService.getRelationshipsFrom(versionRecord); - assertTrue(from.isEmpty()); - - Set to = relationshipService.getRelationshipsTo(versionRecord); - assertTrue(to.isEmpty()); - } - }); - } - - /** - * Given a chain of version records (1.0, 1.1, 1.2) which are all related - * When I delete version record 1.0 - * Then 1.1 is the oldest version - */ - public void testDeleteOldestVersion() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - - public void given() throws Exception - { - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - } - - public void when() - { - Version version10 = versionHistory.getVersion("1.0"); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - - // delete record version 1.0 - nodeService.deleteNode(recordVersion10); - } - - public void then() - { - // check the deleted version - Version version10 = versionHistory.getVersion("1.0"); - assertNotNull(version10); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version10)); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNull(recordVersion10); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, from12.size()); - - // verify 1.1 setup as expected - Version version11 = versionHistory.getPredecessor(version12); - assertEquals("1.1", version11.getVersionLabel()); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNotNull(recordVersion11); - - Set to11 = relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, to11.size()); - assertEquals(recordVersion12, to11.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - } - }); - } - - /** - * Given a chain of version records (1.0, 1.1, 1.2) which are all related - * When I delete version record 1.1 - * Then 1.2 now 'versions' 1.0 - */ - public void testDeleteMiddleVersion() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - - public void given() throws Exception - { - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - } - - public void when() - { - Version version11 = versionHistory.getVersion("1.1"); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - - // delete record version 1.1 - nodeService.deleteNode(recordVersion11); - } - - public void then() - { - // check the deleted version - Version version11 = versionHistory.getVersion("1.1"); - assertNotNull(version11); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11)); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNull(recordVersion11); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, from12.size()); - - // verify 1.0 setup as expected - Version version10 = versionHistory.getVersion("1.0"); - assertEquals("1.0", version10.getVersionLabel()); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, to10.size()); - assertEquals(recordVersion12, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - } - }); - } - - /** - * Given a chain of version records (1.0, 1.1, 1.2) which are all related - * When I delete version record 1.2 - * Then 1.1 is the most recent version - */ - public void testDeleteCurrentVersion() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - - public void given() throws Exception - { - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - } - - public void when() - { - Version version12 = versionHistory.getVersion("1.2"); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - - // delete record version 1.2 - nodeService.deleteNode(recordVersion12); - } - - public void then() - { - // check 1.2 - Version version12 = versionHistory.getVersion("1.2"); - assertNotNull(version12); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version12)); - assertNull(recordableVersionService.getVersionRecord(version12)); - - // verify 1.1 - Version version11 = versionHistory.getVersion("1.1"); - assertNotNull(version11); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNotNull(recordVersion11); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, from11.size()); - - // verify 1.0 - Version version10 = versionHistory.getVersion("1.0"); - assertNotNull(version10); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, to10.size()); - assertEquals(recordVersion11, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - } - }); - } - - /** - * Given that a version record - * When the version record is destroyed whilst retaining the meta data - * Then the version is marked as destroyed in the collab version history - */ - public void testDestroyVersionRecordWithMetadata() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - private NodeRef recordVersion11; - - public void given() throws Exception - { - // create file plan structure - NodeRef myCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(myCategory, GUID.generate(), GUID.generate(), true, true); - - NodeRef myRecordFolder = recordFolderService.createRecordFolder(myCategory, GUID.generate()); - - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - - // file and complete all the version records into my record folder - for (Version version : versionHistory.getAllVersions()) - { - NodeRef record = recordableVersionService.getVersionRecord(version); - fileFolderService.move(record, myRecordFolder, null); - utils.completeRecord(record); - } - } - - public void when() - { - Version version11 = versionHistory.getVersion("1.1"); - recordVersion11 = recordableVersionService.getVersionRecord(version11); - - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordVersion11, CompleteEventAction.NAME, params); - - rmActionService.executeRecordsManagementAction(recordVersion11, CutOffAction.NAME); - - rmActionService.executeRecordsManagementAction(recordVersion11, DestroyAction.NAME); - } - - public void then() - { - // verify that the version history looks as expected - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - Collection versions = versionHistory.getAllVersions(); - assertEquals(3, versions.size()); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(version12)); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - assertFalse(recordService.isMetadataStub(recordVersion12)); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions"); - assertEquals(1, from12.size()); - - // verify 1.1 setup as expected - Version version11 = versionHistory.getPredecessor(version12); - assertEquals("1.1", version11.getVersionLabel()); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11)); - assertNotNull(recordVersion11); - assertTrue(recordService.isMetadataStub(recordVersion11)); - - Set to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions"); - assertEquals(1, to11.size()); - assertEquals(recordVersion12, to11.iterator().next().getSource()); - - Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions"); - assertEquals(1, from11.size()); - - // verify 1.0 setup as expected - Version version10 = versionHistory.getPredecessor(version11); - assertEquals("1.0", version10.getVersionLabel()); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(version10)); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - assertFalse(recordService.isMetadataStub(recordVersion10)); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions"); - assertEquals(1, to10.size()); - assertEquals(recordVersion11, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty()); - - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java deleted file mode 100644 index 283ebe4028..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java +++ /dev/null @@ -1,422 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.Collection; -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.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.module.org_alfresco_module_rm.version.RecordableVersionService; -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.GUID; -import org.alfresco.util.PropertyMap; - -/** - * Recordable versions base integration test - * - * @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."; - - protected RecordableVersionService recordableVersionService; - - @Override - protected void initServices() - { - super.initServices(); - recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService"); - } - - /** - * @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); - - // prepare content - prepareContent(dmDocument); - } - - protected void prepareContent(NodeRef content) - { - // add titled aspect - PropertyMap titledProperties = new PropertyMap(2); - titledProperties.put(ContentModel.PROP_TITLE, "document title"); - titledProperties.put(ContentModel.PROP_DESCRIPTION, "document description"); - nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProperties); - - // add ownable aspect - PropertyMap ownableProperties = new PropertyMap(1); - ownableProperties.put(ContentModel.PROP_OWNER, OWNER); - nodeService.addAspect(content, 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(content, ContentModel.ASPECT_DUBLINCORE, dublinCoreProperties); - - // add content - ContentWriter writer = contentService.getWriter(content, 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(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()); - - // 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 = recordableVersionService.getVersionRecord(version); - 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 = recordableVersionService.getVersionRecord(version); - 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); - if(beforePropertyName.equals(ContentModel.PROP_CONTENT)) - { - assertTrue("Content property value should be different.", - entry.getValue() != frozenValue); - } - else - { - 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) && - !ContentModel.PROP_VERSION_TYPE.equals(beforePropertyName) && - !ContentModel.PROP_VERSION_LABEL.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()); - } - } - - // remove "owner" from cloneFrozenProperties - cloneFrozenProperties.remove(ContentModel.PROP_OWNER); - - - // 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()); - } - } - - /** - * Creates a document with three versions (1.0, 1.1, 1.2) all of which - * are recorded. - * - * @return NodeRef node reference - */ - protected NodeRef createDocumentWithRecordVersions() - { - // create document and initial version (1.0) - final NodeRef myDocument = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create a document - NodeRef testDoc = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - ContentWriter writer = fileFolderService.getWriter(testDoc); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(GUID.generate()); - - // make versionable - Map props = new HashMap<>(2); - props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); - nodeService.addAspect(testDoc, RecordableVersionModel.ASPECT_VERSIONABLE, props); - nodeService.addAspect(testDoc, ContentModel.ASPECT_VERSIONABLE, null); - - return testDoc; - } - }); - - // create 1.1 - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // update content - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.putContent(GUID.generate()); - - return null; - } - }); - - // create 1.2 - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // update content - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.putContent(GUID.generate()); - - return null; - } - }); - - // we do these checks to ensure that the test data is in the correct state before we - // start to manipulate the versions and execute tests - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // verify that the version history looks as expected - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - Collection versions = versionHistory.getAllVersions(); - assertEquals(3, versions.size()); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions"); - assertEquals(1, from12.size()); - - // verify 1.1 setup as expected - Version version11 = versionHistory.getPredecessor(version12); - assertEquals("1.1", version11.getVersionLabel()); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNotNull(recordVersion11); - - Set to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions"); - assertEquals(1, to11.size()); - assertEquals(recordVersion12, to11.iterator().next().getSource()); - - Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions"); - assertEquals(1, from11.size()); - - // verify 1.0 setup as expected - Version version10 = versionHistory.getPredecessor(version11); - assertEquals("1.0", version10.getVersionLabel()); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions"); - assertEquals(1, to10.size()); - assertEquals(recordVersion11, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty()); - - return null; - } - }); - - return myDocument; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java deleted file mode 100644 index 8365e48f28..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Record service implementation unit test. - * - * @author Roy Wetherall - */ -public class CreateRecordActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Test create record action - * - * Given a collaboration site document - * When the create record action is executed for that document - * Then a record is created for it - */ - public void testCreateRecordAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(action, dmDocument); - - return null; - } - - public void test(Void result) throws Exception - { - assertTrue(recordService.isRecord(dmDocument)); - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - } - }, - dmCollaborator); - } - - public void testCreateRecordActionWithLocation() - { - doTestInTransaction(new Test() - { - public Void run() - { - assertFalse(recordService.isRecord(dmDocument1)); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - action.setParameterValue(CreateRecordAction.PARAM_PATH, "rmContainer/rmFolder"); - actionService.executeAction(action, dmDocument1); - - return null; - } - - public void test(Void result) throws Exception - { - assertTrue(recordService.isRecord(dmDocument1)); - assertTrue(recordService.isFiled(dmDocument1)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument1).getParentRef(); - assertEquals(rmFolder, parent); - } - }, - ADMIN_USER); - } - - public void testCreateRecordActionWithLocationWithSpaces() - { - doTestInTransaction(new Test() - { - public Void run() - { - assertFalse(recordService.isRecord(dmDocument1)); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - action.setParameterValue(CreateRecordAction.PARAM_PATH, "rm Container/rm Folder"); - actionService.executeAction(action, dmDocument1); - - return null; - } - - public void test(Void result) throws Exception - { - assertTrue(recordService.isRecord(dmDocument1)); - assertTrue(recordService.isFiled(dmDocument1)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument1).getParentRef(); - assertEquals(rm_Folder, parent); - } - }, - ADMIN_USER); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/DeclareVersionAsRecordActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/DeclareVersionAsRecordActionTest.java deleted file mode 100644 index 165c0807c8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/DeclareVersionAsRecordActionTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -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.DeclareAsVersionRecordAction; -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.version.VersionModel; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; - -public class DeclareVersionAsRecordActionTest extends BaseRMTestCase -{ - private RuleService ruleService; - private NodeRef ruleFile; - protected static final String DESCRIPTION = "description"; - - - @Override - protected void initServices() - { - super.initServices(); - ruleService = (RuleService)applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - - /** - * Given a node set to auto-declare documents as records for minor and major versions - * When I try to upload a minor or major version - * Then the version record aspect is added - */ - public void testUpdateNextDispositionAction_RM3060() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmContributor) - { - Map versionProperties = new HashMap<>(4); - Version recordedVersion; - - @Override - public void given() - { - // create the file - ruleFile = fileFolderService.create(documentLibrary, "mytestfile", ContentModel.TYPE_CONTENT).getNodeRef(); - - Action action = actionService.createAction(DeclareAsVersionRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule rule = new Rule(); - rule.setRuleType(RuleType.INBOUND); - rule.setTitle("my rule"); - rule.setAction(action); - rule.setExecuteAsynchronously(true); - ruleService.saveRule(ruleFile, rule); - - // setup version properties - 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); - } - - @Override - public void when() - { - recordedVersion = versionService.createVersion(ruleFile, versionProperties); - } - - @Override - public void then() throws Exception - { - NodeRef recordedVersionNodeRef= (NodeRef)recordedVersion.getVersionProperties().get(RecordableVersionModel.PROP_RECORD_NODE_REF.getLocalName()); - assertNotNull("Recorded version shouldn't be null.", recordedVersionNodeRef); - assertTrue(nodeService.hasAspect(recordedVersionNodeRef, RecordableVersionModel.ASPECT_VERSION_RECORD)); - } - }); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java deleted file mode 100644 index b34d487544..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportAction; -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.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang3.StringUtils; -import org.springframework.extensions.webscripts.GUID; - -/** - * File report action unit test - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class FileReportActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - public void testFileReport() - { - fileReport(MimetypeMap.MIMETYPE_HTML); - } - - public void testfileReportDefaultMimetype() - { - fileReport(null); - } - - private void fileReport(final String mimeType) - { - AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); - - // create record folder - final NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // close the record folder - recordFolderService.closeRecordFolder(recordFolder); - - // create hold - final NodeRef hold = holdService.createHold(filePlan, "holdName", "holdReason", "holdDescription"); - - doTestInTransaction(new FailureTest() - { - @Override - public void run() throws Exception - { - // execute action - executeAction(mimeType, recordFolder, hold); - } - }); - - doTestInTransaction(new Test() - { - public Void run() - { - // reopen the record folder - rmActionService.executeRecordsManagementAction(recordFolder, "openRecordFolder"); - return null; - } - - @Override - public void test(Void result) throws Exception - { - // execute action - executeAction(mimeType, recordFolder, hold); - } - }); - } - - private void executeAction(String mimeType, NodeRef recordFolder, NodeRef hold) - { - Action action = actionService.createAction(FileReportAction.NAME); - if (StringUtils.isNotBlank(mimeType)) - { - action.setParameterValue(FileReportAction.MIMETYPE, mimeType); - } - action.setParameterValue(FileReportAction.DESTINATION, recordFolder.toString()); - action.setParameterValue(FileReportAction.REPORT_TYPE, "rmr:destructionReport"); - actionService.executeAction(action, hold); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java deleted file mode 100644 index 514819b11d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -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.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.springframework.util.StringUtils; - -/** - * FileTo action unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FileToActionTest extends BaseRMTestCase -{ - private static final String PATH = "rmContainer/rmFolder"; - private static final String PATH2 = "/rmContainer/rmFolder"; - private static final String PATH_BAD = "monkey/rmFolder"; - private static final String PATH_CREATE = "rmContainer/newRmFolder"; - private static final String LONG_PATH_CREATE = "/rmContainer/one/two/three/four/newRmFolder"; - - private static final String PATH_SUB1 = "rmContainer/${node.cm:title}"; - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - public void testFileToNodeRef() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - @Override - public void given() throws Exception - { - initRecord(); - - NodeRef unfiledContainer = filePlanService.getUnfiledContainer(filePlan); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); - - Capability capability = capabilityService.getCapability("FileUnfiledRecords"); - assertNotNull(capability); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(dmDocument)); - } - - @Override - public void when() throws Exception - { - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_DESTINATION_RECORD_FOLDER, rmFolder); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - } - - @Override - public void then() throws Exception - { - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(rmFolder, parent); - } - }); - } - - private void initRecord() - { - doTestInTransaction(new Test() - { - public Void run() - { - nodeService.setProperty(dmDocument, ContentModel.PROP_TITLE, "mytestvalue"); - - // create record from document - recordService.createRecord(filePlan, dmDocument); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - AuthenticationUtil.runAs(() -> - { - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // is the unfiled container the primary parent of the filed - // record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(filePlanService.getUnfiledContainer(filePlan), parent); - - return null; - }, AuthenticationUtil.getAdminUserName()); - } - - }, dmCollaborator); - } - - public void testFileToPath() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - @Override - public void given() throws Exception - { - initRecord(); - } - - @Override - public void when() throws Exception - { - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_PATH, PATH); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - } - - @Override - public void then() throws Exception - { - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(rmFolder, parent); - } - }); - } - - public void testFileToPath2() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - @Override - public void given() throws Exception - { - initRecord(); - } - - @Override - public void when() throws Exception - { - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_PATH, PATH2); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - } - - @Override - public void then() throws Exception - { - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(rmFolder, parent); - } - }); - } - - public void testCreate() throws Exception - { - initRecord(); - createRecord(PATH_CREATE, "newRmFolder"); - } - - public void testCreateSub() throws Exception - { - initRecord(); - createRecord(PATH_SUB1, "mytestvalue", "rmContainer/mytestvalue"); - } - - public void testCreatePath() throws Exception - { - initRecord(); - createRecord(LONG_PATH_CREATE, "newRmFolder", "rmContainer/one/two/three/four/newRmFolder"); - } - - private void createRecord(String path, String name) - { - createRecord(path, name, path); - } - - private void createRecord(final String path, final String name, final String resolvedPath) - { - final String[] pathValues = StringUtils.tokenizeToStringArray(resolvedPath, "/"); - - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_PATH, path); - params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - // show the folder doesn't exist to begin with - FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList<>(Arrays.asList(pathValues)), false); - assertNull(createdRecordFolder); - - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_PATH, path); - params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - return null; - } - }); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - // show the folder has now been created - FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList<>(Arrays.asList(pathValues)), false); - assertNotNull(createdRecordFolder); - assertEquals(name, createdRecordFolder.getName()); - NodeRef createdRecordFolderNodeRef = createdRecordFolder.getNodeRef(); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(createdRecordFolderNodeRef, parent); - - return null; - } - }, ADMIN_USER); - } - - public void failureTests() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - // create record from document - recordService.createRecord(filePlan, dmDocument); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // is the unfiled container the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(filePlanService.getUnfiledContainer(filePlan), parent); - - return null; - } - }, dmCollaborator); - - doTestInTransaction(new FailureTest - ( - "Path is invalid and record create not set." - ) - { - @Override - public void run() throws Exception - { - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_PATH, PATH_BAD); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - } - }); - - doTestInTransaction(new FailureTest - ( - "Path is for a new folder, but create not set." - ) - { - @Override - public void run() throws Exception - { - // set parameters - Map params = new HashMap<>(1); - params.put(FileToAction.PARAM_PATH, PATH_CREATE); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - } - }); - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java deleted file mode 100644 index 531185ff35..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.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.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hide Record Action Unit Test - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class HideRecordActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testHideRecordAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - // Create a document so that the user has the write permissions for that document - NodeRef doc = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - - // Create a record from that document - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, doc); - - // Check if the document is a record now - assertTrue(recordService.isRecord(doc)); - - // The record should have the original location information - assertNotNull(nodeService.getProperty(doc, PROP_RECORD_ORIGINATING_LOCATION)); - - // Check the parents. In this case the document should have two parents (doclib and fileplan) - assertTrue(nodeService.getParentAssocs(doc).size() == 2); - - // Hide the document. The user has the write permissions so he should be able to hide it - Action hideAction = actionService.createAction(HideRecordAction.NAME); - actionService.executeAction(hideAction, doc); - - // The document should be removed from the collaboration site - assertTrue(nodeService.getParentAssocs(doc).size() == 1); - - return null; - } - }, - dmCollaborator); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java deleted file mode 100644 index c43f76fa98..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java deleted file mode 100644 index 07703a2f29..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.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/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java deleted file mode 100644 index d8631af0b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; - -/** - * Reject Action Unit Test - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RejectActionTest extends BaseRMTestCase -{ - /** Reject reason */ - private final String REJECT_REASON = "rejectReason:Not valid!£$%^&*()_+"; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testRejectAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - // Create a record from the document - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, dmDocument); - - // Check if the document is a record now - assertTrue(recordService.isRecord(dmDocument)); - - // The record should have the original location information - assertNotNull(nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); - - // Check the parents. In this case the document should have two parents (doclib and fileplan) - assertTrue(nodeService.getParentAssocs(dmDocument).size() == 2); - - return null; - } - }, - dmCollaborator); - - doTestInTransaction(new FailureTest("Cannot reject a record without a reason.", IllegalArgumentException.class) - { - public void run() - { - // The test should fail if the reject reason is not supplied - Action rejectAction = actionService.createAction(RejectAction.NAME); - actionService.executeAction(rejectAction, dmDocument); - } - }, - dmCollaborator); - - doTestInTransaction(new Test() - { - public Void run() - { - // Create the reject action and add the reject reason - Action rejectAction = actionService.createAction(RejectAction.NAME); - rejectAction.setParameterValue(RejectAction.PARAM_REASON, REJECT_REASON); - actionService.executeAction(rejectAction, dmDocument); - - // The "record" aspect should be removed - assertFalse(nodeService.hasAspect(dmDocument, ASPECT_RECORD)); - - // The "file plan component" should be removed - assertFalse(nodeService.hasAspect(dmDocument, ASPECT_FILE_PLAN_COMPONENT)); - - // The "identifier" property should be removed - assertNull(nodeService.getProperty(dmDocument, PROP_IDENTIFIER)); - - // The record should be removed from the file plan - assertTrue(nodeService.getParentAssocs(dmDocument).size() == 1); - - // The extended reader information should be removed - assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - assertTrue(extendedSecurityService.getReaders(dmDocument).isEmpty()); - - return null; - } - }, - dmCollaborator); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java deleted file mode 100644 index 2b50fda172..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.capabilities; - -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.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Declarative capability unit test - * - * @author Roy Wetherall - */ -public class CompositeCapabilityTest extends BaseRMTestCase -{ - private NodeRef record; - private NodeRef declaredRecord; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Pre-filed content - record = utils.createRecord(rmFolder, "record.txt"); - declaredRecord = utils.createRecord(rmFolder, "declaredRecord.txt"); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - utils.completeRecord(declaredRecord); - - return null; - } - }); - } - - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.FILING); - } - } - - public void testUpdate() - { - final Capability capability = capabilityService.getCapability("Update"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(declaredRecord)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - - return null; - } - }, userName); - - - } - - public void testUpdateProperties() - { - final Capability capability = capabilityService.getCapability("UpdateProperties"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(declaredRecord)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - - return null; - } - }, userName); - - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java deleted file mode 100644 index 998fc840fa..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.capabilities; - -import java.util.ArrayList; -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.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCompositeCapability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -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.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.springframework.extensions.webscripts.GUID; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Declarative capability unit test - * - * @author Roy Wetherall - */ -public class DeclarativeCapabilityTest extends BaseRMTestCase -{ - private NodeRef record; - private NodeRef declaredRecord; - private NodeRef undeclaredRecord; - - private NodeRef recordFolderContainsFrozen; - private NodeRef frozenRecord; - private NodeRef frozenRecord2; - private NodeRef frozenRecordFolder; - - private NodeRef closedFolder; - - private NodeRef moveToFolder; - private NodeRef moveToCategory; - - private NodeRef hold; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Pre-filed content - record = utils.createRecord(rmFolder, "record.txt"); - declaredRecord = utils.createRecord(rmFolder, "declaredRecord.txt"); - undeclaredRecord = utils.createRecord(rmFolder, "undeclaredRecord.txt"); - - // Closed folder - closedFolder = recordFolderService.createRecordFolder(rmContainer, "closedFolder"); - utils.closeFolder(closedFolder); - - // Frozen artifacts - recordFolderContainsFrozen = recordFolderService.createRecordFolder(rmContainer, "containsFrozen"); - frozenRecord = utils.createRecord(rmFolder, "frozenRecord.txt"); - frozenRecord2 = utils.createRecord(recordFolderContainsFrozen, "frozen2.txt"); - frozenRecordFolder = recordFolderService.createRecordFolder(rmContainer, "frozenRecordFolder"); - - // MoveTo artifacts - moveToFolder = recordFolderService.createRecordFolder(rmContainer, "moveToFolder"); - moveToCategory = filePlanService.createRecordCategory(rmContainer, "moveToCategory"); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - utils.completeRecord(declaredRecord); - utils.completeRecord(frozenRecord); - utils.completeRecord(frozenRecord2); - - hold = holdService.createHold(filePlan, GUID.generate(), "reason", "description"); - - holdService.addToHold(hold, frozenRecord); - holdService.addToHold(hold, frozenRecordFolder); - holdService.addToHold(hold, frozenRecord2); - - return null; - } - }); - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.READ_RECORDS); - } - } - - public void testDeclarativeCapabilities() - { - Set capabilities = capabilityService.getCapabilities(); - for (Capability capability : capabilities) - { - if (capability instanceof DeclarativeCapability && - !(capability instanceof DeclarativeCompositeCapability) && - !capability.isPrivate() && - !capability.getName().equals("MoveRecords") && - !capability.getName().equals("DeleteLinks") && - !capability.getName().equals("ChangeOrDeleteReferences")) - { - testDeclarativeCapability((DeclarativeCapability)capability); - } - } - } - - private void testDeclarativeCapability(final DeclarativeCapability capability) - { - for (String user : testUsers) - { - testDeclarativeCapability(capability, user, filePlan); - testDeclarativeCapability(capability, user, rmContainer); - testDeclarativeCapability(capability, user, rmFolder); - testDeclarativeCapability(capability, user, record); - } - } - - private void testDeclarativeCapability(final DeclarativeCapability capability, final String userName, final NodeRef filePlanComponent) - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - AccessStatus accessStatus = capability.hasPermission(filePlanComponent); - - Set roles = filePlanRoleService.getRolesByUser(filePlan, userName); - if (roles.isEmpty()) - { - assertEquals("User " + userName + " has no RM role so we expect access to be denied for capability " + capability.getName(), - AccessStatus.DENIED, - accessStatus); - } - else - { - // Do the kind check here ... - FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(filePlanComponent); - List kinds = capability.getKinds(); - - if (kinds == null || - kinds.contains(actualKind.toString())) - { - Map conditions = capability.getConditions(); - boolean conditionResult = getConditionResult(filePlanComponent, conditions); - - assertEquals("User is expected to only have one role.", 1, roles.size()); - Role role = new ArrayList<>(roles).get(0); - assertNotNull(role); - - Set roleCapabilities = role.getCapabilities(); - if (roleCapabilities.contains(capability) && conditionResult) - { - assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + - " so we expect access to be allowed for capability " + capability.getName() + " on the object " + - (String)nodeService.getProperty(filePlanComponent, ContentModel.PROP_NAME), - AccessStatus.ALLOWED, - accessStatus); - } - else - { - assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + " so we expect access to be denied for capability " + capability.getName(), - AccessStatus.DENIED, - accessStatus); - } - } - else - { - // Expect fail since the kind is not expected by the capability - assertEquals("NodeRef is of kind" + actualKind + " so we expect access to be denied for capability " + capability.getName(), - AccessStatus.DENIED, - accessStatus); - } - } - - return null; - } - }, userName); - } - - private boolean getConditionResult(NodeRef nodeRef, Map conditions) - { - boolean result = true; - - if (conditions != null && conditions.size() != 0) - { - for (Map.Entry entry : conditions.entrySet()) - { - // Get the condition bean - CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(entry.getKey()); - assertNotNull("Invalid condition name.", condition); - - boolean actual = condition.evaluate(nodeRef); - if (actual != entry.getValue().booleanValue()) - { - result = false; - break; - } - } - } - - return result; - } - - /** Specific declarative capability tests */ - - public void testCreateRecordCapability() - { - final Capability capability = capabilityService.getCapability("CreateRecords"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - - return null; - } - }, rmUserName); - } - - public void testMoveRecordCapability() - { - // grab the move record capability - final Capability capability = capabilityService.getCapability("MoveRecords"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(record)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(undeclaredRecord)); - - // now lets take a look when we know what the destination is - // NOTE: should be denied since we do not have file permission on the destination folder - // despite having the capability! - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(record, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(declaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(undeclaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - for (String user : testUsers) - { - filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.FILING); - } - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(record)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(undeclaredRecord)); - - // now lets take a look when we know what the destination is - // NOTE: should be allowed now since we have filling permission on the destination folder - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(record, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(declaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(undeclaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - // now lets take a look when we know what the destination is - // NOTE: should be allowed now since we have filling permission on the destination folder - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(record, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(declaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(undeclaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); - - return null; - } - }, rmUserName); - } - - public void testMoveRecordFolderCapability() - { - // grab the move record capability - final Capability capability = capabilityService.getCapability("MoveRecordFolder"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(rmFolder, moveToCategory)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - for (String user : testUsers) - { - filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.FILING); - } - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(rmFolder, moveToCategory)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(rmFolder, moveToCategory)); - - return null; - } - }, rmUserName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java deleted file mode 100644 index afba6519e2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.jscript; - -import java.io.Serializable; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.jscript.app.JSONConversionComponent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang3.ArrayUtils; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * @author Roy Wetherall - */ -public class JSONConversionComponentTest extends BaseRMTestCase -{ - protected JSONConversionComponent converter; - protected NodeRef record; - - @Override - protected void initServices() - { - super.initServices(); - converter = (JSONConversionComponent) applicationContext.getBean("jsonConversionComponent"); - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Create records - record = utils.createRecord(rmFolder, "testRecord.txt"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testJSON() throws Exception - { - doTestInTransaction(new JSONTest - ( - filePlan, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "FILE_PLAN"} - ){}); - - doTestInTransaction(new JSONTest - ( - rmContainer, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "RECORD_CATEGORY"} - ){}); - - doTestInTransaction(new JSONTest - ( - rmFolder, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "RECORD_FOLDER"} - ){}); - - doTestInTransaction(new JSONTest - ( - record, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "RECORD"} - ){}); - } - - class JSONTest extends Test - { - private NodeRef nodeRef; - private String[][] testValues; - - public JSONTest(NodeRef nodeRef, String[] ... testValues) - { - this.nodeRef = nodeRef; - this.testValues = testValues; - } - - @Override - public JSONObject run() throws Exception - { - String json = converter.toJSON(nodeRef, true); - //System.out.println(json); - return new JSONObject(json); - } - - @Override - public void test(JSONObject result) throws Exception - { - for (String[] testValue : testValues) - { - String key = testValue[0]; - String type = "string"; - if (testValue.length == 3) - { - type = testValue[2]; - } - Serializable value = convertValue(testValue[1], type); - Serializable actualValue = (Serializable)getValue(result, key); - - assertEquals("The key " + key + " did not have the expected value.", value, actualValue); - } - } - - private Serializable convertValue(String stringValue, String type) - { - Serializable value = stringValue; - if (type.equals("boolean")) - { - value = new Boolean(stringValue); - } - return value; - } - - private Object getValue(JSONObject jsonObject, String key) throws JSONException - { - return getValue(jsonObject, key.split("\\.")); - } - - private Object getValue(JSONObject jsonObject, String[] key) throws JSONException - { - if (key.length == 1) - { - return jsonObject.get(key[0]); - } - else - { - return getValue(jsonObject.getJSONObject(key[0]), - (String[])ArrayUtils.subarray(key, 1, key.length)); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java deleted file mode 100644 index c663f47a44..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.security; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Tests method level security of core alfresco services. - * - * @author Roy Wetherall - * @since 2.0 - */ -public class MethodSecurityTest extends BaseRMTestCase implements RMPermissionModel -{ - /** - * Indicate this is a user test. - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * Test node service security access - */ - public void testNodeService() - { - doTestInTransaction(new FailureTest - ( - "We don't have permission to access this node." - ) - { - @Override - public void run() - { - nodeService.getProperties(rmContainer); - } - - }, rmUserName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(rmContainer, rmUserName, READ_RECORDS); - return null; - } - - @Override - public void test(Void result) throws Exception - { - nodeService.getProperties(rmContainer); - } - - }, rmUserName); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java deleted file mode 100644 index 3aabddc788..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.List; - -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.Group; -import org.alfresco.module.org_alfresco_module_rm.capability.GroupImpl; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Test class for testing the methods in {@link CapabilityService} - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class CapabilityServiceImplTest extends BaseRMTestCase -{ - public void testGetAddRemoveGroups() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Group auditGroup = capabilityService.getGroup("audit"); - assertNotNull(auditGroup); - assertEquals(10, auditGroup.getIndex()); - assertEquals("Audit", auditGroup.getTitle()); - assertEquals("audit", auditGroup.getId()); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - int initialSize = capabilityService.getGroups().size(); - - GroupImpl testGroup = new GroupImpl(); - testGroup.setId("testGroup"); - testGroup.setIndex(140); - testGroup.setTitle("Test group"); - capabilityService.addGroup(testGroup); - - assertEquals(initialSize+1, capabilityService.getGroups().size()); - - Group group = capabilityService.getGroup("testGroup"); - assertNotNull(group); - assertTrue(group.getId().equalsIgnoreCase("testGroup")); - assertTrue(group.getTitle().equalsIgnoreCase("Test group")); - assertTrue(group.getIndex() == 140); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Group testGroup = capabilityService.getGroup("testGroup"); - assertNotNull(testGroup); - int initialSize = capabilityService.getGroups().size(); - - capabilityService.removeGroup(testGroup); - assertEquals(initialSize-1, capabilityService.getGroups().size()); - - return null; - } - }); - } - - public void testGetCapabilitiesByGroup() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - List groups = capabilityService.getGroups(); - assertNotNull(groups); - - Group recordsGroup = groups.get(0); - assertNotNull(recordsGroup); - - List recordCapabilities = capabilityService.getCapabilitiesByGroup(recordsGroup); - assertNotNull(recordCapabilities); - - int recordCapabilitiesSize = recordCapabilities.size(); - assertTrue(recordCapabilitiesSize > 1); - - for (int i = 1; i == recordCapabilitiesSize; i++) - { - Capability capability = recordCapabilities.get(i); - assertNotNull(capability); - assertEquals(i * 10, capability.getIndex()); - } - - Group rulesGroup = groups.get(groups.size() - 2); - assertNotNull(rulesGroup); - - List ruleCapabilities = capabilityService.getCapabilitiesByGroupId(rulesGroup.getId()); - assertNotNull(ruleCapabilities); - - int ruleCapabilitiesSize = ruleCapabilities.size(); - assertTrue(ruleCapabilitiesSize > 0); - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java deleted file mode 100644 index 3fbd4d80c4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.alfresco.module.org_alfresco_module_rm.email.CustomMapping; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Custom EMail Mapping Service - * - * @author Roy Wetherall - * @since 2.0 - */ -public class CustomEMailMappingServiceImplTest extends BaseRMTestCase -{ - private CustomEmailMappingService eMailMappingService; - - @Override - protected void initServices() - { - super.initServices(); - - eMailMappingService = (CustomEmailMappingService)applicationContext.getBean("customEmailMappingService"); - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setUp() throws Exception - { - super.setUp(); - eMailMappingService.registerEMailMappingKey("EmailMappingKeyTest1"); - eMailMappingService.registerEMailMappingKey("EmailMappingKeyTest2"); - } - - public void testCRUD() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - // Check the initial custom mapping size - assertTrue(checkCustomMappingsSize(20)); - - String firstKey = eMailMappingService.getEmailMappingKeys().get(0); - - // Add a custom mapping - eMailMappingService.addCustomMapping(firstKey, "cm:monkeyFace"); - - // Check the new size - assertTrue(checkCustomMappingsSize(21)); - - // Check the new added custom mapping - CustomMapping monkeyMapping = getCustomMapping(firstKey, "cm:monkeyFace"); - assertNotNull(monkeyMapping); - assertEquals(firstKey, monkeyMapping.getFrom()); - assertEquals("cm:monkeyFace", monkeyMapping.getTo()); - - // Delete the new added custom mapping - eMailMappingService.deleteCustomMapping(firstKey, "cm:monkeyFace"); - - // Check the size after deletion - assertTrue(checkCustomMappingsSize(20)); - - // Check the custom mapping after deletion if it exists - assertNull(getCustomMapping(firstKey, "cm:monkeyFace")); - - // Check the email mapping keys size - // There are 6 "standard" EmailMappingKeys + 2 CustomEmailMappingKeys are added on setUp - assertTrue(checkEmailMappingKeysSize(8)); - - try - { - eMailMappingService.addCustomMapping(" ", "cm:monkeyFace"); - fail("Should not get here. Invalid data."); - } - catch (AlfrescoRuntimeException are) - { - assertNotNull(are); //Must throw this exception - assertTrue(are.getMessage().contains("Invalid values for")); - } - - try - { - eMailMappingService.addCustomMapping("monkey", " "); - fail("Should not get here. Invalid data."); - } - catch (AlfrescoRuntimeException are) - { - assertNotNull(are); //Must throw this exception - assertTrue(are.getMessage().contains("Invalid values for")); - } - - eMailMappingService.addCustomMapping(firstKey, "cm:monkeyFace"); //valid key - - return null; - } - }, ADMIN_USER); - } - - private CustomMapping getCustomMapping(String from, String to) - { - CustomMapping result = null; - for (CustomMapping customMapping : eMailMappingService.getCustomMappings()) - { - if (customMapping.getFrom().equalsIgnoreCase(from) && customMapping.getTo().equalsIgnoreCase(to)) - { - result = customMapping; - break; - } - } - return result; - } - - private boolean checkCustomMappingsSize(int expected) - { - return expected == eMailMappingService.getCustomMappings().size(); - } - - private boolean checkEmailMappingKeysSize(int expected) - { - return expected == eMailMappingService.getEmailMappingKeys().size(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java deleted file mode 100644 index 237ae53e4f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -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.vital.VitalRecordDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Dataset Service Test - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class DataSetServiceImplTest extends BaseRMTestCase -{ - /** Id of the test data set*/ - private static final String DATA_SET_ID = "testExampleData"; - - /** - * @see DataSetService#getDataSets() - */ - public void testGetDataSets() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Map dataSets = dataSetService.getDataSets(); - // Test the data sets - assertNotNull(dataSets); - // At least the test data set must exist - assertTrue(dataSets.size() >= 1); - // The test data set must be in the list of available data sets - assertNotNull(dataSets.get(DATA_SET_ID)); - - for (Map.Entry entry : dataSets.entrySet()) - { - // Test the key - String key = entry.getKey(); - assertNotNull(key); - - // Test the value - DataSet dataSet = entry.getValue(); - assertNotNull(dataSet); - - // Test the id - String id = dataSet.getId(); - assertNotNull(id); - assertEquals(id, key); - - // Test the label - String label = dataSet.getLabel(); - assertNotNull(label); - - // Test the path - String path = dataSet.getPath(); - assertNotNull(path); - } - - return null; - } - }); - } - - /** - * @see DataSetService#loadDataSet(String, org.alfresco.service.cmr.repository.NodeRef) - */ - public void testLoadDataSet() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Test the file plan before importing the data sets - testFilePlanBeforeImportingDataSet(); - - // Load the data set into the specified file plan - dataSetService.loadDataSet(filePlan, DATA_SET_ID); - - // Test the file plan after importing the data sets - testFilePlanAfterImportingDataSet(); - - return null; - } - - /** - * Helper method for testing the test file plan before importing the data - */ - private void testFilePlanBeforeImportingDataSet() - { - // There should not be any categories before importing - assertNull(nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1")); - assertNull(nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2")); - - // The aspect should exist before loading a data set - assertNull(nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS)); - - // At the beginning the file plan is empty. So there should not be any data sets - assertTrue(dataSetService.getLoadedDataSets(filePlan).size() == 0); - assertFalse(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID)); - assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0); - assertTrue(dataSetService.getDataSets(filePlan, false).size() > 0); - } - - /** - * Helper method for testing the test file plan after importing the data - */ - private void testFilePlanAfterImportingDataSet() - { - // Test the "first level" categories after importing if they exist - // TestRecordCategory1 - NodeRef recCat1 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1"); - assertNotNull(recCat1); - List recCat1ImmediateChildren = filePlanService.getAllContained(recCat1); - assertTrue(recCat1ImmediateChildren.size() == 3); - List recCat1AllChildren = filePlanService.getAllContained(recCat1, true); - assertTrue(recCat1AllChildren.size() == 6); - DispositionSchedule recCat1DispositionSchedule = dispositionService.getDispositionSchedule(recCat1); - assertNull(recCat1DispositionSchedule); - - // TestRecordCategory2 - NodeRef recCat2 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2"); - assertNotNull(recCat2); - List recCat2ImmediateChildren = filePlanService.getAllContained(recCat2); - assertTrue(recCat2ImmediateChildren.size() == 2); - List recCat2AllChildren = filePlanService.getAllContained(recCat2, true); - assertTrue(recCat2AllChildren.size() == 4); - DispositionSchedule recCat2DispositionSchedule = dispositionService.getDispositionSchedule(recCat2); - assertNull(recCat2DispositionSchedule); - - // TestRecordCategory1: Test the "second level" categories and record folders - NodeRef recCat11 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory11"); - assertNotNull(recCat11); - List recCat11ImmediateChilderen = filePlanService.getAllContained(recCat11); - assertTrue(recCat11ImmediateChilderen.size() == 2); - List recCat11Childeren = filePlanService.getAllContained(recCat11, true); - assertTrue(recCat11Childeren.size() == 2); - assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder1")); - assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder2")); - VitalRecordDefinition recCat11VitalRecordDefinition = vitalRecordService.getVitalRecordDefinition(recCat11); - assertNotNull(recCat11VitalRecordDefinition); - assertTrue(recCat11VitalRecordDefinition.getReviewPeriod().getExpression().equals("1")); - assertNotNull(recCat11VitalRecordDefinition.getNextReviewDate()); - - NodeRef recCat12 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory12"); - assertNotNull(recCat12); - List recCat12ImmediateChildren = filePlanService.getAllContained(recCat12); - assertTrue(recCat12ImmediateChildren.size() == 1); - List recCat12Children = filePlanService.getAllContained(recCat12, true); - assertTrue(recCat12Children.size() == 1); - assertNotNull(nodeService.getChildByName(recCat12, ContentModel.ASSOC_CONTAINS, "TestRecordFolder3")); - DispositionSchedule recCat12DispositionSchedule = dispositionService.getDispositionSchedule(recCat12); - assertNotNull(recCat12DispositionSchedule); - assertTrue(recCat12DispositionSchedule.getDispositionInstructions().equals("Cut off every 3 months, hold 3 months, then destroy.")); - assertTrue(recCat12DispositionSchedule.getDispositionAuthority().equals("T0-000-00-1 item 002")); - assertTrue(recCat12DispositionSchedule.getDispositionActionDefinitions().size() == 2); - assertNotNull(recCat12DispositionSchedule.getDispositionActionDefinitionByName("cutoff")); - assertNotNull(recCat12DispositionSchedule.getDispositionActionDefinitionByName("destroy")); - - NodeRef recCat13 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory13"); - assertNotNull(recCat13); - List recCat13ImmediateChildren = filePlanService.getAllContained(recCat13); - assertTrue(recCat13ImmediateChildren.size() == 0); - DispositionSchedule recCat13DispositionSchedule = dispositionService.getDispositionSchedule(recCat13); - assertNotNull(recCat13DispositionSchedule); - - // TestRecordCategory2: Test the "second level" categories and record folders - NodeRef recCat21 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory21"); - assertNotNull(recCat21); - List recCat21ImmediateChildren = filePlanService.getAllContained(recCat21); - assertTrue(recCat21ImmediateChildren.size() == 0); - DispositionSchedule recCat21DispositionSchedule = dispositionService.getDispositionSchedule(recCat21); - assertNotNull(recCat21DispositionSchedule); - - NodeRef recCat22 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory22"); - assertNotNull(recCat22); - List recCat22ImmediateChildren = filePlanService.getAllContained(recCat22); - assertTrue(recCat22ImmediateChildren.size() == 2); - List recCat22Children = filePlanService.getAllContained(recCat22, true); - assertTrue(recCat22Children.size() == 2); - assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder4")); - assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder5")); - DispositionSchedule recCat22DispositionSchedule = dispositionService.getDispositionSchedule(recCat22); - assertNotNull(recCat22DispositionSchedule); - - // After loading the data set into the file plan the custom aspect should contain the id of the loaded data set - Serializable nodeProperty = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - assertNotNull(nodeProperty); - @SuppressWarnings("unchecked") - ArrayList loadedDataSetIds = (ArrayList)nodeProperty; - assertTrue(loadedDataSetIds.size() == 1); - assertTrue(loadedDataSetIds.contains(DATA_SET_ID)); - - // The data set has been loaded into the file plan, so the file plan should contain the data set id - Map loadedDataSets = dataSetService.getLoadedDataSets(filePlan); - assertTrue(loadedDataSets.size() == 1); - assertTrue(loadedDataSets.containsKey(DATA_SET_ID)); - assertTrue(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID)); - assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0); - assertTrue(dataSetService.getDataSets(filePlan, false).size() > 1); - } - }); - } - - /** - * @see DataSetService#existsDataSet(String) - */ - public void testExistsDataSet() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Test if a data set with the specified data set id exists - assertTrue(dataSetService.existsDataSet(DATA_SET_ID)); - assertFalse(dataSetService.existsDataSet("AnotherDataSetId")); - - return null; - } - }); - } - - /* - * INFO: - * - * The tests for - * - * DataSetService#getDataSets(NodeRef, boolean) - * DataSetService#getLoadedDataSets(NodeRef) - * DataSetService#isLoadedDataSet(NodeRef, String) - * - * will be executed in testFilePlanBeforeImportingDataSet() and testFilePlanAfterImportingDataSet(). - */ - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java deleted file mode 100644 index 0265521c11..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java +++ /dev/null @@ -1,1032 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -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.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.job.PublishUpdatesJobExecuter; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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; - -/** - * Disposition service implementation unit test. - * - * @author Roy Wetherall - */ -public class DispositionServiceImplTest extends BaseRMTestCase -{ - @Override - protected boolean isMultiHierarchyTest() - { - return true; - } - - public void testGetDispositionProperties() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Collection properties = dispositionService.getDispositionProperties(); - - assertNotNull(properties); - assertEquals(5, properties.size()); - - for (DispositionProperty property : properties) - { - assertNotNull(property.getQName()); - assertNotNull(property.getPropertyDefinition()); - } - - return null; - } - }); - } - - /** - * @see DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testGetDispositionSchedule() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Check for null lookup's - assertNull(dispositionService.getDispositionSchedule(filePlan)); - - // Get the containers disposition schedule - DispositionSchedule ds = dispositionService.getDispositionSchedule(rmContainer); - assertNotNull(ds); - checkDispositionSchedule(ds, false); - - // Get the folders disposition schedule - ds = dispositionService.getDispositionSchedule(rmContainer); - assertNotNull(ds); - checkDispositionSchedule(ds, false); - - return null; - } - - }); - - // Failure: Root node - doTestInTransaction(new FailureTest - ( - "Should not be able to get adisposition schedule for the root node", - AlfrescoRuntimeException.class - ) - { - @Override - public void run() - { - dispositionService.getDispositionSchedule(rootNodeRef); - } - }); - - // Failure: Non-rm node - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - dispositionService.getDispositionSchedule(folder); - } - }); - } - - /** - * @see DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testGetDispositionScheduleMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertNull(dispositionService.getDispositionSchedule(mhContainer)); - - // Level 1 - doCheck(mhContainer11, "ds11", false); - doCheck(mhContainer12, "ds12", false); - - // Level 2 - doCheck(mhContainer21, "ds11", false); - doCheck(mhContainer22, "ds12", false); - doCheck(mhContainer23, "ds23", false); - - // Level 3 - doCheck(mhContainer31, "ds11", false); - doCheck(mhContainer32, "ds12", false); - doCheck(mhContainer33, "ds33", true); - doCheck(mhContainer34, "ds23", false); - doCheck(mhContainer35, "ds35", true); - - // Folders - doCheckFolder(mhRecordFolder41, "ds11", false); - doCheckFolder(mhRecordFolder42, "ds12", false); - doCheckFolder(mhRecordFolder43, "ds33", true); - doCheckFolder(mhRecordFolder44, "ds23", false); - doCheckFolder(mhRecordFolder45, "ds35", true); - - return null; - } - - private void doCheck(NodeRef container, String dispositionInstructions, boolean isRecordLevel) - { - DispositionSchedule ds = dispositionService.getDispositionSchedule(container); - assertNotNull(ds); - checkDispositionSchedule(ds, dispositionInstructions, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); - } - - private void doCheckFolder(NodeRef container, String dispositionInstructions, boolean isRecordLevel) - { - doCheck(container, dispositionInstructions, isRecordLevel); - if (!isRecordLevel) - { - assertNotNull(dispositionService.getNextDispositionAction(container)); - } - } - }); - - } - - /** - * Checks a disposition schedule - * - * @param ds disposition scheduleS - */ - private void checkDispositionSchedule(DispositionSchedule ds, String dispositionInstructions, String dispositionAuthority, boolean isRecordLevel) - { - assertEquals(dispositionAuthority, ds.getDispositionAuthority()); - assertEquals(dispositionInstructions, ds.getDispositionInstructions()); - assertEquals(isRecordLevel, ds.isRecordLevelDisposition()); - - List defs = ds.getDispositionActionDefinitions(); - assertNotNull(defs); - assertEquals(2, defs.size()); - - DispositionActionDefinition defCutoff = ds.getDispositionActionDefinitionByName("cutoff"); - assertNotNull(defCutoff); - assertEquals("cutoff", defCutoff.getName()); - - DispositionActionDefinition defDestroy = ds.getDispositionActionDefinitionByName("destroy"); - assertNotNull(defDestroy); - assertEquals("destroy", defDestroy.getName()); - } - - /** - * - * @param ds - */ - private void checkDispositionSchedule(DispositionSchedule ds, boolean isRecordLevel) - { - checkDispositionSchedule(ds, CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); - } - - /** - * @see DispositionService#getAssociatedDispositionSchedule(NodeRef) - */ - public void testGetAssociatedDispositionSchedule() throws Exception - { - // Get associated disposition schedule for rmContainer - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Get the containers disposition schedule - DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(rmContainer); - assertNotNull(ds); - checkDispositionSchedule(ds, false); - - // Show the null disposition schedules - assertNull(dispositionService.getAssociatedDispositionSchedule(filePlan)); - assertNull(dispositionService.getAssociatedDispositionSchedule(rmFolder)); - - return null; - } - }); - - // Failure: associated disposition schedule for non-rm node - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - dispositionService.getAssociatedDispositionSchedule(folder); - } - }); - } - - /** - * @see DispositionService#getAssociatedDispositionSchedule(NodeRef) - */ - public void testGetAssociatedDispositionScheduleMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer)); - - // Level 1 - doCheck(mhContainer11, "ds11", false); - doCheck(mhContainer12, "ds12", false); - - // Level 2 - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer21)); - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer22)); - doCheck(mhContainer23, "ds23", false); - - // Level 3 - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer31)); - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer32)); - doCheck(mhContainer33, "ds33", true); - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer34)); - doCheck(mhContainer35, "ds35", true); - - return null; - } - - private void doCheck(NodeRef container, String dispositionInstructions, boolean isRecordLevel) - { - DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(container); - assertNotNull(ds); - checkDispositionSchedule(ds, dispositionInstructions, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); - } - }); - } - - /** - * @see DispositionService#hasDisposableItems(DispositionSchedule) - */ - public void testHasDisposableItems() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add a new disposition schedule - NodeRef container = filePlanService.createRecordCategory(rmContainer, "hasDisposableTest"); - DispositionSchedule ds = utils.createBasicDispositionSchedule(container); - - assertTrue(dispositionService.hasDisposableItems(dispositionSchedule)); - assertFalse(dispositionService.hasDisposableItems(ds)); - - return null; - } - }); - } - - /** - * @see DispositionService#hasDisposableItems(DispositionSchedule) - */ - public void testHasDisposableItemsMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule11)); - assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule12)); - assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule23)); - assertFalse(dispositionService.hasDisposableItems(mhDispositionSchedule33)); - assertFalse(dispositionService.hasDisposableItems(mhDispositionSchedule35)); - - return null; - } - }); - } - - /** - * @see DispositionService#getDisposableItems(DispositionSchedule) - */ - public void testGetDisposableItems() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List nodeRefs = dispositionService.getDisposableItems(dispositionSchedule); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(rmFolder)); - - return null; - } - }); - } - - /** - * @see DispositionService#getDisposableItems(DispositionSchedule) - */ - public void testGetDisposableItemsMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule11); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(mhRecordFolder41)); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule12); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(mhRecordFolder42)); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule23); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(mhRecordFolder44)); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule33); - assertNotNull(nodeRefs); - assertEquals(0, nodeRefs.size()); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule35); - assertNotNull(nodeRefs); - assertEquals(0, nodeRefs.size()); - - return null; - } - }); - } - - /** - * @see DispositionService#createDispositionSchedule(NodeRef, Map) - */ - public void testCreateDispositionSchedule() throws Exception - { - // Test: simple disposition create - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create a new container - NodeRef container = filePlanService.createRecordCategory(filePlan, "testCreateDispositionSchedule"); - - // Create a new disposition schedule - utils.createBasicDispositionSchedule(container, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false, true); - - return container; - } - - @Override - public void test(NodeRef result) throws Exception - { - // Get the created disposition schedule - DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(result); - assertNotNull(ds); - - // Check the disposition schedule - checkDispositionSchedule(ds, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false); - } - }); - - // Failure: create disposition schedule on container with existing disposition schedule - doTestInTransaction(new FailureTest - ( - "Can not create a disposition schedule on a container with an existing disposition schedule" - ) - { - @Override - public void run() - { - utils.createBasicDispositionSchedule(rmContainer); - } - }); - } - - /** - * @see DispositionService#createDispositionSchedule(NodeRef, Map) - */ - public void testCreateDispositionScheduleMultiHier() throws Exception - { - // Test: simple disposition create - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Create a new structure container - NodeRef testA = filePlanService.createRecordCategory(mhContainer, "testA"); - NodeRef testB = filePlanService.createRecordCategory(testA, "testB"); - - // Create new disposition schedules - utils.createBasicDispositionSchedule(testA, "testA", "testA", false, true); - utils.createBasicDispositionSchedule(testB, "testB", "testB", false, true); - - // Add created containers to model - setNodeRef("testA", testA); - setNodeRef("testB", testB); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Get the created disposition schedule - DispositionSchedule testA = dispositionService.getAssociatedDispositionSchedule(getNodeRef("testA")); - assertNotNull(testA); - DispositionSchedule testB = dispositionService.getAssociatedDispositionSchedule(getNodeRef("testB")); - assertNotNull(testB); - - // Check the disposition schedule - checkDispositionSchedule(testA, "testA", "testA", false); - checkDispositionSchedule(testB, "testB", "testB", false); - } - }); - - // Failure: create disposition schedule on container with existing disposition schedule - doTestInTransaction(new FailureTest - ( - "Can not create a disposition schedule on container with an existing disposition schedule" - ) - { - @Override - public void run() - { - utils.createBasicDispositionSchedule(mhContainer11); - } - }); - - // Failure: create disposition schedule on a container where there are disposable items under management - doTestInTransaction(new FailureTest - ( - "Can not create a disposition schedule on a container where there are already disposable items under management" - ) - { - @Override - public void run() - { - utils.createBasicDispositionSchedule(mhContainer21); - } - }); - } - - /** - * @see DispositionService#getAssociatedRecordsManagementContainer(DispositionSchedule) - */ - public void testGetAssociatedRecordsManagementContainer() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef nodeRef = dispositionService.getAssociatedRecordsManagementContainer(dispositionSchedule); - assertNotNull(nodeRef); - assertEquals(rmContainer, nodeRef); - - return null; - } - }); - } - - /** - * @see DispositionService#getAssociatedRecordsManagementContainer(DispositionSchedule) - */ - public void testGetAssociatedRecordsManagementContainerMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule11); - assertNotNull(nodeRef); - assertEquals(mhContainer11, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule12); - assertNotNull(nodeRef); - assertEquals(mhContainer12, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule23); - assertNotNull(nodeRef); - assertEquals(mhContainer23, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule33); - assertNotNull(nodeRef); - assertEquals(mhContainer33, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule35); - assertNotNull(nodeRef); - assertEquals(mhContainer35, nodeRef); - - return null; - } - }); - } - - // TODO DispositionActionDefinition addDispositionActionDefinition - - // TODO void removeDispositionActionDefinition( - - private NodeRef record43; - private NodeRef record45; - - public void testUpdateDispositionActionDefinitionMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - record43 = utils.createRecord(mhRecordFolder43, "record1.txt"); - record45 = utils.createRecord(mhRecordFolder45, "record2.txt"); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Check all the current record folders first - checkDisposableItemUnchanged(mhRecordFolder41); - checkDisposableItemUnchanged(mhRecordFolder42); - checkDisposableItemUnchanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - - updateDispositionScheduleOnContainer(mhContainer11); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemUnchanged(mhRecordFolder42); - checkDisposableItemUnchanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer12); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemUnchanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer33); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemChanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer23); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemChanged(record43); - checkDisposableItemChanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer35); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemChanged(record43); - checkDisposableItemChanged(mhRecordFolder44); - checkDisposableItemChanged(record45); - } - }); - } - - private void publishDispositionActionDefinitionChange(DispositionActionDefinition dad) - { - PublishExecutorRegistry reg = (PublishExecutorRegistry)applicationContext.getBean("publishExecutorRegistry"); - PublishExecutor pub = reg.get(RecordsManagementModel.UPDATE_TO_DISPOSITION_ACTION_DEFINITION); - assertNotNull(pub); - pub.publish(dad.getNodeRef()); - } - - private void checkDisposableItemUnchanged(NodeRef recordFolder) - { - checkDispositionAction( - dispositionService.getNextDispositionAction(recordFolder), - "cutoff", - new String[]{CommonRMTestUtils.DEFAULT_EVENT_NAME}, - CommonRMTestUtils.PERIOD_NONE); - } - - private void checkDisposableItemChanged(NodeRef recordFolder) throws Exception - { - checkDispositionAction( - dispositionService.getNextDispositionAction(recordFolder), - "cutoff", - new String[]{CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished"}, - "week|1"); - } - - private void updateDispositionScheduleOnContainer(NodeRef nodeRef) - { - Map updateProps = new HashMap<>(3); - updateProps.put(PROP_DISPOSITION_PERIOD, "week|1"); - updateProps.put(PROP_DISPOSITION_EVENT, (Serializable)Arrays.asList(CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished")); - - DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); - DispositionActionDefinition dad = ds.getDispositionActionDefinitionByName("cutoff"); - dispositionService.updateDispositionActionDefinition(dad, updateProps); - publishDispositionActionDefinitionChange(dad); - } - - /** - * - * @param da - * @param name - * @param arrEventNames - * @param strPeriod - */ - private void checkDispositionAction(DispositionAction da, String name, String[] arrEventNames, String strPeriod) - { - assertNotNull(da); - assertEquals(name, da.getName()); - - List events = da.getEventCompletionDetails(); - assertNotNull(events); - assertEquals(arrEventNames.length, events.size()); - - List origEvents = new ArrayList<>(events.size()); - for (EventCompletionDetails event : events) - { - origEvents.add(event.getEventName()); - } - - List expectedEvents = Arrays.asList(arrEventNames); - Collection copy = new ArrayList<>(origEvents); - - for (Iterator i = origEvents.iterator(); i.hasNext(); ) - { - String origEvent = i.next(); - - if (expectedEvents.contains(origEvent)) - { - i.remove(); - copy.remove(origEvent); - } - } - - if (copy.size() != 0 && expectedEvents.size() != 0) - { - StringBuffer buff = new StringBuffer(255); - if (copy.size() != 0) - { - buff.append("The following events where found, but not expected: ("); - for (String eventName : copy) - { - buff.append(eventName).append(", "); - } - buff.append("). "); - } - if (expectedEvents.size() != 0) - { - buff.append("The following events where not found, but expected: ("); - for (String eventName : expectedEvents) - { - buff.append(eventName).append(", "); - } - buff.append(")."); - } - fail(buff.toString()); - } - - if (CommonRMTestUtils.PERIOD_NONE.equals(strPeriod)) - { - assertNull(da.getAsOfDate()); - } - else - { - assertNotNull(da.getAsOfDate()); - } - } - - // TODO boolean isNextDispositionActionEligible(NodeRef nodeRef); - - // TODO DispositionAction getNextDispositionAction(NodeRef nodeRef); - - // TODO List getCompletedDispositionActions(NodeRef nodeRef); - - // TODO DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef); - - // TODO List getDispositionPeriodProperties(); - - /* === Issues === */ - - private NodeRef testRM263RecordCategory; - private DispositionSchedule testRM263DispositionSchedule; - private NodeRef testRM263Record; - - /** - * https://issues.alfresco.com/jira/browse/RM-263 - */ - public void testRM_263() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - testRM263RecordCategory = filePlanService.createRecordCategory(rmContainer, "rm263"); - testRM263DispositionSchedule = utils.createBasicDispositionSchedule( - testRM263RecordCategory, - "test", - "test", - true, - false); - - Map adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff"); - adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); - adParams.put(PROP_DISPOSITION_PERIOD, "week|1"); - adParams.put(PROP_DISPOSITION_PERIOD_PROPERTY, DOD5015Model.PROP_PUBLICATION_DATE.toString()); - - dispositionService.addDispositionActionDefinition(testRM263DispositionSchedule, adParams); - - NodeRef recordFolder = recordFolderService.createRecordFolder(testRM263RecordCategory, "testRM263RecordFolder"); - testRM263Record = utils.createRecord(recordFolder, "testRM263Record", "testRM263Record"); - - return null; - } - }); - - doTestInTransaction(new Test() - { - private final QName PROP_SEARCH_ASOF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf"); - - @Override - public Void run() throws Exception - { - Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE); - assertNull(pubDate); - Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF); - assertNull(asOfDate); - - DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record); - assertNotNull(da); - assertNull(da.getAsOfDate()); - - //rma:recordSearchDispositionActionAsOf" - nodeService.setProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE, new Date()); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE); - assertNotNull(pubDate); - Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF); - assertNotNull(asOfDate); - - DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record); - assertNotNull(da); - assertNotNull(da.getAsOfDate()); - } - }); - } - - private NodeRef testRM386RecordCategory; - private DispositionSchedule testRM386DispositionSchedule; - private NodeRef testRM386Record; - - /** - * Test to make sure all the search rollups are correct after schedule is updated - * @throws Exception - */ - public void testRM386() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386"); - testRM386DispositionSchedule = utils.createBasicDispositionSchedule( - testRM386RecordCategory, - "disposition instructions", - "disposition authority", - true, // record level - true); // set the default actions - - NodeRef recordFolder = recordFolderService.createRecordFolder(testRM386RecordCategory, "testRM386RecordFolder"); - testRM386Record = utils.createRecord(recordFolder, "testRM386Record", "testRM386Record"); - - return null; - } - - @SuppressWarnings("unchecked") - @Override - public void test(Void result) throws Exception - { - // Test the rollups for the record - Map properties = nodeService.getProperties(testRM386Record); - - assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS)); - - assertEquals("none", properties.get(PROP_RS_DISPOSITION_PERIOD)); - assertEquals("0", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); - - List events = (List)properties.get(PROP_RS_DISPOSITION_EVENTS); - assertNotNull(events); - assertEquals(1, events.size()); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, events.get(0)); - assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); - - assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public DispositionActionDefinition run() throws Exception - { - DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); - assertNotNull( "Expected an action definition", actionDefinition); - - Map adParams = new HashMap<>(3); - - List events = new ArrayList<>(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add("obsolete"); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - adParams.put(PROP_DISPOSITION_PERIOD, "week|1"); - - dispositionService.updateDispositionActionDefinition( - actionDefinition, - adParams); - - return actionDefinition; - } - - @SuppressWarnings("unchecked") - @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); - assertEquals("cutoff", dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertEquals(2, dispositionAction.getEventCompletionDetails().size()); - - // Test the rollups for the record - Map properties = nodeService.getProperties(testRM386Record); - - assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS)); - - assertEquals("week", properties.get(PROP_RS_DISPOSITION_PERIOD)); - assertEquals("1", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); - - List events = (List)properties.get(PROP_RS_DISPOSITION_EVENTS); - assertNotNull(events); - assertEquals(2, events.size()); - assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); - - assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java deleted file mode 100644 index d42a3693fd..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionPropertySubs; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.action.ParameterDefinition; - -/** - * Extended action service test. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedActionServiceTest extends BaseRMTestCase -{ - /** Action names */ - public static final String TEST_ACTION = "testAction"; - public static final String TEST_ACTION_2 = "testAction2"; - public static final String TEST_DM_ACTION = "testDMAction"; - public static final String RECORD_ONLY_ACTION = "recordOnlyAction"; - public static final String RECORD_AND_FOLDER_ONLY_ACTION = "recordandFolderOnlyAction"; - public static final String DELEGATE_ACTION = "rmDelegateAction"; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - // NOTE: temporarily disabled test ... now that RM actions are no longer registered with the action service, aplicability - // may no longer be relevant ... possibly something to back out?? - public void xtestAvailableActions() - { - doTestInTransaction(new Test() - { - public Void run() - { - List result = actionService.getActionDefinitions(recordOne); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertTrue(containsAction(result, TEST_ACTION_2)); - assertFalse(containsAction(result, TEST_DM_ACTION)); - assertTrue(containsAction(result, RECORD_ONLY_ACTION)); - assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertTrue(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(rmFolder); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertTrue(containsAction(result, TEST_ACTION_2)); - assertFalse(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(rmContainer); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertTrue(containsAction(result, TEST_ACTION_2)); - assertFalse(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(dmDocument); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertFalse(containsAction(result, TEST_ACTION_2)); - assertTrue(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(dmFolder); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertFalse(containsAction(result, TEST_ACTION_2)); - assertTrue(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - return null; - } - }); - } - - private boolean containsAction(List list, String actionName) - { - boolean result = false; - - for (ActionDefinition actionDefinition : list) - { - if (actionDefinition.getName().equals(actionName)) - { - result = true; - break; - } - } - - return result; - } - - public void testActionPropertySubstitution() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Action action = actionService.createAction(TestActionPropertySubs.NAME); - - action.setParameterValue("dayShort", "${date.day.short}"); - action.setParameterValue("dayShort2", "${date.day}"); - action.setParameterValue("dayLong", "${date.day.long}"); - action.setParameterValue("dayNumber", "${date.day.number}"); - action.setParameterValue("dayYear", "${date.day.year}"); - - action.setParameterValue("monthShort", "${date.month.short}"); - action.setParameterValue("monthShort2", "${date.month}"); - action.setParameterValue("monthLong", "${date.month.long}"); - action.setParameterValue("monthNumber", "${date.month.number}"); - - action.setParameterValue("yearShort", "${date.year.short}"); - action.setParameterValue("yearShort2", "${date.year}"); - action.setParameterValue("yearLong", "${date.year.long}"); - action.setParameterValue("yearWeek", "${date.year.week}"); - - action.setParameterValue("name", "${node.cm:name}"); - - action.setParameterValue("company", "${message.test.company}"); - - action.setParameterValue("combo", "${date.year.long}/${date.month.short}/${node.cm:name}-${message.test.company}.txt"); - - actionService.executeAction(action, rmFolder); - - return null; - } - }); - } - - /** - * RM-3000 - * Tests if the actions extending DelegateAction inherit the parameter definitions from their delegate action - */ - public void testDelegateActions() - { - /* - * set-property-value is the delegate action for setPropertyValue. - */ - assertTrue(inheritsAllParameterDefinitions("setPropertyValue", "set-property-value")); - - /* - * rmscript is the delegate action for executeScript. - */ - assertTrue(inheritsAllParameterDefinitions("executeScript", "rmscript")); - - /* - * mail is the delegate action for sendEmail. - */ - assertTrue(inheritsAllParameterDefinitions("sendEmail", "mail")); - } - - /** - * Checks if the action definition rmAction inherits all the parameter definitions from delegateAction. - * @param rmAction The name of the action definition extending DelegateAction. - * @param delegateAction The name of the delegate action. - * @return true if rmAction inherits all the parameter definitions from delegateAction. false otherwise. - */ - private boolean inheritsAllParameterDefinitions(String rmAction, String delegateAction) - { - /* - * Get the parameter definition list for rmAction - */ - ActionDefinition rmActionDefinition = actionService.getActionDefinition(rmAction); - assertNotNull(rmActionDefinition); - List rmParameterDefinitions = rmActionDefinition.getParameterDefinitions(); - - /* - * Get the parameter definition list for the delegate action - */ - ActionDefinition delegateActionDefinition = actionService.getActionDefinition(delegateAction); - assertNotNull(delegateActionDefinition); - List delegateParameterDefinitions = delegateActionDefinition.getParameterDefinitions(); - - /* - * Check if rmActionDefinition contains all the elements in rmActionDefinition - */ - return rmParameterDefinitions.containsAll(delegateParameterDefinitions); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java deleted file mode 100644 index a7da71e574..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.HashSet; -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.repo.site.SiteModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.util.GUID; - -/** - * Records management security service test. - * - * @author Roy Wetherall - */ -public class ExtendedSecurityServiceImplTest extends BaseRMTestCase -{ - private NodeRef record; - private NodeRef recordToo; - private NodeRef moveRecordCategory; - private NodeRef moveRecordFolder; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - record = utils.createRecord(rmFolder, "record.txt"); - recordToo = utils.createRecord(rmFolder, "recordToo.txt"); - - moveRecordCategory = filePlanService.createRecordCategory(filePlan, "moveRecordCategory"); - moveRecordFolder = recordFolderService.createRecordFolder(moveRecordCategory, "moveRecordFolder"); - } - - private String createTestUser() - { - return doTestInTransaction(new Test() - { - public String run() - { - String userName = GUID.generate(); - createPerson(userName); - return userName; - } - }, AuthenticationUtil.getSystemUserName()); - } - - public void testExtendedSecurity() - { - final String monkey = createTestUser(); - final String elephant = createTestUser(); - final String snake = createTestUser(); - - doTestInTransaction(new Test() - { - public Void run() - { - assertFalse(extendedSecurityService.hasExtendedSecurity(filePlan)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmContainer)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmFolder)); - assertFalse(extendedSecurityService.hasExtendedSecurity(record)); - - assertTrue(extendedSecurityService.getReaders(record).isEmpty()); - assertTrue(extendedSecurityService.getWriters(record).isEmpty()); - - Set extendedReaders = new HashSet<>(2); - extendedReaders.add(monkey); - extendedReaders.add(elephant); - - extendedSecurityService.set(record, extendedReaders, null); - checkExtendedReaders(record, extendedReaders); - - Set extendedReadersToo = new HashSet<>(2); - extendedReadersToo.add(monkey); - extendedReadersToo.add(snake); - - extendedSecurityService.set(recordToo, extendedReadersToo, null); - checkExtendedReaders(recordToo, extendedReadersToo); - - // test remove - extendedSecurityService.remove(recordToo); - - assertFalse(extendedSecurityService.hasExtendedSecurity(recordToo)); - assertTrue(extendedSecurityService.getReaders(recordToo).isEmpty()); - assertTrue(extendedSecurityService.getWriters(recordToo).isEmpty()); - - return null; - } - }); - } - - public void testMove() - { - final String monkey = createTestUser(); - final String elephant = createTestUser(); - - doTestInTransaction(new Test() - { - Set extendedReaders = new HashSet<>(2); - - public Void run() throws Exception - { - extendedReaders.add(monkey); - extendedReaders.add(elephant); - - assertFalse(extendedSecurityService.hasExtendedSecurity(filePlan)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmContainer)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmFolder)); - assertFalse(extendedSecurityService.hasExtendedSecurity(record)); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordCategory)); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordFolder)); - - assertTrue(extendedSecurityService.getReaders(record).isEmpty()); - - extendedSecurityService.set(record, extendedReaders, null); - - checkExtendedReaders(record, extendedReaders); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordCategory)); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordFolder)); - - fileFolderService.move(record, moveRecordFolder, "movedRecord"); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - checkExtendedReaders(record, extendedReaders); - } - }); - } - - /** - * Check extended readers helper method - */ - private void checkExtendedReaders(NodeRef nodeRef, Set testReaders) - { - assertTrue(extendedSecurityService.hasExtendedSecurity(nodeRef)); - - Set readers = extendedSecurityService.getReaders(nodeRef); - assertNotNull(readers); - assertEquals(testReaders, readers); - } - - public void testDifferentUsersDifferentPermissions() - { - final String userNone = createTestUser(); - final String userRead = createTestUser(); - final String userWrite = createTestUser(); - final String siteShortName = GUID.generate(); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - siteService.createSite(null, siteShortName, "test", "test", SiteVisibility.PRIVATE); - return null; - } - }); - - final NodeRef documentLibrary = doTestInTransaction(new Test() - { - public NodeRef run() throws Exception - { - siteService.setMembership(siteShortName, userRead, SiteModel.SITE_CONSUMER); - siteService.setMembership(siteShortName, userWrite, SiteModel.SITE_COLLABORATOR); - return siteService.createContainer(siteShortName, SiteService.DOCUMENT_LIBRARY, null, null); - } - }); - - final NodeRef record = doTestInTransaction(new Test() - { - public NodeRef run() throws Exception - { - NodeRef record = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.createRecord(filePlan, record); - return record; - } - }); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userNone); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userRead); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userWrite); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userNone); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userRead); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userWrite); - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java deleted file mode 100644 index c23bcef944..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java +++ /dev/null @@ -1,1267 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -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; -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.springframework.extensions.webscripts.GUID; - -/** - * File plan permission service unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanPermissionServiceImplTest 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#isRecordTest() - */ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Helper to create test user - */ - private String createTestUser() - { - return doTestInTransaction(new Test() - { - @Override - public String run() - { - String userName = GUID.generate(); - createPerson(userName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, userName); - return userName; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Helper to set permission - */ - private void setPermission(final NodeRef nodeRef, final String userName, final String permission) - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(nodeRef, userName, permission); - return null; - } - }); - } - - /** - * Helper to delete permission - */ - private void deletePermission(final NodeRef nodeRef, final String userName, final String permission) - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.deletePermission(nodeRef, userName, permission); - return null; - } - }); - } - - /** - * Test set/delete permissions on file plan - */ - public void testSetDeletePermissionFilePlan() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(filePlan, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.ALLOWED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - deletePermission(filePlan, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - //what happens if we try and remove READ for a normal user on the file plan ??? - deletePermission(filePlan, userName, RMPermissionModel.READ_RECORDS); - - // nothing .. user still has read on file plan .. only removing the user from all roles will remove read on file plan - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - /** - * Test set/delete permission on record categorty - */ - public void testSetDeletePermissionRecordCategory() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(rmContainer, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // category read - AccessStatus.ALLOWED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - deletePermission(rmContainer, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - /** - * Test set/delete permission on record folder - */ - public void testSetDeletePermissionRecordFolder() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(rmFolder, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - deletePermission(rmFolder, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - /** - * Test set/delete permission on record - */ - public void testSetDeletePermissionRecord() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(recordOne, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - deletePermission(recordOne, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - public void testMoveRecord() throws Exception - { - String userOne = createTestUser(); - String userTwo = createTestUser(); - String userThree = createTestUser(); - - final NodeRef otherFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return recordFolderService.createRecordFolder(rmContainer, "otherFolder"); - } - }); - - assertPermissions(userOne, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userOne); - - assertPermissions(userTwo, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userTwo); - - assertPermissions(userThree, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userThree); - - setPermission(rmFolder, userOne, RMPermissionModel.FILING); - setPermission(otherFolder, userTwo, RMPermissionModel.FILING); - setPermission(recordOne, userThree, RMPermissionModel.FILING); - - assertPermissions(userOne, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userOne); - - assertPermissions(userTwo, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userTwo); - - assertPermissions(userThree, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userThree); - - // move the record! - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - fileFolderService.move(recordOne, otherFolder, "movedRecord.txt"); - return null; - } - }); - - assertPermissions(userOne, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userOne); - - assertPermissions(userTwo, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userTwo); - - assertPermissions(userThree, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userThree); - - } - - /** - * Helper to assert permissions for passed user - */ - private void assertPermissions(final String userName, final AccessStatus ... accessStatus) - { - assertEquals(8, accessStatus.length); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals("Everyone who has a role has read permissions on the file plan", - accessStatus[0], permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[1], permissionService.hasPermission(filePlan, RMPermissionModel.FILING)); - - assertEquals(accessStatus[2], permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[3], permissionService.hasPermission(rmContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[4], permissionService.hasPermission(rmFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[5], permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); - - assertEquals(accessStatus[6], permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[7], permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); - - return null; - } - }, userName); - } - - /** - * Helper to assert permissions for the passed user - */ - private void assertPermissionsWithInheritance( - final String userName, - final NodeRef subCategory, - final NodeRef folder, - final NodeRef record, - final AccessStatus ... accessStatus) - { - assertEquals(16, accessStatus.length); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(accessStatus[0], permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[1], permissionService.hasPermission(filePlan, RMPermissionModel.FILING)); - - assertEquals(accessStatus[2], permissionService.hasPermission(transfersContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[3], permissionService.hasPermission(transfersContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[4], permissionService.hasPermission(holdsContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[5], permissionService.hasPermission(holdsContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[6], permissionService.hasPermission(unfiledContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[7], permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[8], permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[9], permissionService.hasPermission(rmContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[10], permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[11], permissionService.hasPermission(subCategory, RMPermissionModel.FILING)); - - assertEquals(accessStatus[12], permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[13], permissionService.hasPermission(folder, RMPermissionModel.FILING)); - - assertEquals(accessStatus[14], permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[15], permissionService.hasPermission(record, RMPermissionModel.FILING)); - - return null; - } - }, userName); - } - - public void testFilePlanComponentInheritance() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Inheritance is turned off for file plan, transfer, holds, unfiled records and root categories - // it is turned on for sub categories, record folders and records - assertFalse(permissionService.getInheritParentPermissions(filePlan)); - assertFalse(permissionService.getInheritParentPermissions(filePlanService.getTransferContainer(filePlan))); - assertFalse(permissionService.getInheritParentPermissions(filePlanService.getHoldContainer(filePlan))); - assertFalse(permissionService.getInheritParentPermissions(unfiledContainer)); - assertFalse(permissionService.getInheritParentPermissions(rmContainer)); - assertTrue(permissionService.getInheritParentPermissions(recordFolderService.createRecordFolder(rmContainer, "subCategory"))); - assertTrue(permissionService.getInheritParentPermissions(rmFolder)); - assertTrue(permissionService.getInheritParentPermissions(recordOne)); - - return null; - } - }, ADMIN_USER); - } - - public void testRolesSetByDefault() - { - NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory1"); - NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder1"); - NodeRef record = utils.createRecord(folder, "record1.txt"); - - // Admin user has read/filing permissions on file plan, transfer, hold, unfiled records, root categories, sub categories, folders and records - assertPermissionsWithInheritance(ADMIN_USER, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.ALLOWED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.ALLOWED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.ALLOWED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.ALLOWED, // root category read - AccessStatus.ALLOWED, // root category file - AccessStatus.ALLOWED, // sub category read - AccessStatus.ALLOWED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.ALLOWED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - // Test user has read permissions on file plan, transfer, hold and unfiled records as the user will be added in the all records management roles - // which has read permissions on those nodes by default - assertPermissionsWithInheritance(createTestUser(), subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - public void testAddUserToContainers() - { - NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory2"); - NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder2"); - NodeRef record = utils.createRecord(folder, "record2.txt"); - - // The user1 will have read permissions on the file plan - // and read permissions on transfer, hold and unfiled records as the user will be in the all records management users role - String user1 = createTestUser(); - setPermission(filePlan, user1, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user1, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user2 will have read and filing permissions on the transfer container - // and read permissions on file plan, hold and unfiled records as the user will be in the all records management users role - String user2 = createTestUser(); - setPermission(transfersContainer, user2, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user2, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.ALLOWED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user3 will have read permissions on file plan, transfer, hold and unfiled records - String user3 = createTestUser(); - setPermission(holdsContainer, user3, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user3, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user4 will have read permissions on file plan, transfer, hold - // and read and filing permissions on unfiled records container - String user4 = createTestUser(); - setPermission(unfiledContainer, user4, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user4, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user5 will read permissions on the root category - // as the inheritance is turned on for the sub category the user will have also read permissions on sub category, folder and record - // and also read permissions on file plan, transfer, hold and unfiled records - String user5 = createTestUser(); - setPermission(rmContainer, user5, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user5, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.ALLOWED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.ALLOWED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.DENIED); // record file - - // The user6 will read and filing permissions on the sub category - // as the inheritance is turned on the user will have also read and filing permissions on folder and record - // and also read permissions on file plan, transfer, hold and unfiled records - String user6 = createTestUser(); - setPermission(subCategory, user6, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user6, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.ALLOWED, // sub category read - AccessStatus.ALLOWED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.ALLOWED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - // The user7 will read permissions on the folder - // as the inheritance is turned on the user will have also read on record - // and also read permissions on file plan, transfer, hold and unfiled records - String user7 = createTestUser(); - setPermission(folder, user7, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user7, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.DENIED); // record file - - // The user8 will read and filing permissions on the record - // and also read permissions on file plan, transfer, hold and unfiled records - String user8 = createTestUser(); - setPermission(record, user8, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user8, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - } - - public void testAccessPermissionOnSingleRecordWithSeveralUsers() - { - final NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory3"); - final NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder3"); - final NodeRef record = utils.createRecord(folder, "record3.txt"); - - String user1 = createTestUser(); - String user2 = createTestUser(); - - setPermission(rmContainer, user1, RMPermissionModel.READ_RECORDS); - - // user1 will have access to file plan, root category and because of inheritance sub category, folder and record - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user1); - - // user2 will have access to file plan - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user2); - } - - public void testDenyPermissionsOnRecordsWithSeveralUsers() - { - final NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory4"); - final NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder4"); - final NodeRef record4 = utils.createRecord(folder, "record4.txt"); - final NodeRef record5 = utils.createRecord(folder, "record5.txt"); - - String user1 = createTestUser(); - String user2 = createTestUser(); - - setPermission(rmContainer, user1, RMPermissionModel.READ_RECORDS); - setPermission(rmContainer, user2, RMPermissionModel.READ_RECORDS); - - permissionService.setInheritParentPermissions(record4, false); - permissionService.setInheritParentPermissions(record5, false); - - setPermission(record4, user1, RMPermissionModel.READ_RECORDS); - setPermission(record5, user1, RMPermissionModel.READ_RECORDS); - - // user1 will have access to file plan, root category and because of inheritance sub category, folder, record4 and record5 - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record4, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record5, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user1); - - // user2 will have access to file plan, root category and because of inheritance sub category and folder - // user2 won't have access to the records as the inheritance is set to false - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record4, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record5, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user2); - } - - public void testMoveRootCategoryIntoAnotherRootCategory() - { - final NodeRef category5 = filePlanService.createRecordCategory(filePlan, "category5"); - final NodeRef category6 = filePlanService.createRecordCategory(filePlan, "category6"); - - assertFalse(permissionService.getInheritParentPermissions(category5)); - assertFalse(permissionService.getInheritParentPermissions(category6)); - - final String user1 = createTestUser(); - final String user2 = createTestUser(); - - setPermission(category5, user1, RMPermissionModel.READ_RECORDS); - setPermission(category6, user2, RMPermissionModel.FILING); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user2); - - final NodeRef movedCategory5 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return fileFolderService.move(category5, category6, null).getNodeRef(); - } - }); - - assertFalse(permissionService.getInheritParentPermissions(movedCategory5)); - assertFalse(permissionService.getInheritParentPermissions(category6)); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedCategory5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user2); - } - - public void testPermissionsForMovedRecord() - { - final NodeRef category7 = filePlanService.createRecordCategory(filePlan, "category7"); - final NodeRef folder7 = recordFolderService.createRecordFolder(category7, "rmFolder7"); - final NodeRef record7 = utils.createRecord(folder7, "record7.txt"); - - final NodeRef category8 = filePlanService.createRecordCategory(filePlan, "category8"); - final NodeRef folder8 = recordFolderService.createRecordFolder(category8, "rmFolder8"); - final NodeRef record8 = utils.createRecord(folder8, "record8.txt"); - - final String user1 = createTestUser(); - final String user2 = createTestUser(); - final String user3 = createTestUser(); - - setPermission(folder7, user1, RMPermissionModel.FILING); - setPermission(record8, user2, RMPermissionModel.READ_RECORDS); - setPermission(category7, user3, RMPermissionModel.FILING); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); - - return null; - } - }, user2); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); - - return null; - } - }, user3); - - final NodeRef movedRecord8 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return fileFolderService.move(record8, folder7, null).getNodeRef(); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); - - return null; - } - }, user2); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); - - return null; - } - }, user3); - } - - public void testSpecialRoles() - { - final NodeRef category9 = filePlanService.createRecordCategory(filePlan, "category9"); - final NodeRef subCategory9 = filePlanService.createRecordCategory(category9, "subCategory9"); - final NodeRef folder9 = recordFolderService.createRecordFolder(subCategory9, "rmFolder9"); - final NodeRef record9 = utils.createRecord(folder9, "record9.txt"); - - assertExistenceOfSpecialRolesAndPermissions(category9); - - assertExistenceOfSpecialRolesAndPermissions(subCategory9); - // After setting the permissions off the special roles should be still available as they will be added to the node automatically - permissionService.setInheritParentPermissions(subCategory9, false); - assertExistenceOfSpecialRolesAndPermissions(subCategory9); - permissionService.setInheritParentPermissions(subCategory9, true); - assertExistenceOfSpecialRolesAndPermissions(subCategory9); - - assertExistenceOfSpecialRolesAndPermissions(folder9); - permissionService.setInheritParentPermissions(folder9, false); - assertExistenceOfSpecialRolesAndPermissions(folder9); - permissionService.setInheritParentPermissions(folder9, true); - assertExistenceOfSpecialRolesAndPermissions(folder9); - - assertExistenceOfSpecialRolesAndPermissions(record9); - permissionService.setInheritParentPermissions(record9, false); - assertExistenceOfSpecialRolesAndPermissions(record9); - permissionService.setInheritParentPermissions(record9, true); - assertExistenceOfSpecialRolesAndPermissions(record9); - } - - private void assertExistenceOfSpecialRolesAndPermissions(NodeRef node) - { - Map accessPermissions = new HashMap<>(); - Set permissions = permissionService.getAllSetPermissions(node); - // FIXME!!! - //assertEquals(3, permissions.size()); - - for (AccessPermission permission : permissions) - { - accessPermissions.put(permission.getAuthority(), permission.getPermission()); - } - - String adminRole = authorityService.getName(AuthorityType.GROUP, FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); - assertTrue(accessPermissions.containsKey(adminRole)); - assertEquals(RMPermissionModel.FILING, accessPermissions.get(adminRole)); - } - - public void testMoveSubCategoryIntoFilePlan() - { - final NodeRef rootCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - final NodeRef subCategory = filePlanService.createRecordCategory(rootCategory, GUID.generate()); - - assertFalse(permissionService.getInheritParentPermissions(rootCategory)); - assertTrue(permissionService.getInheritParentPermissions(subCategory)); - - final NodeRef movedSubCategory = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return fileFolderService.move(subCategory, filePlan, null).getNodeRef(); - } - }); - - assertFalse(permissionService.getInheritParentPermissions(rootCategory)); - assertFalse(permissionService.getInheritParentPermissions(movedSubCategory)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java deleted file mode 100644 index 145902e262..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * File plan role service unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanRoleServiceImplTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - public void testGetAllRolesContainerGroup() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - String allRolesGroup = filePlanRoleService.getAllRolesContainerGroup(filePlan); - assertNotNull(allRolesGroup); - - return null; - } - }); - } - - public void testGetRoles() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Set roles = filePlanRoleService.getRoles(filePlan); - assertNotNull(roles); - assertTrue(roles.size() != 0); - - Set rolesIncludingSystemRoles = filePlanRoleService.getRoles(filePlan, true); - assertNotNull(rolesIncludingSystemRoles); - assertTrue(roles.size() != 0); - assertTrue(roles.size() == rolesIncludingSystemRoles.size()); - - Set rolesWithoutSystemRoles = filePlanRoleService.getRoles(filePlan, false); - assertNotNull(rolesWithoutSystemRoles); - assertTrue(rolesWithoutSystemRoles.size() != 0); - assertTrue(rolesIncludingSystemRoles.size() > rolesWithoutSystemRoles.size()); - assertTrue(rolesIncludingSystemRoles.size() == rolesWithoutSystemRoles.size() + FilePlanRoleService.SYSTEM_ROLES.size()); - - return null; - } - }); - } - - public void testRolesByUser() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Set roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); - assertNotNull(roles); - assertEquals(1, roles.size()); - - Set rolesIncludingSystemRoles = filePlanRoleService.getRolesByUser(filePlan, rmUserName, true); - assertNotNull(rolesIncludingSystemRoles); - assertEquals(1, rolesIncludingSystemRoles.size()); - assertEquals(roles.size(), rolesIncludingSystemRoles.size()); - - return null; - } - }); - } - - public void testGetRole() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Role role = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_POWER_USER); - assertNotNull(role); - assertEquals(FilePlanRoleService.ROLE_POWER_USER, role.getName()); - - role = filePlanRoleService.getRole(filePlan, "donkey"); - assertNull(role); - - return null; - } - }); - } - - public void testExistsRole() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - assertTrue(filePlanRoleService.existsRole(filePlan, FilePlanRoleService.ROLE_POWER_USER)); - assertFalse(filePlanRoleService.existsRole(filePlan, "donkey")); - - return null; - } - }); - } - - public void testCreateUpdateDeleteRole() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - assertFalse(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - Set caps = new HashSet<>(2); - caps.add(capabilityService.getCapability(RMPermissionModel.ACCESS_AUDIT)); - caps.add(capabilityService.getCapability(RMPermissionModel.ADD_MODIFY_EVENT_DATES)); - - Role role = filePlanRoleService.createRole(filePlan, "Michelle Holt", "Michelle Holt", caps); - assertNotNull(role); - assertEquals("Michelle Holt", role.getName()); - assertEquals(2, role.getCapabilities().size()); - - assertTrue(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - caps.add(capabilityService.getCapability(RMPermissionModel.AUTHORIZE_ALL_TRANSFERS)); - - role = filePlanRoleService.updateRole(filePlan, "Michelle Holt", "Michelle Wetherall", caps); - assertNotNull(role); - assertEquals("Michelle Holt", role.getName()); - assertEquals(3, role.getCapabilities().size()); - - assertTrue(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - filePlanRoleService.deleteRole(filePlan, "Michelle Holt"); - - assertFalse(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - return null; - } - }); - } - - /** - * {@link FilePlanRoleService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, String, String)} - * {@link FilePlanRoleService#getAuthorities(org.alfresco.service.cmr.repository.NodeRef, String) - */ - public void testAuthorityAssignment() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Set roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); - assertNotNull(roles); - assertEquals(1, roles.size()); - - Set authorities = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(1, authorities.size()); - - authorities = filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(0, authorities.size()); - - authorities = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(1, authorities.size()); - - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, rmUserName); - - roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); - assertNotNull(roles); - assertEquals(2, roles.size()); - - authorities = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(2, authorities.size()); - - authorities = filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(0, authorities.size()); - - authorities = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(2, authorities.size()); - - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java deleted file mode 100644 index 4f189427f8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java +++ /dev/null @@ -1,546 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.List; - -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.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * File plan service unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanServiceImplTest extends BaseRMTestCase -{ - /** - * Pull in collaboration test data - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * {@link FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef)} - */ - public void testIsFilePlan() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertTrue(filePlanService.isFilePlan(filePlan)); - assertFalse(filePlanService.isFilePlan(rmContainer)); - assertFalse(filePlanService.isFilePlan(dmDocument)); - } - }); - } - - /** - * {@link FilePlanService#getFilePlan(org.alfresco.service.cmr.repository.NodeRef)} - */ - public void testGetFilePlans() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertEquals(filePlan, filePlanService.getFilePlan(filePlan)); - assertEquals(filePlan, filePlanService.getFilePlan(rmContainer)); - assertEquals(filePlan, filePlanService.getFilePlan(rmFolder)); - assertNull(filePlanService.getFilePlan(dmDocument)); - } - }); - } - - /** - * {@link FilePlanService#getFilePlanBySiteId(String)} - */ - public void testGetFilePlanBySiteId() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertEquals(filePlan, filePlanService.getFilePlanBySiteId(siteId)); - assertNull(filePlanService.getFilePlanBySiteId("rubbish")); - - String siteId = GUID.generate(); - siteService.createSite("anything", siteId, "title", "descrition", SiteVisibility.PUBLIC); - assertNull(filePlanService.getFilePlanBySiteId(siteId)); - } - }); - - } - - /** - * @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testIsFilePlanComponent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan)); - assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer)); - assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#getFilePlanComponentKind(NodeRef) - */ - public void testGetFilePlanComponentKind() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return utils.createRecord(rmFolder, "testRecord.txt"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer)); - assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder)); - assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result)); - // TODO HOLD and TRANSFER - assertNull(filePlanService.getFilePlanComponentKind(folder)); - } - }); - } - - /** - * @see FilePlanService#isRecordCategory(NodeRef) - */ - public void testIsRecordCategory() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan)); - assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer)); - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String) - * @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName) - */ - public void testCreateFilePlan() throws Exception - { - // Create default type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Create specific type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Failure: creating root in existing hierarchy - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(rmContainer, GUID.generate()); - } - }); - - // Failure: type no extended from root container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /** - * A basic test of a records management container - * - * @param nodeRef node reference - * @param name name of the container - * @param type the type of container - */ - private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type) - { - // Check the basic details - assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME)); - assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER)); - assertEquals(type, nodeService.getType(nodeRef)); - } - - /** - * @see FilePlanService#createRecordCategory(NodeRef, String) - * @see FilePlanService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName) - */ - public void testCreateRecordCategory() throws Exception - { - // Create container (in root) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(filePlan, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // Create container (in container) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(rmContainer, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // TODO need a custom type of container! - // Create container of a given type -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() -// { -// String id = setString("id", GUID.generate()); -// return rmService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES); -// } -// -// @Override -// public void test(NodeRef result) -// { -// assertNotNull("Unable to create records management container", result); -// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES); -// } -// }); - - // Fail Test: parent is not a container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(folder, GUID.generate()); - } - }); - - // Fail Test: type is not a sub-type of rm:recordsManagementContainer - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /** - * @see FilePlanService#getAllContained(NodeRef) - * @see FilePlanService#getAllContained(NodeRef, boolean) - */ - public void testGetAllContained() throws Exception - { - // Get all contained test - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getAllContained(rmContainer); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, false); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, true); - assertNotNull(nodes); - assertEquals(4, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getAllContained(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordCategories(NodeRef) - * @see FilePlanService#getContainedRecordCategories(NodeRef, boolean) - */ - public void testGetContainedRecordCategories() throws Exception - { - // Test getting all contained containers - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordCategories(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordCategories(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordFolders(NodeRef) - * @see FilePlanService#getContainedRecordFolders(NodeRef, boolean) - */ - public void testGetContainedRecordFolders() throws Exception - { - // Test getting all contained record folders - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordFolders(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordFolders(rmFolder); - } - }); - } - - /** - * Test to create a simple multi-hierarchy record taxonomy - */ - public void testCreateSimpleHierarchy() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Create 3 level hierarchy - NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1")); - assertNotNull("Unable to create container", levelOne); - NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2")); - assertNotNull("Unable to create container", levelTwo); - NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3")); - assertNotNull("Unable to create container", levelThree); - NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", recordFolderService.createRecordFolder(levelThree, "recordFolder3")); - assertNotNull("Unable to create record folder", levelThreeRecordFolder); - - return null; - } - - @Override - public void test(Void result) - { - // Test that the hierarchy has been created correctly - basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER); - - // TODO need to check that the parents and children can be retrieved correctly - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java deleted file mode 100644 index 870cce7038..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.ArrayList; -import java.util.Arrays; -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.NodeRef; - -/** - * Freeze service implementation test. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class FreezeServiceImplTest extends BaseRMTestCase -{ - private List holdAssocs; - - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Test freeze service methods. - * - * @deprecated as of 2.2 - */ - public void testFreezeService() throws Exception - { - - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertTrue(recordService.isRecord(recordOne)); - assertTrue(recordService.isRecord(recordTwo)); - assertTrue(recordService.isRecord(recordThree)); - assertTrue(recordService.isRecord(recordFour)); - assertTrue(filePlanService.isFilePlanComponent(recordOne)); - assertTrue(filePlanService.isFilePlanComponent(recordTwo)); - assertTrue(filePlanService.isFilePlanComponent(recordThree)); - assertTrue(filePlanService.isFilePlanComponent(recordFour)); - - // Freeze a record - NodeRef hold101 = holdService.createHold(filePlan, "freezename 101", "FreezeReason", null); - - assertNotNull(hold101); - holdService.addToHold(hold101, recordOne); - - //assertTrue(freezeService.hasFrozenChildren(rmFolder)); - - // Check the hold exists - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(1, holdAssocs.size()); - - NodeRef holdNodeRef = holdAssocs.iterator().next(); - - - assertEquals(holdNodeRef, hold101); - assertTrue(holdService.isHold(holdNodeRef)); - assertEquals("FreezeReason", holdService.getHoldReason(holdNodeRef)); - List frozenNodes = holdService.getHeld(holdNodeRef); - - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - - // Check the nodes are frozen - assertTrue(freezeService.isFrozen(recordOne)); - assertNotNull(freezeService.getFreezeDate(recordOne)); - assertNotNull(freezeService.getFreezeInitiator(recordOne)); - assertFalse(freezeService.isFrozen(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - - // Update the freeze reason - holdService.setHoldReason(holdNodeRef, "NewFreezeReason"); - - // Check the hold has been updated - assertEquals("NewFreezeReason", holdService.getHoldReason(holdNodeRef)); - - // Freeze a number of records - List records = new ArrayList<>(); - records.add(recordOne); - records.add(recordTwo); - records.add(recordThree); - NodeRef newHold = holdService.createHold(filePlan, "Hold 102", "Freeze a set of nodes", null); - - holdService.addToHold(newHold, records); - assertNotNull(newHold); - assertTrue(holdService.isHold(newHold)); - - // Check the holds exist - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(2, holdAssocs.size()); - - for (NodeRef hold : holdAssocs) - { - String reason = holdService.getHoldReason(hold); - if (reason.equals("Freeze a set of nodes")) - { - assertEquals(newHold, hold); - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(3, frozenNodes.size()); - } - else if (reason.equals("NewFreezeReason")) - { - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - } - else - { - throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds."); - } - } - - // Check the nodes are frozen - final List testRecords = Arrays.asList(new NodeRef[]{recordOne, recordTwo, recordThree}); - for (NodeRef nr : testRecords) - { - assertTrue(freezeService.isFrozen(nr)); - assertNotNull(freezeService.getFreezeDate(nr)); - assertNotNull(freezeService.getFreezeInitiator(nr)); - } - - // Unfreeze a node - holdService.removeFromAllHolds(recordThree); - // Check the holds - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(2, holdAssocs.size()); - for (NodeRef hold : holdAssocs) - { - String reason = holdService.getHoldReason(hold); - if (reason.equals("Freeze a set of nodes")) - { - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(2, frozenNodes.size()); - } - else if (reason.equals("NewFreezeReason")) - { - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - } - else - { - throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds."); - } - } - - // Check the nodes are frozen - assertTrue(freezeService.isFrozen(recordOne)); - assertNotNull(freezeService.getFreezeDate(recordOne)); - assertNotNull(freezeService.getFreezeInitiator(recordOne)); - assertTrue(freezeService.isFrozen(recordTwo)); - assertNotNull(freezeService.getFreezeDate(recordTwo)); - assertNotNull(freezeService.getFreezeInitiator(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - assertFalse(freezeService.isFrozen(recordFour)); - return null; - } - }); - //Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Relinquish the first hold - NodeRef holdNodeRef = holdAssocs.iterator().next(); - holdService.deleteHold(holdNodeRef); - - // Check the existing hold - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(1, holdAssocs.size()); - - // Relinquish the second hold - holdNodeRef = holdAssocs.iterator().next(); - holdService.removeFromAllHolds(holdService.getHeld(holdNodeRef)); - - // hold is not automatically removed - holdAssocs = holdService.getHolds(filePlan); - assertEquals(1, holdAssocs.size()); - - // delete hold - holdService.deleteHold(holdNodeRef); - - holdAssocs = holdService.getHolds(filePlan); - assertEquals(0, holdAssocs.size()); - - // Check the nodes are unfrozen - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - assertFalse(freezeService.isFrozen(recordFour)); - //assertFalse(freezeService.hasFrozenChildren(rmFolder)); - - // Test freezing nodes, adding them to an existing hold - NodeRef hold = holdService.createHold(filePlan, "hold 1", "AnotherFreezeReason", "description"); - holdService.addToHold(hold, recordFour); - holdService.addToHold(hold, recordOne); - List nodes = new ArrayList<>(); - nodes.add(recordTwo); - nodes.add(recordThree); - holdService.addToHold(hold, nodes); - //assertTrue(freezeService.hasFrozenChildren(rmFolder)); - // Check the hold - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(1, holdAssocs.size()); - return null; - } - }); - //Splitting transaction to fix onCreateNodePolicy issue where there was a node not found exception - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Relinquish the first hold - holdService.deleteHold(holdAssocs.iterator().next()); - - // Check the nodes are unfrozen - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - assertFalse(freezeService.isFrozen(recordFour)); - // assertFalse(freezeService.hasFrozenChildren(rmFolder)); - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java deleted file mode 100644 index d7dc920951..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedAspect; -import org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedProperty; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.namespace.QName; - -/** - * Model security service test. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ModelSecurityServiceImplTest extends BaseRMTestCase -{ - private static final QName CUSTOM_ASPECT = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customAspect"); - private static final QName CUSTOM_PROTECTED_ASPECT = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProtectedAspect"); - - private static final QName CUSTOM_PROPERTY = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProperty"); - private static final QName CUSTOM_PROTECTED_PROPERTY = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProtectedProperty"); - - - /** Model security service */ - private ModelSecurityService modelSecurityService; - - private boolean enabled; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isFillingForAllUsers() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService"); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestDataImpl() - */ - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - enabled = modelSecurityService.isEnabled(); - modelSecurityService.setEnabled(true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - modelSecurityService.setEnabled(enabled); - } - - /** - * test - getProtectedAspects(), isProtectedAspect(), getProtectedAspect() - */ - public void testProtectedAspects() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - Set protectedAspects = modelSecurityService.getProtectedAspects(); - - assertNotNull(protectedAspects); - assertFalse(protectedAspects.isEmpty()); - assertTrue(protectedAspects.contains(CUSTOM_PROTECTED_ASPECT)); - assertFalse(protectedAspects.contains(CUSTOM_ASPECT)); - - assertTrue(modelSecurityService.isProtectedAspect(CUSTOM_PROTECTED_ASPECT)); - assertFalse(modelSecurityService.isProtectedAspect(CUSTOM_ASPECT)); - - ProtectedAspect protectedAspect = modelSecurityService.getProtectedAspect(CUSTOM_ASPECT); - assertNull(protectedAspect); - protectedAspect = modelSecurityService.getProtectedAspect(CUSTOM_PROTECTED_ASPECT); - assertNotNull(protectedAspect); - assertNotNull(protectedAspect.getQName()); - assertNotNull(protectedAspect.getCapabilities()); - } - }); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.isProtectedAspect(CUSTOM_PROTECTED_ASPECT)); - assertFalse(modelSecurityService.canEditProtectedAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - } - }, powerUserName); - - doTestInTransaction(new FailureTest - ( - "Normal rm user should not have the permissions to add the protected aspect.", - ModelAccessDeniedException.class - ) - { - @Override - public void run() throws Exception - { - // try and add the aspect - nodeService.addAspect(rmFolder, CUSTOM_PROTECTED_ASPECT, null); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.canEditProtectedAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - - // try and add the aspect - nodeService.addAspect(rmFolder, CUSTOM_PROTECTED_ASPECT, null); - assertTrue(nodeService.hasAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - } - }, ADMIN_USER); - - // check protected aspect via removeAspect - doTestInTransaction(new FailureTest - ( - "Normal rm user should not have the permissions to remove the custom aspect.", - ModelAccessDeniedException.class - ) - { - @Override - public void run() throws Exception - { - nodeService.removeAspect(rmFolder, CUSTOM_PROTECTED_ASPECT); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - nodeService.removeAspect(rmFolder, CUSTOM_PROTECTED_ASPECT); - assertFalse(nodeService.hasAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - } - }, ADMIN_USER); - } - - /** - * test - getProtectedProperties(), isProtectedProperty(), getProtectedProperty() - */ - public void testProtectedProperties() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() - { - Set protectedProperties = modelSecurityService.getProtectedProperties(); - - assertNotNull(protectedProperties); - assertFalse(protectedProperties.isEmpty()); - assertTrue(protectedProperties.contains(CUSTOM_PROTECTED_PROPERTY)); - assertFalse(protectedProperties.contains(CUSTOM_PROPERTY)); - - assertTrue(modelSecurityService.isProtectedProperty(CUSTOM_PROTECTED_PROPERTY)); - assertFalse(modelSecurityService.isProtectedProperty(CUSTOM_PROPERTY)); - - ProtectedProperty protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROPERTY); - assertNull(protectedProperty); - protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROTECTED_PROPERTY); - assertNotNull(protectedProperty); - assertNotNull(protectedProperty.getQName()); - assertNotNull(protectedProperty.getCapabilities()); - } - }); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, ADMIN_USER); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.isProtectedProperty(CUSTOM_PROTECTED_PROPERTY)); - assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, powerUserName); - - doTestInTransaction(new FailureTest - ( - "Should not have the permissions to edit protected property.", - ModelAccessDeniedException.class - ) - { - @Override - public void run() throws Exception - { - nodeService.setProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY, "hello"); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - - nodeService.setProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY, "hello"); - assertEquals("hello", nodeService.getProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, ADMIN_USER); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java deleted file mode 100644 index 94a3f75ec7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java +++ /dev/null @@ -1,901 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -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.RecordsManagementPolicies.BeforeRecordDeclaration; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRecordRejection; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRecordDeclaration; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRecordRejection; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -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.content.MimetypeMap; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.BehaviourDefinition; -import org.alfresco.repo.policy.ClassBehaviourBinding; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Records Service Implementation Test - * - * @author Roy Wetherall - * @author Tuna Aksoy - * @since 2.1 - */ -public class RecordServiceImplTest extends BaseRMTestCase implements BeforeRecordDeclaration, - OnRecordDeclaration, - BeforeRecordRejection, - OnRecordRejection -{ - /** - * This is a user test - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * This is a record test - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() - */ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * This is a collaboration site test - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see RecordService#getRecordMetaDataAspects() - */ - public void testGetRecordMetaDataAspects() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Set aspects = recordService.getRecordMetadataAspects(filePlan); - assertNotNull(aspects); - assertEquals(2, aspects.size()); - assertTrue(aspects.containsAll(getAspectList())); - - return null; - } - - /** - * Helper method for getting a list of record meta data aspects - * - * @return Record meta data aspects as list - */ - private List getAspectList() - { - QName[] aspects = new QName[] - { - ASPECT_RECORD_META_DATA - }; - - return Arrays.asList(aspects); - } - }); - } - - /** - * @see RecordService#isRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testIsRecord() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() - { - assertFalse(recordService.isRecord(filePlan)); - assertFalse(recordService.isRecord(rmContainer)); - assertFalse(recordService.isRecord(rmFolder)); - assertTrue(recordService.isRecord(recordOne)); - assertTrue(recordService.isRecord(recordDeclaredOne)); - } - }); - } - - /** - * @see RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testIsDeclared() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() - { - assertFalse(recordService.isRecord(filePlan)); - assertFalse(recordService.isRecord(rmContainer)); - assertFalse(recordService.isRecord(rmFolder)); - assertTrue(recordService.isRecord(recordOne)); - assertTrue(recordService.isRecord(recordDeclaredOne)); - } - }); - } - - public void testUnfiled() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() - { - assertFalse(recordService.isFiled(filePlan)); - assertFalse(recordService.isFiled(rmContainer)); - assertFalse(recordService.isFiled(rmFolder)); - assertTrue(recordService.isFiled(recordOne)); - assertTrue(recordService.isFiled(recordDeclaredOne)); - } - }); - } - - public void testExtendedWriters() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertTrue(extendedSecurityService.getReaders(recordOne).isEmpty()); - assertTrue(extendedSecurityService.getWriters(recordOne).isEmpty()); - - return null; - } - }, dmCollaborator); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - return null; - } - }, dmCollaborator); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Set writers = new HashSet<>(1); - writers.add(dmCollaborator); - extendedSecurityService.set(recordOne, null, writers); - - assertTrue(extendedSecurityService.getReaders(recordOne).isEmpty()); - assertFalse(extendedSecurityService.getWriters(recordOne).isEmpty()); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); - - // ALLOWED, becuase users have been added to the in-place roles - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - return null; - } - }, dmCollaborator); - - } - - /** - * @see RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.cmr.repository.NodeRef) - */ - public void testCreateRecord() throws Exception - { - // show that users without WRITE can not create a record from a document - doTestInTransaction(new FailureTest( - "Can not create a record from a document if you do not have WRITE permissions.", - AccessDeniedException.class) - { - public void run() throws Exception - { - recordService.createRecord(filePlan, dmDocument); - } - }, dmConsumer); - - // create record from document - doTestInTransaction(new Test() - { - private NodeRef originalLocation; - - @Override - public Void run() - { - originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef(); - - assertFalse(recordService.isRecord(dmDocument)); - assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - recordService.createRecord(filePlan, dmDocument); - - return null; - } - - public void test(Void result) - { - checkPermissions(READ_RECORDS, - AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.ALLOWED); // doc/record - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, - AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.ALLOWED); // doc/record - - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(extendedSecurityService.hasExtendedSecurity(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // show that the record has meta-data about it's original - // location - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS)); - assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); - assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef()); - - // show that the record is linked to it's original location - assertEquals(2, nodeService.getParentAssocs(dmDocument).size()); - - // **** - // Capability Tests - // **** - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - Capability filling = capabilityService.getCapability("FileRecords"); - assertEquals(AccessStatus.DENIED, filling.hasPermission(dmDocument)); - - Capability editRecordMetadata = capabilityService.getCapability("EditNonRecordMetadata"); - assertEquals(AccessStatus.ALLOWED, editRecordMetadata.hasPermission(dmDocument)); - - Capability updateProperties = capabilityService.getCapability("UpdateProperties"); - assertEquals(AccessStatus.ALLOWED, updateProperties.hasPermission(dmDocument)); - } - }, dmCollaborator); - - // check the consumer's permissions are correct for the newly created - // document - doTestInTransaction(new Test() - { - @Override - public Void run() - { - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.ALLOWED); // doc/record - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - Capability filling = capabilityService.getCapability("FileRecords"); - assertEquals(AccessStatus.DENIED, filling.hasPermission(dmDocument)); - - Capability editRecordMetadata = capabilityService.getCapability("EditNonRecordMetadata"); - assertEquals(AccessStatus.DENIED, editRecordMetadata.hasPermission(dmDocument)); - - Capability updateProperties = capabilityService.getCapability("UpdateProperties"); - assertEquals(AccessStatus.DENIED, updateProperties.hasPermission(dmDocument)); - - return null; - } - }, dmConsumer); - } - - public void testCreateRecordNoLink() throws Exception - { - // show that users without WRITE can not create a record from a document - doTestInTransaction(new FailureTest( - "Can not create a record from a document if you do not have WRITE permissions.", - AccessDeniedException.class) - { - public void run() throws Exception - { - recordService.createRecord(filePlan, dmDocument, false); - } - }, dmConsumer); - - // create record from document - final NodeRef originalLocation = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef(); - - //assertFalse(recordService.isRecord(dmDocument)); - //assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - recordService.createRecord(filePlan, dmDocument, false); - - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - return originalLocation; - } - }, dmCollaborator); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // show that the record has meta-data about it's original - // location - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS)); - assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); - assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef()); - - // show that the record is linked to it's original location - assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); - - return null; - } - }, ADMIN_USER); - } - - public void testFileNewContent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef record = fileFolderService.create(rmFolder, "test101.txt", TYPE_CONTENT).getNodeRef(); - - ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent("hello world this is some test content"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertTrue(recordService.isRecord(record)); - assertTrue(recordService.isFiled(record)); - - assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); - } - }); - } - - public void xtestFileUnfiledrecord() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - recordService.createRecord(filePlan, dmDocument); - - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED)); - - fileFolderService.move(dmDocument, rmFolder, "record.txt"); - - return dmDocument; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertTrue(recordService.isRecord(record)); - assertTrue(recordService.isFiled(record)); - - assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); - } - }); - } - - public void testFileDirectlyFromCollab() throws Exception - { - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED)); - - fileFolderService.move(dmDocument, rmFolder, "record.txt"); - - return dmDocument; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertTrue(recordService.isRecord(record)); - assertTrue(recordService.isFiled(record)); - - assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); - } - }, AuthenticationUtil.getSystemUserName()); - } - - private void checkPermissions(String permission, AccessStatus filePlanExpected, AccessStatus unfiledExpected, - AccessStatus recordCatExpected, AccessStatus recordFolderExpected, AccessStatus recordExpected) - { - assertEquals(filePlanExpected, permissionService.hasPermission(filePlan, permission)); - assertEquals(unfiledExpected, permissionService.hasPermission(unfiledContainer, permission)); - assertEquals(recordCatExpected, permissionService.hasPermission(rmContainer, permission)); - assertEquals(recordFolderExpected, permissionService.hasPermission(rmFolder, permission)); - assertEquals(recordExpected, permissionService.hasPermission(dmDocument, permission)); - } - - private String createUserWithCapabilties(final String... capabiltyNames) - { - return doTestInTransaction(new Test() - { - @Override - public String run() throws Exception - { - Role role = utils.createRole(filePlan, GUID.generate(), capabiltyNames); - - String userName = GUID.generate(); - createPerson(userName); - filePlanRoleService.assignRoleToAuthority(filePlan, role.getName(), userName); - - return userName; - } - }, AuthenticationUtil.getSystemUserName()); - - } - - /** - * Test {@link RecordService#isPropertyEditable(NodeRef, QName)} - */ - public void testIsPropertyEditable() throws Exception - { - final String nonRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_NON_RECORD_METADATA); - final String recordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_RECORD_METADATA); - final String declaredRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, rmUserName, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, nonRecordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, recordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING); - } - }); - - // test rmadmin - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertTrue(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }); - - // test normal user - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - - assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, rmUserName); - - // test undeclared record with edit non-record metadata capability - // test declared record with edit non-record metadata capability - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, nonRecordMetadata); - - // test undeclared record with edit record metadata capability - // test declared record with edit record metadata capability - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, recordMetadata); - - // test undeclared record with edit declared record metadata capability - // test declared record with edit declared record metadata capability - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertTrue(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, declaredRecordMetadata); - } - - public void testRecordPropertiesUpdate() throws Exception - { - final String nonRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_NON_RECORD_METADATA); - final String recordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_RECORD_METADATA); - final String declaredRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, rmUserName, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, nonRecordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, recordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING); - } - }); - - // test rmadmin - canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, ADMIN_USER); - canEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, ADMIN_USER); - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, ADMIN_USER); - canEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, ADMIN_USER); - - // test normal user - cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, rmUserName); - cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, rmUserName); - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, rmUserName); - cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, rmUserName); - - // test undeclared record with edit non-record metadata capability - canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata); - cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, nonRecordMetadata); - // test declared record with edit non-record metadata capability - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata); - cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, nonRecordMetadata); - - // test undeclared record with edit record metadata capability - cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, recordMetadata); - canEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, recordMetadata); - // test declared record with edit record metadata capability - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, recordMetadata); - cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, recordMetadata); - - // test undeclared record with edit declared record metadata capability - cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata); - cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, declaredRecordMetadata); - // test declared record with edit declared record metadata capability - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata); - canEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, declaredRecordMetadata); - - } - - private void cantEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception - { - boolean failure = false; - try - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - nodeService.setProperty(nodeRef, property, GUID.generate()); - } - - }, user); - } - catch (Throwable exception) - { - // expected - failure = true; - } - - // assert fail not failure - if (!failure) - { - fail("Property should not have been editable."); - } - } - - private void canEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - nodeService.setProperty(nodeRef, property, GUID.generate()); - } - }, user); - } - - /** - * RM-4611 - integration test for policies for record declaration - * @see RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.cmr.repository.NodeRef) - */ - private boolean beforeRecordDeclaration = false; - private boolean onRecordDeclaration = false; - - public void testPolicyNotificationForRecordDeclaration() throws Exception - { - doTestInTransaction(new Test() - { - - @Override - public Void run() - { - assertFalse(recordService.isRecord(dmDocument)); - - BehaviourDefinition beforeRecordDeclarationBehaviour = policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_RECORD_DECLARATION, ContentModel.TYPE_CONTENT, - new JavaBehaviour(RecordServiceImplTest.this, "beforeRecordDeclaration", NotificationFrequency.EVERY_EVENT)); - BehaviourDefinition onRecordDeclarationBehaviour = policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_RECORD_DECLARATION, ASPECT_RECORD, - new JavaBehaviour(RecordServiceImplTest.this, "onRecordDeclaration", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeRecordDeclaration); - assertFalse(onRecordDeclaration); - - recordService.createRecord(filePlan, dmDocument); - - assertTrue(beforeRecordDeclaration); - assertTrue(onRecordDeclaration); - - assertTrue(recordService.isRecord(dmDocument)); - - policyComponent.removeClassDefinition(beforeRecordDeclarationBehaviour); - policyComponent.removeClassDefinition(onRecordDeclarationBehaviour); - - return null; - } - }, dmCollaborator); - } - - @Override - public void beforeRecordDeclaration(NodeRef nodeRef) - { - assertEquals(nodeRef, dmDocument); - beforeRecordDeclaration = true; - } - - @Override - public void onRecordDeclaration(NodeRef nodeRef) - { - assertEquals(nodeRef, dmDocument); - onRecordDeclaration = true; - } - - /** - * RM-5180 - integration test for policies for record rejection - * @see RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - private boolean beforeRecordRejection = false; - private boolean onRecordRejection = false; - - @Override - public void beforeRecordRejection(NodeRef nodeRef) - { - assertEquals(nodeRef, dmDocument); - beforeRecordRejection = true; - } - - @Override - public void onRecordRejection(NodeRef nodeRef) - { - assertEquals(nodeRef, dmDocument); - onRecordRejection = true; - } - - public void testPolicyNotificationForRecordRejection() throws Exception - { - doTestInTransaction(new Test() - { - - @Override - public Void run() - { - assertFalse(recordService.isRecord(dmDocument)); - - BehaviourDefinition beforeRecordRejectionBehaviour = policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_RECORD_REJECTION, ContentModel.TYPE_CONTENT, - new JavaBehaviour(RecordServiceImplTest.this, "beforeRecordRejection", NotificationFrequency.EVERY_EVENT)); - BehaviourDefinition onRecordRejectionBehaviour = policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_RECORD_REJECTION, ContentModel.TYPE_CONTENT, - new JavaBehaviour(RecordServiceImplTest.this, "onRecordRejection", NotificationFrequency.EVERY_EVENT)); - - recordService.createRecord(filePlan, dmDocument); - - assertFalse(beforeRecordRejection); - assertFalse(onRecordRejection); - assertTrue(recordService.isRecord(dmDocument)); - - recordService.rejectRecord(dmDocument, "test reasons"); - - assertTrue(beforeRecordRejection); - assertTrue(onRecordRejection); - assertFalse(recordService.isRecord(dmDocument)); - - policyComponent.removeClassDefinition(beforeRecordRejectionBehaviour); - policyComponent.removeClassDefinition(onRecordRejectionBehaviour); - - return null; - } - }, dmCollaborator); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java deleted file mode 100644 index 8410b78a1e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction2; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -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.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Records management action service implementation test - * - * @author Roy Wetherall - */ -public class RecordsManagementActionServiceImplTest extends BaseRMTestCase - implements BeforeRMActionExecution, - OnRMActionExecution -{ - private RetryingTransactionHelper txnHelper; - - private NodeRef nodeRef; - private List nodeRefs; - - private boolean beforeMarker; - private boolean onMarker; - private boolean inTest; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - this.txnHelper = transactionService.getRetryingTransactionHelper(); - - // Set the current security context as system - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - RetryingTransactionCallback setUpCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Create a node we can use for the tests - NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - nodeRef = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), - ContentModel.TYPE_CONTENT).getChildRef(); - - // Create nodeRef list - nodeRefs = new ArrayList<>(5); - for (int i = 0; i < 5; i++) - { - nodeRefs.add( - nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), - ContentModel.TYPE_CONTENT).getChildRef()); - } - return null; - } - }; - txnHelper.doInTransaction(setUpCallback); - - beforeMarker = false; - onMarker = false; - inTest = false; - } - - @Override - protected void tearDown() - { - AuthenticationUtil.clearCurrentSecurityContext(); - } - - public void testGetActions() - { - RetryingTransactionCallback testCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - getActionsImpl(); - return null; - } - }; - txnHelper.doInTransaction(testCallback); - } - - private void getActionsImpl() - { - List result = this.rmActionService.getRecordsManagementActions(); - assertNotNull(result); - Map resultMap = new HashMap<>(8); - for (RecordsManagementAction action : result) - { - resultMap.put(action.getName(), action); - } - - assertTrue(resultMap.containsKey(TestAction.NAME)); - assertTrue(resultMap.containsKey(TestAction2.NAME)); - - result = this.rmActionService.getDispositionActions(); - resultMap = new HashMap<>(8); - for (RecordsManagementAction action : result) - { - resultMap.put(action.getName(), action); - } - assertTrue(resultMap.containsKey(TestAction.NAME)); - assertFalse(resultMap.containsKey(TestAction2.NAME)); - - // get some specific actions and check the label - RecordsManagementAction cutoff = this.rmActionService.getDispositionAction("cutoff"); - assertNotNull(cutoff); - assertEquals("Cut Off", cutoff.getLabel()); - - RecordsManagementAction freeze = this.rmActionService.getRecordsManagementAction("freeze"); - assertNotNull(freeze); - assertEquals("Freeze", freeze.getLabel()); - assertEquals("Freeze", freeze.getLabel()); - - // test non-existent actions - assertNull(this.rmActionService.getDispositionAction("notThere")); - assertNull(this.rmActionService.getRecordsManagementAction("notThere")); - } - - public void testExecution() - { - RetryingTransactionCallback testCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - executionImpl(); - return null; - } - }; - txnHelper.doInTransaction(testCallback); - } - - public void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - if (inTest) - { - assertEquals(this.nodeRef, nodeRef); - assertEquals(TestAction.NAME, name); - assertEquals(1, parameters.size()); - assertTrue(parameters.containsKey(TestAction.PARAM)); - assertEquals(TestAction.PARAM_VALUE, parameters.get(TestAction.PARAM)); - beforeMarker = true; - } - } - - public void onRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - if (inTest) - { - assertEquals(this.nodeRef, nodeRef); - assertEquals(TestAction.NAME, name); - assertEquals(1, parameters.size()); - assertTrue(parameters.containsKey(TestAction.PARAM)); - assertEquals(TestAction.PARAM_VALUE, parameters.get(TestAction.PARAM)); - onMarker = true; - } - } - - private void executionImpl() - { - inTest = true; - try - { - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_RM_ACTION_EXECUTION, - this, - new JavaBehaviour(this, "beforeRMActionExecution", NotificationFrequency.EVERY_EVENT)); - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_RM_ACTION_EXECUTION, - this, - new JavaBehaviour(this, "onRMActionExecution", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeMarker); - assertFalse(onMarker); - assertFalse(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); - - Map params = new HashMap<>(1); - params.put(TestAction.PARAM, TestAction.PARAM_VALUE); - this.rmActionService.executeRecordsManagementAction(this.nodeRef, TestAction.NAME, params); - - assertTrue(beforeMarker); - assertTrue(onMarker); - assertTrue(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); - } - finally - { - inTest = false; - } - } - - public void testBulkExecution() - { - RetryingTransactionCallback testCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - bulkExecutionImpl(); - return null; - } - }; - txnHelper.doInTransaction(testCallback); - } - - private void bulkExecutionImpl() - { - for (NodeRef nodeRef : this.nodeRefs) - { - assertFalse(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); - } - - Map params = new HashMap<>(1); - params.put(TestAction.PARAM, TestAction.PARAM_VALUE); - this.rmActionService.executeRecordsManagementAction(this.nodeRefs, TestAction.NAME, params); - - for (NodeRef nodeRef : this.nodeRefs) - { - assertTrue(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java deleted file mode 100644 index 909270c6c1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java +++ /dev/null @@ -1,952 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.io.Serializable; -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.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.test.util.BaseRMTestCase; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -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.Constraint; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -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.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.Pair; -import org.springframework.util.CollectionUtils; - -/** - * This test class tests the definition and use of a custom RM elements at the Java services layer. - * - * @author Neil McErlean, janv, Roy Wetherall - */ -public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase - implements RecordsManagementModel, - BeforeCreateReference, - OnCreateReference -{ - - private final static long testRunID = System.currentTimeMillis(); - - private List createdCustomProperties; - private List madeCustomisable; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - createdCustomProperties = new ArrayList<>(); - madeCustomisable = new ArrayList<>(); - super.setUp(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData() - */ - @Override - protected void setupTestData() - { - super.setupTestData(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - for (QName createdCustomProperty : createdCustomProperties) - { - rmAdminService.removeCustomPropertyDefinition(createdCustomProperty); - } - - for (QName customisable : madeCustomisable) - { - rmAdminService.unmakeCustomisable(customisable); - } - - return null; - } - }); - - super.tearDown(); - } - - /** - * @see RecordsManagementAdminService#getCustomisable() - */ - public void testGetCustomisable() throws Exception - { - // Get the customisable types - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Set list = rmAdminService.getCustomisable(); - assertNotNull(list); - assertTrue(list.containsAll( - CollectionUtils.arrayToList(new QName[] - { - ASPECT_RECORD, - TYPE_RECORD_FOLDER, - TYPE_NON_ELECTRONIC_DOCUMENT, - TYPE_RECORD_CATEGORY - }))); - - return null; - } - }); - } - - /** - * @see RecordsManagementAdminService#isCustomisable(QName) - */ - public void testIsCustomisable() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertFalse(rmAdminService.isCustomisable(TYPE_CONTENT)); - assertFalse(rmAdminService.isCustomisable(ASPECT_DUBLINCORE)); - assertTrue(rmAdminService.isCustomisable(TYPE_RECORD_FOLDER)); - assertTrue(rmAdminService.isCustomisable(ASPECT_RECORD)); - - return null; - } - }); - } - - /** - * @see RecordsManagementAdminService#existsCustomProperty(QName) - * @see RecordsManagementAdminService#addCustomPropertyDefinition(QName, QName, String, QName, String, String, String, boolean, boolean, boolean, QName) - * @see RecordsManagementAdminService#addCustomPropertyDefinition(QName, QName, String, QName, String, String) - */ - public void testAddCustomPropertyDefinition() throws Exception - { - // Add property to Record (id specified, short version) - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - // Check the property does not exist - assertFalse(rmAdminService.existsCustomProperty(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"))); - - return rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), - ASPECT_RECORD, - "Label1", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - try - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), result); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); - assertNotNull(propDefs); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label1", propDef.getTitle(dictionaryService)); - } - finally - { - // Store the created property for cleanup later - createdCustomProperties.add(result); - } - } - }); - - // Add property to record (no id, short version) - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - return rmAdminService.addCustomPropertyDefinition( - null, - ASPECT_RECORD, - "Label2", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - try - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI()); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); - assertNotNull(propDefs); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label2", propDef.getTitle(dictionaryService)); - } - finally - { - // Store the created property for cleanup later - createdCustomProperties.add(result); - } - } - }); - - // Add property to record (long version) - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - return rmAdminService.addCustomPropertyDefinition( - null, - ASPECT_RECORD, - "Label3", - DataTypeDefinition.TEXT, - "Title", - "Description", - "default", - false, - false, - false, - null); - } - - @Override - public void test(QName result) throws Exception - { - try - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI()); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); - assertNotNull(propDefs); - //assertEquals(3, propDefs.size()); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label3", propDef.getTitle(dictionaryService)); - assertEquals("default", propDef.getDefaultValue()); - assertFalse(propDef.isMandatory()); - assertFalse(propDef.isMultiValued()); - assertFalse(propDef.isProtected()); - - } - finally - { - // Store the created property for cleanup later - createdCustomProperties.add(result); - } - } - }); - - // Failure: Add a property with the same name twice - doTestInTransaction(new FailureTest - ( - "Can not create a property with the same id twice", - CustomMetadataException.class - ) - { - @Override - public void run() throws Exception - { - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), - ASPECT_RECORD, - "Label1", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - }); - - // Failure: Try and add a property to a type that isn't customisable - doTestInTransaction(new FailureTest - ( - "Can not add a custom property to a type that isn't registered as customisable", - CustomMetadataException.class - ) - { - @Override - public void run() throws Exception - { - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myContentProp"), - TYPE_CONTENT, - "Label1", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - }); - } - - /** - * @see RecordsManagementAdminService#makeCustomisable(QName) - */ - public void testMakeCustomisable() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - // Make a type customisable - assertFalse(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE)); - rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE); - madeCustomisable.add(TYPE_CUSTOM_TYPE); - assertTrue(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE)); - - // Add a custom property - return rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), - TYPE_CUSTOM_TYPE, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), result); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(TYPE_CUSTOM_TYPE); - assertNotNull(propDefs); - assertEquals(1, propDefs.size()); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label", propDef.getTitle(dictionaryService)); - - } - }); - - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - // Make an aspect customisable - assertFalse(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT)); - rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT); - madeCustomisable.add(ASPECT_CUSTOM_ASPECT); - assertTrue(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT)); - - // Add a custom property - return rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), - ASPECT_CUSTOM_ASPECT, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), result); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_CUSTOM_ASPECT); - assertNotNull(propDefs); - assertEquals(1, propDefs.size()); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label", propDef.getTitle(dictionaryService)); - } - }); - } - - public void testUseCustomProperty() throws Exception - { - // Create custom property on type and aspect - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE); - madeCustomisable.add(TYPE_CUSTOM_TYPE); - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), - TYPE_CUSTOM_TYPE, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT); - madeCustomisable.add(ASPECT_CUSTOM_ASPECT); - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), - ASPECT_CUSTOM_ASPECT, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - - return null; - } - }); - - // Create nodes using custom type and aspect - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - NodeRef customInstance1 = nodeService.createNode( - folder, - ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myCustomInstance1"), - TYPE_CUSTOM_TYPE).getChildRef(); - NodeRef customInstance2 = nodeService.createNode( - folder, - ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myCustomInstance2"), - TYPE_CONTENT).getChildRef(); - nodeService.addAspect(customInstance2, ASPECT_CUSTOM_ASPECT, null); - - // Assert that both instances have the custom aspects applied - assertTrue(nodeService.hasAspect(customInstance1, QName.createQName(RM_CUSTOM_URI, "rmtcustomTypeCustomProperties"))); - assertTrue(nodeService.hasAspect(customInstance2, QName.createQName(RM_CUSTOM_URI, "rmtcustomAspectCustomProperties"))); - - // Remove the custom aspect - nodeService.removeAspect(customInstance2, ASPECT_CUSTOM_ASPECT); - - // Assert the custom property aspect is no longer applied applied - assertTrue(nodeService.hasAspect(customInstance1, QName.createQName(RM_CUSTOM_URI, "rmtcustomTypeCustomProperties"))); - assertFalse(nodeService.hasAspect(customInstance2, QName.createQName(RM_CUSTOM_URI, "rmtcustomAspectCustomProperties"))); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - - public void testCreateAndUseCustomChildReference() throws Exception - { - long now = System.currentTimeMillis(); - createAndUseCustomReference(RelationshipType.PARENTCHILD, null, "superseded" + now, "superseding" + now); - } - - public void testCreateAndUseCustomNonChildReference() throws Exception - { - long now = System.currentTimeMillis(); - createAndUseCustomReference(RelationshipType.BIDIRECTIONAL, "supporting" + now, null, null); - } - - private void createAndUseCustomReference(final RelationshipType refType, final String label, final String source, final String target) throws Exception - { - final NodeRef testRecord1 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - NodeRef result = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis()); - return result; - } - }); - final NodeRef testRecord2 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - NodeRef result = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis()); - return result; - } - }); - - final QName generatedQName = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public QName execute() throws Throwable - { - utils.completeRecord(testRecord1); - utils.completeRecord(testRecord2); - - Map params = new HashMap<>(); - params.put("referenceType", refType.toString()); - if (label != null) params.put("label", label); - if (source != null) params.put("source", source); - if (target != null) params.put("target", target); - - // Create the relationship display name - RelationshipDisplayName displayName; - if (label != null) - { - // A bidirectional reference - displayName = new RelationshipDisplayName(label, label); - } - else - { - // A parent/child reference - displayName = new RelationshipDisplayName(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 + "'"); - - return qNameResult; - } - }); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - 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())); - - // 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)) - { - nodeService.addChild(testRecord1, testRecord2, generatedQName, generatedQName); - } - else - { - nodeService.createAssociation(testRecord1, testRecord2, generatedQName); - } - return null; - } - }); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Read back the reference value to make sure it was correctly applied. - List childAssocs = nodeService.getChildAssocs(testRecord1); - List retrievedAssocs = nodeService.getTargetAssocs(testRecord1, RegexQNamePattern.MATCH_ALL); - - Object newlyAddedRef = null; - if (RelationshipType.PARENTCHILD.equals(refType)) - { - for (ChildAssociationRef caRef : childAssocs) - { - QName refInstanceQName = caRef.getQName(); - if (generatedQName.equals(refInstanceQName)) newlyAddedRef = caRef; - } - } - else - { - for (AssociationRef aRef : retrievedAssocs) - { - QName refQName = aRef.getTypeQName(); - if (generatedQName.equals(refQName)) newlyAddedRef = aRef; - } - } - assertNotNull("newlyAddedRef was null.", newlyAddedRef); - - // Check that the reference has appeared in the data dictionary - AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); - assertNotNull(customAssocsAspect); - if (RelationshipType.PARENTCHILD.equals(refType)) - { - assertNotNull("The customReference is not returned from the dictionaryService.", - customAssocsAspect.getChildAssociations().get(generatedQName)); - } - else - { - assertNotNull("The customReference is not returned from the dictionaryService.", - customAssocsAspect.getAssociations().get(generatedQName)); - } - return null; - } - }); - } - - public void testGetAllProperties() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Just dump them out for visual inspection - System.out.println("Available custom properties:"); - Map props = rmAdminService.getCustomPropertyDefinitions(); - for (QName prop : props.keySet()) - { - System.out.println(" - " + prop.toString()); - - String propId = props.get(prop).getTitle(dictionaryService); - assertNotNull("null client-id for " + prop, propId); - - System.out.println(" " + propId); - } - return null; - } - }); - } - - public void testGetAllReferences() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - 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) - { - String uniqueName = relationshipDefinition.getUniqueName(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - System.out.println(" - " + uniqueName); - System.out.println(" " + displayName.toString()); - } - - return null; - } - }); - } - - public void testGetAllConstraints() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Just dump them out for visual inspection - System.out.println("Available custom constraints:"); - List constraints = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - for (ConstraintDefinition constraint : constraints) - { - System.out.println(" - " + constraint.getName()); - System.out.println(" " + constraint.getTitle(dictionaryService)); - } - return null; - } - }); - } - - private boolean beforeMarker = false; - private boolean onMarker = false; - @SuppressWarnings("unused") - private boolean inTest = false; - - public void testCreateReference() throws Exception - { - inTest = true; - try - { - // Create the necessary test objects in the db: two records. - final Pair testRecords = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback>() - { - public Pair execute() throws Throwable - { - NodeRef rec1 = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis()); - NodeRef rec2 = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis()); - Pair result = new Pair<>(rec1, rec2); - return result; - } - }); - final NodeRef testRecord1 = testRecords.getFirst(); - final NodeRef testRecord2 = testRecords.getSecond(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - utils.completeRecord(testRecord1); - utils.completeRecord(testRecord2); - - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_CREATE_REFERENCE, - this, - new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "beforeCreateReference", NotificationFrequency.EVERY_EVENT)); - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_CREATE_REFERENCE, - this, - new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "onCreateReference", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeMarker); - assertFalse(onMarker); - - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), testRecord1, testRecord2); - - assertTrue(beforeMarker); - assertTrue(onMarker); - return null; - } - }); - } - finally - { - inTest = false; - } - } - - public void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - beforeMarker = true; - } - - public void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - onMarker = true; - } - - public void testCreateCustomConstraints() throws Exception - { - final int beforeCnt = - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Integer execute() throws Throwable - { - List result = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - assertNotNull(result); - return result.size(); - } - }); - - final String conTitle = "test title - "+testRunID; - final List allowedValues = new ArrayList<>(3); - allowedValues.add("RED"); - allowedValues.add("AMBER"); - allowedValues.add("GREEN"); - - final QName testCon = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public QName execute() throws Throwable - { - String conLocalName = "test-"+testRunID; - - final QName result = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, conLocalName); - - rmAdminService.addCustomConstraintDefinition(result, conTitle, true, allowedValues, MatchLogic.AND); - return result; - } - }); - - - // Set the current security context as System - to see allowed values (unless caveat config is also updated for admin) - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - assertEquals(beforeCnt+1, customConstraintDefs.size()); - - boolean found = false; - for (ConstraintDefinition conDef : customConstraintDefs) - { - if (conDef.getName().equals(testCon)) - { - assertEquals(conTitle, conDef.getTitle(dictionaryService)); - - Constraint con = conDef.getConstraint(); - assertTrue(con instanceof RMListOfValuesConstraint); - - assertEquals("LIST", ((RMListOfValuesConstraint)con).getType()); - assertEquals(3, ((RMListOfValuesConstraint)con).getAllowedValues().size()); - - found = true; - break; - } - } - assertTrue(found); - return null; - } - }); - - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - allowedValues.clear(); - allowedValues.add("RED"); - allowedValues.add("YELLOW"); - - rmAdminService.changeCustomConstraintValues(testCon, allowedValues); - return null; - } - }); - - // Set the current security context as System - to see allowed values (unless caveat config is also updated for admin) - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - assertEquals(beforeCnt+1, customConstraintDefs.size()); - - boolean found = false; - for (ConstraintDefinition conDef : customConstraintDefs) - { - if (conDef.getName().equals(testCon)) - { - assertEquals(conTitle, conDef.getTitle(dictionaryService)); - - Constraint con = conDef.getConstraint(); - assertTrue(con instanceof RMListOfValuesConstraint); - - assertEquals("LIST", ((RMListOfValuesConstraint)con).getType()); - assertEquals(2, ((RMListOfValuesConstraint)con).getAllowedValues().size()); - - found = true; - break; - } - } - assertTrue(found); - return null; - } - }); - - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // Add custom property to record with test constraint - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - String propLocalName = "myProp-"+testRunID; - - QName dataType = DataTypeDefinition.TEXT; - String propTitle = "My property title"; - String description = "My property description"; - String defaultValue = null; - boolean multiValued = false; - boolean mandatory = false; - boolean isProtected = false; - - QName propName = rmAdminService.addCustomPropertyDefinition(null, ASPECT_RECORD, propLocalName, dataType, propTitle, description, defaultValue, multiValued, mandatory, isProtected, testCon); - createdCustomProperties.add(propName); - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java deleted file mode 100644 index d7787236cb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java +++ /dev/null @@ -1,996 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditEntry; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.EqualsHelper; -import org.alfresco.util.GUID; -import org.alfresco.util.Pair; - -/** - * @see RecordsManagementAuditService - * - * @author Derek Hulley - * @author Roy Wetherall - * - * @since 3.2 - */ -public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase - implements RMPermissionModel -{ - /** A QName to display for the hold name. */ - private static final QName HOLD_NAME = QName.createQName(RecordsManagementModel.RM_URI, "Hold Name"); - - /** Test record */ - private NodeRef record; - - /** Test start time */ - private Date testStartTime; - - /** - * Remove from hold audit event name. - */ - private static final String REMOVE_FROM_HOLD_AUDIT_EVENT = "Remove From Hold"; - - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - super.setUp(); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // test start time recorded - testStartTime = new Date(); - - // Stop and clear the log - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - rmAuditService.startAuditLog(filePlan); - - // check that audit service is started - assertTrue(rmAuditService.isAuditLogEnabled(filePlan)); - - return 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#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestDataImpl() - */ - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - record = utils.createRecord(rmFolder, "AuditTest.txt"); - } - - /** - * @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); - - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(filePlan, user, FILING); - filePlanPermissionService.setPermission(rmContainer, user, FILING); - } - } - - public void testGetAuditEvents() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - List events = rmAuditService.getAuditEvents(); - - System.out.println("Found audit events:"); - for (AuditEvent event : events) - { - System.out.println(" - " + event.getName() + " (" + event.getLabel() + ")"); - } - - return null; - } - }, ADMIN_USER); - } - - /** - * Test getAuditTrail method to check that deleted items always show in the audit. - * - * @see RM-2391 (last addressed isue) - */ - public void testGetAuditTrailForDeletedItem() - { - // We have only one entry for the event "audit.start": - List entries = getAuditTrail(1, ADMIN_USER); - - assertEquals(entries.get(0).getEvent(), "audit.start"); - - // Event "audit.view" was generated but will be visible on the next call to getAuditTrail(). - - // Make a change: - updateTitle(filePlan, ADMIN_USER); // event=Update RM Object - - // Show the audit has been updated; at this point we have three entries for the three events up to now: - // "audit.start", "audit.view" and "Update RM Object"; - entries = getAuditTrail(3, ADMIN_USER); - - assertEquals(entries.get(2).getEvent(), "audit.start"); - assertEquals(entries.get(1).getEvent(), "audit.view"); - assertEquals(entries.get(0).getEvent(), "Update RM Object"); - - // New "audit.view" event was generated - will be visible on next getAuditTrail(). - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - nodeService.deleteNode(record); - List entries = getAuditTrail(5, ADMIN_USER); - - assertEquals(entries.get(4).getEvent(), "audit.start"); - assertEquals(entries.get(3).getEvent(), "audit.view"); - assertEquals(entries.get(2).getEvent(), "Update RM Object"); - assertEquals(entries.get(1).getEvent(), "audit.view"); - - // Show the audit contains a reference to the deleted item: - assertEquals(entries.get(0).getEvent(), "Delete RM Object"); - assertEquals(entries.get(0).getNodeRef(), record); - - return null; - } - }); - } - - /** - * Test getAuditTrail method and parameter filters. - */ - public void testGetAuditTrail() - { - // show the audit is empty - getAuditTrail(1, ADMIN_USER); - - // make a change - final String updatedProperty = updateTitle(filePlan, ADMIN_USER); - - // show the audit has been updated - List entries = getAuditTrail(3, ADMIN_USER); - final RecordsManagementAuditEntry entry = entries.get(0); - assertNotNull(entry); - - // investigate the contents of the audit entry - doTestInTransaction(new Test() - { - @SuppressWarnings("unchecked") - @Override - public Void run() throws Exception - { - assertEquals(filePlan, entry.getNodeRef()); - - String id = (String)nodeService.getProperty(filePlan, PROP_IDENTIFIER); - assertEquals(id, entry.getIdentifier()); - - Map after = entry.getAfterProperties(); - Map> changed = entry.getChangedProperties(); - - assertTrue(after.containsKey(PROP_TITLE)); - assertTrue(changed.containsKey(PROP_TITLE)); - - Serializable value = ((Map)after.get(PROP_TITLE)).get(Locale.ENGLISH); - assertEquals(updatedProperty, value); - value = ((Map)changed.get(PROP_TITLE).getSecond()).get(Locale.ENGLISH); - assertEquals(updatedProperty, value); - - return null; - } - }, ADMIN_USER); - - // add some more title updates - updateTitle(rmContainer, ADMIN_USER); - updateTitle(rmFolder, ADMIN_USER); - updateTitle(record, ADMIN_USER); - - // show the audit has been updated - getAuditTrail(7, ADMIN_USER); - - // snap shot date - Date snapShot = new Date(); - - // show the audit results can be limited - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - params.setMaxEntries(2); - getAuditTrail(params, 2, ADMIN_USER); - - // test filter by user - updateTitle(rmContainer, recordsManagerName); - updateTitle(rmFolder, recordsManagerName); - updateTitle(record, recordsManagerName); - - params = new RecordsManagementAuditQueryParameters(); - params.setUser(recordsManagerName); - getAuditTrail(params, 3, ADMIN_USER); - - // test filter by date - params = new RecordsManagementAuditQueryParameters(); - params.setDateFrom(snapShot); - getAuditTrail(params, 13, ADMIN_USER); - params = new RecordsManagementAuditQueryParameters(); - params.setDateTo(snapShot); - getAuditTrail(params, 14, ADMIN_USER); - params.setDateFrom(testStartTime); - getAuditTrail(params, 15, ADMIN_USER); - - // test filter by object - updateTitle(record, ADMIN_USER); - updateTitle(record, ADMIN_USER); - updateTitle(record, ADMIN_USER); - params = new RecordsManagementAuditQueryParameters(); - params.setNodeRef(record); - getAuditTrail(params, 5, ADMIN_USER); - - // test filter by event - params = new RecordsManagementAuditQueryParameters(); - // params.setEvent("cutoff"); - // getAuditTrail(params, 0, ADMIN_USER); - params.setEvent("Update RM Object"); - getAuditTrail(params, 10, ADMIN_USER); - - // test filter by property - // params = new RecordsManagementAuditQueryParameters(); - //params.setProperty(PROP_ADDRESSEES); - //getAuditTrail(params, 0, ADMIN_USER); - // params.setProperty(PROP_TITLE); - // getAuditTrail(params, 10, ADMIN_USER); - } - - /** - * Tests the following methods: - * - start() - * - stop() - * - clear() - * - isEnabled() - * - getDateLastStopped() - * - getDateLastStarted() - * - * @throws InterruptedException - */ - public void testAdminMethods() throws InterruptedException - { - // Stop the audit - rmAuditService.stopAuditLog(filePlan); - - Thread.sleep(5000); - - List result1 = getAuditTrail(ADMIN_USER); - assertNotNull(result1); - - // Update the fileplan - updateTitle(filePlan, ADMIN_USER); - - Thread.sleep(5000); - - // There should be no new audit entries - List result2 = getAuditTrail(ADMIN_USER); - assertNotNull(result2); - assertEquals( - "Audit results should not have changed after auditing was disabled", - result1.size(), result2.size()); - - // repeat with a start - rmAuditService.startAuditLog(filePlan); - updateTitle(filePlan, ADMIN_USER); - - Thread.sleep(5000); - - List result3 = getAuditTrail(ADMIN_USER); - assertNotNull(result3); - assertTrue( - "Expected more results after enabling audit", - result3.size() > result1.size()); - - Thread.sleep(5000); - - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - - // There should be no entries - List result4 = getAuditTrail(ADMIN_USER); - assertNotNull(result4); - assertEquals( - "Audit entries should have been cleared", - 0, result4.size()); - } - - // TODO testAuditRMAction - - // TODO testGetAuditTrailFile - - // TODO testFileAuditTrailAsRecord - - public void xtestAuditAuthentication() - { - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - rmAuditService.startAuditLog(filePlan); - - //MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService(); - //PersonService personService = serviceRegistry.getPersonService(); - - try - { - personService.deletePerson("baboon"); - authenticationService.deleteAuthentication("baboon"); - } - catch (Throwable e) - { - // Not serious - } - - // Failed login attempt ... - try - { - AuthenticationUtil.pushAuthentication(); - authenticationService.authenticate("baboon", "lskdfj".toCharArray()); - fail("Expected authentication failure"); - } - catch (AuthenticationException e) - { - // Good - } - finally - { - AuthenticationUtil.popAuthentication(); - } - rmAuditService.stopAuditLog(filePlan); - List result1 = getAuditTrail(ADMIN_USER); - // Check that the username is reflected correctly in the results - assertFalse("No audit results were generated for the failed login.", result1.isEmpty()); - boolean found = false; - for (RecordsManagementAuditEntry entry : result1) - { - String userName = entry.getUserName(); - if (userName.equals("baboon")) - { - found = true; - break; - } - } - assertTrue("Expected to hit failed login attempt for user", found); - - // Test successful authentication - try - { - personService.deletePerson("cdickons"); - authenticationService.deleteAuthentication("cdickons"); - } - catch (Throwable e) - { - // Not serious - } - authenticationService.createAuthentication("cdickons", getName().toCharArray()); - Map personProperties = new HashMap<>(); - personProperties.put(ContentModel.PROP_USERNAME, "cdickons"); - personProperties.put(ContentModel.PROP_FIRSTNAME, "Charles"); - personProperties.put(ContentModel.PROP_LASTNAME, "Dickons"); - personService.createPerson(personProperties); - - rmAuditService.clearAuditLog(filePlan); - rmAuditService.startAuditLog(filePlan); - try - { - AuthenticationUtil.pushAuthentication(); - authenticationService.authenticate("cdickons", getName().toCharArray()); - } - finally - { - AuthenticationUtil.popAuthentication(); - } - rmAuditService.stopAuditLog(filePlan); - List result2 = getAuditTrail(ADMIN_USER); - found = false; - for (RecordsManagementAuditEntry entry : result2) - { - String userName = entry.getUserName(); - String fullName = entry.getFullName(); - if (userName.equals("cdickons") && EqualsHelper.nullSafeEquals(fullName, "Charles Dickons")) - { - found = true; - break; - } - } - assertTrue("Expected to hit successful login attempt for Charles Dickons (cdickons)", found); - } - - /** - * Given I have deleted a user - * When I will get the RM audit filter by delete user event - * Then there will be an entry for the deleted user - * And the audit entry has the username property value audited - * @throws Exception - */ - @org.junit.Test - public void testAuditForDeletedUser() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - final static String DELETE_USER_AUDIT_EVENT = "Delete Person"; - String userName = "auditDeleteUser"; - NodeRef user; - List entry; - - @Override - public void given() throws Exception - { - // create a user - user = createPerson(userName); - personService.deletePerson(userName); - } - - @Override - public void when() throws Exception - { - // set the audit wuery param - RecordsManagementAuditQueryParameters params = createAuditQueryParameters(DELETE_USER_AUDIT_EVENT); - - // get the audit events for "Delete Person" - entry = getAuditTrail(params, 1, ADMIN_USER); - } - - @Override - public void then() throws Exception - { - assertEquals("Delete user event is not audited.", DELETE_USER_AUDIT_EVENT, entry.get(0).getEvent()); - assertEquals(user.getId(), entry.get(0).getNodeName()); - assertEquals("Unexpected nr of properties audited for cm:person type when deleting a user.", - 1, entry.get(0).getBeforeProperties().size()); - assertEquals("Wrong value for username property is audited", - userName, entry.get(0).getBeforeProperties().get(ContentModel.PROP_USERNAME)); - } - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - - }); - } - - /** - * Given I have created a user - * When I will get the RM audit filter by create user event - * Then there will be an entry for the created user - * - * @throws Exception - */ - @org.junit.Test - public void testAuditForCreateUser() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - final static String CREATE_USER_AUDIT_EVENT = "Create Person"; - String userName = "auditCreateUser"; - NodeRef user; - List entry; - - @Override - public void given() throws Exception - { - // create a user - user = createPerson(userName); - } - - @Override - public void when() throws Exception - { - // set the audit query param - RecordsManagementAuditQueryParameters params = createAuditQueryParameters(CREATE_USER_AUDIT_EVENT); - - // get the audit events for "Create Person" - entry = getAuditTrail(params, 1, ADMIN_USER); - } - - @Override - public void then() throws Exception - { - assertEquals("Create user event is not audited.", - CREATE_USER_AUDIT_EVENT, entry.get(0).getEvent()); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - - }); - } - - /** - * Given I have created a hold - * When I will get the RM audit filter by create hold event - * Then there will be an entry for the created hold, including the hold name and reason - */ - public void testAuditForCreateHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - final static String CREATE_HOLD_AUDIT_EVENT = "Create Hold"; - - String holdName = "Hold " + GUID.generate(); - String holdReason = "Reason " + GUID.generate(); - - Map auditEventProperties; - - @Override - public void given() - { - rmAuditService.clearAuditLog(filePlan); - utils.createHold(filePlan, holdName, holdReason); - } - - @Override - public void when() - { - auditEventProperties = getAuditEntry(CREATE_HOLD_AUDIT_EVENT).getAfterProperties(); - } - - @Override - public void then() - { - // check create hold audit event includes the hold name - assertEquals("Create Hold event does not include hold name.", holdName, - auditEventProperties.get(HOLD_NAME)); - - // check create hold audit event includes the hold reason - assertEquals("Create Hold event does not include hold reason.", holdReason, - auditEventProperties.get(PROP_HOLD_REASON)); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - }); - } - - /** - * Given I have created a hold - * When I delete the hold and get the RM audit filter by delete hold event - * Then there will be an entry for the deleted hold, including the hold name - */ - public void testAuditForDeleteHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - final static String DELETE_HOLD_AUDIT_EVENT = "Delete Hold"; - - String holdName = "Hold " + GUID.generate(); - - NodeRef hold; - Map auditEventProperties; - - @Override - public void given() - { - rmAuditService.clearAuditLog(filePlan); - hold = utils.createHold(filePlan, holdName, "Reason " + GUID.generate()); - } - - @Override - public void when() - { - utils.deleteHold(hold); - auditEventProperties = getAuditEntry(DELETE_HOLD_AUDIT_EVENT).getBeforeProperties(); - } - - @Override - public void then() - { - // check delete hold audit event includes the hold name - assertEquals("Delete Hold event does not include hold name.", holdName, - auditEventProperties.get(HOLD_NAME)); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - }); - } - - /** - * Given I have added an item of content to a hold - * When I get the RM audit filter by add to hold event - * Then there will be an entry for the item added to the hold, including both the item name and hold name - */ - public void testAuditForAddContentToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - final static String ADD_TO_HOLD_AUDIT_EVENT = "Add To Hold"; - - String holdName = "Hold " + GUID.generate(); - NodeRef hold; - - Map auditEventProperties; - - @Override - public void given() - { - rmAuditService.clearAuditLog(filePlan); - hold = utils.createHold(filePlan, holdName, "Reason " + GUID.generate()); - utils.addItemToHold(hold, dmDocument); - } - - @Override - public void when() - { - auditEventProperties = getAuditEntry(ADD_TO_HOLD_AUDIT_EVENT).getAfterProperties(); - } - - @Override - public void then() - { - // check add to hold audit event includes the hold name - assertEquals("Add To Hold event does not include hold name.", holdName, - auditEventProperties.get(HOLD_NAME)); - - // check add to hold audit event includes the content name - String contentName = (String) nodeService.getProperty(dmDocument, PROP_NAME); - assertEquals("Add To Hold event does not include content name.", contentName, - auditEventProperties.get(PROP_NAME)); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - }); - } - - - /** - * Given I have an item in a hold - * When I remove the item from the hold - * Then there will be an audit entry for the item removed from the hold, including both the item name and hold name - */ - @org.junit.Test - public void testAuditForRemoveContentFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - String holdName = "Hold " + GUID.generate(); - NodeRef hold; - - @Override - public void given() - { - rmAuditService.clearAuditLog(filePlan); - hold = utils.createHold(filePlan, holdName, "Reason " + GUID.generate()); - utils.addItemToHold(hold, dmDocument); - } - - @Override - public void when() - { - utils.removeItemFromHold(hold, dmDocument); - } - - @Override - public void then() - { - Map auditEventProperties = getAuditEntry(REMOVE_FROM_HOLD_AUDIT_EVENT).getBeforeProperties(); - - // check remove from hold audit event includes the hold name - assertEquals("Remove From Hold event does not include hold name.", holdName, - auditEventProperties.get(HOLD_NAME)); - - // check remove from hold audit event includes the content name - String contentName = (String) nodeService.getProperty(dmDocument, PROP_NAME); - assertEquals("Remove From Hold event does not include content name.", contentName, - auditEventProperties.get(PROP_NAME)); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - }); - - } - - - /** - * Given I have removed an item from multiple holds - * When I will get the RM audit filter by remove from hold events - * Then there will be entries for the item removed from each hold, including both the item name and hold name - */ - @org.junit.Test - public void testAuditForRemoveContentFromMultipleHolds() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - String holdName1 = "Hold " + GUID.generate(); - String holdName2 = "Hold " + GUID.generate(); - NodeRef hold1, hold2; - - @Override - public void given() - { - rmAuditService.clearAuditLog(filePlan); - - hold1 = utils.createHold(filePlan, holdName1, "Reason " + GUID.generate()); - hold2 = utils.createHold(filePlan, holdName2, "Reason " + GUID.generate()); - utils.addItemToHold(hold1, dmDocument); - utils.addItemToHold(hold2, dmDocument); - } - - @Override - public void when() - { - utils.removeItemsFromHolds(Arrays.asList(hold1, hold2), Arrays.asList(dmDocument)); - } - - @Override - public void then() - { - List auditEntries = getAuditEntries(REMOVE_FROM_HOLD_AUDIT_EVENT); - - // check remove from hold audit event exists for both holds - assertEquals(2, auditEntries.size()); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - }); - - } - - - /** - * Given I have removed items from a hold - * When I will get the RM audit filter by remove from hold events - * Then there will be entries for the items removed from the hold, including both the item name and hold name - */ - @org.junit.Test - public void testAuditForRemoveMultipleContentFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - String holdName = "Hold " + GUID.generate(); - NodeRef hold; - - @Override - public void given() - { - rmAuditService.clearAuditLog(filePlan); - - hold = utils.createHold(filePlan, holdName, "Reason " + GUID.generate()); - utils.addItemToHold(hold, dmDocument); - utils.addItemToHold(hold, dmDocument1); - } - - @Override - public void when() - { - utils.removeItemsFromHolds(Arrays.asList(hold), Arrays.asList(dmDocument, dmDocument1)); - } - - @Override - public void then() - { - List auditEntries = getAuditEntries(REMOVE_FROM_HOLD_AUDIT_EVENT); - - // check remove from hold audit event exists for both documents - assertEquals(2, auditEntries.size()); - } - - @Override - public void after() - { - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - } - }); - - } - - - /** === Helper methods === */ - - private List getAuditTrail(String asUser) - { - return getAuditTrail(-1, asUser); - } - - private List getAuditTrail(final int expectedCount, String asUser) - { - return getAuditTrail(new RecordsManagementAuditQueryParameters(), expectedCount, asUser); - } - - private List getAuditTrail(final RecordsManagementAuditQueryParameters params, final int expectedCount, final String asUser) - { - return doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - return rmAuditService.getAuditTrail(params); - } - - @Override - public void test(List result) throws Exception - { - assertNotNull(result); - if (expectedCount != -1) - { - assertEquals(expectedCount, result.size()); - } - } - }, asUser); - } - - private String updateTitle(final NodeRef nodeRef, final String asUser) - { - return doTestInTransaction(new Test() - { - @Override - public String run() throws Exception - { - String updatedProperty = "Updated - " + System.currentTimeMillis(); - nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, updatedProperty); - return updatedProperty; - } - }, asUser); - } - - private RecordsManagementAuditEntry getAuditEntry(String auditEvent) - { - // create the audit query parameters for the given event - RecordsManagementAuditQueryParameters params = createAuditQueryParameters(auditEvent); - - // get the audit entries for the given event - List auditEntries = getAuditEntryAssertOnlyOne(params); - - // verify we have the expected audit event - RecordsManagementAuditEntry auditEntry = auditEntries.get(0); - assertEquals(auditEvent + " event is not audited.", auditEvent, auditEntry.getEvent()); - - // return the properties of the audit event - return auditEntry; - } - - private List getAuditEntryAssertOnlyOne(RecordsManagementAuditQueryParameters params) - { - List auditEntries; - auditEntries = getAuditTrail(params, 1, ADMIN_USER); - return auditEntries; - } - - private List getAuditEntries(String auditEvent) - { - // create the audit query parameters for the given event - RecordsManagementAuditQueryParameters params = createAuditQueryParameters(auditEvent); - - // get the audit entries for the given event - List auditEntries = getAllAuditEntries(params); - - return auditEntries; - } - - private List getAllAuditEntries(RecordsManagementAuditQueryParameters params) - { - List auditEntries; - auditEntries = getAuditTrail(params, -1, ADMIN_USER); - return auditEntries; - } - - private RecordsManagementAuditQueryParameters createAuditQueryParameters(String auditEvent) - { - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - params.setEvent(auditEvent); - return params; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java deleted file mode 100644 index a25492bbcf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.repository.StoreRef; - -/** - * Event service implementation unit test - * - * @author Roy Wetherall - */ -public class RecordsManagementEventServiceImplTest extends BaseRMTestCase implements RecordsManagementModel -{ - protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private RetryingTransactionHelper transactionHelper; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - // Get the service required in the tests - this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper"); - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - } - - public void testGetEventTypes() - { - transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List eventTypes = rmEventService.getEventTypes(); - assertNotNull(eventTypes); - for (RecordsManagementEventType eventType : eventTypes) - { - System.out.println(eventType.getName() + " - " + eventType.getDisplayLabel()); - } - return null; - } - }); - } - - public void testGetEvents() - { - transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List events = rmEventService.getEvents(); - assertNotNull(events); - for (RecordsManagementEvent event : events) - { - System.out.println(event.getName()); - } - return null; - } - }); - } - - public void testAddRemoveEvents() - { - transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List events = rmEventService.getEvents(); - assertNotNull(events); - assertFalse(containsEvent(events, "myEvent")); - - rmEventService.addEvent("rmEventType.simple", "myEvent", "My Event"); - - events = rmEventService.getEvents(); - assertNotNull(events); - assertTrue(containsEvent(events, "myEvent")); - - rmEventService.removeEvent("myEvent"); - - events = rmEventService.getEvents(); - assertNotNull(events); - assertFalse(containsEvent(events, "myEvent")); - return null; - } - }); - } - - private boolean containsEvent(List events, String eventName) - { - boolean result = false; - for (RecordsManagementEvent event : events) - { - if (eventName.equals(event.getName())) - { - result = true; - break; - } - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java deleted file mode 100644 index 8dfc7a98bf..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.Set; - -import com.google.common.collect.ImmutableSet; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Records Management Query DAO - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementQueryDAOImplTest extends BaseRMTestCase implements RecordsManagementModel -{ - protected RecordsManagementQueryDAO queryDAO; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - queryDAO = (RecordsManagementQueryDAO)applicationContext.getBean("recordsManagementQueryDAO"); - } - - /** - * This is a record test - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() - */ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * @see RecordService#getRecordMetaDataAspects() - */ - public void testGetRecordMetaDataAspects() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - int count = queryDAO.getCountRmaIdentifier("abc-123"); - assertEquals(0, count); - - String existingID = (String)nodeService.getProperty(recordOne, PROP_IDENTIFIER); - count = queryDAO.getCountRmaIdentifier(existingID); - assertEquals(1, count); - - return null; - } - }); - } - - /** - * Given a folder containing 3 files with distinct descriptions set - * When I get the children property values - * Then the answer contains all distinct property values set - */ - @org.junit.Test - public void testGetChildrenWithPropertyValues_childrenWithValues() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef parentFolder; - NodeRef file1; - NodeRef file2; - NodeRef file3; - String propValue1 = "descr1"; // set on file1 - String propValue2 = "descr2"; // set on file2 - String propValue3 = "descr3"; // set on file3 - Set propertyValues; - - @Override - public void given() throws Exception - { - setupCollaborationSiteTestDataImpl(); - parentFolder = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file1 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file2 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file3 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - nodeService.setProperty(file1, PROP_DESCRIPTION, propValue1); - nodeService.setProperty(file2, PROP_DESCRIPTION, propValue2); - nodeService.setProperty(file3, PROP_DESCRIPTION, propValue3); - } - - @Override - public void when() throws Exception - { - propertyValues = queryDAO.getChildrenStringPropertyValues(parentFolder, PROP_DESCRIPTION); - } - - @Override - public void then() throws Exception - { - Set expectedValues = ImmutableSet.of(propValue1, propValue2, propValue3); - assertEquals(propertyValues.size(), expectedValues.size()); - assertTrue(propertyValues.containsAll(expectedValues)); - } - - @Override - public void after() throws Exception - { - if (parentFolder != null && nodeService.exists(parentFolder)) - { - nodeService.deleteNode(parentFolder); - } - } - }); - } - - /** - * Given a folder containing 3 files only some have description set - * When I get the children property values - * Then the answer contains only the descriptions set - */ - @org.junit.Test - public void testGetChildrenWithPropertyValues_someChildrenWithValues() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef parentFolder; - NodeRef file1; - NodeRef file2; - NodeRef file3; - String propValue1 = "descr1"; // set on file1 - String propValue2 = "descr2"; // set on file2 - Set propertyValues; - - - @Override - public void given() throws Exception - { - setupCollaborationSiteTestDataImpl(); - parentFolder = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file1 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file2 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file3 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - nodeService.setProperty(file1, PROP_DESCRIPTION, propValue1); - nodeService.setProperty(file2, PROP_DESCRIPTION, propValue2); - } - - @Override - public void when() throws Exception - { - propertyValues = queryDAO.getChildrenStringPropertyValues(parentFolder, PROP_DESCRIPTION); - } - - @Override - public void then() throws Exception - { - Set expectedValues = ImmutableSet.of(propValue1, propValue2); - assertEquals(propertyValues.size(), expectedValues.size()); - assertTrue(propertyValues.containsAll(expectedValues)); - } - - @Override - public void after() throws Exception - { - if (parentFolder != null && nodeService.exists(parentFolder)) - { - nodeService.deleteNode(parentFolder); - } - } - }); - } - - /** - * Given a folder containing 3 files with the descriptions unset - * When I get the children property values - * Then empty list is returned - */ - @org.junit.Test - public void testGetChildrenWithPropertyValues_propertyNotSetOnChildren() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef parentFolder; - NodeRef file1; - NodeRef file2; - NodeRef file3; - Set propertyValues; - - @Override - public void given() throws Exception - { - setupCollaborationSiteTestDataImpl(); - parentFolder = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file1 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file2 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - file3 = fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - @Override - public void when() throws Exception - { - propertyValues = queryDAO.getChildrenStringPropertyValues(parentFolder, PROP_DESCRIPTION); - - } - - @Override - public void then() throws Exception - { - assertTrue(propertyValues.isEmpty()); - } - - @Override - public void after() throws Exception - { - if (parentFolder != null && nodeService.exists(parentFolder)) - { - nodeService.deleteNode(parentFolder); - } - } - }); - } - - /** - * Given a folder with no children but the property set on itself - * When get the children property values - * Then the list is empty - */ - @org.junit.Test - public void testGetChildrenWithPropertyValues_noChildren() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef folder; - String propValue = "descr"; - Set propertyValues; - - @Override - public void given() throws Exception - { - setupCollaborationSiteTestDataImpl(); - folder = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - nodeService.setProperty(folder, PROP_DESCRIPTION, propValue); - } - - @Override - public void when() throws Exception - { - propertyValues = queryDAO.getChildrenStringPropertyValues(folder, PROP_DESCRIPTION); - } - - @Override - public void then() throws Exception - { - assertTrue(propertyValues.isEmpty()); - } - - @Override - public void after() throws Exception - { - if (folder != null && nodeService.exists(folder)) - { - nodeService.deleteNode(folder); - } - } - }); - } - - /** - * Given a folder with children and an unused property - * When I get the property values for the unused property - * Then empty list is returned - */ - @org.junit.Test - public void testGetChildrenWithPropertyValues_propertyNotUsed() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef parentFolder; - QName property; - Set propertyValues; - - @Override - public void given() throws Exception - { - setupCollaborationSiteTestDataImpl(); - parentFolder = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - fileFolderService.create(parentFolder, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - property = QName.createQName(URI, "customProp-" + GUID.generate()); - } - - @Override - public void when() throws Exception - { - propertyValues = queryDAO.getChildrenStringPropertyValues(folder, property); - } - - @Override - public void then() throws Exception - { - assertTrue(propertyValues.isEmpty()); - } - - @Override - public void after() throws Exception - { - if (folder != null && nodeService.exists(folder)) - { - nodeService.deleteNode(folder); - } - } - }); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java deleted file mode 100644 index f95e22e762..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import static org.alfresco.util.GUID.generate; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; - -/** - * Search service implementation unit test. - * - * @author Roy Wetherall - */ -public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase -{ - private static final String SEARCH1 = "search1"; - private static final String SEARCH2 = "search2"; - private static final String SEARCH3 = "search3"; - private static final String SEARCH4 = "search4"; - - private String user; - private int numberOfReports; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData() - */ - @Override - protected void setupTestData() - { - super.setupTestData(); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Count the number of pre-defined reports - List searches = rmSearchService.getSavedSearches(siteId); - assertNotNull(searches); - numberOfReports = searches.size(); - - user = generate(); - createPerson(user); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - public void testSaveSearch() - { - // Add some saved searches (as admin user) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true); - checkSearchDetails(details1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); - SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false); - checkSearchDetails(details2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false); - - return null; - } - - }); - - // Add some saved searches (as user1) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); - checkSearchDetails(details1, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); - SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false); - checkSearchDetails(details2, siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false); - - return null; - } - - }, user); - - // Get searches (as admin user) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List searches = rmSearchService.getSavedSearches(siteId); - assertNotNull(searches); - assertEquals(numberOfReports + 2, searches.size()); - - SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); - - SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2); - assertNotNull(search2); - checkSearchDetails(search2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false); - - SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3); - assertNull(search3); - - SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4); - assertNull(search4); - - return null; - } - - }); - - // Get searches (as user1) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List searches = rmSearchService.getSavedSearches(siteId); - assertNotNull(searches); - assertEquals(numberOfReports + 3, searches.size()); - - SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); - - SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2); - assertNull(search2); - - SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3); - assertNotNull(search3); - checkSearchDetails(search3, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); - - SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4); - assertNotNull(search4); - checkSearchDetails(search4, siteId, "search4", "description4", "query4", new RecordsManagementSearchParameters(), false); - - return null; - } - - }, user); - - // Update search (as admin user) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true); - - rmSearchService.saveSearch(siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true); - - search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true); - - return null; - } - }); - - // Delete searches (as admin user) - // TODO - } - - /** - * Check the details of the saved search. - */ - private void checkSearchDetails( - SavedSearchDetails details, - String siteid, - String name, - String description, - String query, - RecordsManagementSearchParameters searchParameters, - boolean isPublic) - { - assertNotNull(details); - assertEquals(siteid, details.getSiteId()); - assertEquals(name, details.getName()); - assertEquals(description, details.getDescription()); - assertEquals(query, details.getSearch()); - assertEquals(isPublic, details.isPublic()); - - assertEquals(searchParameters.getMaxItems(), details.getSearchParameters().getMaxItems()); - assertEquals(searchParameters.isIncludeRecords(), details.getSearchParameters().isIncludeRecords()); - assertEquals(searchParameters.isIncludeUndeclaredRecords(), details.getSearchParameters().isIncludeUndeclaredRecords()); - assertEquals(searchParameters.isIncludeVitalRecords(), details.getSearchParameters().isIncludeVitalRecords()); - assertEquals(searchParameters.isIncludeRecordFolders(), details.getSearchParameters().isIncludeRecordFolders()); - assertEquals(searchParameters.isIncludeFrozen(), details.getSearchParameters().isIncludeFrozen()); - assertEquals(searchParameters.isIncludeCutoff(), details.getSearchParameters().isIncludeCutoff()); - - // Check the other stuff .... - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java deleted file mode 100644 index b1d91d45fc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java +++ /dev/null @@ -1,623 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.ArrayList; -import java.util.List; - -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.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Records management service test. - * - * @author Roy Wetherall - */ -public class RecordsManagementServiceImplTest extends BaseRMTestCase -{ - /********** RM Component methods **********/ - - /** - * @see FilePlanService#isFilePlanComponent(NodeRef) - */ - public void testIsFilePlanComponent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan)); - assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer)); - assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#getFilePlanComponentKind(NodeRef) - */ - public void testGetFilePlanComponentKind() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return utils.createRecord(rmFolder, "testRecord.txt"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer)); - assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder)); - assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result)); - // TODO HOLD and TRANSFER - assertNull(filePlanService.getFilePlanComponentKind(folder)); - } - }); - } - - /** - * @see FilePlanService#isFilePlan(NodeRef) - */ - public void testIsFilePlan() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertTrue("This is a records management root", filePlanService.isFilePlan(filePlan)); - assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmContainer)); - assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#isRecordCategory(NodeRef) - */ - public void testIsRecordCategory() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan)); - assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer)); - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder)); - - return null; - } - }); - } - - /** - * @see RecordFolderService#isRecordFolder(NodeRef) - */ - public void testIsRecordFolder() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertFalse("This should not be a record folder", recordFolderService.isRecordFolder(filePlan)); - assertFalse("This should not be a record folder", recordFolderService.isRecordFolder(rmContainer)); - assertTrue("This should be a record folder", recordFolderService.isRecordFolder(rmFolder)); - - return null; - } - }); - } - - public void testGetRecordsManagementRoot() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertEquals(filePlan, filePlanService.getFilePlan(filePlan)); - assertEquals(filePlan, filePlanService.getFilePlan(rmContainer)); - assertEquals(filePlan, filePlanService.getFilePlan(rmFolder)); - - return null; - } - }); - } - - /********** Record Management Root methods **********/ - - /** - * @see FilePlanService#getFilePlans() - */ - public void testGetRecordsManagementRoots() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - List roots = new ArrayList<>(filePlanService.getFilePlans()); - assertNotNull(roots); - assertTrue(roots.size() != 0); - assertTrue(roots.contains(filePlan)); - - return null; - } - }); - } - - /** - * @see FilePlanService#createFilePlan(NodeRef, String) - * @see FilePlanService#createFilePlan(NodeRef, String, QName) - */ - public void testCreateFilePlan() throws Exception - { - // Create default type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Create specific type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Failure: creating root in existing hierarchy - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(rmContainer, GUID.generate()); - } - }); - - // Failure: type no extended from root container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /********** Records Management Container methods **********/ - - /** - * @see FilePlanService#createRecordCategory(NodeRef, String) - * @see FilePlanService#createFilePlan(NodeRef, String, QName) - */ - public void testCreateRecordCategory() throws Exception - { - // Create container (in root) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(filePlan, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // Create container (in container) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(rmContainer, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // TODO need a custom type of container! - // Create container of a given type -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() -// { -// String id = setString("id", GUID.generate()); -// return filePlanService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES); -// } -// -// @Override -// public void test(NodeRef result) -// { -// assertNotNull("Unable to create records management container", result); -// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES); -// } -// }); - - // Fail Test: parent is not a container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(folder, GUID.generate()); - } - }); - - // Fail Test: type is not a sub-type of rm:recordsManagementContainer - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /** - * @see FilePlanService#getAllContained(NodeRef) - * @see FilePlanService#getAllContained(NodeRef, boolean) - */ - public void testGetAllContained() throws Exception - { - // Get all contained test - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getAllContained(rmContainer); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, false); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, true); - assertNotNull(nodes); - assertEquals(4, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getAllContained(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordCategories(NodeRef) - * @see FilePlanService#getContainedRecordCategories(NodeRef, boolean) - */ - public void testGetContainedRecordCategories() throws Exception - { - // Test getting all contained containers - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordCategories(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordCategories(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordFolders(NodeRef) - * @see FilePlanService#getContainedRecordFolders(NodeRef, boolean) - */ - public void testGetContainedRecordFolders() throws Exception - { - // Test getting all contained record folders - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordFolders(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordFolders(rmFolder); - } - }); - } - - /********** Record Folder methods **********/ - - // TODO void testIsRecordFolderDeclared() - - // TODO void testIsRecordFolderClosed() - - // TODO void testGetRecords() - - /** - * @see RecordFolderService#createRecordFolder(NodeRef, String) - * @see RecordFolderService#createRecordFolder(NodeRef, String, QName) - */ - public void testCreateRecordFolder() throws Exception - { - // Create record - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return recordFolderService.createRecordFolder(rmContainer, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create record folder", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_FOLDER); - } - }); - - // TODO Create record of type - - // Failure: Create record with invalid type - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - recordFolderService.createRecordFolder(rmContainer, GUID.generate(), TYPE_FOLDER); - } - }); - - // Failure: Create record folder in root - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - recordFolderService.createRecordFolder(filePlan, GUID.generate()); - } - }); - } - - - /********** RM2 - Multi-hierarchy record taxonomy's **********/ - - /** - * Test to create a simple multi-hierarchy record taxonomy - */ - public void testCreateSimpleHierarchy() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Create 3 level hierarchy - NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1")); - assertNotNull("Unable to create container", levelOne); - NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2")); - assertNotNull("Unable to create container", levelTwo); - NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3")); - assertNotNull("Unable to create container", levelThree); - NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", recordFolderService.createRecordFolder(levelThree, "recordFolder3")); - assertNotNull("Unable to create record folder", levelThreeRecordFolder); - - return null; - } - - @Override - public void test(Void result) - { - // Test that the hierarchy has been created correctly - basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER); - - // TODO need to check that the parents and children can be retrieved correctly - } - }); - } - - /** - * A basic test of a records management container - * - * @param nodeRef node reference - * @param name name of the container - * @param type the type of container - */ - private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type) - { - // Check the basic details - assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME)); - assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER)); - assertEquals(type, nodeService.getType(nodeRef)); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java deleted file mode 100644 index 75f195b1d5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; -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.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -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.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.apache.commons.lang3.StringUtils; - -/** - * Report service implementation unit test. - * - * @author Roy Wetherall - */ -public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel -{ - public void testGetReportTypes() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Set reportTypes = reportService.getReportTypes(); - - assertNotNull(reportTypes); - assertFalse(reportTypes.isEmpty()); - - for (QName reportType : reportTypes) - { - System.out.println(reportType.toString()); - } - - return null; - } - }); - } - - public void testGenerateReport() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Destruction Report - Report destructionReport = generateDestructionReport(); - System.out.println(destructionReport.getReportName()); - System.out.println(destructionReport.getReportContent().getContentString()); - - // Transfer Report - Report transferReport = reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML); - System.out.println(transferReport.getReportName()); - System.out.println(transferReport.getReportContent().getContentString()); - - return null; - } - }); - } - - public void testFileReport() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Destruction Report - NodeRef destructionReportNodeRef = fileDestructionReport(); - assertNotNull(destructionReportNodeRef); - assertTrue(recordService.isRecord(destructionReportNodeRef)); - assertFalse(recordService.isFiled(destructionReportNodeRef)); - assertEquals(TYPE_DESTRUCTION_REPORT, nodeService.getType(destructionReportNodeRef)); - - // Transfer Report - NodeRef transferReportNodeRef = fileTransferReport(); - assertNotNull(transferReportNodeRef); - assertTrue(recordService.isRecord(transferReportNodeRef)); - assertFalse(recordService.isFiled(transferReportNodeRef)); - assertEquals(TYPE_TRANSFER_REPORT, nodeService.getType(transferReportNodeRef)); - - return null; - } - }); - } - - /** - * Helper method to generate a destruction report - * - * @return Destruction report - */ - private Report generateDestructionReport() - { - return reportService.generateReport(TYPE_DESTRUCTION_REPORT, rmFolder); - } - - /** - * Helper method to file a destruction report - * - * @return Node reference of the destruction report - */ - private NodeRef fileDestructionReport() - { - Report destructionReport = generateDestructionReport(); - return reportService.fileReport(filePlan, destructionReport); - } - - /** - * Helper method to file a transfer report - * - * @return Node reference of the transfer report - */ - private NodeRef fileTransferReport() - { - Report transferReport = reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML); - return reportService.fileReport(filePlan, transferReport); - } - - public void testFileDestructionReportAction() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(rmFolder, CompleteEventAction.NAME, params); - - rmActionService.executeRecordsManagementAction(rmFolder, CutOffAction.NAME); - rmActionService.executeRecordsManagementAction(rmFolder, DestroyAction.NAME); - - Map fileReportParams = new HashMap<>(2); - fileReportParams.put(FileReportAction.REPORT_TYPE, "rmr:destructionReport"); - fileReportParams.put(FileReportAction.DESTINATION, filePlan.toString()); - rmActionService.executeRecordsManagementAction(rmFolder, FileReportAction.NAME, fileReportParams); - return null; - } - }); - } - - public void testFileTransferReportAction() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Create transfer report for the transfer object - Map params = new HashMap<>(2); - params.put(FileReportAction.REPORT_TYPE, "rmr:transferReport"); - params.put(FileReportAction.DESTINATION, filePlan.toString()); - RecordsManagementActionResult transferReportAction = rmActionService.executeRecordsManagementAction(getTransferObject(), FileReportAction.NAME, params); - // Check transfer report result - String transferReportName = (String) transferReportAction.getValue(); - assertFalse(StringUtils.isBlank(transferReportName)); - return null; - } - }); - } - - /** - * Helper method for creating a transfer object - * - * @return Node reference of the transfer object - */ - private NodeRef getTransferObject() - { - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createDispositionSchedule( - recordCategory, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - false, // record level - true, // set the default actions - true); // extended disposition schedule - - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // Set the record folder identifier - String identifier = identifierService.generateIdentifier(TYPE_RECORD_FOLDER, recordCategory); - nodeService.setProperty(recordFolder, PROP_IDENTIFIER, identifier); - - // Complete event - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME); - - // Transfer folder - RecordsManagementActionResult transferAction = rmActionService.executeRecordsManagementAction(recordFolder, TransferAction.NAME); - NodeRef transferObject = (NodeRef) transferAction.getValue(); - assertTrue(transferObject != null); - - return transferObject; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java deleted file mode 100644 index 9fdb6dd2a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -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.test.util.TestServiceImpl; -import org.alfresco.service.namespace.QName; - -/** - * Unit test for service base implementation. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class ServiceBaseImplTest extends BaseRMTestCase -{ - /** test service */ - private TestServiceImpl testService; - - /** - * Init services - */ - @Override - protected void initServices() - { - super.initServices(); - - testService = (TestServiceImpl)applicationContext.getBean("testService"); - } - - /** - * test instanceOf() - */ - public void testInstanceOf() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertTrue(testService.doInstanceOf(rmFolder, ContentModel.TYPE_FOLDER)); - assertTrue(testService.doInstanceOf(rmFolder, TYPE_RECORD_FOLDER)); - assertFalse(testService.doInstanceOf(rmFolder, TYPE_RECORD_CATEGORY)); - - return null; - } - }); - - } - - /** - * test getNextCounter() - */ - public void testGetNextCounter() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertNull(nodeService.getProperty(rmFolder, PROP_COUNT)); - assertEquals(1, testService.doGetNextCount(rmFolder)); - assertEquals(2, testService.doGetNextCount(rmFolder)); - assertEquals(3, testService.doGetNextCount(rmFolder)); - - return null; - } - }); - - } - - /** - * test getTypeAndAspects() - */ - public void testGetTypeAndAspects() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Set result = testService.doGetTypeAndApsects(rmFolder); - assertTrue(result.contains(TYPE_RECORD_FOLDER)); - - return null; - } - }); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java deleted file mode 100644 index ad9934ab4b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java +++ /dev/null @@ -1,470 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.service; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.util.GUID; - -/** - * Vital record service implementation unit test. - * - * @author Roy Wetherall - */ -public class VitalRecordServiceImplTest extends BaseRMTestCase -{ - /** Test periods */ - protected static final Period PERIOD_NONE = new Period("none|0"); - protected static final Period PERIOD_WEEK = new Period("week|1"); - protected static final Period PERIOD_MONTH = new Period("month|1"); - - /** Test records */ - private NodeRef mhRecord51; - private NodeRef mhRecord52; - private NodeRef mhRecord53; - private NodeRef mhRecord54; - private NodeRef mhRecord55; - - /** - * Indicate this test uses the collaboration site test data - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** Indicate this is a multi hierarchy test */ - @Override - protected boolean isMultiHierarchyTest() - { - return true; - } - - /** vital record multi-hierarchy test data - * - * |--rmRootContainer (no vr def) - * | - * |--mhContainer (no vr def) - * | - * |--mhContainer-1-1 (has schedule - folder level) (no vr def) - * | | - * | |--mhContainer-2-1 (vr def) - * | | - * | |--mhContainer-3-1 (no vr def) - * | - * |--mhContainer-1-2 (has schedule - folder level) (no vr def) - * | - * |--mhContainer-2-2 (no vr def) - * | | - * | |--mhContainer-3-2 (vr def disabled) - * | | - * | |--mhContainer-3-3 (has schedule - record level) (vr def) - * | - * |--mhContainer-2-3 (has schedule - folder level) (vr def) - * | - * |--mhContainer-3-4 (no vr def) - * | - * |--mhContainer-3-5 (has schedule- record level) (vr def) - */ - @Override - protected void setupMultiHierarchyTestData() - { - // Load core test data - super.setupMultiHierarchyTestData(); - - // Setup vital record definitions - setupVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - // Create records - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - mhRecord51 = utils.createRecord(mhRecordFolder41, "record51.txt"); - mhRecord52 = utils.createRecord(mhRecordFolder42, "record52.txt"); - mhRecord53 = utils.createRecord(mhRecordFolder43, "record53.txt"); - mhRecord54 = utils.createRecord(mhRecordFolder44, "record54.txt"); - mhRecord55 = utils.createRecord(mhRecordFolder45, "record55.txt"); - - return null; - } - }); - } - - /** - * Helper to set up the vital record definition data in a transactional manner. - * - * @param nodeRef - * @param enabled - * @param period - */ - private void setupVitalRecordDefinition(final NodeRef nodeRef, final boolean enabled, final Period period) - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - vitalRecordService.setVitalRecordDefintion(nodeRef, enabled, period); - return null; - } - }); - } - - /** - * Based on the initial data: - * - check category, folder and record raw values. - * - check search aspect values. - */ - public void testInit() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, false, null); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, false, null); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer31, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder42, false, null); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, true, PERIOD_WEEK); - assertVitalRecord(mhRecord52, false, null); - assertVitalRecord(mhRecord53, true, PERIOD_WEEK); - assertVitalRecord(mhRecord54, true, PERIOD_WEEK); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - - return null; - } - }); - } - - /** - * Test that when new record categories and record folders are created in an existing file plan - * structure that they correctly inherit the correct vital record property values - */ - public void testValueInheritance() throws Exception - { - // Test record category value inheritance - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return filePlanService.createRecordCategory(mhContainer35, GUID.generate()); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertHasVitalRecordDefinition(result, true, PERIOD_MONTH); - } - }); - - // Test record folder value inheritance - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return recordFolderService.createRecordFolder(mhContainer32, GUID.generate()); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertHasVitalRecordDefinition(result, false, PERIOD_WEEK); - } - }); - } - - /** Filling tests */ - - public void testFileNewContent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef record = fileFolderService.create(mhRecordFolder41, "test101.txt" , TYPE_CONTENT).getNodeRef(); - - ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent("hello world this is some test content"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertVitalRecord(record, true, PERIOD_WEEK); - } - }); - } - -// public void testFileUnfiledrecord() throws Exception -// { -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() throws Exception -// { -// recordService.createRecord(filePlan, dmDocument); -// fileFolderService.move(dmDocument, mhRecordFolder41, "record.txt"); -// -// return dmDocument; -// } -// -// @Override -// public void test(NodeRef record) throws Exception -// { -// assertVitalRecord(record, true, PERIOD_WEEK); -// } -// }); -// } -// -// public void testFileDirectlyFromCollab() throws Exception -// { -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() throws Exception -// { -// fileFolderService.move(dmDocument, mhRecordFolder41, "record.txt"); -// return dmDocument; -// } -// -// @Override -// public void test(NodeRef record) throws Exception -// { -// assertVitalRecord(record, true, PERIOD_WEEK); -// } -// }); -// } - - /** Helper Methods */ - - /** - * Test to ensure that changes made to vital record definitions are reflected down the hierarchy. - */ - public void testChangesToVitalRecordDefinitions() throws Exception - { - // Override vital record definition - doTestInTransaction(new Test() - { - @Override - public Void run() - { - setupVitalRecordDefinition(mhContainer31, true, PERIOD_MONTH); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, false, null); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, false, null); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer31, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder42, false, null); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, true, PERIOD_MONTH); - assertVitalRecord(mhRecord52, false, null); - assertVitalRecord(mhRecord53, true, PERIOD_WEEK); - assertVitalRecord(mhRecord54, true, PERIOD_WEEK); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - } - }); - - // 'turn off' vital record def - doTestInTransaction(new Test() - { - @Override - public Void run() - { - setupVitalRecordDefinition(mhContainer31, false, PERIOD_NONE); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, false, null); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, false, null); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer31, false, null); - assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, false, null); - assertHasVitalRecordDefinition(mhRecordFolder42, false, null); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, false, null); - assertVitalRecord(mhRecord52, false, null); - assertVitalRecord(mhRecord53, true, PERIOD_WEEK); - assertVitalRecord(mhRecord54, true, PERIOD_WEEK); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - } - }); - - // Test parent change overrites existing - doTestInTransaction(new Test() - { - @Override - public Void run() - { - setupVitalRecordDefinition(mhContainer12, true, PERIOD_MONTH); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer31, false, null); - assertHasVitalRecordDefinition(mhContainer32, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, false, null); - assertHasVitalRecordDefinition(mhRecordFolder42, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, false, null); - assertVitalRecord(mhRecord52, true, PERIOD_MONTH); - assertVitalRecord(mhRecord53, true, PERIOD_MONTH); - assertVitalRecord(mhRecord54, true, PERIOD_MONTH); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - } - }); - - } - - @SuppressWarnings("deprecation") - private void assertHasVitalRecordDefinition(NodeRef nodeRef, boolean enabled, Period period) - { - assertTrue(nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)); - - VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef); - assertNotNull(def); - - Boolean vitalRecordIndicator = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR); - assertNotNull(vitalRecordIndicator); - assertEquals(enabled, vitalRecordIndicator.booleanValue()); - assertEquals(enabled, def.isEnabled()); - - if (enabled) - { - Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); - assertNotNull(reviewPeriod); - assertEquals(period, reviewPeriod); - assertEquals(period, def.getReviewPeriod()); - assertEquals(period.getNextDate(new Date()).getDate(), def.getNextReviewDate().getDate()); - } - } - - @SuppressWarnings("deprecation") - private void assertVitalRecord(NodeRef nodeRef, boolean enabled, Period period) - { - assertEquals(enabled, nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)); - if (enabled) - { - Date reviewAsOf = (Date)nodeService.getProperty(nodeRef, PROP_REVIEW_AS_OF); - assertNotNull(reviewAsOf); - assertEquals(period.getNextDate(new Date()).getDate(), reviewAsOf.getDate()); - - assertEquals(period.getPeriodType(), nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD)); - assertEquals(period.getExpression(), nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)); - } - else - { - assertNull(nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD)); - assertNull(nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java deleted file mode 100644 index 051232f9b7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Action Definitions - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class ActionDefinitionsRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String RM_ACTIONDEFINITIONS_URL = "/api/rm/rm-actiondefinitions"; - - /** - * Test the REST API to retrieve the list of rm action definitions - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetActionDefinitions() throws IOException, JSONException - { - // Send request - Response response = sendRequest(new GetRequest(RM_ACTIONDEFINITIONS_URL), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json and check the data - JSONObject contentAsJson = new JSONObject(contentAsString); - JSONArray data = contentAsJson.getJSONArray("data"); - assertNotNull(data); - - // Get a (sub)list of available dm action definitions - List dmActionDefinitions = getDmActionDefinitions(); - - // Get the list of rm action definitions from the response and check it - List rmActionDefinitions = new ArrayList<>(); - for (int i = 0; i < data.length(); i++) - { - String name = data.getJSONObject(i).getString("name"); - assertNotNull(name); - rmActionDefinitions.add(name); - assertFalse(dmActionDefinitions.contains(name)); - } - assertTrue(rmActionDefinitions.containsAll(getRmActionDefinitions())); - } - - /** - * Returns a (sub)list of rm action definitions - * - * @return A (sub)list of rm action definitions - */ - private List getRmActionDefinitions() - { - return Arrays.asList(new String[] - { - "reject", - "fileTo", - "declareRecord" - }); - } - - /** - * Returns a (sub)list of dm action definitions - * - * @return A (sub)list of dm action definitions - */ - private List getDmActionDefinitions() - { - return Arrays.asList(new String[] - { - "check-in", - "check-out", - "mail", - "move", - "transform" - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java deleted file mode 100644 index b81cc38338..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import static org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.DEFAULT_RM_SITE_ID; - -import java.io.IOException; -import java.text.MessageFormat; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; - -public class AuditRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - protected static final String GET_NODE_AUDITLOG_URL_FORMAT = "/api/node/{0}/rmauditlog"; - - private static final String USER_WITHOUT_AUDIT_CAPABILITY = GUID.generate(); - - private NodeRef record; - - public void testAuditAccessCapability() throws IOException - { - - String recordAuditUrl = MessageFormat.format(GET_NODE_AUDITLOG_URL_FORMAT,record.toString().replace("://", "/")); - - sendRequest(new GetRequest(recordAuditUrl), Status.STATUS_OK, AuthenticationUtil.getAdminUserName() ); - - sendRequest(new GetRequest(recordAuditUrl), Status.STATUS_FORBIDDEN, USER_WITHOUT_AUDIT_CAPABILITY ); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil - .getSystemUserName()); - - createUser(USER_WITHOUT_AUDIT_CAPABILITY); - - record = utils.createRecord(recordFolder, GUID.generate()); - - - return null; - } - }); - } - - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - deleteUser(USER_WITHOUT_AUDIT_CAPABILITY); - } - - protected String getRMSiteId() - { - return DEFAULT_RM_SITE_ID; - } - - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java deleted file mode 100644 index d6b474658d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.text.MessageFormat; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Test for Capabilities - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase -{ - /** URLs for the REST API */ - private static final String GET_CAPABILITIES_URL = "/api/node/{0}/{1}/{2}/capabilities?"; - - /** - * Tests the REST API to get the list of capabilities - * - * @throws IOException - * @throws JSONException - */ - public void testGetCapabilitiesAction() throws IOException, JSONException - { - String baseURL = MessageFormat.format(GET_CAPABILITIES_URL, - filePlan.getStoreRef().getProtocol(), - filePlan.getStoreRef().getIdentifier(), - filePlan.getId()); - - // Format url and send request - String getUrl = String.format(baseURL + "includeAll=%s", true); - Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - - // Check the content from the response - String getContentAsString = getResponse.getContentAsString(); - assertNotNull(getContentAsString); - - System.out.println(getContentAsString); - - // Convert the response to json and check the data - JSONObject getContentAsJson = new JSONObject(getContentAsString); - JSONObject getData = getContentAsJson.getJSONObject("data"); - assertNotNull(getData); - - // Get the capabilities and check them - JSONArray getDataSets = getData.getJSONArray("capabilities"); - assertNotNull(getDataSets); - - // Format url and send another request with different parameter - getUrl = String.format(baseURL + "grouped=%s", true); - getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - - // Check the content from the response - getContentAsString = getResponse.getContentAsString(); - assertNotNull(getContentAsString); - - // If both parameters are specified the result should be the same with only specifying the "grouped" parameter - getUrl = String.format(baseURL + "includeAll=%s&grouped=%s", true, true); - getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - getContentAsString.equalsIgnoreCase(getResponse.getContentAsString()); - - // Convert the response to json and check the data - getContentAsJson = new JSONObject(getContentAsString); - getData = getContentAsJson.getJSONObject("data"); - assertNotNull(getData); - - // Get the grouped capabilities and check them - getDataSets = getData.getJSONArray("groupedCapabilities"); - assertNotNull(getDataSets); - - // Check the JSON structure - int length = getDataSets.length(); - if (length > 0) - { - for (int i = 0; i < length; i++) - { - JSONObject jsonObject = getDataSets.getJSONObject(i); - String key = (String) jsonObject.keys().next(); - JSONObject value = jsonObject.getJSONObject(key); - assertNotNull(value.getString("groupTitle")); - assertNotNull(value.getJSONObject("capabilities")); - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java deleted file mode 100644 index 2573d68245..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -public class DataSetRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String GET_DATASETS_URL = "/api/rma/datasets?site=%s"; - //private static final String POST_DATASET_URL = "/api/rma/datasets/%s?site=%s"; - - /** Constant for the content type */ - //private static final String APPLICATION_JSON = "application/json"; - - /** - * Test the REST API to retrieve details of available RM data sets - * and to import an RM data set into a file plan - * - * @throws IOException - * @throws JSONException - */ - public void testGetPostDataSetAction() throws IOException, JSONException - { - /** Test GET */ - - // Format url and send request - String getUrl = String.format(GET_DATASETS_URL, siteId); - Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - - // Check the content from the response - String getContentAsString = getResponse.getContentAsString(); - assertNotNull(getContentAsString); - - // Convert the response to json and check the data - JSONObject getContentAsJson = new JSONObject(getContentAsString); - JSONObject getData = getContentAsJson.getJSONObject("data"); - assertNotNull(getData); - - // Get the data sets and check them - JSONArray getDataSets = getData.getJSONArray("datasets"); - assertNotNull(getDataSets); - - // Check the label and the id of the data sets - for (int i = 0; i < getDataSets.length(); i++) - { - JSONObject dataSet = (JSONObject) getDataSets.get(i); - assertTrue(dataSet.length() == 3); - assertNotNull(dataSet.get("label")); - assertNotNull(dataSet.get("id")); - assertNotNull(dataSet.get("isLoaded")); - } - - /** Test POST */ -// String dataSetId = getDataSets.getJSONObject(0).getString("id"); -// if (StringUtils.isNotBlank(dataSetId)) -// { -// // Format url and send request -// String url = String.format(POST_DATASET_URL, dataSetId, SITE_ID); -// Response response = sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); -// -// // Check the content from the response -// String contentAsString = response.getContentAsString(); -// assertNotNull(contentAsString); -// -// // Convert the response to json and check the result -// JSONObject contentAsJson = new JSONObject(contentAsString); -// String success = contentAsJson.getString("success"); -// assertNotNull(success); -// assertTrue(success.equals("true")); -// -// // It is not possible to import the same data set into the same file plan -// response = sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); -// -// // Check the content from the response -// contentAsString = response.getContentAsString(); -// assertNotNull(contentAsString); -// -// // Convert the response to json and check the result -// contentAsJson = new JSONObject(contentAsString); -// success = contentAsJson.getString("success"); -// assertNotNull(success); -// assertTrue(success.equals("false")); -// assertNotNull(contentAsJson.getString("message")); -// } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java deleted file mode 100644 index a6b9bbcca8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java +++ /dev/null @@ -1,447 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.text.MessageFormat; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.util.GUID; -import org.json.JSONArray; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * This class tests the Rest API for disposition related operations - * - * @author Gavin Cornwell - */ -public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel -{ - protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - protected static final String GET_SCHEDULE_URL_FORMAT = "/api/node/{0}/dispositionschedule"; - protected static final String GET_LIFECYCLE_URL_FORMAT = "/api/node/{0}/nextdispositionaction"; - protected static final String POST_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions"; - protected static final String DELETE_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions/{1}"; - protected static final String PUT_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions/{1}"; - protected static final String GET_LIST_URL = "/api/rma/admin/listofvalues"; - protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; - protected static final String APPLICATION_JSON = "application/json"; - - - public void testGetDispositionSchedule() throws Exception - { - // Test 404 status for non existent node - int expectedStatus = 404; - String nonExistentNode = "workspace/SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"; - String nonExistentUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, nonExistentNode); - Response rsp = sendRequest(new GetRequest(nonExistentUrl), expectedStatus); - - // Test 404 status for node that doesn't have dispostion schedule i.e. a record series - String seriesNodeUrl = recordSeries.toString().replace("://", "/"); - String wrongNodeUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, seriesNodeUrl); - rsp = sendRequest(new GetRequest(wrongNodeUrl), expectedStatus); - - // Test data structure returned from "AIS Audit Records" - expectedStatus = 200; - - String categoryNodeUrl = recordCategory.toString().replace("://", "/"); - String requestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - rsp = sendRequest(new GetRequest(requestUrl), expectedStatus); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - - // check JSON data - JSONObject dataObj = jsonParsedObject.getJSONObject("data"); - assertNotNull(dataObj); - JSONObject rootDataObject = (JSONObject)dataObj; - assertEquals(10, rootDataObject.length()); - - // check individual data items - String serviceUrl = SERVICE_URL_PREFIX + requestUrl; - String url = rootDataObject.getString("url"); - assertEquals(serviceUrl, url); - - String authority = rootDataObject.getString("authority"); - - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, authority); - - String instructions = rootDataObject.getString("instructions"); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, instructions); - - String actionsUrl = rootDataObject.getString("actionsUrl"); - assertEquals(serviceUrl + "/dispositionactiondefinitions", actionsUrl); - - boolean recordLevel = rootDataObject.getBoolean("recordLevelDisposition"); - assertFalse(recordLevel); - - assertFalse(rootDataObject.getBoolean("canStepsBeRemoved")); - - JSONArray actions = rootDataObject.getJSONArray("actions"); - assertNotNull(actions); - assertEquals(2, actions.length()); - JSONObject action1 = (JSONObject)actions.get(0); - assertEquals(9, action1.length()); - assertNotNull(action1.get("id")); - assertNotNull(action1.get("url")); - assertEquals(0, action1.getInt("index")); - assertEquals("cutoff", action1.getString("name")); - assertTrue(action1.getBoolean("eligibleOnFirstCompleteEvent")); - - JSONObject action2 = (JSONObject)actions.get(1); - assertEquals(8, action2.length()); - - // make sure the disposition schedule node ref is present and valid - String scheduleNodeRefJSON = rootDataObject.getString("nodeRef"); - NodeRef scheduleNodeRef = new NodeRef(scheduleNodeRefJSON); - assertTrue(this.nodeService.exists(scheduleNodeRef)); - - // create a new recordCategory node in the recordSeries and then get - // the disposition schedule - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - requestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - //System.out.println("GET response: " + rsp.getContentAsString()); - rsp = sendRequest(new GetRequest(requestUrl), expectedStatus); - - // get response as JSON - jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - System.out.println(rsp.getContentAsString()); - assertNotNull(jsonParsedObject); - - // check JSON data - dataObj = jsonParsedObject.getJSONObject("data"); - assertNotNull(dataObj); - rootDataObject = (JSONObject)dataObj; - assertEquals(8, rootDataObject.length()); - actions = rootDataObject.getJSONArray("actions"); - assertNotNull(actions); - assertEquals(0, actions.length()); - } - - public void testPostDispositionAction() throws Exception - { - // create a new recordCategory node in the recordSeries and then get - // the disposition schedule - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - String requestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); - - // Construct the JSON request. - String name = "destroy"; - String desc = "Destroy this record after 5 years"; - String period = "year|5"; - String periodProperty = "rma:cutOffDate"; - boolean eligibleOnFirstCompleteEvent = true; - - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("name", name); - jsonPostData.put("description", desc); - jsonPostData.put("period", period); - jsonPostData.put("location", "my location"); - jsonPostData.put("periodProperty", periodProperty); - jsonPostData.put("eligibleOnFirstCompleteEvent", eligibleOnFirstCompleteEvent); - JSONArray events = new JSONArray(); - events.put("superseded"); - events.put("no_longer_needed"); - jsonPostData.put("events", events); - - // Submit the JSON request. - String jsonPostString = jsonPostData.toString(); - Response rsp = sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 200); - - // check the returned data is what was expected - JSONObject jsonResponse = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONObject dataObj = jsonResponse.getJSONObject("data"); - JSONObject rootDataObject = (JSONObject)dataObj; - assertNotNull(rootDataObject.getString("id")); - assertNotNull(rootDataObject.getString("url")); - assertEquals(0, rootDataObject.getInt("index")); - assertEquals(name, rootDataObject.getString("name")); - assertEquals("Destroy", rootDataObject.getString("label")); - assertEquals(desc, rootDataObject.getString("description")); - assertEquals(period, rootDataObject.getString("period")); - assertEquals("my location", rootDataObject.getString("location")); - assertEquals(periodProperty, rootDataObject.getString("periodProperty")); - assertTrue(rootDataObject.getBoolean("eligibleOnFirstCompleteEvent")); - events = rootDataObject.getJSONArray("events"); - assertNotNull(events); - assertEquals(2, events.length()); - assertEquals("superseded", events.get(0)); - assertEquals("no_longer_needed", events.get(1)); - - // test the minimum amount of data required to create an action definition - jsonPostData = new JSONObject(); - jsonPostData.put("name", name); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 200); - - // check the returned data is what was expected - jsonResponse = new JSONObject(new JSONTokener(rsp.getContentAsString())); - dataObj = jsonResponse.getJSONObject("data"); - assertNotNull(rootDataObject.getString("id")); - assertNotNull(rootDataObject.getString("url")); - assertEquals(0, rootDataObject.getInt("index")); - assertEquals(name, dataObj.getString("name")); - assertEquals("none|0", dataObj.getString("period")); - assertFalse(dataObj.has("description")); - assertFalse(dataObj.has("periodProperty")); - assertFalse(dataObj.has("events")); - assertTrue(dataObj.getBoolean("eligibleOnFirstCompleteEvent")); - - // negative test to ensure not supplying mandatory data results in an error - jsonPostData = new JSONObject(); - jsonPostData.put("description", desc); - jsonPostData.put("period", period); - jsonPostString = jsonPostData.toString(); - sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 400); - } - - public void testPutDispositionAction() throws Exception - { - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - // create an action definition to then update - String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - String postRequestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("name", "cutoff"); - String jsonPostString = jsonPostData.toString(); - sendRequest(new PostRequest(postRequestUrl, jsonPostString, APPLICATION_JSON), 200); - - // verify the action definition is present and retrieve it's id - String getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - Response rsp = sendRequest(new GetRequest(getRequestUrl), 200); - JSONObject json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONObject actionDef = json.getJSONObject("data").getJSONArray("actions").getJSONObject(0); - String actionDefId = actionDef.getString("id"); - assertEquals("cutoff", actionDef.getString("name")); - assertEquals("none|0", actionDef.getString("period")); - assertFalse(actionDef.has("description")); - assertFalse(actionDef.has("events")); - - // define body for PUT request - String name = "destroy"; - String desc = "Destroy this record after 5 years"; - String period = "year|5"; - String location = "my location"; - String periodProperty = "rma:cutOffDate"; - boolean eligibleOnFirstCompleteEvent = false; - - jsonPostData = new JSONObject(); - jsonPostData.put("name", name); - jsonPostData.put("description", desc); - jsonPostData.put("period", period); - jsonPostData.put("location", location); - jsonPostData.put("periodProperty", periodProperty); - jsonPostData.put("eligibleOnFirstCompleteEvent", eligibleOnFirstCompleteEvent); - JSONArray events = new JSONArray(); - events.put("superseded"); - events.put("no_longer_needed"); - jsonPostData.put("events", events); - jsonPostString = jsonPostData.toString(); - - // try and update a non existent action definition to check for 404 - String putRequestUrl = MessageFormat.format(PUT_ACTIONDEF_URL_FORMAT, categoryNodeUrl, "xyz"); - rsp = sendRequest(new PutRequest(putRequestUrl, jsonPostString, APPLICATION_JSON), 404); - - // update the action definition - putRequestUrl = MessageFormat.format(PUT_ACTIONDEF_URL_FORMAT, categoryNodeUrl, actionDefId); - rsp = sendRequest(new PutRequest(putRequestUrl, jsonPostString, APPLICATION_JSON), 200); - - // check the update happened correctly - json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - actionDef = json.getJSONObject("data"); - assertEquals(name, actionDef.getString("name")); - assertEquals("Destroy", actionDef.getString("label")); - assertEquals(desc, actionDef.getString("description")); - assertEquals(period, actionDef.getString("period")); - assertEquals(location, actionDef.getString("location")); - assertEquals(periodProperty, actionDef.getString("periodProperty")); - assertFalse(actionDef.getBoolean("eligibleOnFirstCompleteEvent")); - assertEquals(2, actionDef.getJSONArray("events").length()); - assertEquals("superseded", actionDef.getJSONArray("events").getString(0)); - assertEquals("no_longer_needed", actionDef.getJSONArray("events").getString(1)); - } - - public void testDeleteDispositionAction() throws Exception - { - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - // create an action definition to then delete - String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - String postRequestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("name", "cutoff"); - String jsonPostString = jsonPostData.toString(); - sendRequest(new PostRequest(postRequestUrl, jsonPostString, APPLICATION_JSON), 200); - - // verify the action definition is present and retrieve it's id - String getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - Response rsp = sendRequest(new GetRequest(getRequestUrl), 200); - JSONObject json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - String actionDefId = json.getJSONObject("data").getJSONArray("actions").getJSONObject(0).getString("id"); - - // try and delete a non existent action definition to check for 404 - String deleteRequestUrl = MessageFormat.format(DELETE_ACTIONDEF_URL_FORMAT, categoryNodeUrl, "xyz"); - rsp = sendRequest(new DeleteRequest(deleteRequestUrl), 404); - - // now delete the action defintion created above - deleteRequestUrl = MessageFormat.format(DELETE_ACTIONDEF_URL_FORMAT, categoryNodeUrl, actionDefId); - rsp = sendRequest(new DeleteRequest(deleteRequestUrl), 200); - - // verify it got deleted - getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - rsp = sendRequest(new GetRequest(getRequestUrl), 200); - json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONArray actions = json.getJSONObject("data").getJSONArray("actions"); - assertEquals(0, actions.length()); - } - - public void testGetDispositionLifecycle() throws Exception - { - // Test 404 for disposition lifecycle request on incorrect node - String categoryUrl = recordCategory.toString().replace("://", "/"); - String requestUrl = MessageFormat.format(GET_LIFECYCLE_URL_FORMAT, categoryUrl); - Response rsp = sendRequest(new GetRequest(requestUrl), 200); - - JSONObject notFound = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertEquals(true, notFound.getJSONObject("data").getBoolean("notFound")); - - NodeRef newRecordFolder = recordFolderService.createRecordFolder(recordCategory, "recordFolder"); - - - // there should now be a disposition lifecycle for the record - requestUrl = MessageFormat.format(GET_LIFECYCLE_URL_FORMAT, newRecordFolder.toString().replace("://", "/")); - rsp = sendRequest(new GetRequest(requestUrl), 200); - System.out.println("GET : " + rsp.getContentAsString()); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - - // check mandatory stuff is present - JSONObject dataObj = jsonParsedObject.getJSONObject("data"); - assertEquals(SERVICE_URL_PREFIX + requestUrl, dataObj.getString("url")); - assertEquals("cutoff", dataObj.getString("name")); - assertFalse(dataObj.getBoolean("eventsEligible")); - assertTrue(dataObj.has("events")); - JSONArray events = dataObj.getJSONArray("events"); - assertEquals(1, events.length()); - JSONObject event1 = events.getJSONObject(0); - assertEquals("case_closed", event1.get("name")); - assertEquals("Case Closed", event1.get("label")); - assertFalse(event1.getBoolean("complete")); - assertFalse(event1.getBoolean("automatic")); - - // check stuff expected to be missing is missing - assertFalse(dataObj.has("asOf")); - assertFalse(dataObj.has("startedAt")); - assertFalse(dataObj.has("startedBy")); - assertFalse(dataObj.has("completedAt")); - assertFalse(dataObj.has("completedBy")); - assertFalse(event1.has("completedAt")); - assertFalse(event1.has("completedBy")); - } - - public void testGetListOfValues() throws Exception - { - // call the list service - Response rsp = sendRequest(new GetRequest(GET_LIST_URL), 200); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - JSONObject data = jsonParsedObject.getJSONObject("data"); - - // check dispostion actions - JSONObject actions = data.getJSONObject("dispositionActions"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/dispositionactions", actions.getString("url")); - JSONArray items = actions.getJSONArray("items"); - assertEquals(actionService.getDispositionActions().size(), items.length()); - assertTrue(items.length() > 0); - JSONObject item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - - // check events - JSONObject events = data.getJSONObject("events"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/events", events.getString("url")); - items = events.getJSONArray("items"); - assertEquals(eventService.getEvents().size(), items.length()); - assertTrue(items.length() > 0); - item = items.getJSONObject(0); - assertTrue(item.length() == 3); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - assertTrue(item.has("automatic")); - - // check period types - JSONObject periodTypes = data.getJSONObject("periodTypes"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodtypes", periodTypes.getString("url")); - items = periodTypes.getJSONArray("items"); - assertEquals(Period.getProviderNames().size()-1, items.length()); - assertTrue(items.length() > 0); - item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - - // check period properties - JSONObject periodProperties = data.getJSONObject("periodProperties"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodproperties", periodProperties.getString("url")); - items = periodProperties.getJSONArray("items"); - assertEquals(5, items.length()); - assertTrue(items.length() > 0); - item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java deleted file mode 100644 index 60c555bee1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Test for Email mapping keys - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class EmailMapKeysRestApiTest extends BaseRMWebScriptTestCase -{ - /** URLs for the REST API */ - private static final String GET_EMAIL_MAP_KEYS_URL = "/api/rma/admin/emailmapkeys"; - - /** - * Tests the REST API to get the list of email mapping keys - * - * @throws IOException - * @throws JSONException - */ - public void testGetCapabilitiesAction() throws IOException, JSONException - { - // Send request - Response response = sendRequest(new GetRequest(GET_EMAIL_MAP_KEYS_URL), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json and check the data - JSONObject contentAsJson = new JSONObject(contentAsString); - JSONObject data = contentAsJson.getJSONObject("data"); - assertNotNull(data); - - // Get the email mapping keys and check them - JSONArray dataSets = data.getJSONArray("emailmapkeys"); - assertNotNull(dataSets); - - // Check the number of email mapping keys - assertTrue(dataSets.length() == 6); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java deleted file mode 100644 index fe7dfdb0c4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -public class EmailMapScriptTest extends BaseRMWebScriptTestCase -{ - /** URLs for the REST APIs */ - public final static String URL_RM_EMAILMAP = "/api/rma/admin/emailmap"; - public final static String URL_RM_EMAILMAP_DELETE = "/api/rma/admin/emailmap/%s/%s"; - - /** Constant for the content type */ - private static final String APPLICATION_JSON = "application/json"; - - /** - * Tests the REST APIs for a custom mapping - * - * @throws IOException - * @throws JSONException - */ - public void testEmailMap() throws IOException, JSONException - { - /** Test GET */ - Response getResponse = sendRequest(new GetRequest(URL_RM_EMAILMAP), Status.STATUS_OK); - - JSONObject getResponseContent = new JSONObject(getResponse.getContentAsString()); - JSONObject getData = getResponseContent.getJSONObject("data"); - JSONArray getMappings = getData.getJSONArray("mappings"); - assertTrue(getMappings.length() == 20); - - /** Test POST */ - JSONObject newMapping = new JSONObject(); - newMapping.put("from", "messageTo"); - newMapping.put("to", "rmc:Wibble"); - - Response postResponse = sendRequest(new PostRequest(URL_RM_EMAILMAP, newMapping.toString(), APPLICATION_JSON), Status.STATUS_OK); - JSONObject postResponseContent = new JSONObject(postResponse.getContentAsString()); - JSONObject postData = postResponseContent.getJSONObject("data"); - JSONArray postMappings = postData.getJSONArray("mappings"); - - assertTrue(postMappings.length() == 21); - assertTrue(existsMapping(postMappings)); - - /** Test DELETE */ - Response deleteResponse = sendRequest(new DeleteRequest(String.format(URL_RM_EMAILMAP_DELETE, "messageTo", "rmc:Wibble")), Status.STATUS_OK); - JSONObject deleteResponseContent = new JSONObject(deleteResponse.getContentAsString()); - JSONObject deleteData = deleteResponseContent.getJSONObject("data"); - JSONArray deleteMappings = deleteData.getJSONArray("mappings"); - - assertTrue(deleteMappings.length() == 20); - assertFalse(existsMapping(deleteMappings)); - } - - /** - * Helper method for checking if a custom mapping exists - * - * @param mappings The list of available mappings - * @return true if the custom mapping exists in the list of available mappings, false otherwise - * @throws JSONException - */ - private boolean existsMapping(JSONArray mappings) throws JSONException - { - boolean result = false; - for (int i = 0; i < mappings.length(); i++) - { - String from = mappings.getJSONObject(i).getString("from"); - String to = mappings.getJSONObject(i).getString("to"); - if (from.equalsIgnoreCase("messageTo") && to.equalsIgnoreCase("rmc:Wibble")) - { - result = true; - break; - } - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java deleted file mode 100644 index 51cc262ed3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.util.GUID; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * RM event REST API test - * - * @author Roy Wetherall - */ -public class EventRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel -{ - protected static final String GET_EVENTS_URL = "/api/rma/admin/rmevents"; - protected static final String GET_EVENTTYPES_URL = "/api/rma/admin/rmeventtypes"; - protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; - protected static final String APPLICATION_JSON = "application/json"; - - protected static final String DISPLAY_LABEL = "display label"; - protected static final String EVENT_TYPE = "rmEventType.simple"; - protected static final String KEY_EVENT_NAME = "eventName"; - protected static final String KEY_EVENT_TYPE = "eventType"; - protected static final String KEY_EVENT_DISPLAY_LABEL = "eventDisplayLabel"; - - public void testGetEventTypes() throws Exception - { - Response rsp = sendRequest(new GetRequest(GET_EVENTTYPES_URL),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject types = obj.getJSONObject("data"); - assertNotNull(types); - - JSONObject type = types.getJSONObject("rmEventType.simple"); - assertNotNull(type); - assertEquals("rmEventType.simple", type.getString("eventTypeName")); - assertNotNull(type.getString("eventTypeDisplayLabel")); - - System.out.println(rspContent); - } - - public void testGetEvents() throws Exception - { - String event1 = GUID.generate(); - String event2 = GUID.generate(); - - // Create a couple or events by hand - eventService.addEvent(EVENT_TYPE, event1, DISPLAY_LABEL); - eventService.addEvent(EVENT_TYPE, event2, DISPLAY_LABEL); - - try - { - // Get the events - Response rsp = sendRequest(new GetRequest(GET_EVENTS_URL),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject roles = obj.getJSONObject("data"); - assertNotNull(roles); - - JSONObject eventObj = roles.getJSONObject(event1); - assertNotNull(eventObj); - assertEquals(event1, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - eventObj = roles.getJSONObject(event2); - assertNotNull(eventObj); - assertEquals(event2, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - } - finally - { - // Clean up - eventService.removeEvent(event1); - eventService.removeEvent(event2); - } - - } - - public void testPostEvents() throws Exception - { - String eventName= GUID.generate(); - - JSONObject obj = new JSONObject(); - obj.put(KEY_EVENT_NAME, eventName); - obj.put(KEY_EVENT_DISPLAY_LABEL, DISPLAY_LABEL); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - - Response rsp = sendRequest(new PostRequest(GET_EVENTS_URL, obj.toString(), APPLICATION_JSON),200); - try - { - String rspContent = rsp.getContentAsString(); - - JSONObject resultObj = new JSONObject(rspContent); - JSONObject eventObj = resultObj.getJSONObject("data"); - assertNotNull(eventObj); - - assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - } - finally - { - eventService.removeEvent(eventName); - } - - // Test with no event name set - obj = new JSONObject(); - obj.put(KEY_EVENT_DISPLAY_LABEL, DISPLAY_LABEL); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - rsp = sendRequest(new PostRequest(GET_EVENTS_URL, obj.toString(), APPLICATION_JSON),200); - try - { - String rspContent = rsp.getContentAsString(); - - JSONObject resultObj = new JSONObject(rspContent); - JSONObject eventObj = resultObj.getJSONObject("data"); - assertNotNull(eventObj); - - assertNotNull(eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - eventName = eventObj.getString(KEY_EVENT_NAME); - } - finally - { - eventService.removeEvent(eventName); - } - } - - public void testPutRole() throws Exception - { - String eventName = GUID.generate(); - eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); - - try - { - JSONObject obj = new JSONObject(); - obj.put(KEY_EVENT_NAME, eventName); - obj.put(KEY_EVENT_DISPLAY_LABEL, "changed"); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - - // Get the roles - Response rsp = sendRequest(new PutRequest(GET_EVENTS_URL + "/" + eventName, obj.toString(), APPLICATION_JSON),200); - String rspContent = rsp.getContentAsString(); - - JSONObject result = new JSONObject(rspContent); - JSONObject eventObj = result.getJSONObject("data"); - assertNotNull(eventObj); - - assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); - assertEquals("changed", eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - // Bad requests - obj = new JSONObject(); - obj.put(KEY_EVENT_NAME, "cheese"); - obj.put(KEY_EVENT_DISPLAY_LABEL, "whatever"); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - - sendRequest(new PutRequest(GET_EVENTS_URL + "/cheese", obj.toString(), APPLICATION_JSON), 404); - } - finally - { - // Clean up - eventService.removeEvent(eventName); - } - - } - - public void testGetRole() throws Exception - { - String eventName = GUID.generate(); - eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); - - try - { - // Get the roles - Response rsp = sendRequest(new GetRequest(GET_EVENTS_URL + "/" + eventName),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject eventObj = obj.getJSONObject("data"); - assertNotNull(eventObj); - - assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - // Bad requests - sendRequest(new GetRequest(GET_EVENTS_URL + "/cheese"), 404); - } - finally - { - // Clean up - eventService.removeEvent(eventName); - } - - } - - public void testDeleteRole() throws Exception - { - String eventName = GUID.generate(); - assertFalse(eventService.existsEvent(eventName)); - eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); - assertTrue(eventService.existsEvent(eventName)); - sendRequest(new DeleteRequest(GET_EVENTS_URL + "/" + eventName),200); - assertFalse(eventService.existsEvent(eventName)); - - // Bad request - sendRequest(new DeleteRequest(GET_EVENTS_URL + "/cheese"), 404); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java deleted file mode 100644 index e29f30b3d9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java +++ /dev/null @@ -1,929 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.util.GUID; -import org.json.JSONArray; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * - * - * @author Mark Rogers - */ -@SuppressWarnings("unused") -public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase -{ - protected final static String RM_LIST = "rmc:smListTest"; - protected final static String RM_LIST_URI_ELEM = "rmc_smListTest"; - - private static final String URL_RM_CONSTRAINTS = "/api/rma/admin/rmconstraints"; - - public void testGetRMConstraints() throws Exception - { - { - Response response = sendRequest(new GetRequest(URL_RM_CONSTRAINTS), Status.STATUS_OK); - - JSONObject top = new JSONObject(response.getContentAsString()); - System.out.println(response.getContentAsString()); - assertNotNull(top.getJSONArray("data")); - } - - /** - * Add a list, then get it back via the list rest script - */ - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - { - Response response = sendRequest(new GetRequest(URL_RM_CONSTRAINTS), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - System.out.println(response.getContentAsString()); - JSONArray data = top.getJSONArray("data"); - - boolean found = false; - assertTrue("no data returned", data.length() > 0); - for(int i = 0; i < data.length(); i++) - { - JSONObject obj = data.getJSONObject(i); - String name = (String)obj.getString("constraintName"); - assertNotNull("constraintName is null", name); - String url = (String)obj.getString("url"); - assertNotNull("detail url is null", name); - if(name.equalsIgnoreCase(RM_LIST)) - { - found = true; - } - - /** - * vallidate the detail URL returned - */ - sendRequest(new GetRequest(url), Status.STATUS_OK); - } - } - } - - /** - * - * @throws Exception - */ - public void testGetRMConstraint() throws Exception - { - /** - * Delete the list to remove any junk then recreate it. - */ - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - - createUser("fbloggs"); - createUser("jrogers"); - createUser("jdoe"); - - - List values = new ArrayList<>(); - values.add("NOFORN"); - values.add("FGI"); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); - - /** - * Positive test Get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String constraintName = data.getString("constraintName"); - assertNotNull("constraintName is null", constraintName); -// JSONArray allowedValues = data.getJSONArray("allowedValues"); - -// assertTrue("values not correct", compare(array, allowedValues)); - -// JSONArray constraintDetails = data.getJSONArray("constraintDetails"); -// -// assertTrue("details array does not contain 3 elements", constraintDetails.length() == 3); -// for(int i =0; i < constraintDetails.length(); i++) -// { -// JSONObject detail = constraintDetails.getJSONObject(i); -// } - } - - /** - * - * @throws Exception - */ - - /** - * Negative test - Attempt to get a constraint that does exist - */ - { - String url = URL_RM_CONSTRAINTS + "/" + "rmc_wibble"; - sendRequest(new GetRequest(url), Status.STATUS_NOT_FOUND); - } - - deleteUser("fbloggs"); - deleteUser("jrogers"); - deleteUser("jdoe"); - - - - - } - - /** - * Create an RM Constraint - * @throws Exception - */ - public void testUpdateRMConstraint() throws Exception - { - - String constraintName = null; - /* - * Create a new list - */ - { - String title = "test Update RM Constraint title"; - JSONArray array = new JSONArray(); - array.put("LEMON"); - array.put("BANANA"); - array.put("PEACH"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintTitle", title); - /** - * Now do a post to create a new list - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - constraintName = data.getString("constraintName"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - assertTrue("values not correct", compare(array, allowedValues)); - - } - - /** - * Now update both values and title - remove BANANA, PEACH, Add APPLE. - */ - - { - String newTitle = "this is the new title"; - JSONArray array = new JSONArray(); - array.put("LEMON"); - array.put("APPLE"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintName", constraintName); - obj.put("constraintTitle", newTitle); - - System.out.println(obj.toString()); - - /** - * Now do a post to update list - */ - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - JSONObject data = top.getJSONObject("data"); - - System.out.println(response.getContentAsString()); - - String url = data.getString("url"); - String constraintName2 = data.getString("constraintName"); - String constraintTitle = data.getString("constraintTitle"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - - assertTrue(allowedValues.length() == 2); - assertTrue("values not correct", compare(array, allowedValues)); - assertNotNull(url); - assertEquals(constraintName2, constraintName); - assertNotNull(constraintTitle); - assertEquals("title not as expected", constraintTitle, newTitle); - - // Check that data has been persisted. - Response resp2 = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top2 = new JSONObject(resp2.getContentAsString()); - System.out.println("Problem here"); - System.out.println(resp2.getContentAsString()); - JSONObject data2 = top2.getJSONObject("data"); - String constraintTitle2 = data2.getString("constraintTitle"); - JSONArray allowedValues2 = data2.getJSONArray("allowedValues"); - assertTrue("values not correct", compare(array, allowedValues2)); - assertTrue("allowedValues is not 2", allowedValues2.length() == 2); - assertEquals(constraintName2, constraintName); - assertNotNull(constraintTitle2); - assertEquals("title not as expected", constraintTitle2, newTitle); - - } - - /** - * Now put without allowed values - */ - { - String newTitle = "update with no values"; - - JSONObject obj = new JSONObject(); - - obj.put("constraintName", RM_LIST); - obj.put("constraintTitle", newTitle); - - /** - * Now do a put to update a new list - */ - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String url = data.getString("url"); - String constraintName2 = data.getString("constraintName"); - String constraintTitle = data.getString("constraintTitle"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - - assertTrue(allowedValues.length() == 2); - - assertNotNull(url); - assertEquals(constraintName2, constraintName); - assertNotNull(constraintTitle); - assertEquals("title not as expected", constraintTitle, newTitle); - } - - /** - * Now post without constraint Title - */ - { - JSONArray array = new JSONArray(); - array.put("LEMON"); - array.put("APPLE"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - - System.out.println(obj.toString()); - - /** - * Now do a Put to update the list - title should remain - */ - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - } - - /** - * Add a new value (PEAR) to the list - */ - { - JSONArray array = new JSONArray(); - array.put("PEAR"); - array.put("LEMON"); - array.put("APPLE"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - - System.out.println(obj.toString()); - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - } - - /** - * Remove a value (PEAR) from the list - */ - { - JSONArray array = new JSONArray(); - array.put("APPLE"); - array.put("LEMON"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - - System.out.println(obj.toString()); - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - } - - } - - - /** - * Create an RM Constraint - * @throws Exception - */ - public void testCreateRMConstraint() throws Exception - { - /** - * Delete the list to remove any junk then recreate it. - */ - //caveatConfigService.deleteRMConstraint(RM_LIST); - - /** - * create a new list - */ - { - JSONArray array = new JSONArray(); - array.put("NOFORN"); - array.put("FGI"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintName", RM_LIST); - obj.put("constraintTitle", GUID.generate()); - - System.out.println(obj.toString()); - - /** - * Now do a post to create a new list - */ - - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - } - - /** - * Now go and get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String constraintName = data.getString("constraintName"); - assertNotNull("constraintName is null", constraintName); - -// JSONArray constraintDetails = data.getJSONArray("constraintDetails"); -// -// assertTrue("details array does not contain 3 elements", constraintDetails.length() == 3); -// for(int i =0; i < constraintDetails.length(); i++) -// { -// JSONObject detail = constraintDetails.getJSONObject(i); -// } - } - - /** - * Now a constraint with a generated name - */ - { - String title = GUID.generate(); - JSONArray array = new JSONArray(); - array.put("Red"); - array.put("Blue"); - array.put("Green"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintTitle", title); - - System.out.println(obj.toString()); - - /** - * Now do a post to create a new list - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - // Check the response - - String url = data.getString("url"); - String constraintName = data.getString("constraintName"); - String constraintTitle = data.getString("constraintTitle"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - - assertTrue(allowedValues.length() == 3); - assertNotNull(url); - assertNotNull(constraintName); - assertNotNull(constraintTitle); - assertEquals("title not as expected", constraintTitle, title); - sendRequest(new GetRequest(url), Status.STATUS_OK); - - - } - - - /** - * Now a constraint with an empty list of values. - */ - { - JSONArray array = new JSONArray(); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintName", "rmc_whazoo"); - obj.put("constraintTitle", GUID.generate()); - - System.out.println(obj.toString()); - - /** - * Now do a post to create a new list - */ - - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - // Check the response - } - - -// /** -// * Negative tests - duplicate list -// */ -// { -// JSONArray array = new JSONArray(); -// array.put("NOFORN"); -// array.put("FGI"); -// -// JSONObject obj = new JSONObject(); -// obj.put("allowedValues", array); -// obj.put("constraintName", RM_LIST); -// obj.put("constraintTitle", "this is the title"); -// -// System.out.println(obj.toString()); -// -// /** -// * Now do a post to create a new list -// */ -// Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_CREATED); -// JSONObject top = new JSONObject(response.getContentAsString()); -// -// JSONObject data = top.getJSONObject("data"); -// System.out.println(response.getContentAsString()); -// -// // Check the response -// } - - - } - - - public void testGetRMConstraintValues() throws Exception - { - createUser("fbloggs"); - createUser("jrogers"); - createUser("jdoe"); - - /** - * Delete the list to remove any junk then recreate it. - */ - { - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - List values = new ArrayList<>(); - values.add("NOFORN"); - values.add("FGI"); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); - } - - /** - * Positive test Get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM + "/values"; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String constraintName = data.getString("constraintName"); - assertNotNull("constraintName is null", constraintName); - String constraintTitle = data.getString("constraintTitle"); - assertNotNull("constraintTitle is null", constraintTitle); - - JSONArray values = data.getJSONArray("values"); - - assertTrue("details array does not contain 2 elements", values.length() == 2); - boolean fgiFound = false; - boolean nofornFound = false; - - for(int i =0; i < values.length(); i++) - { - JSONObject value = values.getJSONObject(i); - - if(value.getString("valueName").equalsIgnoreCase("FGI")) - { - fgiFound = true; - - } - - if(value.getString("valueName").equalsIgnoreCase("NOFORN")) - { - nofornFound = true; - } - - - } - assertTrue("fgi not found", fgiFound); - assertTrue("noforn not found", nofornFound); - } - - deleteUser("fbloggs"); - deleteUser("jrogers"); - deleteUser("jdoe"); - } - - - - /** - * Update a value in a constraint - * @throws Exception - */ - public void testUpdateRMConstraintValue() throws Exception - { - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Add some data to an empty list - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("fbloggs"); - authorities.put("jdoe"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOFORN"); - valueA.put("authorities", authorities); - - values.put(valueA); - - JSONObject valueB = new JSONObject(); - valueB.put("value", "FGI"); - valueB.put("authorities", authorities); - - values.put(valueB); - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - - /** - * Do the first update - should get back - * NOFORN - fbloggs, jdoe - * FGI - fbloggs, jdoe - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("two values not found", myValues.length() == 2); - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - } - } - - /** - * Add to a new value, NOCON, fbloggs, jrogers - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("fbloggs"); - authorities.put("jrogers"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOCON"); - valueA.put("authorities", authorities); - - values.put(valueA); - - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - - /** - * Add a new value - should get back - * NOFORN - fbloggs, jdoe - * FGI - fbloggs, jdoe - * NOCON - fbloggs, jrogers - */ - System.out.println(obj.toString()); - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("three values not found", myValues.length() == 3); - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - } - } - - /** - * Add to an existing value (NOFORN, jrogers) - * should get back - * NOFORN - fbloggs, jdoe, jrogers - * FGI - fbloggs, jdoe - * NOCON - fbloggs, jrogers - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("fbloggs"); - authorities.put("jrogers"); - authorities.put("jdoe"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOFORN"); - valueA.put("authorities", authorities); - - values.put(valueA); - - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("three values not found", myValues.length() == 3); - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - } - } - - - /** - * Remove from existing value (NOCON, fbloggs) - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("jrogers"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOCON"); - valueA.put("authorities", authorities); - - values.put(valueA); - - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - - /** - * should get back - * NOFORN - fbloggs, jdoe - * FGI - fbloggs, jdoe - * NOCON - jrogers - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("three values not found", myValues.length() == 3); - boolean foundNOCON = false; - boolean foundNOFORN = false; - boolean foundFGI = false; - - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - - if(myObj.getString("valueName").equalsIgnoreCase("NOCON")) - { - foundNOCON = true; - } - if(myObj.getString("valueName").equalsIgnoreCase("NOFORN")) - { - foundNOFORN = true; - } - if(myObj.getString("valueName").equalsIgnoreCase("FGI")) - { - foundFGI = true; - } - } - - assertTrue("not found NOCON", foundNOCON); - assertTrue("not found NOFORN", foundNOFORN); - assertTrue("not found FGI", foundFGI); - } - } - - - /** - * Delete the entire constraint - * - * @throws Exception - */ - public void testDeleteRMConstraint() throws Exception - { - /** - * Delete the list to remove any junk then recreate it. - */ - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Now do a delete - */ - Response response = sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST), Status.STATUS_OK); - - /** - * Now delete the list that should have been deleted - */ - // TODO NEED TO THINK ABOUT THIS BEHAVIOUR - //{ - // sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST), Status.STATUS_NOT_FOUND); - //} - - /** - * Negative test - delete list that does not exist - */ - { - sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + "rmc_wibble"), Status.STATUS_NOT_FOUND); - } - } - - private boolean compare(JSONArray from, JSONArray to) throws Exception - { - List ret = new ArrayList<>(); - - if(from.length() != to.length()) - { - fail("arrays are different lengths" + from.length() +", " + to.length()); - return false; - } - - for(int i = 0 ; i < to.length(); i++) - { - ret.add(to.getString(i)); - } - - for(int i = 0 ; i < from.length(); i++) - { - String val = from.getString(i); - - if(ret.contains(val)) - { - - } - else - { - fail("Value not contained in list:" + val); - return false; - } - } - - return true; - } - - - /** - * Create an RM Constraint value - * @throws Exception - */ - public void testGetRMConstraintValue() throws Exception - { - - String constraintName = null; - - /* - * Create a new list - */ - { - String title = "Get Constraint Value"; - JSONArray array = new JSONArray(); - array.put("POTATO"); - array.put("CARROT"); - array.put("TURNIP"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintTitle", title); - /** - * Now do a post to create a new list - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - constraintName = data.getString("constraintName"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - assertTrue("values not correct", compare(array, allowedValues)); - } - - /** - * Get the CARROT value - */ - { - String url = URL_RM_CONSTRAINTS + "/" + constraintName + "/values/" + "CARROT"; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - } - - { - String url = URL_RM_CONSTRAINTS + "/" + constraintName + "/values/" + "ONION"; - sendRequest(new GetRequest(url), Status.STATUS_NOT_FOUND); - } - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java deleted file mode 100644 index ececf5137e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * Test of GET RM Constraint (User facing scripts) - * - * @author Mark Rogers - */ -public class RMConstraintScriptTest extends BaseRMWebScriptTestCase -{ - protected final static String RM_LIST = "rmc:smListTest"; - protected final static String RM_LIST_URI_ELEM = "rmc_smListTest"; - - private static final String URL_RM_CONSTRAINTS = "/api/rma/rmconstraints"; - - /** - * - * @throws Exception - */ - public void testGetRMConstraint() throws Exception - { - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - /** - * Delete the list to remove any junk then recreate it. - */ - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - - createUser("fbloggs"); - createUser("jrogers"); - createUser("jdoe"); - - - List values = new ArrayList<>(); - values.add("NOFORN"); - values.add("FGI"); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); - - AuthenticationUtil.setFullyAuthenticatedUser("jdoe"); - /** - * Positive test Get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - data.getJSONArray("allowedValuesForCurrentUser"); - - } - - - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - deleteUser("fbloggs"); - deleteUser("jrogers"); - deleteUser("jdoe"); - - } - -} - - diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java deleted file mode 100644 index be8bbbeec9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.util.GUID; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for adding/removing users/groups to/from a role - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmAuthoritiesRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String RM_CHILDREN_URL = "/api/rm/%s/roles/%s/authorities/%s"; - - /** Constant for the content type */ - private static final String APPLICATION_JSON = "application/json"; - - /** Constant for users and groups */ - private static final String USER_WITH_CAPABILITY = GUID.generate(); - private static final String USER_WITHOUT_CAPABILITY = GUID.generate(); - private static final String ROLE_INCLUDING_CAPABILITY = GUID.generate(); - private static final String ROLE_NOT_INCLUDING_CAPABILITY = GUID.generate(); - private static final String USER_TO_ADD_TO_ROLE = GUID.generate(); - private static final String GROUP_TO_ADD_TO_ROLE = GUID.generate(); - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#setupTestData() - */ - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - // Create test user WITH required capability - createUser(USER_WITH_CAPABILITY); - // Create test role - Set capabilities = new HashSet<>(2); - capabilities.add(capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS)); - capabilities.add(capabilityService.getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS)); - filePlanRoleService.createRole(filePlan, ROLE_INCLUDING_CAPABILITY, ROLE_INCLUDING_CAPABILITY, capabilities); - // Add user to the role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_INCLUDING_CAPABILITY, USER_WITH_CAPABILITY); - - // Create test user WITHOUT required capability - createUser(USER_WITHOUT_CAPABILITY); - // Create test role - filePlanRoleService.createRole(filePlan, ROLE_NOT_INCLUDING_CAPABILITY, ROLE_NOT_INCLUDING_CAPABILITY, new HashSet<>(1)); - // Add user to the role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_NOT_INCLUDING_CAPABILITY, USER_WITHOUT_CAPABILITY); - - // Create a test user to add to role - createUser(USER_TO_ADD_TO_ROLE); - - // Create a group to add to role - createGroup(GROUP_TO_ADD_TO_ROLE); - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // Delete test user WITH required capability - deleteUser(USER_WITH_CAPABILITY); - // Delete test role - filePlanRoleService.deleteRole(filePlan, ROLE_INCLUDING_CAPABILITY); - - // Delete test user WITHOUT required capability - deleteUser(USER_WITHOUT_CAPABILITY); - // Add user to the role - filePlanRoleService.deleteRole(filePlan, ROLE_NOT_INCLUDING_CAPABILITY); - - // Delete the user which was added to the role - deleteUser(getTestUserName()); - - // Delete the group which was added to the role - deleteGroup(getTestGroupName()); - } - - /** - * Test the REST API to add/remove a user to/from a role - * - * @throws IOException - * @throws JSONException - */ - public void testRmAddRemoveUser() throws IOException, JSONException - { - // Do the positive test with a user with the needed capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITH_CAPABILITY); - - // Get the user name - String userName = getTestUserName(); - - // Check if the user is already assigned to the role - assertFalse(getUsersAssignedToRole().contains(userName)); - - // Format url, send the request and check the content - String url = getFormattedUrlString(userName); - checkContent(postRequestSuccess(url)); - - // The user should be added to the role - assertTrue(getUsersAssignedToRole().contains(userName)); - - // Remove the user from the role and check the content - checkContent(deleteRequestSuccess(url)); - - // The user should be removed from the role - assertFalse(getUsersAssignedToRole().contains(userName)); - - // Do the negative test with a user without any capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITHOUT_CAPABILITY); - - // Send a request. The expectation is an internal server error - postRequestFailure(url); - } - - /** - * Test the REST API to add/remove a group to/from a role - * - * @throws IOException - * @throws JSONException - */ - public void testRmAddRemoveGroup() throws IOException, JSONException - { - // Do the positive test with a user with the needed capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITH_CAPABILITY); - - // Get the group name - String groupName = getTestGroupName(); - - // Check if the group is already assigned to the role - assertFalse(getGroupsAssignedToRole().contains(groupName)); - - // Format url, send the request and check the content - String url = getFormattedUrlString(groupName); - checkContent(postRequestSuccess(url)); - - // The group should be added to the role - assertTrue(getGroupsAssignedToRole().contains(groupName)); - - // Remove the group from the role and check the content - checkContent(deleteRequestSuccess(url)); - - // The user should be removed from the role - assertFalse(getGroupsAssignedToRole().contains(groupName)); - - // Do the negative test with a user without any capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITHOUT_CAPABILITY); - - // Send a request. The expectation is an internal server error - deleteRequestFailure(url); - } - - /** - * Util method to get the user name which will be added/removed to/from the role - * - * @return Returns the user name which will be added/removed to/from the role - */ - private String getTestUserName() - { - return authorityService.getName(AuthorityType.USER, USER_TO_ADD_TO_ROLE); - } - - /** - * Util method to get the group name which will be added/removed to/from the role - * - * @return Returns the user group which will be added/removed to/from the role - */ - private String getTestGroupName() - { - return authorityService.getName(AuthorityType.GROUP, GROUP_TO_ADD_TO_ROLE); - } - - /** - * Util method to get a set of groups assigned to a role - * - * @return Returns a set of groups assigned to a role - */ - private Set getGroupsAssignedToRole() - { - return filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER); - } - - /** - * Util method to get a set of users assigned to a role - * - * @return Returns a set of users assigned to a role - */ - private Set getUsersAssignedToRole() - { - return filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER); - } - - /** - * Util method to get a formatted nodeRef string - * - * @return Returns a formatted nodeRef string - */ - private String getFormattedFilePlanString() - { - StoreRef storeRef = filePlan.getStoreRef(); - String storeType = storeRef.getProtocol(); - String storeId = storeRef.getIdentifier(); - String id = filePlan.getId(); - - StringBuffer sb = new StringBuffer(32); - sb.append(storeType); - sb.append("/"); - sb.append(storeId); - sb.append("/"); - sb.append(id); - - return sb.toString(); - } - - /** - * Util method to get a formatted url string - * - * @param authorityName The name of the authority which should be added/removed to/from a role - * @return Returns a formatted url string - */ - private String getFormattedUrlString(String authorityName) - { - return String.format(RM_CHILDREN_URL, getFormattedFilePlanString(), FilePlanRoleService.ROLE_SECURITY_OFFICER, authorityName); - } - - /** - * Util method to send a post request. The expected status is success. - * - * @param url The url which should be used to make the post request - * @return Returns the response from the server - * @throws UnsupportedEncodingException - * @throws IOException - */ - private Response postRequestSuccess(String url) throws UnsupportedEncodingException, IOException - { - return sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); - } - - /** - * Util method to send a post request. The expected status is an internal server error. - * - * @param url The url which should be used to make the post request - * @return Returns the response from the server - * @throws UnsupportedEncodingException - * @throws IOException - */ - private Response postRequestFailure(String url) throws UnsupportedEncodingException, IOException - { - return sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_INTERNAL_SERVER_ERROR); - } - - /** - * Util method to send a delete request. The expected status is success. - * - * @param url The url which should be used to make the delete request - * @return Returns the response from the server - * @throws IOException - */ - private Response deleteRequestSuccess(String url) throws IOException - { - return sendRequest(new DeleteRequest(url), Status.STATUS_OK); - } - - /** - * Util method to send a delete request. The expected status is an internal server error. - * - * @param url The url which should be used to make the delete request - * @return Returns the response from the server - * @throws IOException - */ - private Response deleteRequestFailure(String url) throws IOException - { - return sendRequest(new DeleteRequest(url), Status.STATUS_INTERNAL_SERVER_ERROR); - } - - /** - * Util method to check the server response - * - * @param response The server response - * @throws UnsupportedEncodingException - */ - private void checkContent(Response response) throws UnsupportedEncodingException - { - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - assertTrue(contentAsString.contains("{}")); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java deleted file mode 100644 index f27582fe67..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Class Definitions - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmClassesRestApiTest extends BaseRMWebScriptTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** URL for the REST APIs */ - private static final String RM_ASPECTS_URL = "/api/rm/classes?cf=%s&siteId=%s"; - - /** - * Test the REST API to retrieve the list of rm aspects - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetAspectDefinitions() throws IOException, JSONException - { - // Format url and send request - String url = String.format(RM_ASPECTS_URL, "aspect", siteId); - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - JSONArray contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get a (sub)list of available dm/rm aspects - List dmAspects = getDmAspects(); - List rmAspects = getRmAspects(); - - // Get the list of rm aspects from the response and check it - List rmAspectList = new ArrayList<>(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - rmAspectList.add(name); - assertFalse(dmAspects.contains(name)); - } - assertTrue(rmAspectList.containsAll(rmAspects)); - - // Get the list of dm aspects and check them. It also contains rm related aspects. - - // Format url and send request - url = String.format(RM_ASPECTS_URL, "aspect", collabSiteId); - response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get the list of dm aspects from the response and check it - List dmAspectList = new ArrayList<>(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - dmAspectList.add(name); - } - assertTrue(dmAspectList.containsAll(dmAspects)); - // the list of dm aspescts contains also rm aspects - assertTrue(dmAspectList.containsAll(rmAspects)); - } - - /** - * Returns a (sub)list of rm aspects - * - * @return A (sub)list of rm aspects - */ - private List getRmAspects() - { - return Arrays.asList(new String[] - { - "rma:ascended", - "rma:recordMetaData", - "rma:vitalRecordDefinition" - }); - } - - /** - * Returns a (sub)list of dm aspects - * - * @return A (sub)list of dm aspects - */ - private List getDmAspects() - { - return Arrays.asList(new String[] - { - "emailserver:attached", - "bpm:assignees", - "cm:likesRatingSchemeRollups", - "wf:parallelReviewStats", - "sys:localized" - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java deleted file mode 100644 index 8d90a5b893..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Properties Definitions - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmPropertiesRestApiTest extends BaseRMWebScriptTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** URL for the REST APIs */ - private static final String RM_TYPES_URL = "/api/rm/classes?cf=%s&siteId=%s"; - - /** - * Test the REST API to retrieve the list of rm types - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetTypeDefinitions() throws IOException, JSONException - { - // Format url and send request - String url = String.format(RM_TYPES_URL, "type", siteId); - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - JSONArray contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get a (sub)list of available dm/rm types - List dmTypes = getDmTypes(); - List rmTypes = getRmTypes(); - - // Get the list of rm types from the response and check it - List rmTypeList = new ArrayList<>(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - rmTypeList.add(name); - assertFalse(dmTypes.contains(name)); - } - assertTrue(rmTypeList.containsAll(rmTypes)); - - // Get the list of dm types and check them. It also contains rm related types. - - // Format url and send request - url = String.format(RM_TYPES_URL, "type", collabSiteId); - response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get the list of dm types from the response and check it - List dmTypeList = new ArrayList<>(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - dmTypeList.add(name); - } - assertTrue(dmTypeList.containsAll(dmTypes)); - // the list of dm type contains also rm types - assertTrue(dmTypeList.containsAll(rmTypes)); - } - - /** - * Returns a (sub)list of rm types - * - * @return A (sub)list of rm types - */ - private List getRmTypes() - { - return Arrays.asList(new String[] - { - "rma:eventExecution", - "rma:nonElectronicDocument", - "rma:transfer" - }); - } - - /** - * Returns a (sub)list of dm types - * - * @return A (sub)list of dm types - */ - private List getDmTypes() - { - return Arrays.asList(new String[] - { - "cm:authority", - "sys:descriptor", - "app:folderlink", - "wf:submitGroupReviewTask", - "cmis:policy" - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java deleted file mode 100644 index 5e25d37ba6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.text.MessageFormat; -import java.util.Date; -import java.util.Map; - -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.test.util.BaseRMWebScriptTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionParams; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONStringer; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * This class tests the Rest API for RM. - * - * @author Neil McErlean - */ -public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel -{ - protected static final String GET_NODE_AUDITLOG_URL_FORMAT = "/api/node/{0}/rmauditlog"; - protected static final String GET_TRANSFER_URL_FORMAT = "/api/node/{0}/transfers/{1}"; - protected static final String TRANSFER_REPORT_URL_FORMAT = "/api/node/{0}/transfers/{1}/report"; - protected static final String REF_INSTANCES_URL_FORMAT = "/api/node/{0}/customreferences"; - protected static final String RMA_AUDITLOG_URL = "/api/rma/admin/rmauditlog"; - protected static final String RMA_AUDITLOG_STATUS_URL = "/api/rma/admin/rmauditlog/status"; - protected static final String GET_LIST_URL = "/api/rma/admin/listofvalues"; - protected static final String RMA_ACTIONS_URL = "/api/rma/actions/ExecutionQueue"; - 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"; - - private static final String BI_DI = "BiDi"; - private static final String CHILD_SRC = "childSrc"; - private static final String CHILD_TGT = "childTgt"; - - /** - * This test method ensures that a POST of an RM action to a non-existent node - * will result in a 404 status. - * - * @throws Exception - */ - public void testPostActionToNonExistentNode() throws Exception - { - NodeRef nonExistentNode = new NodeRef("workspace://SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"); - - // Construct the JSON request. - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("nodeRef", nonExistentNode.toString()); - // Although the request specifies a 'reviewed' action, it does not matter what - // action is specified here, as the non-existent Node should trigger a 404 - // before the action is executed. - jsonPostData.put("name", "reviewed"); - - // Submit the JSON request. - String jsonPostString = jsonPostData.toString(); - - final int expectedStatus = 404; - sendRequest(new PostRequest(RMA_ACTIONS_URL, jsonPostString, APPLICATION_JSON), expectedStatus); - } - - public void testPostReviewedAction() throws IOException, JSONException - { - NodeRef testRecord = utils.createRecord(recordFolder, "test.txt"); - - // In this test, this property has a date-value equal to the model import time. - Serializable pristineReviewAsOf = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - - // Construct the JSON request for 'reviewed'. - String jsonString = new JSONStringer().object() - .key("name").value("reviewed") - .key("nodeRef").value(testRecord.toString()) - // These JSON params are just to test the submission of params. They'll be ignored. - .key("params").object() - .key("param1").value("one") - .key("param2").value("two") - .endObject() - .endObject() - .toString(); - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest(RMA_ACTIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("Successfully queued action [reviewed]")); - - Serializable newReviewAsOfDate = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf, - pristineReviewAsOf.equals(newReviewAsOfDate)); - } - - public void testPostMultiReviewedAction() throws IOException, JSONException - { - NodeRef testRecord = utils.createRecord(recordFolder, "test1.txt"); - NodeRef testRecord2 = utils.createRecord(recordFolder, "test2.txt"); - NodeRef testRecord3 = utils.createRecord(recordFolder, "test3.txt"); - - // In this test, this property has a date-value equal to the model import time. - Serializable pristineReviewAsOf = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - Serializable pristineReviewAsOf2 = this.nodeService.getProperty(testRecord2, PROP_REVIEW_AS_OF); - Serializable pristineReviewAsOf3 = this.nodeService.getProperty(testRecord3, PROP_REVIEW_AS_OF); - - // Construct the JSON request for 'reviewed'. - String jsonString = new JSONStringer().object() - .key("name").value("reviewed") - .key("nodeRefs").array() - .value(testRecord.toString()) - .value(testRecord2.toString()) - .value(testRecord3.toString()) - .endArray() - // These JSON params are just to test the submission of params. They'll be ignored. - .key("params").object() - .key("param1").value("one") - .key("param2").value("two") - .endObject() - .endObject() - .toString(); - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest(RMA_ACTIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("Successfully queued action [reviewed]")); - - Serializable newReviewAsOfDate = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf, - pristineReviewAsOf.equals(newReviewAsOfDate)); - Serializable newReviewAsOfDate2 = this.nodeService.getProperty(testRecord2, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf2, - pristineReviewAsOf2.equals(newReviewAsOfDate2)); - Serializable newReviewAsOfDate3 = this.nodeService.getProperty(testRecord3, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf3, - pristineReviewAsOf3.equals(newReviewAsOfDate3)); - } - - public void testActionParams() throws Exception - { - // Construct the JSON request for 'reviewed'. - String jsonString = new JSONStringer().object() - .key("name").value("testActionParams") - .key("nodeRef").array() - .value("nothing://nothing/nothing") - .endArray() - // These JSON params are just to test the submission of params. They'll be ignored. - .key("params").object() - .key(TestActionParams.PARAM_DATE).object() - .key("iso8601") - .value(ISO8601DateFormat.format(new Date())) - .endObject() - .endObject() - .endObject() - .toString(); - - // Submit the JSON request. - final int expectedStatus = 200; - //TODO Currently failing unit test. - sendRequest(new PostRequest(RMA_ACTIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - } - - public void testPostCustomReferenceDefinitions() throws IOException, JSONException - { - postCustomReferenceDefinitions(); - } - - /** - * This method creates a child and a non-child reference and returns their generated ids. - * - * - * @return String[] with element 0 = refId of p/c ref, 1 = refId pf bidi. - */ - private String[] postCustomReferenceDefinitions() throws JSONException, IOException, - UnsupportedEncodingException { - String[] result = new String[2]; - - // 1. Child association. - String jsonString = new JSONStringer().object() - .key("referenceType").value(RelationshipType.PARENTCHILD) - .key("source").value(CHILD_SRC) - .key("target").value(CHILD_TGT) - .endObject() - .toString(); - -// System.out.println(jsonString); - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("success")); - -// System.out.println(rspContent); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String generatedChildRefId = jsonRsp.getJSONObject("data").getString("refId"); - result[0] = generatedChildRefId; - - // 2. Non-child or standard association. - jsonString = new JSONStringer().object() - .key("referenceType").value(RelationshipType.BIDIRECTIONAL) - .key("label").value(BI_DI) - .endObject() - .toString(); - -// System.out.println(jsonString); - - // Submit the JSON request. - rsp = sendRequest(new PostRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("success")); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String generatedBidiRefId = jsonRsp.getJSONObject("data").getString("refId"); - result[1] = generatedBidiRefId; - - // Now assert that both have appeared in the data dictionary. - AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); - assertNotNull("Missing customAssocs aspect", customAssocsAspect); - - QName newRefQname = adminService.getQNameForClientId(generatedChildRefId); - Map associations = customAssocsAspect.getAssociations(); - assertTrue("Custom child assoc not returned by dataDictionary.", associations.containsKey(newRefQname)); - - newRefQname = adminService.getQNameForClientId(generatedBidiRefId); - assertTrue("Custom std assoc not returned by dataDictionary.", customAssocsAspect.getAssociations().containsKey(newRefQname)); - - return result; - } - - public void testPutCustomPropertyDefinition() throws Exception - { - // POST to create a property definition with a known propId - final String propertyLabel = "Original label åçîéøü"; - String propId = postCustomPropertyDefinition(propertyLabel, null); - - // PUT an updated label. - final String updatedLabel = "Updated label πø^¨¥†®"; - String jsonString = new JSONStringer().object() - .key("label").value(updatedLabel) - .endObject() - .toString(); - - String propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; - Response rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - // GET from the URL again to ensure it's valid - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - String rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - // PUT an updated constraint ref. - final String updatedConstraint = "rmc:tlList"; - jsonString = new JSONStringer().object() - .key("constraintRef").value(updatedConstraint) - .endObject() - .toString(); - - propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; - rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewPropDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); - - // GET from the URL again to ensure it's valid - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - JSONObject customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - Object keyToSoleProp = customPropsObject.keys().next(); - - JSONObject newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); - JSONArray constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); - assertEquals("ConstraintRefsArray wrong length.", 1, constraintRefsArray.length()); - String retrievedUpdatedTitle = constraintRefsArray.getJSONObject(0).getString("name"); - assertEquals("Constraints had wrong name.", "rmc:tlList", retrievedUpdatedTitle); - - // PUT again to remove all constraints - jsonString = new JSONStringer().object() - .key("constraintRef").value(null) - .endObject() - .toString(); - - rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - // GET from the URL again to ensure it's valid - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - keyToSoleProp = customPropsObject.keys().next(); - - newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); - constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); - assertEquals("ConstraintRefsArray wrong length.", 0, constraintRefsArray.length()); - - // Finally PUT a constraint on a PropertyDefn that has been cleared of constraints. - // This was raised as an issue - final String readdedConstraint = "rmc:tlList"; - jsonString = new JSONStringer().object() - .key("constraintRef").value(readdedConstraint) - .endObject() - .toString(); - - propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; - rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); -// System.out.println("PUTting a constraint back again."); -// System.out.println(rspContent); - - // And GET from the URL again - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - keyToSoleProp = customPropsObject.keys().next(); - - newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); - constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); - assertEquals("ConstraintRefsArray wrong length.", 1, constraintRefsArray.length()); - String readdedUpdatedTitle = constraintRefsArray.getJSONObject(0).getString("name"); - assertEquals("Constraints had wrong name.", "rmc:tlList", readdedUpdatedTitle); - } - - public void testGetCustomReferences() throws IOException, JSONException - { - // Ensure that there is at least one custom reference. - postCustomReferenceDefinitions(); - - // GET all custom reference definitions - final int expectedStatus = 200; - Response rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL), expectedStatus); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray customRefsObj = (JSONArray)dataObj.get("customReferences"); - assertNotNull("JSON 'customReferences' object was null", customRefsObj); - - 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); - - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - customRefsObj = (JSONArray)dataObj.get("customReferences"); - assertNotNull("JSON 'customProperties' object was null", customRefsObj); - - assertTrue("There should be exactly 1 custom references. Found " + customRefsObj.length(), customRefsObj.length() == 1); - } - - public void testGetDodCustomTypes() throws IOException, JSONException - { - final int expectedStatus = 200; - Response rsp = sendRequest(new GetRequest("/api/rma/admin/dodcustomtypes"), expectedStatus); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - // System.out.println(rspContent); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray customTypesObj = (JSONArray)dataObj.get("dodCustomTypes"); - assertNotNull("JSON 'dodCustomTypes' object was null", customTypesObj); - - assertEquals("Wrong DOD custom types count.", 4, customTypesObj.length()); - } - - public void testGetPostAndRemoveCustomReferenceInstances() throws Exception - { - NodeRef testRecord1 = utils.createRecord(recordFolder, "testRecord1" + System.currentTimeMillis(), "The from recørd"); - NodeRef testRecord2 = utils.createRecord(recordFolder, "testRecord2" + System.currentTimeMillis(), "The to récord"); - - String node1Url = testRecord1.toString().replace("://", "/"); - String refInstancesRecord1Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node1Url); - - // Create reference types. - String[] generatedRefIds = postCustomReferenceDefinitions(); - - // Add a standard ref - String jsonString = new JSONStringer().object() - .key("toNode").value(testRecord2.toString()) - .key("refId").value(generatedRefIds[1]) - .endObject() - .toString(); - - Response rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 200); - - // Add a child ref - jsonString = new JSONStringer().object() - .key("toNode").value(testRecord2.toString()) - .key("refId").value(generatedRefIds[0]) - .endObject() - .toString(); - -// System.out.println(jsonString); - - rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 200); - -// System.out.println(rsp.getContentAsString()); - - // Now retrieve the applied references from the REST API - // 1. references on the 'from' record. - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String contentAsString = rsp.getContentAsString(); -// System.out.println(contentAsString); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); - assertNotNull("JSON 'customReferencesFrom' object was null", customRefsFromArray); - - int customRefsCount = customRefsFromArray.length(); - assertTrue("There should be at least one custom reference. Found " + customRefsFromArray, customRefsCount > 0); - - JSONArray customRefsToArray = (JSONArray)dataObj.get("customReferencesTo"); - assertNotNull("JSON 'customReferencesTo' object was null", customRefsToArray); - assertEquals("customReferencesTo wrong length.", 0, customRefsToArray.length()); - - // 2. Back-references on the 'to' record - String node2Url = testRecord2.toString().replace("://", "/"); - String refInstancesRecord2Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node2Url); - - rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); - - contentAsString = rsp.getContentAsString(); - - jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - customRefsToArray = (JSONArray)dataObj.get("customReferencesTo"); - assertNotNull("JSON 'customReferencesTo' object was null", customRefsToArray); - - customRefsCount = customRefsToArray.length(); - assertTrue("There should be at least one custom reference. Found " + customRefsToArray, customRefsCount > 0); - - customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); - assertNotNull("JSON 'customReferencesFrom' object was null", customRefsFromArray); - assertEquals("customReferencesFrom wrong length.", 0, customRefsFromArray.length()); - - - - // Now to delete a reference instance of each type - String protocol = testRecord2.getStoreRef().getProtocol(); - String identifier = testRecord2.getStoreRef().getIdentifier(); - String recId = testRecord2.getId(); - final String queryFormat = "?st={0}&si={1}&id={2}"; - String urlQueryString = MessageFormat.format(queryFormat, protocol, identifier, recId); - - rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + generatedRefIds[1] + urlQueryString), 200); - assertTrue(rsp.getContentAsString().contains("success")); - - rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" - + generatedRefIds[0] - + urlQueryString), 200); - assertTrue(rsp.getContentAsString().contains("success")); - - // Get the reference instances back and confirm they've been removed. - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); - assertNotNull("JSON 'customReferences' object was null", customRefsFromArray); - assertTrue("customRefsArray was unexpectedly not empty.", customRefsFromArray.length() == 0); - } - - public void testMob1630ShouldNotBeAbleToCreateTwoSupersedesReferencesOnOneRecordPair() throws Exception - { - // Create 2 test records. - NodeRef testRecord1 = utils.createRecord(recordFolder, "testRecord1" + System.currentTimeMillis(), "The from recørd"); - NodeRef testRecord2 = utils.createRecord(recordFolder, "testRecord2" + System.currentTimeMillis(), "The to récord"); - - String node1Url = testRecord1.toString().replace("://", "/"); - String node2Url = testRecord2.toString().replace("://", "/"); - String refInstancesRecord1Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node1Url); - String refInstancesRecord2Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node2Url); - - {// Sanity check. There should be no references defined on these new records. - Response rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = jsonRsp.getJSONObject("data"); - JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); - JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - } - - // Add a supersedes ref instance between them - final String supersedesRefLocalName = CUSTOM_REF_SUPERSEDES.getLocalName(); - String jsonString = new JSONStringer().object() - .key("toNode").value(testRecord2.toString()) - .key("refId").value(supersedesRefLocalName) - .endObject() - .toString(); - - Response rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 200); - - // The bug is that we can apply two such references which should not be allowed - rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 500); - - {// Retrieve reference instances on this pair of records. - // The first record - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = jsonRsp.getJSONObject("data"); - JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); - JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 1, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - - // The second record - the back-reference - rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); - - rspContent = rsp.getContentAsString(); - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObj = jsonRsp.getJSONObject("data"); - refsFrom = dataObj.getJSONArray("customReferencesFrom"); - refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 1, refsTo.length()); - } - - // Delete the reference instance - String protocol = testRecord2.getStoreRef().getProtocol(); - String identifier = testRecord2.getStoreRef().getIdentifier(); - String recId = testRecord2.getId(); - final String queryFormat = "?st={0}&si={1}&id={2}"; - String urlQueryString = MessageFormat.format(queryFormat, protocol, identifier, recId); - - rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + supersedesRefLocalName + urlQueryString), 200); - assertTrue(rsp.getContentAsString().contains("success")); - - {// Retrieve reference instances on this pair of records. - // The first record - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = jsonRsp.getJSONObject("data"); - JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); - JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - - // The second record - the back-reference - rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); - - rspContent = rsp.getContentAsString(); - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObj = jsonRsp.getJSONObject("data"); - refsFrom = dataObj.getJSONArray("customReferencesFrom"); - refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - } - } - - public void testPostCustomPropertyDefinition() throws Exception - { - long currentTimeMillis = System.currentTimeMillis(); - - // Create one with no propId - it'll get generated. - postCustomPropertyDefinition("customProperty" + currentTimeMillis, null); - - // Create another with an explicit propId. - postCustomPropertyDefinition("customProperty" + currentTimeMillis, "prop" + currentTimeMillis); - } - - /** - * Creates a new property definition using a POST call. - * GETs the resultant property definition. - * - * @param propertyLabel the label to use - * @param propId the propId to use - null to have one generated. - * @return the propId of the new property definition - */ - private String postCustomPropertyDefinition(String propertyLabel, String propId) throws JSONException, - IOException, UnsupportedEncodingException - { - String jsonString; - if (propId == null) - { - jsonString = new JSONStringer().object() - .key("label").value(propertyLabel) - .key("description").value("Dynamically defined test property") - .key("mandatory").value(false) - .key("dataType").value("d:text") - .key("element").value("record") - .key("constraintRef").value("rmc:smList") - // Note no propId - .endObject() - .toString(); - } - else - { - jsonString = new JSONStringer().object() - .key("label").value(propertyLabel) - .key("description").value("Dynamically defined test property") - .key("mandatory").value(false) - .key("dataType").value("d:text") - .key("element").value("record") - .key("constraintRef").value("rmc:smList") - .key("propId").value(propId) - .endObject() - .toString(); - } - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest("/api/rma/admin/custompropertydefinitions?element=record", - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewPropDef = jsonRsp.getString("url"); - String newPropId = jsonRsp.getString("propId"); - - assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); - - // GET from the URL we're given to ensure it's valid - rsp = sendRequest(new GetRequest(urlOfNewPropDef), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - JSONObject customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - Object keyToSoleProp = customPropsObject.keys().next(); - -// System.out.println("New property defn: " + keyToSoleProp); - - JSONObject newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", propertyLabel, newPropObject.getString("label")); - - return newPropId; - } - - public void testPutCustomReferenceDefinition() throws Exception - { - String[] generatedRefIds = postCustomReferenceDefinitions(); - final String pcRefId = generatedRefIds[0]; - final String bidiRefId = generatedRefIds[1]; - - // GET the custom refs in order to retrieve the label/source/target - String refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + bidiRefId; - Response rsp = sendRequest(new GetRequest(refDefnUrl), 200); - - String rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; - rsp = sendRequest(new GetRequest(refDefnUrl), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - // Update the bidirectional reference. - final String updatedBiDiLabel = "Updated label üøéîçå"; - String jsonString = new JSONStringer().object() - .key("label").value(updatedBiDiLabel) - .endObject() - .toString(); - - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + bidiRefId; - rsp = sendRequest(new PutRequest(refDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewRefDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewRefDef was null.", urlOfNewRefDef); - - // GET the bidi reference to ensure it's valid - rsp = sendRequest(new GetRequest(refDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - JSONArray customRefsObject = dataObject.getJSONArray("customReferences"); - assertNotNull("JSON customReferences object was null", customRefsObject); - assertEquals("Wrong customReferences length.", 1, customRefsObject.length()); - - JSONObject newRefObject = customRefsObject.getJSONObject(0); - assertEquals("Wrong property label.", updatedBiDiLabel, newRefObject.getString("label")); - - // Update the parent/child reference. - final String updatedPcSource = "Updated source ∆Ωç√∫"; - final String updatedPcTarget = "Updated target ∆Ωç√∫"; - jsonString = new JSONStringer().object() - .key("source").value(updatedPcSource) - .key("target").value(updatedPcTarget) - .endObject() - .toString(); - - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; - rsp = sendRequest(new PutRequest(refDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - urlOfNewRefDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewRefDef was null.", urlOfNewRefDef); - - // GET the parent/child reference to ensure it's valid - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; - - rsp = sendRequest(new GetRequest(refDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - customRefsObject = dataObject.getJSONArray("customReferences"); - assertNotNull("JSON customReferences object was null", customRefsObject); - assertEquals("Wrong customReferences length.", 1, customRefsObject.length()); - - newRefObject = customRefsObject.getJSONObject(0); - assertEquals("Wrong reference source.", updatedPcSource, newRefObject.getString("source")); - assertEquals("Wrong reference target.", updatedPcTarget, newRefObject.getString("target")); - } - - public void testGetCustomProperties() throws Exception - { - getCustomProperties(); - } - - private String getCustomProperties() throws Exception, IOException, - UnsupportedEncodingException, JSONException - { - // Ensure that there is at least one custom property. - this.testPostCustomPropertyDefinition(); - - final int expectedStatus = 200; - Response rsp = sendRequest(new GetRequest("/api/rma/admin/custompropertydefinitions?element=record"), expectedStatus); - - String contentAsString = rsp.getContentAsString(); -// System.out.println(contentAsString); - JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONObject customPropsObj = (JSONObject)dataObj.get("customProperties"); - assertNotNull("JSON 'customProperties' object was null", customPropsObj); - - final int customPropsCount = customPropsObj.length(); - assertTrue("There should be at least one custom property. Found " + customPropsObj, customPropsCount > 0); - - return contentAsString; - } - - public void testGetRecordMetaDataAspects() throws Exception - { - Response rsp = sendRequest(new GetRequest("/api/rma/recordmetadataaspects"), 200); - String contentAsString = rsp.getContentAsString(); - System.out.println(contentAsString); - JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray aspects = dataObj.getJSONArray("recordMetaDataAspects"); - assertNotNull(aspects); - assertEquals(4, aspects.length()); - - // TODO test the items themselves - } - - public void testExport() throws Exception - { - String exportUrl = "/api/rma/admin/export"; - - // define JSON POST body - JSONObject jsonPostData = new JSONObject(); - JSONArray nodeRefs = new JSONArray(); - nodeRefs.put(recordFolder.toString()); - nodeRefs.put(recordFolder2.toString()); - jsonPostData.put("nodeRefs", nodeRefs); - String jsonPostString = jsonPostData.toString(); - - // make the export request - Response rsp = sendRequest(new PostRequest(exportUrl, jsonPostString, APPLICATION_JSON), 200); - assertEquals("application/acp", rsp.getContentType()); - } - - public void testExportInTransferFormat() throws Exception - { - String exportUrl = "/api/rma/admin/export"; - - // define JSON POST body - JSONObject jsonPostData = new JSONObject(); - JSONArray nodeRefs = new JSONArray(); - nodeRefs.put(recordFolder.toString()); - nodeRefs.put(recordFolder2.toString()); - jsonPostData.put("nodeRefs", nodeRefs); - jsonPostData.put("transferFormat", true); - String jsonPostString = jsonPostData.toString(); - - // make the export request - Response rsp = sendRequest(new PostRequest(exportUrl, jsonPostString, APPLICATION_JSON), 200); - assertEquals("application/zip", rsp.getContentType()); - } - - public void testAudit() throws Exception - { - // call the list service to get audit events - Response rsp = sendRequest(new GetRequest(GET_LIST_URL), 200); - //System.out.println("GET : " + rsp.getContentAsString()); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON and check - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - JSONObject data = jsonParsedObject.getJSONObject("data"); - JSONObject events = data.getJSONObject("auditEvents"); - JSONArray items = events.getJSONArray("items"); - assertEquals(auditService.getAuditEvents().size(), items.length()); - assertTrue(items.length() > 0); - JSONObject item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - - // get the full RM audit log and check response - rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL), 200); - assertEquals("application/json", rsp.getContentType()); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // get the full RM audit log as an HTML report and check response - rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL + "?format=html"), 200); - assertEquals("text/html", rsp.getContentType()); - - // export the full RM audit log and check response - rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL + "?export=true"), 200); - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // construct the URL - String nodeUrl = recordCategory.toString().replace("://", "/"); - String auditUrl = MessageFormat.format(GET_NODE_AUDITLOG_URL_FORMAT, nodeUrl); - - // send request - rsp = sendRequest(new GetRequest(auditUrl), 200); - // check response - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // get the audit log with all restrictions in place - String filteredAuditUrl = auditUrl + "?user=gavinc&size=5&from=2009-01-01&to=2009-12-31&event=Login"; - rsp = sendRequest(new GetRequest(filteredAuditUrl), 200); - // check response - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // attempt to get the audit log with invalid restrictions in place - filteredAuditUrl = auditUrl + "?user=fred&size=abc&from=2009&to=2010&property=wrong"; - rsp = sendRequest(new GetRequest(filteredAuditUrl), 200); - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - checkAuditStatus(true); - - // start the RM audit log - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("enabled", true); - String jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PutRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - checkAuditStatus(true); - - // check the response - //System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - assertTrue(dataObj.getBoolean("enabled")); - assertTrue(dataObj.has("started")); - assertTrue(dataObj.has("stopped")); - - // stop the RM audit log - jsonPostData = new JSONObject(); - jsonPostData.put("enabled", false); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PutRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - checkAuditStatus(false); - - // check the response - //System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - assertFalse(dataObj.getBoolean("enabled")); - - // clear the RM audit log - rsp = sendRequest(new DeleteRequest(RMA_AUDITLOG_URL), 200); - //System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - assertFalse(dataObj.getBoolean("enabled")); - } - - private void checkAuditStatus(boolean expected) throws Exception - { - Response rsp = sendRequest(new GetRequest(RMA_AUDITLOG_STATUS_URL), 200); - JSONObject rspObj = new JSONObject(rsp.getContentAsString()); - JSONObject data = rspObj.getJSONObject("data"); - boolean enabled = data.getBoolean("enabled"); - assertEquals("Audit log status does not match expected status.", expected, enabled); - - } - - public void testFileAuditLogAsRecord() throws Exception - { - // Attempt to store audit log at non existent destination, make sure we get 404 - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("destination", "workspace://SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"); - String jsonPostString = jsonPostData.toString(); - Response rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 404); - - // Attempt to store audit log at wrong type of destination, make sure we get 400 - jsonPostData = new JSONObject(); - jsonPostData.put("destination", recordCategory.toString()); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 400); - - - // Store the full audit log as a record - jsonPostData = new JSONObject(); - jsonPostData.put("destination", recordFolder2); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - // check the response - System.out.println(rsp.getContentAsString()); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertTrue(jsonRsp.has("success")); - assertTrue(jsonRsp.getBoolean("success")); - assertTrue(jsonRsp.has("record")); - assertNotNull(jsonRsp.get("record")); - assertTrue(nodeService.exists(new NodeRef(jsonRsp.getString("record")))); - assertTrue(jsonRsp.has("recordName")); - assertNotNull(jsonRsp.get("recordName")); - assertTrue(jsonRsp.getString("recordName").startsWith("audit_")); - - // Store a filtered audit log as a record - jsonPostData = new JSONObject(); - jsonPostData.put("destination", recordFolder2); - jsonPostData.put("size", "50"); - jsonPostData.put("user", "gavinc"); - jsonPostData.put("event", "Update Metadata"); - jsonPostData.put("property", "{http://www.alfresco.org/model/content/1.0}modified"); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - // check the response - System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertTrue(jsonRsp.has("success")); - assertTrue(jsonRsp.getBoolean("success")); - assertTrue(jsonRsp.has("record")); - assertNotNull(jsonRsp.get("record")); - assertTrue(nodeService.exists(new NodeRef(jsonRsp.getString("record")))); - assertTrue(jsonRsp.has("recordName")); - assertNotNull(jsonRsp.get("recordName")); - assertTrue(jsonRsp.getString("recordName").startsWith("audit_")); - } - - public void testPropertyLabelWithAccentedChars() throws Exception - { - final long number = System.currentTimeMillis(); - - // Create a property with a simple name - final String simplePropId = "simpleId" + number; - postCustomPropertyDefinition("simple", simplePropId); - - // Create a property whose name has accented chars - final String originalAccentedLabel = "øoê≈çœ"; - final String accentedPropId = "accentedId" + number; - postCustomPropertyDefinition(originalAccentedLabel, accentedPropId); - - // We'll update the label on the simple-name property a few times. - // This will cause the repeated read and write of the entire RM custom model xml file - // This should also leave the accented-char property unchanged. - putCustomPropDefinition("one", simplePropId); - putCustomPropDefinition("two", simplePropId); - putCustomPropDefinition("three", simplePropId); - putCustomPropDefinition("four", simplePropId); - putCustomPropDefinition("five", simplePropId); - - // Now get all the custom properties back. - String rspContent = getCustomProperties(); - - JSONObject rspObject = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = rspObject.getJSONObject("data"); - assertNotNull("jsonObject was null", dataObj); - - JSONObject customPropertiesObj = dataObj.getJSONObject("customProperties"); - assertNotNull("customPropertiesObj was null", customPropertiesObj); - - JSONObject accentedPropertyObj = customPropertiesObj.getJSONObject(RecordsManagementCustomModel.RM_CUSTOM_PREFIX - + ":" + accentedPropId); - assertNotNull("accentedPropertyObj was null", accentedPropertyObj); - - String labelObj = accentedPropertyObj.getString("label"); - assertEquals("labelObj was changed.", originalAccentedLabel, labelObj); - } - - private void putCustomPropDefinition(String label, String id) throws JSONException, IOException, - UnsupportedEncodingException - { - String jsonString = new JSONStringer().object() - .key("label").value(label) - .endObject() - .toString(); - - String propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + id; - Response rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - String rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewPropDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java deleted file mode 100644 index ecbed7743a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.text.MessageFormat; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.util.GUID; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * This class tests the Rest API for disposition related operations - * - * @author Roy Wetherall - */ -public class RoleRestApiTest extends BaseRMWebScriptTestCase - implements RecordsManagementModel -{ - protected static final String GET_ROLES_URL_BY_SITE = "/api/rma/admin/{0}/rmroles"; - protected static final String GET_ROLES_URL_BY_FILEPLAN = "/api/rma/admin/{0}/{1}/{2}/rmroles"; - protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; - protected static final String APPLICATION_JSON = "application/json"; - - private String getRolesUrlBySite() - { - return MessageFormat.format(GET_ROLES_URL_BY_SITE, siteId); - } - - private String getRoleUrlByFilePlan() - { - return MessageFormat.format(GET_ROLES_URL_BY_FILEPLAN, filePlan.getStoreRef().getProtocol(), filePlan.getStoreRef().getIdentifier(), filePlan.getId()); - } - - public void testGetRoles() throws Exception - { - String role1 = GUID.generate(); - String role2 = GUID.generate(); - String role3 = GUID.generate(); - - // Create a couple or roles by hand - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - filePlanRoleService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5)); - - //The user can either enter a plain text label or a key to look up in a property file. - filePlanRoleService.createRole(filePlan, role3, "System Administrator", getListOfCapabilities(5)); - - // create test group - String groupName = GUID.generate(); - String group = authorityService.createAuthority(AuthorityType.GROUP, groupName, "monkey", null); - - // Add the admin user to one of the roles - filePlanRoleService.assignRoleToAuthority(filePlan, role1, "admin"); - filePlanRoleService.assignRoleToAuthority(filePlan, role1, group); - - try - { - // Get the roles (for the default file plan) - Response rsp = sendRequest(new GetRequest(getRolesUrlBySite()),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject roles = obj.getJSONObject("data"); - assertNotNull(roles); - - JSONObject roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - roleObj = roles.getJSONObject(role2); - assertNotNull(roleObj); - assertEquals(role2, roleObj.get("name")); - assertEquals("My Test Role Too", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - //Custom role with a user entered message key - roleObj = roles.getJSONObject(role3); - assertNotNull(roleObj); - assertEquals(role3, roleObj.get("name")); - assertEquals("System Administrator", roleObj.get("displayLabel")); - - // Get the roles, specifying the file plan - rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan()),200); - rspContent = rsp.getContentAsString(); - - obj = new JSONObject(rspContent); - roles = obj.getJSONObject("data"); - assertNotNull(roles); - - roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - roleObj = roles.getJSONObject(role2); - assertNotNull(roleObj); - assertEquals(role2, roleObj.get("name")); - assertEquals("My Test Role Too", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - // Get the roles for "admin" - rsp = sendRequest(new GetRequest(getRolesUrlBySite() + "?user=admin"),200); - rspContent = rsp.getContentAsString(); - - obj = new JSONObject(rspContent); - roles = obj.getJSONObject("data"); - assertNotNull(roles); - - roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - assertFalse(roles.has(role2)); - - // Get the roles including assigned authorities - rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan() + "?auths=true"),200); - rspContent = rsp.getContentAsString(); - - System.out.println(rspContent); - - obj = new JSONObject(rspContent); - roles = obj.getJSONObject("data"); - assertNotNull(roles); - - roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - JSONArray users = roleObj.getJSONArray("assignedUsers"); - assertNotNull(users); - assertEquals(1, users.length()); - - JSONArray groups = roleObj.getJSONArray("assignedGroups"); - assertNotNull(groups); - assertEquals(1, groups.length()); - - roleObj = roles.getJSONObject(role2); - assertNotNull(roleObj); - assertEquals(role2, roleObj.get("name")); - assertEquals("My Test Role Too", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - users = roleObj.getJSONArray("assignedUsers"); - assertNotNull(users); - assertEquals(0, users.length()); - - groups = roleObj.getJSONArray("assignedGroups"); - assertNotNull(groups); - assertEquals(0, groups.length()); - } - finally - { - // Clean up - filePlanRoleService.deleteRole(filePlan, role1); - filePlanRoleService.deleteRole(filePlan, role2); - } - - } - - @SuppressWarnings("unchecked") - private void checkCapabilities(JSONObject role, int expectedCount) throws JSONException - { - JSONObject capabilities = role.getJSONObject("capabilities"); - assertNotNull(capabilities); - - int count = 0; - Iterator it = capabilities.keys(); - while (it.hasNext()) - { - String key = it.next(); - assertNotNull(key); - assertNotNull(capabilities.getString(key)); - count ++; - } - - assertEquals(expectedCount, count); - } - - public void testPostRoles() throws Exception - { - Set caps = getListOfCapabilities(5); - JSONArray arrCaps = new JSONArray(); - for (Capability cap : caps) - { - arrCaps.put(cap.getName()); - } - - String roleName = GUID.generate(); - - JSONObject obj = new JSONObject(); - obj.put("name", roleName); - obj.put("displayLabel", "Display Label"); - obj.put("capabilities", arrCaps); - - Response rsp = sendRequest(new PostRequest(getRolesUrlBySite(), obj.toString(), APPLICATION_JSON),200); - try - { - String rspContent = rsp.getContentAsString(); - - JSONObject resultObj = new JSONObject(rspContent); - JSONObject roleObj = resultObj.getJSONObject("data"); - assertNotNull(roleObj); - - assertNotNull(roleObj); - assertEquals(roleName, roleObj.get("name")); - assertEquals("Display Label", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - } - finally - { - filePlanRoleService.deleteRole(filePlan, roleName); - } - - } - - public void testPutRole() throws Exception - { - String role1 = GUID.generate(); - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - - try - { - Set caps = getListOfCapabilities(4,8); - JSONArray arrCaps = new JSONArray(); - for (Capability cap : caps) - { - System.out.println(cap.getName()); - arrCaps.put(cap.getName()); - } - - JSONObject obj = new JSONObject(); - obj.put("name", role1); - obj.put("displayLabel", "Changed"); - obj.put("capabilities", arrCaps); - - // Get the roles - Response rsp = sendRequest(new PutRequest(getRolesUrlBySite() + "/" + role1, obj.toString(), APPLICATION_JSON),200); - String rspContent = rsp.getContentAsString(); - - JSONObject result = new JSONObject(rspContent); - JSONObject roleObj = result.getJSONObject("data"); - assertNotNull(roleObj); - - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("Changed", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 4); - - // Bad requests - sendRequest(new PutRequest(getRolesUrlBySite() + "/cheese", obj.toString(), APPLICATION_JSON), 404); - } - finally - { - // Clean up - filePlanRoleService.deleteRole(filePlan, role1); - } - - } - - public void testGetRole() throws Exception - { - String role1 = GUID.generate(); - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - - try - { - // Get the roles - Response rsp = sendRequest(new GetRequest(getRolesUrlBySite() + "/" + role1),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject roleObj = obj.getJSONObject("data"); - assertNotNull(roleObj); - - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - // Bad requests - sendRequest(new GetRequest(getRolesUrlBySite() + "/cheese"), 404); - } - finally - { - // Clean up - filePlanRoleService.deleteRole(filePlan, role1); - } - - } - - public void testDeleteRole() throws Exception - { - String role1 = GUID.generate(); - assertFalse(filePlanRoleService.existsRole(filePlan, role1)); - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - assertTrue(filePlanRoleService.existsRole(filePlan, role1)); - sendRequest(new DeleteRequest(getRolesUrlBySite() + "/" + role1),200); - assertFalse(filePlanRoleService.existsRole(filePlan, role1)); - - // Bad request - sendRequest(new DeleteRequest(getRolesUrlBySite() + "/cheese"), 404); - } - - private Set getListOfCapabilities(int size) - { - return getListOfCapabilities(size, 0); - } - - private Set getListOfCapabilities(int size, int offset) - { - Set result = new HashSet<>(size); - Set caps = capabilityService.getCapabilities(false); - int count = 0; - for (Capability cap : caps) - { - if (count < size+offset) - { - if (count >= offset) - { - result.add(cap); - } - } - else - { - break; - } - count ++; - } - return result; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java deleted file mode 100644 index 713cf285a6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Action Definitions - * - * @author Mark Hibbins - * @since 2.2 - */ -public class SubstitutionSuggestionsRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String RM_SUBSTITUTIONSUGGESTIONS_URL = "/api/rm/rm-substitutionsuggestions?fragment=month"; - - /** - * Test the REST API to retrieve the list of rm substitution suggestions - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetSubstitutionSuggestions() throws IOException, JSONException - { - // Send request - Response response = sendRequest(new GetRequest(RM_SUBSTITUTIONSUGGESTIONS_URL), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json and check the data - JSONObject contentAsJson = new JSONObject(contentAsString); - JSONArray data = contentAsJson.getJSONArray("substitutions"); - assertNotNull(data); - - // Get the list of rm action definitions from the response and check it - List substitutionDefinitions = getSubstitutionDefinitions(); - List rmSubstitutionDefinitions = new ArrayList<>(); - for (int i = 0; i < data.length(); i++) - { - String value = data.getString(i); - assertNotNull(value); - rmSubstitutionDefinitions.add(value); - } - assertTrue(rmSubstitutionDefinitions.containsAll(substitutionDefinitions)); - assertTrue(substitutionDefinitions.containsAll(rmSubstitutionDefinitions)); - } - - /** - * Returns a (sub)list of dm action definitions - * - * @return A (sub)list of dm action definitions - */ - private List getSubstitutionDefinitions() - { - return Arrays.asList(new String[] - { - "date.month.number", - "date.month.long", - "date.month.short", - "date.month", - "date.day.month", - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java deleted file mode 100644 index 1c33edf8f1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.system; - -import java.io.Serializable; -import java.util.ArrayList; -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.fileplan.FilePlanService; -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteRole; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ApplicationContextHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.extensions.webscripts.GUID; - -public class DataLoadSystemTest -{ - /** services */ - protected FilePlanService filePlanService; - protected RecordFolderService recordFolderService; - protected RecordService recordService; - protected TransactionService transactionService; - protected AuthorityService authorityService; - protected MutableAuthenticationService authenticationService; - protected PersonService personService; - protected FilePlanRoleService filePlanRoleService; - protected SiteService siteService; - protected FileFolderService fileFolderService; - - /** config locations */ - protected String[] getConfigLocations() - { - return new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml" - }; - } - - /** transaction batch size */ - private static final int BATCH_SIZE = 100; - - /** file plan sizing */ - private static final int ROOT_CATEGORY_COUNT = 0; - private static final int RECORD_FOLDER_COUNT = 0; - private static final int RECORD_COUNT = 0; - - /** rm user sizing */ - private static final int RM_GROUP_COUNT = 0; - private static final int RM_USER_COUNT = 0; - - /** inplace sizing */ - private static final int USER_COUNT = 0; - private static final int INPLACE_RECORD_COUNT = 5000; - - /** application context */ - private ApplicationContext applicationContext; - CommonRMTestUtils utils; - - private int totalCount; - private List recordCategories; - private List recordFolders; - private List groups; - - @Before - public void before() - { - applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); - utils = new CommonRMTestUtils(applicationContext); - - filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService"); - recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService"); - recordService = (RecordService)applicationContext.getBean("RecordService"); - transactionService = (TransactionService)applicationContext.getBean("transactionService"); - authorityService = (AuthorityService)applicationContext.getBean("authorityService"); - authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService"); - personService = (PersonService)applicationContext.getBean("personService"); - filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("filePlanRoleService"); - siteService = (SiteService)applicationContext.getBean("siteService"); - fileFolderService = (FileFolderService)applicationContext.getBean("fileFolderService"); - } - - @Test - public void loadAllData() - { - loadFilePlanData(); - loadRMUsersAndGroups(); - loadInPlace(); - } - - private void loadInPlace() - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - final SiteInfo site = siteService.getSite("test"); - if (site == null) - { - throw new AlfrescoRuntimeException("The collab site test is not present."); - } - - final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - Assert.fail("The default RM site is not present."); - } - - // create users and add to site - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - // create user - String userName = GUID.generate(); - System.out.println("Creating user " + userName); - createPerson(userName, true); - - // add to collab site - siteService.setMembership("test", userName, SiteRole.SiteCollaborator.toString()); - - return null; - } - }, USER_COUNT); - - // create content and declare as record - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - // create document - NodeRef docLib = siteService.getContainer(site.getShortName(), SiteService.DOCUMENT_LIBRARY); - NodeRef document = fileFolderService.create(docLib, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - recordService.createRecord(filePlan, document); - - return null; - } - }, INPLACE_RECORD_COUNT); - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - - private void loadRMUsersAndGroups() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - Assert.fail("The default RM site is not present."); - } - - groups = new ArrayList<>(); - - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - String groupName = GUID.generate(); - System.out.println("Creating group " + groupName); - groups.add("GROUP_" + authorityService.createAuthority(AuthorityType.GROUP, groupName)); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, groupName); - return null; - } - }, RM_GROUP_COUNT); - - for (final String group : groups) - { - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - String userName = GUID.generate(); - System.out.println("Creating user " + userName + " and adding to group " + group); - createPerson(userName, true); - authorityService.addAuthority(group, userName); - return null; - } - }, RM_USER_COUNT); - } - - return null; - } - }); - } - - private void loadFilePlanData() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - Assert.fail("The default RM site is not present."); - } - - // create root categories - recordCategories = new ArrayList<>(ROOT_CATEGORY_COUNT); - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - recordCategories.add(filePlanService.createRecordCategory(filePlan, GUID.generate())); - return null; - } - }, ROOT_CATEGORY_COUNT); - - // create record folders - recordFolders = new ArrayList<>(RECORD_FOLDER_COUNT); - for (final NodeRef recordCategory : recordCategories) - { - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - recordFolders.add(recordFolderService.createRecordFolder(recordCategory, GUID.generate())); - return null; - } - }, RECORD_FOLDER_COUNT); - } - - // create records - for (final NodeRef recordFolder : recordFolders) - { - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null); - return null; - } - }, RECORD_COUNT); - } - - - return null; - } - }); - } - - private NodeRef createPerson(String userName, boolean createAuth) - { - if (createAuth) - { - authenticationService.createAuthentication(userName, "password".toCharArray()); - } - Map properties = new HashMap<>(); - properties.put(ContentModel.PROP_USERNAME, userName); - return personService.createPerson(properties); - } - - private void repeatInTransactionBatches(final RunAsWork work, final int count) throws Exception - { - totalCount = 0; - while (totalCount < count) - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - int batchSize = count - totalCount; - if (batchSize >= BATCH_SIZE) - { - batchSize = BATCH_SIZE; - } - - for (int i = 0; i < batchSize; i++) - { - // do it - work.doWork(); - totalCount++; - } - - System.out.println("Created " + totalCount + " of " + count); - - return null; - } - }, - false, true); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java deleted file mode 100644 index 65c679d078..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.system; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -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.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; - -/** - * Notification helper (system) test - * - * @author Roy Wetherall - */ -public class NotificationServiceHelperSystemTest extends BaseRMTestCase -{ - private static final String NOTIFICATION_ROLE = "RecordsManager"; - private static final String EMAIL_ADDRESS = "roy.wetherall@alfreso.com"; - - /** Services */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Test data */ - private NodeRef record; - private List records; - private String userName; - private NodeRef person; - - @Override - protected void initServices() - { - super.initServices(); - - // Get the notification helper - notificationHelper = (RecordsManagementNotificationHelper)applicationContext.getBean("recordsManagementNotificationHelper"); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // Create a user - userName = GUID.generate(); - authenticationService.createAuthentication(userName, "".toCharArray()); - PropertyMap props = new PropertyMap(); - props.put(PROP_USERNAME, userName); - props.put(PROP_FIRSTNAME, "Test"); - props.put(PROP_LASTNAME, "User"); - props.put(PROP_EMAIL, EMAIL_ADDRESS); - person = personService.createPerson(props); - - // Find the authority for the given role - Role role = filePlanRoleService.getRole(filePlan, NOTIFICATION_ROLE); - assertNotNull("Notification role could not be retrieved", role); - String roleGroup = role.getRoleGroupName(); - assertNotNull("Notification role group can not be null.", roleGroup); - - // Add user to notification role group - authorityService.addAuthority(roleGroup, userName); - - return null; - } - }); - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Create a few test records - record = utils.createRecord(rmFolder, "recordOne"); - NodeRef record2 = utils.createRecord(rmFolder, "recordTwo"); - NodeRef record3 = utils.createRecord(rmFolder, "recordThree"); - - records = new ArrayList<>(3); - records.add(record); - records.add(record2); - records.add(record3); - } - - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // Delete the person and user - personService.deletePerson(person); - } - - public void testSendDueForReviewNotification() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - notificationHelper.recordsDueForReviewEmailNotification(records); - return null; - } - }); - } - - public void testSendSupersededNotification() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - notificationHelper.recordSupersededEmailNotification(record); - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java deleted file mode 100644 index 9ad32a185f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ /dev/null @@ -1,1032 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -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.dataset.DataSetService; -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.event.RecordsManagementEventService; -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.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; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.util.RMContainerCacheManager; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.DocumentLinkService; -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.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -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; -import org.alfresco.util.ApplicationContextHelper; -import org.alfresco.util.GUID; -import org.alfresco.util.RetryingTransactionHelperTestCase; -import org.springframework.context.ApplicationContext; - -/** - * Base test case class to use for RM unit tests. - * - * @author Roy Wetherall - */ -public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase - implements RecordsManagementModel, ContentModel, RMPermissionModel -{ - /** Application context */ - protected String[] getConfigLocations() - { - return new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:alfresco/web-scripts-application-context.xml", - "classpath:test-context.xml" - }; - } - protected ApplicationContext applicationContext; - - /** test model constants */ - protected String URI = "http://www.alfresco.org/model/rmtest/1.0"; - protected String PREFIX = "rmt"; - protected QName TYPE_CUSTOM_TYPE = QName.createQName(URI, "customType"); - 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"; - protected String NAME_DM_DOCUMENT1 = "collabDocument1.txt"; - - /** admin user */ - protected static final String ADMIN_USER = "admin"; - - /** Common test utils */ - protected CommonRMTestUtils utils; - - /** Services */ - protected NodeService nodeService; - protected ContentService contentService; - protected DictionaryService dictionaryService; - protected RetryingTransactionHelper retryingTransactionHelper; - protected PolicyComponent policyComponent; - protected NamespaceService namespaceService; - protected SearchService searchService; - protected SiteService siteService; - protected MutableAuthenticationService authenticationService; - protected AuthorityService authorityService; - protected PersonService personService; - protected TransactionService transactionService; - protected FileFolderService fileFolderService; - protected PermissionService permissionService; - protected TaggingService taggingService; - protected ActionService actionService; - protected OwnableService ownableService; - protected VersionService versionService; - protected DocumentLinkService documentLinkService; - - /** RM Services */ - protected DispositionService dispositionService; - protected RecordsManagementEventService rmEventService; - protected RecordsManagementAdminService rmAdminService; - protected RecordsManagementActionService rmActionService; - protected RecordsManagementSearchService rmSearchService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanPermissionService filePlanPermissionService; - protected CapabilityService capabilityService; - protected VitalRecordService vitalRecordService; - protected DataSetService dataSetService; - protected FreezeService freezeService; - protected RecordService recordService; - protected FilePlanService filePlanService; - protected RecordFolderService recordFolderService; - protected ExtendedSecurityService extendedSecurityService; - protected ReportService reportService; - protected RecordsManagementAuditService rmAuditService; - protected IdentifierService identifierService; - protected HoldService holdService; - protected InplaceRecordService inplaceRecordService; - protected RelationshipService relationshipService; - - /** RM Container Cache Manager */ - protected RMContainerCacheManager rmContainerCacheManager; - - /** test utils */ - protected UserAndGroupsUtils userAndGroupsUtils; - - /** test data */ - protected String siteId; - protected StoreRef storeRef; - protected NodeRef rootNodeRef; - protected SiteInfo siteInfo; - protected NodeRef folder; - protected NodeRef filePlan; - protected NodeRef rmContainer; - protected NodeRef rm_Container; - protected DispositionSchedule dispositionSchedule; - protected NodeRef rmFolder; - protected NodeRef rm_Folder; - protected NodeRef unfiledContainer; - protected String collabSiteId; - protected NodeRef holdsContainer; - protected NodeRef transfersContainer; - - /** multi-hierarchy test data - * - * |--rmRootContainer - * | - * |--mhContainer - * | - * |--mhContainer-1-1 (has schedule - folder level) - * | | - * | |--mhContainer-2-1 - * | | - * | |--mhContainer-3-1 - * | - * |--mhContainer-1-2 (has schedule - folder level) - * | - * |--mhContainer-2-2 - * | | - * | |--mhContainer-3-2 - * | | - * | |--mhContainer-3-3 (has schedule - record level) - * | - * |--mhContainer-2-3 (has schedule - folder level) - * | - * |--mhContainer-3-4 - * | - * |--mhContainer-3-5 (has schedule- record level) - */ - - protected NodeRef mhContainer; - - protected NodeRef mhContainer11; - protected DispositionSchedule mhDispositionSchedule11; - protected NodeRef mhContainer12; - protected DispositionSchedule mhDispositionSchedule12; - - protected NodeRef mhContainer21; - protected NodeRef mhContainer22; - protected NodeRef mhContainer23; - protected DispositionSchedule mhDispositionSchedule23; - - protected NodeRef mhContainer31; - protected NodeRef mhContainer32; - protected NodeRef mhContainer33; - protected DispositionSchedule mhDispositionSchedule33; - protected NodeRef mhContainer34; - protected NodeRef mhContainer35; - protected DispositionSchedule mhDispositionSchedule35; - - protected NodeRef mhRecordFolder41; - protected NodeRef mhRecordFolder42; - protected NodeRef mhRecordFolder43; - protected NodeRef mhRecordFolder44; - protected NodeRef mhRecordFolder45; - - /** test user names */ - protected String[] testUsers; - protected String userName; - protected String rmUserName; - protected String powerUserName; - protected String securityOfficerName; - protected String recordsManagerName; - protected String rmAdminName; - - /** test people */ - protected NodeRef userPerson; - protected NodeRef rmUserPerson; - protected NodeRef powerUserPerson; - protected NodeRef securityOfficerPerson; - protected NodeRef recordsManagerPerson; - protected NodeRef rmAdminPerson; - - /** test records */ - protected NodeRef recordOne; - protected NodeRef recordTwo; - protected NodeRef recordThree; - protected NodeRef recordFour; - protected NodeRef recordFive; - protected NodeRef recordDeclaredOne; - protected NodeRef recordDeclaredTwo; - - /** collaboration site artifacts */ - protected SiteInfo collaborationSite; - protected NodeRef documentLibrary; - protected NodeRef dmFolder; - protected NodeRef dmFolder1; - protected NodeRef dmDocument; - protected NodeRef dmDocument1; - - /** collaboration site users */ - protected String dmConsumer; - protected NodeRef dmConsumerNodeRef; - protected String dmContributor; - protected NodeRef dmContributorNodeRef; - protected String dmCollaborator; - protected NodeRef dmCollaboratorNodeRef; - - /** - * Indicates whether this is a RM site test or not. If true then the test RM site is created along with a basic - * file plan structure, otherwise not. - */ - protected boolean isRMSiteTest() - { - return true; - } - - /** - * Indicates whether this is a multi-hierarchy test or not. If it is then the multi-hierarchy record - * taxonomy test data is loaded. - */ - protected boolean isMultiHierarchyTest() - { - return false; - } - - /** - * Indicates whether the test users should be created or not. - */ - protected boolean isUserTest() - { - return false; - } - - /** - * Indicates whether the test records should be created or not. - */ - protected boolean isRecordTest() - { - return false; - } - - /** - * Indicates whether the test users should have filling on the file plan structure - * by default or not. - */ - protected boolean isFillingForAllUsers() - { - return false; - } - - /** - * Indicates whether the test collaboration site should be created - * or not. - */ - protected boolean isCollaborationSiteTest() - { - return false; - } - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - // Get the application context - applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); - utils = new CommonRMTestUtils(applicationContext); - userAndGroupsUtils = new UserAndGroupsUtils(applicationContext); - - // Initialise the service beans - initServices(); - - // Setup test data - setupTestData(); - - // Create multi hierarchy data - if (isMultiHierarchyTest()) - { - setupMultiHierarchyTestData(); - } - - // Create collaboration data - if (isCollaborationSiteTest()) - { - setupCollaborationSiteTestData(); - } - - // Create the users here - if (isUserTest()) - { - setupTestUsers(filePlan); - } - } - - /** - * Initialise the service beans. - */ - protected void initServices() - { - // Get services - nodeService = (NodeService)applicationContext.getBean("NodeService"); - contentService = (ContentService)applicationContext.getBean("ContentService"); - retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); - namespaceService = (NamespaceService)this.applicationContext.getBean("NamespaceService"); - searchService = (SearchService)this.applicationContext.getBean("SearchService"); - policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent"); - dictionaryService = (DictionaryService)this.applicationContext.getBean("DictionaryService"); - siteService = (SiteService)this.applicationContext.getBean("SiteService"); - authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService"); - authenticationService = (MutableAuthenticationService)this.applicationContext.getBean("AuthenticationService"); - personService = (PersonService)this.applicationContext.getBean("PersonService"); - transactionService = (TransactionService)applicationContext.getBean("TransactionService"); - fileFolderService = (FileFolderService)applicationContext.getBean("FileFolderService"); - permissionService = (PermissionService)applicationContext.getBean("PermissionService"); - taggingService = (TaggingService)applicationContext.getBean("TaggingService"); - actionService = (ActionService)applicationContext.getBean("ActionService"); - ownableService = (OwnableService)applicationContext.getBean("OwnableService"); - versionService = (VersionService)applicationContext.getBean("VersionService"); - documentLinkService = (DocumentLinkService)applicationContext.getBean("DocumentLinkService"); - - // Get RM services - dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); - rmEventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService"); - rmAdminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); - rmActionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService"); - rmSearchService = (RecordsManagementSearchService)this.applicationContext.getBean("RecordsManagementSearchService"); - filePlanRoleService = (FilePlanRoleService)this.applicationContext.getBean("FilePlanRoleService"); - filePlanPermissionService = (FilePlanPermissionService)this.applicationContext.getBean("FilePlanPermissionService"); - capabilityService = (CapabilityService)this.applicationContext.getBean("CapabilityService"); - vitalRecordService = (VitalRecordService)this.applicationContext.getBean("VitalRecordService"); - dataSetService = (DataSetService) applicationContext.getBean("DataSetService"); - freezeService = (FreezeService) applicationContext.getBean("FreezeService"); - recordService = (RecordService) applicationContext.getBean("RecordService"); - filePlanService = (FilePlanService) applicationContext.getBean("FilePlanService"); - recordFolderService = (RecordFolderService) applicationContext.getBean("RecordFolderService"); - extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService"); - reportService = (ReportService) applicationContext.getBean("ReportService"); - 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"); - - // RM Container Cache Manager - rmContainerCacheManager = (RMContainerCacheManager) applicationContext.getBean("rmContainerCacheManager"); - } - - /** - * @see junit.framework.TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // Do the tear down - AuthenticationUtil.runAsSystem(() -> - { - tearDownImpl(); - return null; - }); - - return null; - } - }); - } - - /** - * Tear down implementation - */ - protected void tearDownImpl() - { - BehaviourFilter filter = (BehaviourFilter)applicationContext.getBean("policyBehaviourFilter"); - filter.disableBehaviour(); - try - { - if (filePlan != null && nodeService.exists(filePlan)) - { - List holds = holdService.getHolds(filePlan); - for (NodeRef hold : holds) - { - holdService.deleteHold(hold); - } - } - - if (folder != null && nodeService.exists(folder)) - { - // Delete the folder - nodeService.deleteNode(folder); - } - - if (siteId != null && siteService.getSite(siteId) != null) - { - // Delete the site - siteService.deleteSite(siteId); - } - - // delete the collaboration site (if required) - if (isCollaborationSiteTest() && siteService.getSite(collabSiteId) != null) - { - siteService.deleteSite(collabSiteId); - } - - if (rmContainerCacheManager != null) - { - rmContainerCacheManager.reset(); - } - } - finally - { - filter.enableBehaviour(); - } - } - - /** - * @see org.alfresco.util.RetryingTransactionHelperTestCase#getRetryingTransactionHelper() - */ - @Override - public RetryingTransactionHelper getRetryingTransactionHelper() - { - return retryingTransactionHelper; - } - - /** - * Setup test data for tests - */ - protected void setupTestData() - { - doTestInTransaction(new Test() - { - public Void run() - { - setupTestDataImpl(); - - if (isRecordTest() && isRMSiteTest()) - { - setupTestRecords(); - } - - return null; - } - - @Override - public void test(Void result) throws Exception - { - if (isRMSiteTest()) - { - if (isRecordTest()) - { - // declare a record - utils.completeRecord(recordDeclaredOne); - utils.completeRecord(recordDeclaredTwo); - } - - // unfiled container - unfiledContainer = filePlanService.getUnfiledContainer(filePlan); - assertNotNull(unfiledContainer); - - // holds container - holdsContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdsContainer); - - // transfers container - transfersContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transfersContainer); - } - } - }, AuthenticationUtil.getAdminUserName()); - } - - /** - * Impl of test data setup - */ - protected void setupTestDataImpl() - { - storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - rootNodeRef = nodeService.getRootNode(storeRef); - - // Create folder - String containerName = "RM2_" + System.currentTimeMillis(); - Map containerProps = new HashMap<>(1); - containerProps.put(ContentModel.PROP_NAME, containerName); - folder = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, containerName), - ContentModel.TYPE_FOLDER, - containerProps).getChildRef(); - assertNotNull("Could not create base folder", folder); - - permissionService.setPermission(folder, ADMIN_USER, PermissionService.WRITE, true); - permissionService.setPermission(folder, ADMIN_USER, PermissionService.ADD_CHILDREN, true); - - if (isRMSiteTest()) - { - siteId = GUID.generate(); - siteInfo = siteService.createSite( - "rm-site-dashboard", - siteId, - "title", - "descrition", - SiteVisibility.PUBLIC, - RecordsManagementModel.TYPE_RM_SITE); - - filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - assertNotNull("Site document library container was not created successfully.", filePlan); - - // Create RM container - rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer"); - assertNotNull("Could not create rm container", rmContainer); - - rm_Container = filePlanService.createRecordCategory(filePlan, "rm Container"); - assertNotNull("Could not create rm container", rm_Container); - - // Create disposition schedule - dispositionSchedule = utils.createBasicDispositionSchedule(rmContainer); - - // Create RM folder - rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder"); - assertNotNull("Could not create rm folder", rmFolder); - - rm_Folder = recordFolderService.createRecordFolder(rm_Container, "rm Folder"); - assertNotNull("Could not create rm folder", rm_Folder); - } - } - - protected void setupTestRecords() - { - recordOne = utils.createRecord(rmFolder, "one.txt"); - recordTwo = utils.createRecord(rmFolder, "two.txt"); - recordThree = utils.createRecord(rmFolder, "three.txt"); - recordFour = utils.createRecord(rmFolder, "four.txt"); - recordFive = utils.createRecord(rmFolder, "five.txt"); - recordDeclaredOne = utils.createRecord(rmFolder, "declaredOne.txt"); - recordDeclaredTwo = utils.createRecord(rmFolder, "declaredTwo.txt"); - } - - protected void setupTestUsers(final NodeRef filePlan) - { - AuthenticationUtil.runAs(() -> - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - setupTestUsersImpl(filePlan); - return null; - } - }); - - return null; - }, - AuthenticationUtil.getAdminUserName()); - } - - /** - * - * @param filePlan - */ - protected void setupTestUsersImpl(NodeRef filePlan) - { - userName = GUID.generate(); - userPerson = createPerson(userName); - - rmUserName = GUID.generate(); - rmUserPerson = createPerson(rmUserName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, rmUserName); - - powerUserName = GUID.generate(); - powerUserPerson = createPerson(powerUserName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, powerUserName); - - securityOfficerName = GUID.generate(); - securityOfficerPerson = createPerson(securityOfficerName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER, securityOfficerName); - - recordsManagerName = GUID.generate(); - recordsManagerPerson = createPerson(recordsManagerName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, recordsManagerName); - - rmAdminName = GUID.generate(); - rmAdminPerson = createPerson(rmAdminName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, rmAdminName); - - testUsers = new String[] - { - userName, - rmUserName, - powerUserName, - securityOfficerName, - recordsManagerName, - rmAdminName - }; - - if (isFillingForAllUsers()) - { - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(filePlan, user, FILING); - filePlanPermissionService.setPermission(rmContainer, user, FILING); - filePlanPermissionService.setPermission(rmFolder, user, FILING); - filePlanPermissionService.setPermission(unfiledContainer, user, FILING); - } - } - } - - /** - * Util method to create a person. - * @param userName user name - * @return NodeRef user node reference - */ - protected NodeRef createPerson(String userName, boolean createAuth) - { - if (createAuth) - { - authenticationService.createAuthentication(userName, "password".toCharArray()); - } - Map properties = new HashMap<>(); - properties.put(ContentModel.PROP_USERNAME, userName); - properties.put(ContentModel.PROP_FIRSTNAME, userName); - return personService.createPerson(properties); - } - - protected NodeRef createPerson(String userName) - { - return createPerson(userName, true); - } - - /** - * Setup multi hierarchy test data - */ - protected void setupMultiHierarchyTestData() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - return AuthenticationUtil.runAsSystem(() -> - { - // Do setup - setupMultiHierarchyTestDataImpl(); - - return null; - }); - } - }); - } - - /** - * Impl of multi hierarchy test data - */ - protected void setupMultiHierarchyTestDataImpl() - { - // Create root mh container - mhContainer = filePlanService.createRecordCategory(filePlan, "mhContainer"); - - // Level 1 - mhContainer11 = filePlanService.createRecordCategory(mhContainer, "mhContainer11"); - mhDispositionSchedule11 = utils.createBasicDispositionSchedule(mhContainer11, "ds11", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); - mhContainer12 = filePlanService.createRecordCategory(mhContainer, "mhContainer12"); - mhDispositionSchedule12 = utils.createBasicDispositionSchedule(mhContainer12, "ds12", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); - - // Level 2 - mhContainer21 = filePlanService.createRecordCategory(mhContainer11, "mhContainer21"); - mhContainer22 = filePlanService.createRecordCategory(mhContainer12, "mhContainer22"); - mhContainer23 = filePlanService.createRecordCategory(mhContainer12, "mhContainer23"); - mhDispositionSchedule23 = utils.createBasicDispositionSchedule(mhContainer23, "ds23", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); - - // Level 3 - mhContainer31 = filePlanService.createRecordCategory(mhContainer21, "mhContainer31"); - mhContainer32 = filePlanService.createRecordCategory(mhContainer22, "mhContainer32"); - mhContainer33 = filePlanService.createRecordCategory(mhContainer22, "mhContainer33"); - mhDispositionSchedule33 = utils.createBasicDispositionSchedule(mhContainer33, "ds33", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true); - mhContainer34 = filePlanService.createRecordCategory(mhContainer23, "mhContainer34"); - mhContainer35 = filePlanService.createRecordCategory(mhContainer23, "mhContainer35"); - mhDispositionSchedule35 = utils.createBasicDispositionSchedule(mhContainer35, "ds35", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true); - - // Record folders - mhRecordFolder41 = recordFolderService.createRecordFolder(mhContainer31, "mhFolder41"); - mhRecordFolder42 = recordFolderService.createRecordFolder(mhContainer32, "mhFolder42"); - mhRecordFolder43 = recordFolderService.createRecordFolder(mhContainer33, "mhFolder43"); - mhRecordFolder44 = recordFolderService.createRecordFolder(mhContainer34, "mhFolder44"); - mhRecordFolder45 = recordFolderService.createRecordFolder(mhContainer35, "mhFolder45"); - } - - protected void setupCollaborationSiteTestData() - { - doTestInTransaction(new Test() - { - public Void run() - { - setupCollaborationSiteTestDataImpl(); - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - protected void setupCollaborationSiteTestDataImpl() - { - // create collaboration site - collabSiteId = GUID.generate(); - collaborationSite = siteService.createSite("site-dashboard", collabSiteId, "title", "description", SiteVisibility.PRIVATE); - documentLibrary = SiteServiceImpl.getSiteContainer( - collabSiteId, - SiteService.DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary); - - // 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(); - dmFolder1 = fileFolderService.create(documentLibrary, "collabFolder1", ContentModel.TYPE_FOLDER).getNodeRef(); - dmDocument1 = fileFolderService.create(dmFolder1, NAME_DM_DOCUMENT1, ContentModel.TYPE_CONTENT).getNodeRef(); - - dmConsumer = GUID.generate(); - dmConsumerNodeRef = createPerson(dmConsumer); - siteService.setMembership(collabSiteId, dmConsumer, SiteModel.SITE_CONSUMER); - - dmContributor = GUID.generate(); - dmContributorNodeRef = createPerson(dmContributor); - siteService.setMembership(collabSiteId, dmContributor, SiteModel.SITE_CONTRIBUTOR); - - dmCollaborator = GUID.generate(); - dmCollaboratorNodeRef = createPerson(dmCollaborator); - siteService.setMembership(collabSiteId, dmCollaborator, SiteModel.SITE_COLLABORATOR); - } - - /** - * Override to ensure the tests are run as the 'admin' user by default. - */ - - @Override - protected A doTestInTransaction(Test test) - { - return super.doTestInTransaction(test, AuthenticationUtil.getAdminUserName()); - } - - @Override - protected void doTestInTransaction(FailureTest test) - { - super.doTestInTransaction(test, AuthenticationUtil.getAdminUserName()); - } - - /** - * Helper class to try and simplify {@link Void} tests. - * - * @author Roy Wetherall - * @since 2.1 - */ - protected abstract class VoidTest extends Test - { - @Override - public Void run() throws Exception - { - runImpl(); - return null; - } - - public abstract void runImpl() throws Exception; - - @Override - public void test(Void result) throws Exception - { - testImpl(); - } - - public void testImpl() throws Exception - { - // empty implementation - } - } - - /** - * Execute behaviour driven test. - * - * @param test - */ - protected void doBehaviourDrivenTest(BehaviourDrivenTest test) - { - try - { - test.run(); - } - catch (Exception exception) - { - throw new RuntimeException(exception); - } - } - - /** - * Behaviour driven test. - * - * @author Roy Wetherall - * @since 2.2 - */ - 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() - { - } - - public BehaviourDrivenTest(Class expectedException) - { - 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) - { - this.runInTransactionTests = runInTransactionTests; - if (runAsUser != null) - { - this.runAsUser = runAsUser; - } - } - - public BehaviourDrivenTest(Class expectedException, String runAsUser, boolean runInTransactionTests) - { - this.expectedException = expectedException; - this.runAsUser = runAsUser; - this.runInTransactionTests = runInTransactionTests; - } - - public void given() throws Exception { /** empty implementation */ } - - public void when() throws Exception { /** empty implementation */ } - - public void then() throws Exception { /** empty implementation */ } - - public void after() throws Exception { /** empty implementation */ } - - public void run() throws Exception - { - try - { - if (runInTransactionTests) - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - given(); - } - }, runAsUser); - } - else - { - given(); - } - - if (expectedException == null) - { - if (runInTransactionTests) - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - when(); - } - }, runAsUser); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - then(); - } - }, runAsUser); - } - else - { - when(); - then(); - } - } - else - { - doTestInTransaction(new FailureTest(expectedException) - { - @Override - public void run() throws Exception - { - when(); - } - }, runAsUser); - } - } - finally - { - if (runInTransactionTests) - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - after(); - } - }, runAsUser); - } - else - { - after(); - } - } - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java deleted file mode 100644 index 74249cb061..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; -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.event.RecordsManagementEventService; -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.model.rma.type.RmSiteType; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.repository.Period; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PersonService; -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.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; -import org.springframework.context.ApplicationContext; - -/** - * @author Roy Wetherall - */ -public class BaseRMWebScriptTestCase extends BaseWebScriptTest -{ - /** Common test utils */ - protected CommonRMTestUtils utils; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** Services */ - protected NodeService nodeService; - protected ContentService contentService; - protected DictionaryService dictionaryService; - protected RetryingTransactionHelper retryingTransactionHelper; - protected PolicyComponent policyComponent; - protected NamespaceService namespaceService; - protected SearchService searchService; - protected SiteService siteService; - protected MutableAuthenticationService authenticationService; - protected AuthorityService authorityService; - protected PersonService personService; - protected TransactionService transactionService; - protected TaggingService taggingService; - - /** RM Services */ - protected DispositionService dispositionService; - protected RecordsManagementEventService eventService; - protected RecordsManagementAdminService adminService; - protected RecordsManagementActionService actionService; - protected RecordsManagementSearchService rmSearchService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanPermissionService filePlanPermissionService; - protected RecordsManagementAuditService auditService; - protected CapabilityService capabilityService; - protected VitalRecordService vitalRecordService; - protected FilePlanService filePlanService; - protected RecordFolderService recordFolderService; - protected RMCaveatConfigService caveatConfigService; - - /** test data */ - protected String siteId; - protected StoreRef storeRef; - protected NodeRef rootNodeRef; - protected SiteInfo siteInfo; - protected NodeRef folder; - protected NodeRef filePlan; - protected NodeRef recordSeries; // A category with no disposition schedule - protected NodeRef recordCategory; - protected DispositionSchedule dispositionSchedule; - protected NodeRef recordFolder; - protected NodeRef recordFolder2; - protected String collabSiteId; - - /** admin user name */ - protected static final String ADMIN_USER = "admin"; - - /** - * Indicates whether the test collaboration site should be created - * or not. - */ - protected boolean isCollaborationSiteTest() - { - return false; - } - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - // Initialise the service beans - initServices(); - - // Setup test data - setupTestData(); - } - - /** - * Initialise the service beans. - */ - protected void initServices() - { - applicationContext = getServer().getApplicationContext(); - - // Common test utils - utils = new CommonRMTestUtils(applicationContext); - - // Get services - nodeService = (NodeService)applicationContext.getBean("NodeService"); - contentService = (ContentService)applicationContext.getBean("ContentService"); - retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); - namespaceService = (NamespaceService)applicationContext.getBean("NamespaceService"); - searchService = (SearchService)applicationContext.getBean("SearchService"); - policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent"); - dictionaryService = (DictionaryService)applicationContext.getBean("DictionaryService"); - siteService = (SiteService)applicationContext.getBean("SiteService"); - authorityService = (AuthorityService)applicationContext.getBean("AuthorityService"); - authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService"); - personService = (PersonService)applicationContext.getBean("PersonService"); - transactionService = (TransactionService)applicationContext.getBean("TransactionService"); - taggingService = (TaggingService)applicationContext.getBean("TaggingService"); - - // Get RM services - dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); - eventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService"); - adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); - actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); - rmSearchService = (RecordsManagementSearchService)applicationContext.getBean("RecordsManagementSearchService"); - filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService"); - filePlanPermissionService = (FilePlanPermissionService)applicationContext.getBean("FilePlanPermissionService"); - auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService"); - capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); - vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService"); - filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService"); - recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService"); - caveatConfigService = (RMCaveatConfigService)applicationContext.getBean("CaveatConfigService"); - } - - /** - * @see junit.framework.TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - // Do the tear down - tearDownImpl(); - - return null; - } - }); - } - - /** - * Tear down implementation - */ - protected void tearDownImpl() - { - // Delete the folder - nodeService.deleteNode(folder); - - // Delete the site - siteService.deleteSite(siteId); - - // Delete the collaboration site (if required) - if (isCollaborationSiteTest()) - { - siteService.deleteSite(collabSiteId); - } - } - - /** - * Setup test data for tests - */ - protected void setupTestData() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - setupTestDataImpl(); - return null; - } - }); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, ADMIN_USER); - - return null; - } - }); - } - - /** - * Impl of test data setup - */ - protected void setupTestDataImpl() - { - storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - rootNodeRef = nodeService.getRootNode(storeRef); - - // Create folder - String containerName = "RM2_" + System.currentTimeMillis(); - Map containerProps = new HashMap<>(1); - containerProps.put(ContentModel.PROP_NAME, containerName); - folder = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, containerName), - ContentModel.TYPE_FOLDER, - containerProps).getChildRef(); - assertNotNull("Could not create base folder", folder); - - // Create the site - siteId = getRMSiteId(); - siteInfo = siteService.createSite("rm-site-dashboard", siteId, "title", "descrition", SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE); - filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - assertNotNull("Site document library container was not created successfully.", filePlan); - - recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries"); - assertNotNull("Could not create record category with no disposition schedule", recordSeries); - - recordCategory = filePlanService.createRecordCategory(recordSeries, "rmContainer"); - assertNotNull("Could not create record category", recordCategory); - - // Make vital record - vitalRecordService.setVitalRecordDefintion(recordCategory, true, new Period("week|1")); - - // Create disposition schedule - dispositionSchedule = utils.createBasicDispositionSchedule(recordCategory); - - // Create RM folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, "rmFolder"); - assertNotNull("Could not create rm folder", recordFolder); - recordFolder2 = recordFolderService.createRecordFolder(recordCategory, "rmFolder2"); - assertNotNull("Could not create rm folder 2", recordFolder2); - - // Create collaboration data - if (isCollaborationSiteTest()) - { - setupCollaborationSiteTestData(); - } - } - - protected void setupCollaborationSiteTestData() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - setupCollaborationSiteTestDataImpl(); - - return null; - } - }); - } - - protected void setupCollaborationSiteTestDataImpl() - { - // create collaboration site - collabSiteId = GUID.generate(); - siteService.createSite("preset", collabSiteId, "title", "description", SiteVisibility.PRIVATE); - NodeRef documentLibrary = SiteServiceImpl.getSiteContainer( - collabSiteId, - SiteService.DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary); - } - - protected void createUser(String userName) - { - if (!authenticationService.authenticationExists(userName)) - { - authenticationService.createAuthentication(userName, "PWD".toCharArray()); - - PropertyMap ppOne = new PropertyMap(4); - ppOne.put(ContentModel.PROP_USERNAME, userName); - ppOne.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, "title" + userName); - ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); - ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); - ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); - ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - - personService.createPerson(ppOne); - } - } - - protected void deleteUser(String userName) - { - if (authenticationService.authenticationExists(userName)) - { - personService.deletePerson(userName); - } - } - - protected void createGroup(String groupName) - { - if (!authorityService.authorityExists(groupName)) - { - authorityService.createAuthority(AuthorityType.GROUP, groupName); - } - } - - protected void deleteGroup(String groupName) - { - if (authorityService.authorityExists(groupName)) - { - authorityService.deleteAuthority(groupName, true); - } - } - - protected String getRMSiteId() - { - return GUID.generate(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java deleted file mode 100644 index 523ebaf9a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java +++ /dev/null @@ -1,469 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.alfresco.util.GUID.generate; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -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.action.RecordsManagementActionService; -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.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -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.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -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.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang3.StringUtils; -import org.springframework.context.ApplicationContext; - -/** - * Common RM test utility methods. - * - * @author Roy Wetherall - */ -public class CommonRMTestUtils implements RecordsManagementModel -{ - /** - * test values - */ - public static final String DEFAULT_DISPOSITION_AUTHORITY = "disposition authority"; - public static final String DEFAULT_DISPOSITION_INSTRUCTIONS = "disposition instructions"; - public static final String DEFAULT_DISPOSITION_DESCRIPTION = "disposition action description"; - public static final String DEFAULT_EVENT_NAME = "case_closed"; - public static final String PERIOD_NONE = "none|0"; - public static final String PERIOD_IMMEDIATELY = "immediately|0"; - public static final String PERIOD_ONE_WEEK = "week|1"; - public static final String PERIOD_ONE_YEAR = "year|1"; - public static final String PERIOD_THREE_YEARS = "year|3"; - private DispositionService dispositionService; - private NodeService nodeService; - private ContentService contentService; - private RecordsManagementActionService actionService; - private ModelSecurityService modelSecurityService; - private FilePlanRoleService filePlanRoleService; - private CapabilityService capabilityService; - private RecordService recordService; - private HoldService holdService; - - /** - * Constructor - * - * @param applicationContext application context - */ - public CommonRMTestUtils(ApplicationContext applicationContext) - { - dispositionService = (DispositionService) applicationContext.getBean("DispositionService"); - nodeService = (NodeService) applicationContext.getBean("NodeService"); - contentService = (ContentService) applicationContext.getBean("ContentService"); - actionService = (RecordsManagementActionService) applicationContext.getBean("RecordsManagementActionService"); - modelSecurityService = (ModelSecurityService) applicationContext.getBean("ModelSecurityService"); - filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); - capabilityService = (CapabilityService) applicationContext.getBean("CapabilityService"); - recordService = (RecordService) applicationContext.getBean("RecordService"); - holdService = (HoldService) applicationContext.getBean("HoldService"); - } - - /** - * Create a disposition schedule - * - * @param container record category - * @return {@link DispositionSchedule} created disposition schedule node reference - */ - public DispositionSchedule createBasicDispositionSchedule(NodeRef container) - { - return createBasicDispositionSchedule(container, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true); - } - - /** - * Create test disposition schedule - */ - public DispositionSchedule createBasicDispositionSchedule( - NodeRef container, - String dispositionInstructions, - String dispositionAuthority, - boolean isRecordLevel, - boolean defaultDispositionActions) - { - return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false); - } - - /** - * Create test disposition schedule - */ - public DispositionSchedule createDispositionSchedule( - NodeRef container, - String dispositionInstructions, - String dispositionAuthority, - boolean isRecordLevel, - boolean defaultDispositionActions, - boolean extendedDispositionSchedule) - { - return createDispositionSchedule( - container, - dispositionInstructions, - dispositionAuthority, - isRecordLevel, - defaultDispositionActions, - extendedDispositionSchedule, - DEFAULT_EVENT_NAME); - } - - /** - * Create test disposition schedule - */ - public DispositionSchedule createDispositionSchedule( - NodeRef container, - String dispositionInstructions, - String dispositionAuthority, - boolean isRecordLevel, - boolean defaultDispositionActions, - boolean extendedDispositionSchedule, - String defaultEvent) - { - Map dsProps = new HashMap<>(3); - dsProps.put(PROP_DISPOSITION_AUTHORITY, dispositionAuthority); - dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, dispositionInstructions); - dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, isRecordLevel); - DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(container, dsProps); - - if (defaultDispositionActions) - { - Map adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); - - List events = new ArrayList<>(1); - events.add(defaultEvent); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable) events); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - - if (extendedDispositionSchedule) - { - adParams = new HashMap<>(4); - adParams.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_PERIOD, PERIOD_IMMEDIATELY); - adParams.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - } - - adParams = new HashMap<>(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_PERIOD, PERIOD_IMMEDIATELY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - } - - return dispositionSchedule; - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name) - { - return createRecord(recordFolder, name, null, "Some test content"); - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of the record - * @param title title of the record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name, String title) - { - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_TITLE, title); - return createRecord(recordFolder, name, props, "Some test content"); - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of record - * @param properties properties of the record - * @param content content of the record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name, Map properties, String content) - { - // Create the record - NodeRef record = createRecordImpl(recordFolder, name, properties); - - // Set the content - ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(content); - - return record; - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of record - * @param properties properties of the record - * @param content content of the record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name, Map properties, String mimetype, InputStream content) - { - // Create the record - NodeRef record = createRecordImpl(recordFolder, name, properties); - - // Set the content - ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(mimetype); - writer.setEncoding("UTF-8"); - writer.putContent(content); - - return record; - } - - /** - * Helper to consolidate creation of contentless record - */ - private NodeRef createRecordImpl(NodeRef recordFolder, String name, Map properties) - { - // Create the document - if (properties == null) - { - properties = new HashMap<>(1); - } - if (!properties.containsKey(ContentModel.PROP_NAME)) - { - properties.put(ContentModel.PROP_NAME, name); - } - return nodeService.createNode(recordFolder, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), - ContentModel.TYPE_CONTENT, - properties).getChildRef(); - } - - /** - * Helper method to create a non-electronic record in a record folder. - * - * @param recordFolder record folder - * @param name name of the non-electronic record - * @param title title of the non-electronic record - * @return {@link NodeRef} non-electronic record node reference - */ - public NodeRef createNonElectronicRecord(NodeRef recordFolder, String name, String title) - { - Map props = new HashMap<>(1); - props.put(ContentModel.PROP_TITLE, title); - props.put(ContentModel.PROP_NAME, name); - - // Create the document - NodeRef record = nodeService.createNode(recordFolder, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), - RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT, - props).getChildRef(); - return record; - } - - /** - * Helper method to complete record. - */ - public void completeRecord(final NodeRef record) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - modelSecurityService.setEnabled(false); - try - { - nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date()); - nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue"); - actionService.executeRecordsManagementAction(record, "declareRecord"); - } - finally - { - modelSecurityService.setEnabled(true); - } - - return null; - } - - }, AuthenticationUtil.getAdminUserName()); - - } - - public void closeFolder(final NodeRef recordFolder) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - modelSecurityService.setEnabled(false); - try - { - actionService.executeRecordsManagementAction(recordFolder, "closeRecordFolder"); - } - finally - { - modelSecurityService.setEnabled(true); - } - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - public Role createRole(NodeRef filePlan, String roleName, String... capabilityNames) - { - Set capabilities = new HashSet<>(capabilityNames.length); - for (String name : capabilityNames) - { - Capability capability = capabilityService.getCapability(name); - if (capability == null) - { - throw new AlfrescoRuntimeException("capability " + name + " not found."); - } - capabilities.add(capability); - } - - return filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - } - - /** - * Helper method to complete event on disposable item - * - * @param disposableItem disposable item (record or record folder) - * @param eventName event name - */ - public void completeEvent(NodeRef disposableItem, String eventName) - { - // build action properties - Map params = new HashMap<>(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, eventName); - - // complete event - actionService.executeRecordsManagementAction(disposableItem, CompleteEventAction.NAME, params); - } - - /** - * Helper method to create a hold. - * - * @param holdName hold name - * @param holdReason hold reason - * @return NodeRef hold node reference - */ - public NodeRef createHold(NodeRef filePlan, String holdName, String holdReason) - { - return holdService.createHold(filePlan, holdName, holdReason, generate()); - } - - /** - * Helper method to delete a hold. - * - * @param nodeRef hold node reference - */ - public void deleteHold(NodeRef nodeRef) - { - holdService.deleteHold(nodeRef); - } - - /** - * Util method to add content to a hold. - * - * @param holdNodeRef hold node reference - * @param contentNodeRef content node reference - */ - public void addItemToHold(NodeRef holdNodeRef, NodeRef contentNodeRef) - { - holdService.addToHold(holdNodeRef, contentNodeRef); - } - - /** - * Util method to remove content from a hold. - * - * @param holdNodeRef hold node reference - * @param contentNodeRef content node reference - */ - public void removeItemFromHold(NodeRef holdNodeRef, NodeRef contentNodeRef) - { - holdService.removeFromHold(holdNodeRef, contentNodeRef); - } - - /** - * Util method to remove items from holds. - * - * @param holdNodeRefs the list {@link NodeRef}s of the holds - * @param contentNodeRef the list of items which will be removed from the given holds - */ - public void removeItemsFromHolds(List holdNodeRefs, List contentNodeRef) - { - holdService.removeFromHolds(holdNodeRefs, contentNodeRef); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java deleted file mode 100644 index 31992316c8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.Group; - -/** - * Utility test case to generate a report of the capabilities in the system. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class GenerateCapabilityReport extends BaseRMTestCase -{ - public void testGetCapability() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - FileWriter writer = new FileWriter("c:\\mywork\\capabilityReport.csv"); - BufferedWriter out = new BufferedWriter(writer); - try - { - Set capabilities = capabilityService.getCapabilities(true); - for (Capability capability : capabilities) - { - Group group = capability.getGroup(); - String groupId = "none"; - if (group != null) - { - groupId = group.getId(); - } - - out.write(groupId); - out.write(","); - out.write(capability.getName()); - out.write(","); - out.write(Boolean.toString(capability.isPrivate())); - out.write("\n"); - } - } - finally - { - out.close(); - } - - return null; - } - }); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java deleted file mode 100644 index 82434715d5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.util.ApplicationContextHelper; -import org.alfresco.util.RetryingTransactionHelperTestCase; -import org.springframework.context.ApplicationContext; - -/** - * Base unit test for a simple retrying transaction helper test case. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RetryingTransactionHelperBaseTest extends RetryingTransactionHelperTestCase -{ - /** Application context */ - protected static final String[] CONFIG_LOCATIONS = new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml" - }; - protected ApplicationContext applicationContext; - - /** retrying transaction helper */ - protected RetryingTransactionHelper retryingTransactionHelper; - - /** - * @see org.alfresco.util.RetryingTransactionHelperTestCase#getRetryingTransactionHelper() - */ - @Override - public RetryingTransactionHelper getRetryingTransactionHelper() - { - return retryingTransactionHelper; - } - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - // Get the application context - applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); - - // get the retrying transaction helper - retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java deleted file mode 100644 index a98977e3c4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -public class TestAction extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testAction"; - public static final String PARAM = "testActionParam"; - public static final String PARAM_VALUE = "value"; - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (!action.getParameterValue(PARAM).equals(PARAM_VALUE)) - { - throw new RuntimeException("Unexpected parameter value. Expected " + PARAM_VALUE + " actual " + action.getParameterValue(PARAM)); - } - this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_RECORD, null); - } - - @Override - public boolean isDispositionAction() - { - return true; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java deleted file mode 100644 index f42453f58f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -public class TestAction2 extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testAction2"; - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // Do nothing - } - - @Override - public boolean isDispositionAction() - { - return false; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java deleted file mode 100644 index 46729da2e1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -public class TestActionParams extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testActionParams"; - public static final String PARAM_DATE = "paramDate"; - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - Object dateValue = action.getParameterValue(PARAM_DATE); - if (!(dateValue instanceof java.util.Date)) - { - throw new AlfrescoRuntimeException("Param was not a Date as expected."); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java deleted file mode 100644 index e2b1399cd9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -public class TestActionPropertySubs extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testActionPropertySubs"; - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl("dayShort", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayShort2", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayLong", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayNumber", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayYear", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthShort", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthShort2", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthLong", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthNumber", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearShort", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearShort2", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearLong", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearWeek", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("name", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("company", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("combo", DataTypeDefinition.TEXT, false, "")); - } - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - Date date = new Date(); - String dayShort = new SimpleDateFormat("EE").format(date); - String dayLong = new SimpleDateFormat("EEEE").format(date); - String dayNumber = new SimpleDateFormat("uu").format(date); - String dayYear = new SimpleDateFormat("DDD").format(date); - String monthShort = new SimpleDateFormat("MMM").format(date); - String monthLong = new SimpleDateFormat("MMMM").format(date); - String monthNumber = new SimpleDateFormat("MM").format(date); - 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 company = I18NUtil.getMessage("test.company"); - - assertEquals(dayShort, (String) action.getParameterValue("dayShort")); - assertEquals(dayShort, (String) action.getParameterValue("dayShort2")); - assertEquals(dayLong, (String) action.getParameterValue("dayLong")); - assertEquals(dayNumber, (String) action.getParameterValue("dayNumber")); - assertEquals(dayYear, (String) action.getParameterValue("dayYear")); - assertEquals(monthShort, (String) action.getParameterValue("monthShort")); - assertEquals(monthShort, (String) action.getParameterValue("monthShort2")); - assertEquals(monthLong, (String) action.getParameterValue("monthLong")); - assertEquals(monthNumber, (String) action.getParameterValue("monthNumber")); - assertEquals(yearShort, (String) action.getParameterValue("yearShort")); - assertEquals(yearShort, (String) action.getParameterValue("yearShort2")); - assertEquals(yearLong, (String) action.getParameterValue("yearLong")); - assertEquals(yearWeek, (String) action.getParameterValue("yearWeek")); - assertEquals(name, (String)action.getParameterValue("name")); - assertEquals(company, (String)action.getParameterValue("company")); - assertEquals(yearLong + "/" + monthShort + "/" + name + "-" + company +".txt", (String) action.getParameterValue("combo")); - } - - private void assertEquals(String expected, String actual) - { - if (!expected.equals(actual)) - { - throw new AlfrescoRuntimeException("Expected value " + expected + " does not match actual value " + actual); - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java deleted file mode 100644 index af809e6d23..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.io.File; - -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser522022M; - -/** - * Test Content Cleanser - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class TestContentCleanser extends ContentCleanser522022M -{ - private boolean hasCleansed = false; - - public void reset() - { - hasCleansed = false; - } - - public boolean hasCleansed() - { - return hasCleansed; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) - */ - @Override - public void cleanse(File file) - { - hasCleansed = false; - super.cleanse(file); - hasCleansed = true; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java deleted file mode 100644 index 25ddca8b9f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.util.List; - -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.repository.NodeRef; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -public class TestDmAction extends ActionExecuterAbstractBase -{ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - } - - @Override - protected void addParameterDefinitions(List paramDefs) - { - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java deleted file mode 100644 index f397be8c13..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.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"); - public static final QName NOT_RM_FOLDER_TYPE = QName.createQName(TEST_URI, "notRmFolderType"); -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java deleted file mode 100644 index 75c2bc6e3b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.alfresco.service.cmr.repository.NodeRef; - -public interface TestService -{ - void testMethodOne(NodeRef nodeRef); - - void testMethodTwo(NodeRef nodeRef); - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java deleted file mode 100644 index cf3620dc04..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -public class TestServiceImpl extends ServiceBaseImpl implements TestService -{ - @Override - public void testMethodOne(NodeRef nodeRef) - { - } - - @Override - public void testMethodTwo(NodeRef nodeRef) - { - } - - public boolean doInstanceOf(NodeRef nodeRef, QName ofClassName) - { - return instanceOf(nodeRef, ofClassName); - } - - public int doGetNextCount(NodeRef nodeRef) - { - return getNextCount(nodeRef); - } - - public Set doGetTypeAndApsects(NodeRef nodeRef) - { - return getTypeAndApsects(nodeRef); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java deleted file mode 100644 index b4316daffe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.alfresco.repo.security.authentication.AuthenticationException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.security.AuthenticationService; -import org.alfresco.util.EqualsHelper; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.extensions.webscripts.TestWebScriptServer; - -/** - * Stand-alone Web Script Test Server - * - * @author davidc - */ -public class TestWebScriptRepoServer extends TestWebScriptServer -{ - /** - * Main entry point. - */ - public static void main(String[] args) - { - try - { - TestWebScriptServer testServer = getTestServer(); - AuthenticationUtil.setRunAsUserSystem(); - testServer.rep(); - } - catch(Throwable e) - { - StringWriter strWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(strWriter); - e.printStackTrace(printWriter); - System.out.println(strWriter.toString()); - } - finally - { - System.exit(0); - } - } - - private final static String[] CONFIG_LOCATIONS = new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:alfresco/web-scripts-application-context.xml", - "classpath:alfresco/web-scripts-application-context-test.xml" - }; - - /** A static reference to the application context being used */ - private static ClassPathXmlApplicationContext ctx; - private static String appendedTestConfiguration; - - private RetryingTransactionHelper retryingTransactionHelper; - private AuthenticationService authenticationService; - - - /** - * Sets helper that provides transaction callbacks - */ - public void setTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @param authenticationService - */ - public void setAuthenticationService(AuthenticationService authenticationService) - { - this.authenticationService = authenticationService; - } - - /** - * Get default user name - */ - protected String getDefaultUserName() - { - return AuthenticationUtil.getAdminUserName(); - } - - /** - * {@inheritDoc #getTestServer(String)} - */ - public static TestWebScriptServer getTestServer() - { - return getTestServer(null); - } - - /** - * Start up a context and get the server bean. - *

- * This method will close and restart the application context only if the configuration has - * changed. - * - * @param appendTestConfigLocation additional context file to include in the application context - * @return Test Server - */ - public static synchronized TestWebScriptServer getTestServer(String appendTestConfigLocation) - { - if (TestWebScriptRepoServer.ctx != null) - { - boolean configChanged = !EqualsHelper.nullSafeEquals( - appendTestConfigLocation, - TestWebScriptRepoServer.appendedTestConfiguration); - if (configChanged) - { - // The config changed, so close the context (it'll be restarted later) - try - { - ctx.close(); - ctx = null; - } - catch (Throwable e) - { - throw new RuntimeException("Failed to shut down existing application context", e); - } - } - else - { - // There is already a context with the required configuration - } - } - - // Check if we need to start/restart the context - if (TestWebScriptRepoServer.ctx == null) - { - // Restart it - final String[] configLocations; - if (appendTestConfigLocation == null) - { - configLocations = CONFIG_LOCATIONS; - } - else - { - configLocations = new String[CONFIG_LOCATIONS.length+1]; - System.arraycopy(CONFIG_LOCATIONS, 0, configLocations, 0, CONFIG_LOCATIONS.length); - configLocations[CONFIG_LOCATIONS.length] = appendTestConfigLocation; - } - TestWebScriptRepoServer.ctx = new ClassPathXmlApplicationContext(configLocations); - TestWebScriptRepoServer.appendedTestConfiguration = appendTestConfigLocation; - } - - // Get the bean - TestWebScriptServer testServer = (org.alfresco.repo.web.scripts.TestWebScriptRepoServer)TestWebScriptRepoServer.ctx.getBean("webscripts.test"); - return testServer; - } - - /** - * Interpret a single command using the BufferedReader passed in for any data needed. - * - * @param line The unparsed command - * @return The textual output of the command. - */ - @Override - protected String interpretCommand(final String line) - throws IOException - { - try - { - if (username.startsWith("TICKET_")) - { - try - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - public Object execute() throws Exception - { - authenticationService.validate(username); - return null; - } - }); - return executeCommand(line); - } - finally - { - authenticationService.clearCurrentSecurityContext(); - } - } - } - catch(AuthenticationException e) - { - executeCommand("user " + getDefaultUserName()); - } - - // execute command in context of currently selected user - return AuthenticationUtil.runAs(new RunAsWork() - { - @SuppressWarnings("synthetic-access") - public String doWork() throws Exception - { - return executeCommand(line); - } - }, username); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java deleted file mode 100644 index a8a8eb2c5b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/UserAndGroupsUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.junit.Assert.assertNotNull; - -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.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.springframework.context.ApplicationContext; - -/** - * Test utils class containing methods for managing user, groups and roles - * - * @author Ana Manolache - * @since 2.6 - */ -public class UserAndGroupsUtils -{ - protected FilePlanRoleService filePlanRoleService; - protected AuthorityService authorityService; - - /** - * @param applicationContext the application context - */ - public UserAndGroupsUtils(ApplicationContext applicationContext) - { - filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); - authorityService = (AuthorityService) applicationContext.getBean("AuthorityService"); - } - - /** - * Add a user to an RM role - * - * @param userName the username of the user to add to the role - * @param role the role to add the user to - */ - public void addUserToRole(NodeRef filePlan, String userName, RMRole role) - { - // Find the authority for the given role - Role roleObj = filePlanRoleService.getRole(filePlan, role.getGroupName()); - assertNotNull("Notification role " + role.getGroupName() + " could not be retrieved", roleObj); - String roleGroup = roleObj.getRoleGroupName(); - assertNotNull("Notification role group " + roleGroup + " can not be null.", roleGroup); - - // Add user to notification role group - authorityService.addAuthority(roleGroup, userName); - } - - /** - * An enum of RM Roles - */ - public enum RMRole - { - RM_ADMINISTRATOR("Administrator"), - RM_MANAGER("RecordsManager"), - RM_POWER_USER("PowerUser"), - RM_SECURITY_OFFICER("SecurityOfficer"), - RM_USER("User"); - - private String groupName; - - private RMRole(String groupName) - { - this.groupName = groupName; - } - - public String getGroupName() - { - return this.groupName; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java deleted file mode 100644 index 42f60fefbc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.util.bdt; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; - -/** - * Helper class that provides an simple way to write behaviour integration tests. - *

- * Note that initBehaviourTest() must be called before given() is called. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class BehaviourTest -{ - /** retrying transaction helper */ - private static RetryingTransactionHelper retryingTransactionHelper; - - /** current execution user */ - private String asUser = AuthenticationUtil.getAdminUserName(); - - /** - * Initialise behaviour tests for execution with retrying transaction helper - * - * @param retryingTransactionHelper retrying transaction helper - */ - public static void initBehaviourTests(RetryingTransactionHelper retryingTransactionHelper) - { - BehaviourTest.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * Start a test - * - * @return BehaviourTest new test instance - */ - public static BehaviourTest test() - { - return new BehaviourTest(); - } - - /** - * Helper method to get the retrying transaction helper - * - * @return RetryingTransactionHelper retrying transaction helper - */ - /*package*/ RetryingTransactionHelper getRetryingTransactionHelper() - { - return retryingTransactionHelper; - } - - /** - * Helper method to get the execution user - * - * @return String execution user - */ - /* package*/ String getAsUser() - { - return asUser; - } - - /** - * Helper method to switch the current execution user to admin. - * - * @return BehaviourTest test instance - */ - public BehaviourTest asAdmin() - { - return as(AuthenticationUtil.getAdminUserName()); - } - - /** - * Set execution user - * - * @param asUser execution user - * @return BehaviourTest test instance - */ - public BehaviourTest as(String asUser) - { - this.asUser = asUser; - return this; - } - - /** - * Given. - *

- * Used to group together given conditions. - * - * @return BehaviourTest test instance - */ - public BehaviourTest given() - { - return this; - } - - /** - * Given. - *

- * Performs work. - * - * @param given work to do - * @return BehaviourTest test instance - */ - public BehaviourTest given(Work given) - { - return perform(given); - } - - /** - * When. - *

- * Used to group together when actions. - * - * @return BehaviourTest test instance - */ - public BehaviourTest when() - { - return this; - } - - /** - * When. - *

- * Performs work. - * - * @param when work to do - * @return BehaviourTest test instance - */ - public BehaviourTest when(Work when) - { - return perform(when); - } - - /** - * Then. - *

- * Used to group together then actions. - * - * @return BehaviourTest test instance - */ - public BehaviourTest then() - { - return this; - } - - /** - * Then. - *

- * Performs work. - * - * @param then work to do - * @return BehaviourTest test instance - */ - public BehaviourTest then(Work then) - { - return perform(then); - } - - /** - * Expect a value. - * - * @param value value - * @return ExpectedValue expected value evaluator - */ - public ExpectedValue expect(boolean value) - { - return new ExpectedValue<>(this, value); - } - - /** - * Expect a value. - * - * @param value value - * @return ExpectedValue expected value evaluator - */ - public ExpectedValue expect(String value) - { - return new ExpectedValue<>(this, value); - } - - /** - * Expect a value. - * - * @param value value - * @return ExpectedValue expected value evaluator - */ - public ExpectedValue expect(Object value) - { - return new ExpectedValue<>(this, value); - } - - - /** - * Expect a failure. - * - * @param exceptionClass expected exception - * @return ExpectedFailure expected failure evaluator - */ - public ExpectedFailure expectException(Class exceptionClass) - { - return new ExpectedFailure(this, exceptionClass); - } - - /** - * Perform work a number of times - * - * @param count number of times to perform the work - * @param work work to perform - * @return BehaviourTest test instance - */ - public BehaviourTest perform(int count, Work work) - { - for (int i = 0; i < count; i++) - { - perform(work); - } - - return this; - } - - /** - * Perform work - * - * @param work work to perform - * @return BehaviourTest test instance - */ - public BehaviourTest perform(Work work) - { - return AuthenticationUtil.runAs(() -> - { - return retryingTransactionHelper.doInTransaction(() -> - { - work.doIt(); - return this; - }); - }, - this.asUser); - } - - /** - * Work Interface - */ - public interface Work - { - /** - * Do the work. - */ - void doIt() throws Exception; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java deleted file mode 100644 index ec598fa20c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.util.bdt; - -import static org.junit.Assert.fail; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; - -import org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.Work; - -/** - * Expected failure. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class ExpectedFailure -{ - private static final String MESSAGE = "Expected failure \"{0}\" was not observed."; - - private BehaviourTest test; - private Set> exceptionClasses; - private Work work; - - @SafeVarargs - public ExpectedFailure(BehaviourTest test, Class ...exceptionClasses) - { - this.test = test; - this.exceptionClasses = Arrays.stream(exceptionClasses).collect(Collectors.toSet()); - } - - public ExpectedFailure from(Work work) - { - this.work = work; - return this; - } - - public BehaviourTest because(String message) - { - try - { - test.perform(work); - } - catch(Exception actualException) - { - boolean found = false; - - for (Class exceptionClass : exceptionClasses) - { - if (exceptionClass.isAssignableFrom(actualException.getClass())) - { - found = true; - } - } - - if (!found) - { - fail(MessageFormat.format(MESSAGE, message)); - } - } - - return test; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java b/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java deleted file mode 100644 index 8d4a14d4b4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.test.util.bdt; - -import static org.junit.Assert.assertEquals; - -import java.text.MessageFormat; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; - -/** - * Expected value. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class ExpectedValue -{ - private static final String MESSAGE = "Expected value outcome \"{0}\" was not observed."; - - private T expectedValue; - private Evaluation evaluation; - private BehaviourTest test; - - public ExpectedValue(BehaviourTest test, T value) - { - this.expectedValue = value; - this.test = test; - } - - public ExpectedValue from(Evaluation evaluation) - { - this.evaluation = evaluation; - return this; - } - - public BehaviourTest because(String message) - { - T actualValue = (T)AuthenticationUtil.runAs(() -> - { - return test.getRetryingTransactionHelper().doInTransaction(() -> - { - return evaluation.eval(); - }); - }, - test.getAsUser()); - - if (message != null) - { - message = MessageFormat.format(MESSAGE, message); - } - - assertEquals(message, expectedValue, actualValue); - - return test; - } - - public interface Evaluation - { - T eval() throws Exception; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties b/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties deleted file mode 100644 index 0e1e0079dc..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties +++ /dev/null @@ -1,2 +0,0 @@ -rm.methodsecurity.org.alfresco.module.org_alfresco_module_rm.test.util.TestService.testMethodOne=RM_ALLOW -rm.methodsecurity.org.alfresco.module.org_alfresco_module_rm.test.util.TestService.*=RM_DENY \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/test/content/Image.jpg b/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/test/content/Image.jpg deleted file mode 100644 index 78704a099b..0000000000 Binary files a/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/test/content/Image.jpg and /dev/null differ diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/version.properties b/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/version.properties deleted file mode 100644 index c9f05c7210..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/alfresco/version.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Alfresco version information -# - -# Version label -version.major=7 -version.minor=0 -version.revision=0 -version.label= - -# Edition label -version.edition=Community - -# SCM Revision number -version.scmrevision=@scm-path@-r@scm-revision@ - -# Build number -version.build=r@scm-revision@-b@build-number@ \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl b/amps/ags/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl deleted file mode 100644 index 0572542e70..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl +++ /dev/null @@ -1,39 +0,0 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2021 Alfresco Software Limited - %% - This file is part of the Alfresco software. - - - If the software was purchased under a paid Alfresco license, the terms of - the paid license agreement will prevail. Otherwise, the software is - provided under the following open source license terms: - - - Alfresco is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - Alfresco is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - - You should have received a copy of the GNU Lesser General Public License - along with Alfresco. If not, see . - #L% ---> -<#macro pagedResults data> - "total": ${data.total?c}, - "pageSize": ${data.pageSize?c}, - "startIndex": ${data.startIndex?c}, - "itemCount": ${data.itemCount?c}, - "items": - [ - <#list data.items as item> - <#nested item> - <#if item_has_next>, - - ] - diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/test-context.xml b/amps/ags/rm-community/rm-community-repo/test/resources/test-context.xml deleted file mode 100644 index 0e6459074d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/test-context.xml +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - - test-model.xml - - - - - - - - - - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - 0 30 3 * * ? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.test.util.TestService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - Search - - - ${index.subsystem.name} - - - - manager - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/test-filePlan.xml b/amps/ags/rm-community/rm-community-repo/test/resources/test-filePlan.xml deleted file mode 100644 index 89054370b1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/test-filePlan.xml +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - TestRecordCategory1 - 0001 - TestRecordCategory1 - TestRecordCategory1 description - - - - - - - - - TestRecordCategory11 - 0001-01 - TestRecordCategory11 - TestRecordCategory11 description - week|1 - true - - - - - - T0-000-00-1 item 001 - Cut off monthly, hold 1 month, then destroy. - - - - - - cutoff - monthend|1 - - - - - destroy - month|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - TestRecordFolder1 - TestRecordFolder1 - 0001-01-01 - week|1 - true - - - - - TestRecordFolder2 - TestRecordFolder2 - 0001-01-02 - week|1 - true - - - - - - - - - - - TestRecordCategory12 - 0001-02 - TestRecordCategory12 - TestRecordCategory12 description - - - - - - T0-000-00-1 item 002 - Cut off every 3 months, hold 3 months, then destroy. - - - - - - cutoff - quarterend|1 - - - - - destroy - month|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - TestRecordFolder3 - 0001-02-01 - TestRecordFolder3 - - - - - - - - - - - TestRecordCategory13 - 0001-03 - TestRecordCategory13 - TestRecordCategory13 description - - - - - - T0-000-00-1 item 003 - Cut off at end of FY, hold 3 years, then destroy. - - - - - - cutoff - fyend|1 - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - TestRecordCategory2 - 0002 - TestRecordCategory2 - TestRecordCategory2 description - - - - - - - - - TestRecordCategory21 - 0002-01 - TestRecordCategory21 - TestRecordCategory21 description - - - - - - T0-000-00-2 item 001 - Cut off when superseded, hold 5 years, then destroy. - true - - - - - - cutoff - superseded - - - - - destroy - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - TestRecordCategory22 - 0002-02 - TestRecordCategory22 - TestRecordCategory22 description - - - - - - T0-000-00-2 item 002 - Cut off when no longer needed and destroy immediately. - - - - - - cutoff - no_longer_needed - - - - - destroy - immediately|0 - - - - - - - - - - TestRecordFolder4 - 0002-02-01 - TestRecordFolder4 - - - - - TestRecordFolder5 - 0002-02-02 - TestRecordFolder5 - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/test-job-context.xml b/amps/ags/rm-community/rm-community-repo/test/resources/test-job-context.xml deleted file mode 100644 index 2e93fcc1fb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/test-job-context.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/test-model.xml b/amps/ags/rm-community/rm-community-repo/test/resources/test-model.xml deleted file mode 100644 index b1686f5c6e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/test-model.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - RM Test Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - cm:content - - - cm:folder - - - - - - - - - - - - - d:text - - - d:text - - - - - - - - d:text - - - - - - - - d:text - true - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml b/amps/ags/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml deleted file mode 100644 index f425ebb658..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/test.properties b/amps/ags/rm-community/rm-community-repo/test/resources/test.properties deleted file mode 100644 index c988e45267..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/test.properties +++ /dev/null @@ -1 +0,0 @@ -test.company=Alfresco diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json b/amps/ags/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json deleted file mode 100644 index a7c77f4894..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "rmc:prjList": { - "admin" : ["Project A", "Project B", "Project C"] - }, - "rmc:smList": { - "admin" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"] - } -} diff --git a/amps/ags/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json b/amps/ags/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json deleted file mode 100644 index 6d0dbfea80..0000000000 --- a/amps/ags/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "rmc:prjList": { - "dmartinz" : ["Project A", "Project B", "Project C"], - "jrogers" : ["Project A", "Project B"], - "GROUP_Engineering" : ["Project A"], - "dfranco" : ["Project A", "Project C"], - "admin" : ["Project A", "Project B", "Project C"], - "GROUP_Finance" : ["Project C"] - }, - "rmc:smList": { - "jrangel" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "dmartinz" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "jrogers" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "hmcneil" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "dfranco" : ["NOFORN", "FOUO"], - "gsmith" : ["NOFORN", "FOUO"], - "eharris" : ["NOCONTRACT", "FOUO"], - "bbayless" : ["NOCONTRACT", "FOUO"], - "mhouse" : ["NOCONTRACT", "FOUO"], - "aly" : ["FOUO"], - "dsandy" : ["FGI"], - "driggs" : ["NOFORN"], - "admin" : ["FOUO", "NOFORN"], - "test1" : ["NOCONTRACT"], - "GROUP_test1" : ["NOCONTRACT"] - } -} diff --git a/amps/ags/rm-community/rm-community-repo/tomcat/context.xml b/amps/ags/rm-community/rm-community-repo/tomcat/context.xml deleted file mode 100644 index 3a6aef298e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/tomcat/context.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java deleted file mode 100644 index da00bea009..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java deleted file mode 100644 index ba168375e1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.capability.CapabilityService; -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; -import org.mockito.Mock; -import org.springframework.extensions.webscripts.GUID; - -/** - * 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; - - /** destination record folder node reference */ - private NodeRef destinationRecordFolderNodeRef; - - /** parent destination node reference */ - private NodeRef parentDestinationNodeRef; - - /** declare as version record action */ - private @InjectMocks DeclareAsVersionRecordAction declareAsVersionRecordAction; - - @Mock - private CapabilityService mockedCapabilityService; - - /** - * @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(); - - // mocked destination record folder nodeRef - destinationRecordFolderNodeRef = generateNodeRef(); - - // mocked parent destination nodeRef - parentDestinationNodeRef = 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 - setupMockedAspects(); - - // no default file plan - doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // execute action - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - } - - /** - * Given that no file plan is provided - * And a default file plan exists - * When I execute the action - * Then a version record is declared - */ - @Test - public void noFilePlanParameterDefaultFilePlan() - { - // setup - setupMockedAspects(); - - // no default file plan - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // execute 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 - setupMockedAspects(); - - // not a file plan is provided in the parameters - mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, generateNodeRef()); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // execute 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 - setupMockedAspects(); - - // 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); - - // execute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(myFilePlan, actionedUponNodeRef); - } - - /** - * Given that a valid location is provided - * When I execute the action - * Then a version record is declared in the provided location - */ - @Test - public void validDestinationRecordFolderProvided() - { - String pathParameter = GUID.generate(); - // setup - setupMockedAspects(); - - mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_PATH, pathParameter); - - // provided location - doReturn(destinationRecordFolderNodeRef).when(mockedNodeService).getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, pathParameter); - doReturn(TYPE_RECORD_FOLDER).when(mockedNodeService).getType(destinationRecordFolderNodeRef); - - // capability check - doReturn(true).when(mockedCapabilityService).hasCapability(destinationRecordFolderNodeRef, "FileVersionRecords"); - - // file plan service - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // execute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(destinationRecordFolderNodeRef, actionedUponNodeRef); - } - - /** - * Given that an invalid location is provided - * When I execute the action - * Then an exception is thrown - */ - @Test - public void invalidDestinationRecordFolderProvided() - { - String childName = GUID.generate(); - // setup - setupMockedAspects(); - - // provided location - doReturn(destinationRecordFolderNodeRef).when(mockedNodeService).getChildByName(parentDestinationNodeRef, ContentModel.ASSOC_CONTAINS, childName); - doReturn(TYPE_RECORD_FOLDER).when(mockedNodeService).getType(destinationRecordFolderNodeRef); - - // capability check - doReturn(false).when(mockedCapabilityService).hasCapability(destinationRecordFolderNodeRef, "EditRecordMetadata"); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // execute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - } - - private void setupMockedAspects() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateActionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateActionUnitTest.java deleted file mode 100644 index e9468e1d06..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateActionUnitTest.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import static java.util.Arrays.asList; -import static org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction.CHANGED_PROPERTIES; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_DISPOSITION_AS_OF; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.Serializable; -import java.util.Date; - -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.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.junit.Before; -import org.junit.Test; - -/** - * Unit tests for {@link BroadcastDispositionActionDefinitionUpdateAction}. - * - * @author Tom Page - * @since 2.3.1 - */ -public class BroadcastDispositionActionDefinitionUpdateActionUnitTest -{ - /** The node under the category containing information about the definition of the action. */ - private static final NodeRef DISPOSITION_ACTION_DEF_NODE = new NodeRef("disposition://Action/Def"); - /** The node containing the details of the next disposition step for the content. */ - private static final NodeRef NEXT_ACTION_NODE_REF = new NodeRef("next://Step/"); - /** The node being subject to the disposition step. */ - private static final NodeRef CONTENT_NODE_REF = new NodeRef("content://Node/Ref"); - - /** The class under test. */ - private BroadcastDispositionActionDefinitionUpdateAction action = new BroadcastDispositionActionDefinitionUpdateAction(); - - private NodeService mockNodeService = mock(NodeService.class); - private DispositionService mockDispositionService = mock(DispositionService.class); - private BehaviourFilter mockBehaviourFilter = mock(BehaviourFilter.class); - - /** Inject the mock services into the class under test and link the content and next action nodes. */ - @Before - public void setUp() - { - action.setNodeService(mockNodeService); - action.setDispositionService(mockDispositionService); - action.setBehaviourFilter(mockBehaviourFilter); - - ChildAssociationRef mockAssocRef = mock(ChildAssociationRef.class); - when(mockNodeService.getPrimaryParent(NEXT_ACTION_NODE_REF)).thenReturn(mockAssocRef); - when(mockAssocRef.getParentRef()).thenReturn(CONTENT_NODE_REF); - } - - /** - * Check that the disposition service is used to determine the "disposition as of" date when changes are made to the - * disposition period. - */ - @Test - public void testPersistPeriodChanges() - { - // Set up the data associated with the next disposition action. - DispositionAction mockAction = mock(DispositionAction.class); - when(mockAction.getNodeRef()).thenReturn(NEXT_ACTION_NODE_REF); - DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class); - when(mockAction.getDispositionActionDefinition()).thenReturn(mockDispositionActionDefinition); - when(mockAction.getName()).thenReturn("mockAction"); - // Set up the disposition service to return a known "disposition as of" date. - Date asOfDate = new Date(); - when(mockDispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition)) - .thenReturn(asOfDate); - - // Call the method under test. - action.persistPeriodChanges(DISPOSITION_ACTION_DEF_NODE, mockAction); - - // Check that the "disposition as of" date has been set on the next action. - verify(mockNodeService).setProperty(NEXT_ACTION_NODE_REF, PROP_DISPOSITION_AS_OF, asOfDate); - } - - /** - * Check that changing the period property triggers a recalculation of the "disposition as of" date. - *

- * Set up a disposition action definition node under a schedule defintion node, under a category node. Create a - * record whose next action is an instance of the action definition. Check that if the "period property" of the - * action definition changes then the "disposition as of" date is recalculated and persisted against the node of the - * next action. - */ - @Test - public void testChangePeriodProperty() - { - // Set up the action definition node. - String definitionNodeId = "definitionNodeId"; - NodeRef definitionNode = new NodeRef("definition://node/" + definitionNodeId); - DispositionSchedule mockDispositionSchedule = mock(DispositionSchedule.class); - when(mockDispositionSchedule.getNodeRef()).thenReturn(definitionNode); - when(mockNodeService.getType(definitionNode)).thenReturn(TYPE_DISPOSITION_ACTION_DEFINITION); - // Set up the schedule definition node hierarchy. - NodeRef categoryNode = new NodeRef("category://node/"); - NodeRef scheduleNode = new NodeRef("schedule://node/"); - ChildAssociationRef scheduleDefinitionRelationship = new ChildAssociationRef(null, scheduleNode, null, definitionNode); - when(mockNodeService.getPrimaryParent(definitionNode)).thenReturn(scheduleDefinitionRelationship); - ChildAssociationRef categoryScheduleRelationship = new ChildAssociationRef(null, categoryNode, null, scheduleNode); - when(mockNodeService.getPrimaryParent(scheduleNode)).thenReturn(categoryScheduleRelationship); - // Set up the record/step relationship. - NodeRef recordNode = new NodeRef("record://node/"); - NodeRef stepNode = new NodeRef("step://node/"); - ChildAssociationRef recordStepRelationship = new ChildAssociationRef(null, recordNode, null, stepNode); - when(mockNodeService.getPrimaryParent(stepNode)).thenReturn(recordStepRelationship); - // Set up the disposition schedule. - when(mockDispositionService.getAssociatedDispositionSchedule(categoryNode)).thenReturn(mockDispositionSchedule); - when(mockDispositionService.getDisposableItems(mockDispositionSchedule)).thenReturn(asList(recordNode)); - when(mockDispositionService.getDispositionSchedule(recordNode)).thenReturn(mockDispositionSchedule); - // Set up the record. - when(mockNodeService.hasAspect(recordNode, ASPECT_DISPOSITION_LIFECYCLE)).thenReturn(true); - // Set up the next disposition action. - DispositionAction nextAction = mock(DispositionAction.class); - when(nextAction.getId()).thenReturn(definitionNodeId); - when(nextAction.getNodeRef()).thenReturn(stepNode); - when(mockDispositionService.getNextDispositionAction(recordNode)).thenReturn(nextAction); - DispositionActionDefinition mockActionDefinition = mock(DispositionActionDefinition.class); - when(nextAction.getDispositionActionDefinition()).thenReturn(mockActionDefinition); - - // Set up the action so that it looks like the period property has been changed. - Action mockAction = mock(Action.class); - when(mockAction.getParameterValue(CHANGED_PROPERTIES)).thenReturn((Serializable) asList(PROP_DISPOSITION_PERIOD_PROPERTY)); - // Set up the expected "as of" date. - Date newAsOfDate = new Date(123456789000L); - when(mockDispositionService.calculateAsOfDate(recordNode, mockActionDefinition)).thenReturn(newAsOfDate); - - // Call the method under test. - action.executeImpl(mockAction, definitionNode); - - // Check that the "as of" date is updated. - verify(mockNodeService).setProperty(stepNode, PROP_DISPOSITION_AS_OF, newAsOfDate); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java deleted file mode 100644 index 754aa6c348..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import static org.mockito.Mockito.verifyZeroInteractions; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for file report action. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class FileReportActionUnitTest extends BaseActionUnitTest -{ - /** actioned upon node reference */ - private NodeRef actionedUponNodeRef; - - /** file report action */ - private @InjectMocks FileReportAction fileReportAction; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // actioned upon node reference - actionedUponNodeRef = generateRecord(); - - // mocked action - fileReportAction.setAuditable(false); - } - - /** - * given the destination is not set, ensure that an exception is thrown - */ - @Test - public void destinationNotSet() - { - // == given == - - // set action parameter values - mockActionParameterValue(FileReportAction.MIMETYPE, MimetypeMap.MIMETYPE_HTML); - mockActionParameterValue(FileReportAction.REPORT_TYPE, "rma:destructionReport"); - - // expected exception - exception.expect(AlfrescoRuntimeException.class); - - // == when == - - // execute action - fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); - - // == then == - verifyZeroInteractions(mockedReportService, mockedNodeService); - } - - /** - * given no report type set, ensure that an exception is thrown - */ - @Test - public void reportTypeNotSet() - { - // == given == - - // set action parameter values - mockActionParameterValue(FileReportAction.MIMETYPE, MimetypeMap.MIMETYPE_HTML); - mockActionParameterValue(FileReportAction.DESTINATION, generateNodeRef().toString()); - - // expected exception - exception.expect(AlfrescoRuntimeException.class); - - // == when == - - // execute action - fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); - - // == then == - verifyZeroInteractions(mockedReportService, mockedNodeService); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java deleted file mode 100644 index 0133c79c86..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java deleted file mode 100644 index f388d0ad06..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.api; - -import com.google.common.collect.HashMultimap; - -import org.junit.Test; - -public class CommunityPublicAPIUnitTest -{ - @Test - public void testPublicAPIConsistency() - { - HashMultimap, Class> knownBadReferences = HashMultimap.create(); - PublicAPITestUtil.testPublicAPIConsistency("org.alfresco.module.org_alfresco_module_rm", knownBadReferences); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java deleted file mode 100644 index a5db0d947e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/PublicAPITestUtil.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.api; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Executable; -import java.lang.reflect.Field; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.lang.reflect.WildcardType; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.SetMultimap; -import com.google.common.collect.Sets; - -import org.alfresco.api.AlfrescoPublicApi; -import org.apache.commons.lang3.StringUtils; -import org.reflections.Reflections; - -/** - * A utility class to help testing the Alfresco public API. - * - * @author Tom Page - * @since 2.5 - */ -public class PublicAPITestUtil -{ - private static final String ALFRESCO_PACKAGE = "org.alfresco"; - - /** - * Check the consistency of the public API exposed from the given package. For each class in the package that is - * annotated {@link AlfrescoPublicApi}, check that no exposed methods (or fields, constructors, etc.) use - * non-public-API classes from Alfresco. - * - * @param basePackageName The package to check classes within. - * @param knownBadReferences Any references that would cause this test to fail, but which we don't want to change. - * The keys should be public API classes within our code and the values should be the non-public-API - * class that is being referenced. - */ - public static void testPublicAPIConsistency(String basePackageName, SetMultimap, Class> knownBadReferences) - { - Reflections reflections = new Reflections(basePackageName); - Set> publicAPIClasses = reflections.getTypesAnnotatedWith(AlfrescoPublicApi.class, true); - - SetMultimap, Class> referencedFrom = HashMultimap.create(); - Set> referencedClasses = new HashSet<>(); - for (Class publicAPIClass : publicAPIClasses) - { - Set> referencedClassesFromClass = getReferencedClassesFromClass(publicAPIClass, new HashSet<>()); - referencedClassesFromClass.forEach(clazz -> referencedFrom.put(clazz, publicAPIClass)); - - // Remove any references in knownBadReferences and error if an expected reference wasn't found. - if (knownBadReferences.containsKey(publicAPIClass)) - { - for (Class clazz : knownBadReferences.get(publicAPIClass)) - { - assertTrue("Supplied knownBadReferences expects " + clazz + " to be referenced by " + publicAPIClass - + ", but no such error was found", referencedClassesFromClass.remove(clazz)); - } - } - - referencedClasses.addAll(referencedClassesFromClass); - } - - List errorMessages = new ArrayList<>(); - for (Class referencedClass : referencedClasses) - { - if (isInAlfresco(referencedClass) && !isPartOfPublicApi(referencedClass)) - { - Set referencerNames = referencedFrom.get(referencedClass).stream().map(c -> c.getName()) - .collect(Collectors.toSet()); - errorMessages.add(referencedClass.getName() + " <- " + StringUtils.join(referencerNames, ", ")); - } - } - - if (!errorMessages.isEmpty()) - { - System.out.println("Errors found:"); - System.out.println(StringUtils.join(errorMessages, "\n")); - } - - assertEquals("Found references to non-public API classes from public API classes.", Collections.emptyList(), - errorMessages); - } - - /** - * Check if the given class is a part of the Alfresco public API. - * - * @param clazz The class to check. - * @return {@code true} if the given class is annotated with {@link AlfrescoPublicApi}. - */ - private static boolean isPartOfPublicApi(Class clazz) - { - if (clazz.getAnnotation(AlfrescoPublicApi.class) != null) - { - return true; - } - if (clazz.getEnclosingClass() != null) - { - return isPartOfPublicApi(clazz.getEnclosingClass()); - } - return false; - } - - /** - * Get all the classes referenced by the given class, which might be used by an extension. We consider visible - * methods, constructors, fields and inner classes, as well as superclasses and interfaces extended by the class. - * - * @param initialClass The class to analyse. - * @param consideredClasses Classes that have already been considered, and which should not be considered again. If - * the given class has already been considered then an empty set will be returned. This set will be - * updated with the given class. - * @return The set of classes that might be accessible by an extension of this class. - */ - private static Set> getReferencedClassesFromClass(Class initialClass, Set> consideredClasses) - { - Set> referencedClasses = new HashSet<>(); - - if (consideredClasses.add(initialClass)) - { - for (Method method : initialClass.getDeclaredMethods()) - { - if (isVisibleToExtender(method.getModifiers())) - { - referencedClasses.addAll(getClassesFromMethod(method)); - } - } - for (Constructor constructor : initialClass.getDeclaredConstructors()) - { - if (isVisibleToExtender(constructor.getModifiers())) - { - referencedClasses.addAll(getClassesFromConstructor(constructor)); - } - } - for (Field field : initialClass.getDeclaredFields()) - { - if (isVisibleToExtender(field.getModifiers())) - { - referencedClasses.addAll(getClassesFromField(field)); - } - } - for (Class clazz : initialClass.getDeclaredClasses()) - { - if (isVisibleToExtender(clazz.getModifiers())) - { - referencedClasses.addAll(getReferencedClassesFromClass(clazz, consideredClasses)); - } - } - if (initialClass.getSuperclass() != null) - { - referencedClasses - .addAll(getReferencedClassesFromClass(initialClass.getSuperclass(), consideredClasses)); - } - for (Class clazz : initialClass.getInterfaces()) - { - referencedClasses.addAll(getReferencedClassesFromClass(clazz, consideredClasses)); - } - } - return referencedClasses; - } - - /** - * Check if the supplied {@link Executable#getModifiers() modifiers} indicate that an extension can access the - * element. Here we assume that an extension can see public and protected items, but not package protected (or - * private). - * - * @param modifiers The java language modifiers. - * @return {@code true} if the item is visible to an extension. - */ - private static boolean isVisibleToExtender(int modifiers) - { - return Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers); - } - - /** - * Get all classes involved in the signature of the given method. - * - * @param method The method to analyse. - * @return The set of classes. - */ - private static Set> getClassesFromMethod(Method method) - { - Set types = getTypesFromMethod(method); - return getClassesFromTypes(types); - } - - /** - * Get all classes involved in the signature of the given constructor. - * - * @param constructor The constructor to analyse. - * @return The set of classes. - */ - private static Set> getClassesFromConstructor(Constructor constructor) - { - Set types = getTypesFromConstructor(constructor); - return getClassesFromTypes(types); - } - - /** - * Get all classes involved in the type of the supplied field. For example {@code Pair, Integer> foo} - * involves four classes. - * - * @param field The field to look at. - * @return The set of classes. - */ - private static Set> getClassesFromField(Field field) - { - Set types = Sets.newHashSet(field.getGenericType()); - return getClassesFromTypes(types); - } - - /** - * Get all types references by the supplied method signature (i.e. the parameters, return type and exceptions). - * - * @param method The method to analyse. - * @return The set of types. - */ - private static Set getTypesFromMethod(Method method) - { - Set methodTypes = new HashSet<>(); - methodTypes.addAll(Sets.newHashSet(method.getGenericParameterTypes())); - methodTypes.add(method.getGenericReturnType()); - methodTypes.addAll(Sets.newHashSet(method.getGenericExceptionTypes())); - return methodTypes; - } - - /** - * Get all types referenced by the supplied constructor (i.e. the parameters and exceptions). - * - * @param constructor The constructor to analyse. - * @return The set of types. - */ - private static Set getTypesFromConstructor(Constructor constructor) - { - Set methodTypes = new HashSet<>(); - methodTypes.addAll(Sets.newHashSet(constructor.getGenericParameterTypes())); - methodTypes.addAll(Sets.newHashSet(constructor.getGenericExceptionTypes())); - return methodTypes; - } - - /** - * Find all classes that are within the supplied types. For example a {@code Pair, Integer>} contains - * references to four classes. - * - * @param methodTypes The set of types to examine. - * @return The set of classes used to form the given types. - */ - private static Set> getClassesFromTypes(Set methodTypes) - { - Set> methodClasses = new HashSet<>(); - for (Type type : methodTypes) - { - methodClasses.addAll(getClassesFromType(type, new HashSet<>())); - } - return methodClasses; - } - - /** - * Find all classes that are within the supplied type. For example a {@code Pair, Integer>} contains - * references to four classes. - * - * @param type The type to examine. - * @param processedTypes The set of types which have already been processed. If {@code type} is within this set then - * the method returns an empty set, to prevent analysis of the same type multiple times, and to guard - * against circular references. The underlying set is updated with the given type. - * @return The set of classes used to form the given type. - */ - private static Set> getClassesFromType(Type type, Set processedTypes) - { - Set> returnClasses = new HashSet<>(); - - if (processedTypes.add(type)) - { - if (type instanceof ParameterizedType) - { - ParameterizedType parameterizedType = (ParameterizedType) type; - returnClasses.add((Class) parameterizedType.getRawType()); - - for (Type t : parameterizedType.getActualTypeArguments()) - { - returnClasses.addAll(getClassesFromType(t, processedTypes)); - } - } - else if (type instanceof Class) - { - Class clazz = (Class) type; - if (clazz.isArray()) - { - returnClasses.add(clazz.getComponentType()); - } - returnClasses.add(clazz); - } - else if (type instanceof WildcardType) - { - // No-op - Caller can choose what type to use. - } - else if (type instanceof TypeVariable) - { - TypeVariable typeVariable = (TypeVariable) type; - for (Type bound : typeVariable.getBounds()) - { - returnClasses.addAll(getClassesFromType(bound, processedTypes)); - } - } - else if (type instanceof GenericArrayType) - { - GenericArrayType genericArrayType = (GenericArrayType) type; - returnClasses.addAll(getClassesFromType(genericArrayType.getGenericComponentType(), processedTypes)); - } - else - { - throw new IllegalStateException("This test was not written to work with type " + type); - } - } - return returnClasses; - } - - /** - * Check if a class is within org.alfresco, and so whether it could potentially be part of the public API. - * - * @param type The class to check. - * @return {@code true} if this is an Alfresco class. - */ - private static boolean isInAlfresco(Class type) - { - if (type.getPackage() == null) - { - return false; - } - return type.getPackage().getName().startsWith(ALFRESCO_PACKAGE); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImplUnitTest.java deleted file mode 100644 index 77c5f23fa2..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImplUnitTest.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.audit; - -import static java.util.Collections.emptyList; - -import static org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat.JSON; -import static org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.DOD5015_AUDIT_APPLICATION_NAME; -import static org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.RM_AUDIT_APPLICATION_NAME; -import static org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.RM_AUDIT_PATH_ROOT; -import static org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model.TYPE_DOD_5015_SITE; -import static org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.DEFAULT_RM_SITE_ID; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RM_SITE; -import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.any; -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 static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; -import java.io.Writer; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import com.google.common.collect.Sets; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.audit.AuditComponent; -import org.alfresco.service.cmr.audit.AuditQueryParameters; -import org.alfresco.service.cmr.audit.AuditService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Unit tests for {@link RecordsManagementAuditServiceImpl}. - * - * @author Tom Page - * @since 2.7 - */ -public class RecordsManagementAuditServiceImplUnitTest -{ - /** The maximum entries to return in the audit query. */ - private static final int MAX_ENTRIES = 10; - /** A node representing the file plan root. */ - private static final NodeRef FILE_PLAN_NODE = new NodeRef("file://plan/node"); - /** A node representing the RM site. */ - private static final NodeRef RM_SITE_NODE = new NodeRef("rm://site/node"); - /** The class under test. */ - @InjectMocks - private RecordsManagementAuditServiceImpl recordsManagementAuditServiceImpl; - @Mock - private NodeService mockNodeService; - @Mock - private SiteService mockSiteService; - @Mock - private AuditService mockAuditService; - @Mock - private FilePlanService mockFilePlanService; - @Mock - AuditComponent mockAuditComponent; - @Mock - private Writer mockWriter; - @Mock - private SiteInfo mockSiteInfo; - @Captor - private ArgumentCaptor queryParamsCaptor; - - /** Set up the mocks. */ - @Before - public void setUp() - { - initMocks(this); - - when(mockFilePlanService.getFilePlanBySiteId(DEFAULT_RM_SITE_ID)).thenReturn(FILE_PLAN_NODE); - when(mockSiteService.getSite(DEFAULT_SITE_NAME)).thenReturn(mockSiteInfo); - when(mockSiteInfo.getNodeRef()).thenReturn(RM_SITE_NODE); - - recordsManagementAuditServiceImpl.setIgnoredAuditProperties(emptyList()); - } - - /** - * Check that if the RM site is not a DOD site then the audit trail doesn't make a query for DOD events. - * - * @throws IOException Unexpected. - */ - @Test - public void testAuditWithoutDOD() throws IOException - { - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - params.setMaxEntries(MAX_ENTRIES); - List results = new ArrayList<>(); - // Return a standard site type. - when(mockNodeService.getType(RM_SITE_NODE)).thenReturn(TYPE_RM_SITE); - - // Call the method under test. - recordsManagementAuditServiceImpl.getAuditTrailImpl(params, results, mockWriter, JSON); - - // Check that exactly one audit query was performed. - verify(mockAuditService, times(1)) - .auditQuery(any(AuditService.AuditQueryCallback.class), queryParamsCaptor.capture(), - eq(MAX_ENTRIES)); - // We always need to make the standard query - regardless of the type of RM site (to get events like RM site created). - assertEquals("The application name should be the standard RM application", RM_AUDIT_APPLICATION_NAME, - queryParamsCaptor.getValue().getApplicationName()); - // Check that the event of viewing the audit log was itself audited. - verify(mockAuditComponent).recordAuditValues(eq(RM_AUDIT_PATH_ROOT), any(Map.class)); - } - - /** - * Check that if the RM site is a DOD site then the audit trail makes a query for DOD events and the standard events. - * - * @throws IOException Unexpected. - */ - @Test - public void testAuditWithDOD() throws IOException - { - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - params.setMaxEntries(MAX_ENTRIES); - List results = new ArrayList<>(); - // Return a DOD site type. - when(mockNodeService.getType(RM_SITE_NODE)).thenReturn(TYPE_DOD_5015_SITE); - - // Call the method under test. - recordsManagementAuditServiceImpl.getAuditTrailImpl(params, results, mockWriter, JSON); - - // Check that two audit queries were performed (one for DOD events and one for standard events). - verify(mockAuditService, times(2)) - .auditQuery(any(AuditService.AuditQueryCallback.class), queryParamsCaptor.capture(), - eq(MAX_ENTRIES)); - Set apps = queryParamsCaptor.getAllValues().stream().map(AuditQueryParameters::getApplicationName) - .collect(Collectors.toSet()); - // We always need to make the standard query - regardless of the type of RM site (to get events like RM site created). - assertEquals("Expected the standard audit query and the DOD audit query.", - Sets.newHashSet(RM_AUDIT_APPLICATION_NAME, DOD5015_AUDIT_APPLICATION_NAME), apps); - // Check that the event of viewing the audit log was itself audited. - verify(mockAuditComponent).recordAuditValues(eq(RM_AUDIT_PATH_ROOT), any(Map.class)); - } - - /** Check that passing null to getStartOfDay doesn't result in null being returned. */ - @Test - public void testGetStartOfDay_null() - { - Date startOfDay = recordsManagementAuditServiceImpl.getStartOfDay(null); - assertNotNull("Expected date to be created by method.", startOfDay); - } - - /** Check that any time component passed to getStartOfDay is not included in the response. */ - @Test - public void testGetStartOfDay_timeDiscarded() throws Exception - { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); - Date date = format.parse("2001-02-03 04:05:06.789"); - - // Call the method under test. - Date startOfDay = recordsManagementAuditServiceImpl.getStartOfDay(date); - - assertEquals("Unexpected date truncation.", format.parse("2001-02-03 00:00:00.000"), startOfDay); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToHoldAuditEventUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToHoldAuditEventUnitTest.java deleted file mode 100644 index 11159f2d1c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AddToHoldAuditEventUnitTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.GUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -import java.util.Map; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -/** - * Unit tests for {@link AddToHoldAuditEvent}. - * - * @author Sara Aspery - * @since 3.3 - */ -public class AddToHoldAuditEventUnitTest extends BaseUnitTest -{ - @InjectMocks - private AddToHoldAuditEvent addToHoldAuditEvent; - - @Mock - private NodeService mockedNodeService; - - private NodeRef holdNodeRef; - private NodeRef contentNodeRef; - - /** Set up the mocks. */ - @Before - public void setUp() - { - initMocks(this); - - holdNodeRef = generateNodeRef(); - String holdName = "Hold " + GUID.generate(); - - contentNodeRef = generateNodeRef(); - String contentName = "Content " + GUID.generate(); - - when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName); - when(mockedNodeService.getProperty(contentNodeRef, PROP_NAME)).thenReturn(contentName); - } - - /** - * Check that the add to hold event calls an audit event. - * - */ - @Test - public void testAddToHoldCausesAuditEvent() - { - addToHoldAuditEvent.onAddToHold(holdNodeRef, contentNodeRef); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), any(String.class), isNull(Map.class), any(Map.class), eq(true), eq(false)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateHoldAuditEventUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateHoldAuditEventUnitTest.java deleted file mode 100644 index f41c321fd0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateHoldAuditEventUnitTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.GUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -import java.util.Map; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -/** - * Unit tests for {@link CreateHoldAuditEvent}. - * - * @author Sara Aspery - * @since 3.3 - */ -public class CreateHoldAuditEventUnitTest extends BaseUnitTest -{ - @InjectMocks - private CreateHoldAuditEvent createHoldAuditEvent; - - @Mock - private NodeService mockedNodeService; - - private NodeRef holdNodeRef; - private ChildAssociationRef childAssociationRef; - - /** Set up the mocks. */ - @Before - public void setUp() - { - initMocks(this); - - holdNodeRef = generateNodeRef(); - String holdName = "Hold " + GUID.generate(); - String holdReason = "Reason " + GUID.generate(); - childAssociationRef = generateChildAssociationRef(null, holdNodeRef); - - when(childAssociationRef.getChildRef()).thenReturn(holdNodeRef); - when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName); - when(mockedNodeService.getProperty(holdNodeRef, PROP_HOLD_REASON)).thenReturn(holdReason); - } - - /** - * Check that the create hold event calls an audit event. - * - */ - @Test - public void testCreateHoldCausesAuditEvent() - { - createHoldAuditEvent.onCreateNode(childAssociationRef); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(holdNodeRef), any(String.class), isNull(Map.class), any(Map.class)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteHoldAuditEventUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteHoldAuditEventUnitTest.java deleted file mode 100644 index 8ef99fe9b6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteHoldAuditEventUnitTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - - package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.GUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Matchers; -import org.mockito.Mock; - -import java.util.Map; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -/** - * Unit tests for {@link DeleteHoldAuditEvent}. - * - * @author Sara Aspery - * @since 3.3 - */ -public class DeleteHoldAuditEventUnitTest extends BaseUnitTest -{ - @InjectMocks - private DeleteHoldAuditEvent deleteHoldAuditEvent; - - @Mock - private NodeService mockedNodeService; - - private NodeRef holdNodeRef; - - /** Set up the mocks. */ - @Before - public void setUp() - { - initMocks(this); - - holdNodeRef = generateNodeRef(); - String holdName = "Hold " + GUID.generate(); - - when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName); - } - - /** - * Check that the delete hold event calls an audit event. - * - */ - @Test - public void testDeleteHoldCausesAuditEvent() - { - deleteHoldAuditEvent.beforeDeleteNode(holdNodeRef); - verify(mockedRecordsManagementAuditService, times(1)) - .auditEvent(eq(holdNodeRef), any(String.class), any(Map.class), isNull(Map.class), Matchers.eq(true), Matchers.eq(false)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromHoldAuditEventUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromHoldAuditEventUnitTest.java deleted file mode 100644 index 2ed91b0e96..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RemoveFromHoldAuditEventUnitTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.GUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Unit tests for {@link RemoveFromHoldAuditEvent}. - * - * @author Chris Shields - * @since 3.3 - */ -public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest -{ - @InjectMocks - private RemoveFromHoldAuditEvent removeFromHoldAuditEvent; - - @Mock - private NodeService mockedNodeService; - - private NodeRef holdNodeRef; - private NodeRef contentNodeRef; - - /** - * Set up the mocks. - */ - @Before - public void setUp() - { - initMocks(this); - - holdNodeRef = generateNodeRef(); - String holdName = "Hold " + GUID.generate(); - - contentNodeRef = generateNodeRef(); - String contentName = "Content " + GUID.generate(); - - when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName); - when(mockedNodeService.getProperty(contentNodeRef, PROP_NAME)).thenReturn(contentName); - } - - /** - * Check that the remove from hold event calls an audit event. - */ - @Test - public void testRemoveFromHoldCausesAuditEvent() - { - removeFromHoldAuditEvent.onRemoveFromHold(holdNodeRef, contentNodeRef); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), any(String.class), any(Map.class), isNull(Map.class), eq(true)); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java deleted file mode 100644 index ec78deec63..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java deleted file mode 100644 index aefcf68690..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode; -import org.alfresco.service.cmr.module.ModuleDetails; -import org.alfresco.service.cmr.module.ModuleService; -import org.alfresco.service.descriptor.DescriptorService; -import org.alfresco.service.license.LicenseDescriptor; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Module compatibility component unit test - * - * @author Roy Wetherall - * @since 2.4 - */ -public class ModuleCompatibilityComponentUnitTest -{ - /** mocks */ - @Mock private DescriptorService mockedDescriptorService; - @Mock private ModuleService mockedModuleService; - @Mock private ContextRefreshedEvent mockedContextRefreshedEvent; - @Mock private ConfigurableApplicationContext mockedApplicationContext; - @Mock private ModuleDetails mockedModuleDetails; - @Mock private LicenseDescriptor mockedDescriptor; - - /** object under test */ - @InjectMocks private ModuleCompatibilityComponent moduleCompatibilityComponent; - - /** - * Before test execution - */ - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - - when(mockedContextRefreshedEvent.getApplicationContext()) - .thenReturn(mockedApplicationContext); - when(mockedDescriptorService.getLicenseDescriptor()) - .thenReturn(mockedDescriptor); - } - - /** - * Given that core community is installed - * And that RM community is installed - * When the application context is loaded - * Then it is successful - */ - @Test - public void communityOnCommunity() - { - // community core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.UNKNOWN); - - // community RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(null); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close never called - verify(mockedApplicationContext, never()).close(); - - } - - /** - * Given that core community is installed - * And that RM enterprise is installed - * When the application context is loaded - * Then it fails - */ - @Test - public void enterpriseOnCommunity() - { - // community core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.UNKNOWN); - - // enterprise RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(mockedModuleDetails); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close is called - verify(mockedApplicationContext).close(); - - } - - /** - * Given that core enterprise is installed - * And that RM community is installed - * When the application context is loaded - * Then it fails - */ - @Test - public void communityOnEnterprise() - { - // enterprise core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.ENTERPRISE); - - // community RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(null); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close is called - verify(mockedApplicationContext).close(); - } - - /** - * Given that core enterprise is installed - * And that RM enterprise is installed - * When the application context is loaded - * Then it is successful - */ - @Test - public void enterpriseOnEnterprise() - { - // enterprise core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.ENTERPRISE); - - // enterprise RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(mockedModuleDetails); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close never called - verify(mockedApplicationContext, never()).close(); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java deleted file mode 100644 index 2d1b946fc0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProviderUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProviderUnitTest.java deleted file mode 100644 index c7e5f69dca..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProviderUnitTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import static java.util.Arrays.asList; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.List; - -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.ConfigAttributeDefinition; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSet; -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.cmr.search.LimitBy; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.ResultSetMetaData; -import org.alfresco.service.cmr.search.SearchParameters; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** Unit tests for {@link RMAfterInvocationProvider}. */ -public class RMAfterInvocationProviderUnitTest -{ - private static final NodeRef NODE_A = new NodeRef("test://node/a"); - - /** The class under test. */ - @InjectMocks - private RMAfterInvocationProvider rmAfterInvocationProvider; - @Mock - private Authentication authentication; - @Mock - Object object; - @Mock - ConfigAttributeDefinition config; - @Mock - AuthenticationUtil authenticationUtil; - @Mock - NodeService nodeService; - @Mock - ChildAssociationRef childAssocRefA; - - /** Set up the mocks and common test data. */ - @Before - public void setUp() - { - initMocks(this); - - // Set up the nodes and associations. - when(nodeService.exists(NODE_A)).thenReturn(true); - when(childAssocRefA.getParentRef()).thenReturn(NODE_A); - - // Create the config object for use by the tests. - ConfigAttribute configAttribute = mock(ConfigAttribute.class); - when(configAttribute.getAttribute()).thenReturn("AFTER_RM.test"); - List configAttributes = asList(configAttribute); - when(config.getConfigAttributes()).thenReturn(configAttributes.iterator()); - } - - /** Check that when all the results fit into a page then we get a response of "UNLIMITED". */ - @Test - public void testDecide_resultSet_unlimited() - { - // The returned object is a search result set. - ResultSet returnedObject = mock(ResultSet.class); - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - when(returnedObject.getResultSetMetaData()).thenReturn(resultSetMetaData); - - // Simulate a single result, and the user has access to it. - when(returnedObject.length()).thenReturn(1); - when(returnedObject.getNumberFound()).thenReturn(1L); - when(returnedObject.getNodeRef(0)).thenReturn(NODE_A); - when(returnedObject.getChildAssocRef(0)).thenReturn(childAssocRefA); - - // Set the page size to 1 and skip count to 0. - SearchParameters searchParameters = mock(SearchParameters.class); - when(searchParameters.getMaxItems()).thenReturn(1); - when(searchParameters.getSkipCount()).thenReturn(0); - when(searchParameters.getLanguage()).thenReturn("afts"); - when(resultSetMetaData.getSearchParameters()).thenReturn(searchParameters); - - // Call the method under test. - FilteringResultSet filteringResultSet = (FilteringResultSet) rmAfterInvocationProvider.decide(authentication, object, config, returnedObject); - - assertEquals("Expected total of one result.", 1, filteringResultSet.getNumberFound()); - assertEquals("Expected one result returned.", 1, filteringResultSet.length()); - assertEquals("Expected that results were not limited by the page size.", LimitBy.UNLIMITED, filteringResultSet.getResultSetMetaData().getLimitedBy()); - } - - /** Check that results can skipped due to the skip count. */ - @Test - public void testDecide_resultSet_skipped() - { - // The returned object is a search result set. - ResultSet returnedObject = mock(ResultSet.class); - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - when(returnedObject.getResultSetMetaData()).thenReturn(resultSetMetaData); - - // Simulate a single result that was skipped due to the skip count. - when(returnedObject.length()).thenReturn(0); - when(returnedObject.getNumberFound()).thenReturn(1L); - - // Set the page size to 1 and skip count to 1 (so the result is skipped). - SearchParameters searchParameters = mock(SearchParameters.class); - when(searchParameters.getMaxItems()).thenReturn(1); - when(searchParameters.getSkipCount()).thenReturn(1); - when(searchParameters.getLanguage()).thenReturn("afts"); - when(resultSetMetaData.getSearchParameters()).thenReturn(searchParameters); - - // Call the method under test. - FilteringResultSet filteringResultSet = (FilteringResultSet) rmAfterInvocationProvider.decide(authentication, object, config, returnedObject); - - assertEquals("Expected total of one result.", 1, filteringResultSet.getNumberFound()); - assertEquals("Expected no results returned.", 0, filteringResultSet.length()); - assertEquals("Expected that results were not limited by the page size.", LimitBy.UNLIMITED, filteringResultSet.getResultSetMetaData().getLimitedBy()); - } - - /** Check that results can be limited by the page size. */ - @Test - public void testDecide_resultSet_pageSize() - { - // The returned object is a search result set. - ResultSet returnedObject = mock(ResultSet.class); - ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); - when(returnedObject.getResultSetMetaData()).thenReturn(resultSetMetaData); - - // Simulate a single result, and the user has access to it. - when(returnedObject.length()).thenReturn(1); - when(returnedObject.getNumberFound()).thenReturn(1L); - when(returnedObject.getNodeRef(0)).thenReturn(NODE_A); - when(returnedObject.getChildAssocRef(0)).thenReturn(childAssocRefA); - - // Set the page size to 0 and skip count to 0 (so the result is not in page). - SearchParameters searchParameters = mock(SearchParameters.class); - when(searchParameters.getMaxItems()).thenReturn(0); - when(searchParameters.getSkipCount()).thenReturn(0); - when(searchParameters.getLanguage()).thenReturn("afts"); - when(resultSetMetaData.getSearchParameters()).thenReturn(searchParameters); - - // Call the method under test. - FilteringResultSet filteringResultSet = (FilteringResultSet) rmAfterInvocationProvider.decide(authentication, object, config, returnedObject); - - assertEquals("Expected total of one result.", 1, filteringResultSet.getNumberFound()); - assertEquals("Expected no results returned.", 0, filteringResultSet.length()); - assertEquals("Expected that results were limited by page size.", LimitBy.FINAL_SIZE, filteringResultSet.getResultSetMetaData().getLimitedBy()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java deleted file mode 100644 index 1f5c75f250..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability; - -import static org.junit.Assert.assertEquals; -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 java.lang.reflect.Method; -import java.util.Iterator; - -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; - -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * 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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java deleted file mode 100644 index b824e3b51e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java deleted file mode 100644 index 6aade5cc91..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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 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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java deleted file mode 100644 index ac6e0e54d0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.eq; -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 java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -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.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; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Freeze evaluator unit test. - * - * @author Roy Wetherall - */ -public class HoldCapabilityConditionUnitTest extends BaseUnitTest -{ - /** test data */ - private NodeRef hold1; - private NodeRef hold2; - private List holds; - - /** mocked objects */ - private @Mock(name="kinds") Set mockedKinds; - - /** evaluator */ - private @Spy @InjectMocks HoldCapabilityCondition evaluator; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - - // setup test data - hold1 = generateNodeRef(TYPE_HOLD); - hold2 = generateNodeRef(TYPE_HOLD); - holds = new ArrayList<>(2); - holds.add(hold1); - holds.add(hold2); - - // setup interactions - doReturn(false).when(mockedKinds).contains(FilePlanComponentKind.RECORD_CATEGORY); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD_FOLDER); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.HOLD); - } - - /** - * Test given there are no holds - */ - @Test - public void noHolds() - { - // given - doReturn(Collections.EMPTY_LIST).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); - - // when - boolean result = evaluator.evaluateImpl(recordFolder); - - // then - assertFalse(result); - verify(mockedPermissionService, never()).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); - - } - - /** - * Test given the user has no filling permissions on any of the available holds - */ - @Test - public void noFillingOnHolds() - { - // given - doReturn(holds).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold1, RMPermissionModel.FILING); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold2, RMPermissionModel.FILING); - - // when - boolean result = evaluator.evaluateImpl(recordFolder); - - // then - assertFalse(result); - verify(mockedPermissionService, times(2)).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); - - } - - /** - * Test given the user has filling on one of the available holds - */ - @Test - public void fillingOnHolds() - { - // given - doReturn(holds).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold1, RMPermissionModel.FILING); - doReturn(AccessStatus.ALLOWED).when(mockedPermissionService).hasPermission(hold2, RMPermissionModel.FILING); - - // when - boolean result = evaluator.evaluateImpl(recordFolder); - - // then - assertTrue(result); - verify(mockedPermissionService, times(2)).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java deleted file mode 100644 index 1023b8d440..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import static org.mockito.Mockito.when; - -import java.util.Set; - -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; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * 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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java deleted file mode 100644 index ec2ca2177a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.content; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.content.ContentStore; -import org.alfresco.repo.content.filestore.FileContentReader; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Eager content store cleaner unit test. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class EagerContentStoreCleanerUnitTest extends BaseUnitTest -{ - @InjectMocks private EagerContentStoreCleaner eagerContentStoreCleaner = new EagerContentStoreCleaner() - { - /** dummy implementation */ - public boolean registerOrphanedContentUrl(String contentUrl, boolean force) {return true;} - }; - - @Mock private ContentCleanser mockedContentCleanser; - - /** - * When content is registered for cleansing - * Then the content URL is recorded for use later - */ - @SuppressWarnings("unchecked") - @Test - public void registerContentURL() - { - String contentURL = AlfMock.generateText(); - Set mockedSet = mock(Set.class); - when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) - .thenReturn(mockedSet); - - eagerContentStoreCleaner.registerOrphanedContentUrlForCleansing(contentURL); - - verify(mockedSet).add(contentURL); - } - - /** - * Given that the content requires cleansing - * When the content is deleted from the store - * Then the content is cleansed first - */ - @Test - public void contentRequiresCleaning() - { - String contentURL = AlfMock.generateText(); - Set mockedSet = new HashSet<>(Arrays.asList(contentURL)); - when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) - .thenReturn(mockedSet); - - FileContentReader mockedReader = mock(FileContentReader.class); - when(mockedReader.exists()) - .thenReturn(true); - - File mockedFile = mock(File.class); - when(mockedReader.getFile()) - .thenReturn(mockedFile); - - ContentStore mockedContentStore = mock(ContentStore.class); - when(mockedContentStore.getReader(contentURL)) - .thenReturn(mockedReader); - - eagerContentStoreCleaner.deleteFromStore(contentURL, mockedContentStore); - - verify(mockedContentCleanser).cleanse(mockedFile); - } - - /** - * Given that the content does not require cleansing - * When the content is deleted from the store - * Then the content is not cleansed - */ - @Test - public void contentDoesntRequireCleaning() - { - String contentURL = AlfMock.generateText(); - Set mockedSet = new HashSet<>(Arrays.asList(contentURL)); - when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) - .thenReturn(mockedSet); - - eagerContentStoreCleaner.deleteFromStore(AlfMock.generateText(), mock(ContentStore.class)); - - verifyZeroInteractions(mockedContentCleanser); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java deleted file mode 100644 index 26f56a36b1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.content.cleanser; - -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.when; - -import java.io.File; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ContentIOException; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Eager content store cleaner unit test. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class ContentCleanser522022MUnitTest extends BaseUnitTest -{ - @InjectMocks @Spy private ContentCleanser522022M contentCleanser522022M = new ContentCleanser522022M() - { - /** dummy implementations */ - protected void overwrite(File file, OverwriteOperation overwriteOperation) {} - }; - - @Mock private File mockedFile; - - /** - * Given that a file exists - * When I cleanse it - * Then the content is overwritten - */ - @Test - public void cleanseFile() - { - when(mockedFile.exists()) - .thenReturn(true); - when(mockedFile.canWrite()) - .thenReturn(true); - - contentCleanser522022M.cleanse(mockedFile); - - InOrder inOrder = inOrder(contentCleanser522022M); - - inOrder.verify(contentCleanser522022M) - .overwrite(mockedFile, contentCleanser522022M.overwriteOnes); - inOrder.verify(contentCleanser522022M) - .overwrite(mockedFile, contentCleanser522022M.overwriteZeros); - inOrder.verify(contentCleanser522022M) - .overwrite(mockedFile, contentCleanser522022M.overwriteRandom); - } - - /** - * Given that the file does not exist - * When I cleanse it - * Then an exception is thrown - */ - @Test - ( - expected=ContentIOException.class - ) - public void fileDoesNotExist() - { - when(mockedFile.exists()) - .thenReturn(false); - when(mockedFile.canWrite()) - .thenReturn(true); - - contentCleanser522022M.cleanse(mockedFile); - } - - /** - * Given that I can not write to the file - * When I cleanse it - * Then an exception is thrown - */ - @Test - ( - expected=ContentIOException.class - ) - public void cantWriteToFile() - { - when(mockedFile.exists()) - .thenReturn(true); - when(mockedFile.canWrite()) - .thenReturn(false); - - contentCleanser522022M.cleanse(mockedFile); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImplUnitTest.java deleted file mode 100644 index 95cc65d5be..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImplUnitTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.disposition; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Date; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.junit.Before; -import org.junit.Test; - -/** - * Unit tests for {@link DispositionServiceImpl}. - * - * @author Tom Page - * @since 2.3.1 - */ -public class DispositionServiceImplUnitTest -{ - /** The node being subject to the disposition step. */ - NodeRef CONTENT_NODE_REF = new NodeRef("content://node/"); - - /** The class under test. */ - private DispositionServiceImpl dispositionService = new DispositionServiceImpl(); - - private NodeService mockNodeService = mock(NodeService.class); - - @Before - public void setUp() - { - dispositionService.setNodeService(mockNodeService); - } - - /** - * Check that the relevant information is retrieved from the DispositionActionDefinition in order to determine the - * "disposition as of" date. - */ - @Test - public void testCalculateAsOfDate() - { - // Set up a mock for the disposition action definition. - DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class); - Period mockPeriod = mock(Period.class); - when(mockDispositionActionDefinition.getPeriod()).thenReturn(mockPeriod); - when(mockDispositionActionDefinition.getPeriodProperty()).thenReturn(ContentModel.PROP_CREATED); - // Set up a created date and another date that is some Period later. - Date createdDate = new Date(1234567890); - when(mockNodeService.getProperty(CONTENT_NODE_REF, ContentModel.PROP_CREATED)).thenReturn(createdDate); - Date nextDate = new Date(1240000000); - when(mockPeriod.getNextDate(createdDate)).thenReturn(nextDate); - - // Call the method under test. - Date asOfDate = dispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition); - - assertEquals("Unexpected calculation for 'as of' date", nextDate, asOfDate); - } - - /** Check that the calculated "disposition as of" date is null if a null period is given. */ - @Test - public void testCalculateAsOfDate_nullPeriod() - { - DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class); - when(mockDispositionActionDefinition.getPeriod()).thenReturn(null); - - // Call the method under test. - Date asOfDate = dispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition); - - assertNull("It should not be possible to determine the 'as of' date.", asOfDate); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracterUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracterUnitTest.java deleted file mode 100644 index 092703afce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracterUnitTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.email; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for RFC822MetadataExtracter - * - * @author Ana Manolache - * @since 2.7 - */ -public class RFC822MetadataExtracterUnitTest extends BaseUnitTest -{ - @InjectMocks - private RFC822MetadataExtracter metadataExtracter; - - private static final Map COMMON_PROPERTIES = ImmutableMap.of( - ContentModel.PROP_NAME, "Name", - ContentModel.PROP_TITLE, "Title"); - private static final Map RECORD_PROPERTIES = ImmutableMap.of( - RecordsManagementModel.PROP_DECLARED_BY, "DeclaredBy", - RecordsManagementModel.PROP_DECLARED_AT, new Date()); - private static final Map DOD_PROPERTIES = ImmutableMap.of( - DOD5015Model.PROP_ORIGINATOR, "DODOriginator", - DOD5015Model.PROP_ADDRESS, "Title"); - - /** - * Given a node that is not a record nor a dod record - * and has record and dod record properties - * When the method is called - * Then the record properties and dod properties are filtered out - */ - @Test - public void testRemoveSensitivePropertiesFromCommonNodes() - { - // Given - NodeRef node = generateNodeRef(); - when(mockedNodeService.hasAspect(node, RecordsManagementModel.ASPECT_RECORD)).thenReturn(false); - when(mockedNodeService.hasAspect(node, DOD5015Model.ASPECT_DOD_5015_RECORD)).thenReturn(false); - - // When - Map systemProperties = new HashMap<>(COMMON_PROPERTIES); - systemProperties.putAll(RECORD_PROPERTIES); - systemProperties.putAll(DOD_PROPERTIES); - metadataExtracter.filterSystemProperties(systemProperties, generateTargetProperties(node)); - - // Then - assertTrue("Sensitive properties were not properly filtered out.", - systemProperties.keySet().equals(COMMON_PROPERTIES.keySet())); - } - - /** - * Given a node that is a record - * and has record properties and dod properties - * When the method is called - * Then the DOD properties are filtered out - * and common and record properties are preserved - */ - @Test - public void testRemoveDodPropertiesFromRecordNodes() - { - // Given - NodeRef node = generateNodeRef(); - when(mockedNodeService.hasAspect(node, RecordsManagementModel.ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.hasAspect(node, DOD5015Model.ASPECT_DOD_5015_RECORD)).thenReturn(false); - - // When - Map systemProperties = new HashMap<>(COMMON_PROPERTIES); - systemProperties.putAll(RECORD_PROPERTIES); - systemProperties.putAll(DOD_PROPERTIES); - metadataExtracter.filterSystemProperties(systemProperties, generateTargetProperties(node)); - - // Then - assertTrue("Common properties should not be filtered out from record nodes.", - systemProperties.keySet().containsAll(COMMON_PROPERTIES.keySet())); - assertTrue("Record properties should not be filtered out from record nodes.", - systemProperties.keySet().containsAll(RECORD_PROPERTIES.keySet())); - assertFalse("Sensitive DOD properties were not properly filtered out from record nodes.", - systemProperties.keySet().removeAll(DOD_PROPERTIES.keySet())); - } - - /** - * Given a node that is a dod record - * and has record properties and dod properties - * When the method is called - * Then the record properties are filtered out - * and common and DOD properties are preserved - */ - @Test - public void testRemoveRecordPropertiesFromDodNodes() - { - // Given - NodeRef node = generateNodeRef(); - when(mockedNodeService.hasAspect(node, RecordsManagementModel.ASPECT_RECORD)).thenReturn(false); - when(mockedNodeService.hasAspect(node, DOD5015Model.ASPECT_DOD_5015_RECORD)).thenReturn(true); - - // When - Map systemProperties = new HashMap<>(COMMON_PROPERTIES); - systemProperties.putAll(RECORD_PROPERTIES); - systemProperties.putAll(DOD_PROPERTIES); - metadataExtracter.filterSystemProperties(systemProperties, generateTargetProperties(node)); - - // Then - assertTrue("Common properties should not be filtered out from DOD nodes.", - systemProperties.keySet().containsAll(COMMON_PROPERTIES.keySet())); - assertTrue("DOD properties should not be filtered out from DOD nodes.", - systemProperties.keySet().containsAll(DOD_PROPERTIES.keySet())); - assertFalse("Sensitive record properties were not properly filtered out from DOD nodes.", - systemProperties.keySet().removeAll(RECORD_PROPERTIES.keySet())); - } - - /** - * Helper method that generates target properties such as the given node is retrieved from them - * - * @param node the node to represent in the properties - * @return the list of properties containing the node's information - */ - private Map generateTargetProperties(NodeRef node) - { - Map targetProperties = new HashMap<>(); - targetProperties.put(ContentModel.PROP_STORE_PROTOCOL, node.getStoreRef().getProtocol()); - targetProperties.put(ContentModel.PROP_STORE_IDENTIFIER, node.getStoreRef().getIdentifier()); - targetProperties.put(ContentModel.PROP_NODE_UUID, node.getId()); - return targetProperties; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java deleted file mode 100644 index a1ab80a97e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.forms; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyListOf; -import static org.mockito.Matchers.anyString; -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.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldDefinition; -import org.alfresco.repo.forms.Form; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * RecordsManagementTypeFormFilter Unit Test - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest -{ - private static final QName MY_CUSTOM_TYPE = generateQName(RM_URI); - - @Mock private Form mockForm; - @Mock private TypeDefinition mockTypeDefinition; - @Mock(name="recordsManagementAdminService") private RecordsManagementAdminService mockRecordsManagementAdminService; - - @Spy @InjectMocks RecordsManagementTypeFormFilter typeFormFilter; - - /** - * Test addCustomRMProperties - no custom properties found - */ - @Test - public void testAddCustomRMPropertiesNoneFound() - { - typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); - verifyZeroInteractions(mockForm); - } - - /** - * Test that non-customisable types are being treated correctly - */ - @Test - public void testAfterGenerateNotCustomisable() - { - when(mockTypeDefinition.getName()).thenReturn(MY_CUSTOM_TYPE); - when(mockRecordsManagementAdminService.isCustomisable(MY_CUSTOM_TYPE)).thenReturn(false); - - typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); - - verify(typeFormFilter, never()).addCustomRMProperties(any(QName.class), any(Form.class)); - } - - /** - * Test that customisable types are being treated correctly - */ - @Test - public void testAfterGenerateCustomisable() - { - when(mockTypeDefinition.getName()).thenReturn(MY_CUSTOM_TYPE); - when(mockRecordsManagementAdminService.isCustomisable(MY_CUSTOM_TYPE)).thenReturn(true); - - typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); - - verify(typeFormFilter, times(1)).addCustomRMProperties(any(QName.class), any(Form.class)); - } - - /** - * Test the default values for certain properties are being set correctly - */ - @Test - public void testDefaultFormValues() - { - List defs = new ArrayList<>(3); - FieldDefinition idDef = mockFieldDefinition("rma:identifier"); - defs.add(idDef); - FieldDefinition vrDef = mockFieldDefinition("rma:vitalRecordIndicator"); - defs.add(vrDef); - FieldDefinition rpDef = mockFieldDefinition("rma:reviewPeriod"); - defs.add(rpDef); - - when(mockForm.getFieldDefinitions()).thenReturn(defs); - - typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); - - verify(mockedIdentifierService).generateIdentifier(any(QName.class), any(NodeRef.class)); - verify(idDef).setDefaultValue(anyString()); - verify(vrDef).setDefaultValue(Boolean.FALSE.toString()); - verify(rpDef).setDefaultValue("none|0"); - } - - /** - * Helper to mock field definition - */ - private FieldDefinition mockFieldDefinition(String name) - { - FieldDefinition def = mock(FieldDefinition.class); - when(def.getName()).thenReturn(name); - return def; - } - - /** - * Test addCustomRMProperties - two custom properties found - */ - @Test - public void testAddCustomRMProperties() - { - // map of custom properties - Map properties = mockPropertyDefintionMap(2); - - // setup rm admin service to return properties for my custom type - when(mockRecordsManagementAdminService.getCustomPropertyDefinitions(MY_CUSTOM_TYPE)).thenReturn(properties); - - // call method - typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); - - // ensure that two custom properties have been added to the form - verify(mockForm, times(1)).addFields(anyListOf(Field.class)); - } - - /** - * Helper method to createa a mock property definition map - */ - private Map mockPropertyDefintionMap(int size) - { - Map properties = new HashMap<>(size); - for (int i = 0; i < size; i++) - { - QName name = generateQName(RM_URI); - PropertyDefinition propDef = mock(PropertyDefinition.class); - when(propDef.getName()).thenReturn(name); - DataTypeDefinition mockDataTypeDefinition = mock(DataTypeDefinition.class); - when(mockDataTypeDefinition.getName()).thenReturn(DataTypeDefinition.TEXT); - when(propDef.getDataType()).thenReturn(mockDataTypeDefinition); - properties.put(name, propDef); - } - return properties; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java deleted file mode 100644 index f8fb04b7c9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java +++ /dev/null @@ -1,729 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.hold; - -import static java.util.Arrays.asList; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doNothing; -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 static org.mockito.Mockito.when; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -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.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -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.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -/** - * Hold service implementation unit test - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldServiceImplUnitTest extends BaseUnitTest -{ - /** test values */ - private static final String HOLD_NAME = "holdname"; - private static final String HOLD_REASON = "holdreason"; - private static final String HOLD_DESCRIPTION = "holddescription"; - private static final String GENERIC_ERROR_MSG = "any error message text"; - - protected NodeRef holdContainer; - protected NodeRef hold; - protected NodeRef hold2; - protected NodeRef activeContent; - - @Mock - private CapabilityService mockedCapabilityService; - - @Mock - private ChildAssociationRef mockChildAssociationRef; - - @Spy @InjectMocks HoldServiceImpl holdService; - - @Before - @Override - public void before() throws Exception - { - super.before(); - - // setup objects used in mock interactions - holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - hold = generateNodeRef(TYPE_HOLD); - hold2 = generateNodeRef(TYPE_HOLD); - - when(mockedCapabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD)).thenReturn(AccessStatus.ALLOWED); - when(mockedCapabilityService.getCapabilityAccessState(hold2, RMPermissionModel.ADD_TO_HOLD)).thenReturn(AccessStatus.ALLOWED); - when(mockedCapabilityService.getCapabilityAccessState(hold, RMPermissionModel.REMOVE_FROM_HOLD)).thenReturn(AccessStatus.ALLOWED); - when(mockedCapabilityService.getCapabilityAccessState(hold2, RMPermissionModel.REMOVE_FROM_HOLD)).thenReturn(AccessStatus.ALLOWED); - - activeContent = generateNodeRef(); - QName contentSubtype = QName.createQName("contentSubtype", "contentSubtype"); - when(mockedNodeService.getType(activeContent)).thenReturn(contentSubtype); - when(mockedNodeTypeUtility.instanceOf(contentSubtype, ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockedNodeService.getPrimaryParent(activeContent)).thenReturn(mockChildAssociationRef); - - when(mockedNodeService.getPrimaryParent(recordFolder)).thenReturn(mockChildAssociationRef); - // setup interactions - doReturn(holdContainer).when(mockedFilePlanService).getHoldContainer(filePlan); - } - - @Test - public void isHold() - { - assertTrue(holdService.isHold(hold)); - assertFalse(holdService.isHold(recordFolder)); - } - - @Test - public void heldByMultipleResults() - { - // setup record folder in multiple holds - List holds = new ArrayList<>(4); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold, ASSOC_FROZEN_CONTENT, recordFolder, true, 1)); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold2, ASSOC_FROZEN_CONTENT, recordFolder, true, 2)); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold, ASSOC_FROZEN_CONTENT, activeContent, true, 1)); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold2, ASSOC_FROZEN_CONTENT, activeContent, true, 2)); - doReturn(holds).when(mockedNodeService).getParentAssocs(recordFolder, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - - //setup active content in multiple holds - doReturn(holds).when(mockedNodeService).getParentAssocs(activeContent, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - - doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); - - // check that both holds are found for record folder - List heldByHolds = holdService.heldBy(recordFolder, true); - assertNotNull(heldByHolds); - assertEquals(2, heldByHolds.size()); - assertTrue(holdService.heldBy(recordFolder, false).isEmpty()); - - // check that both holds are found for record (even thou they are one level deep) - heldByHolds = holdService.heldBy(record, true); - assertNotNull(heldByHolds); - assertEquals(2, heldByHolds.size()); - assertTrue(holdService.heldBy(record, false).isEmpty()); - - // check that both holds are found for active content - heldByHolds = holdService.heldBy(activeContent, true); - assertNotNull(heldByHolds); - assertEquals(2, heldByHolds.size()); - assertTrue(holdService.heldBy(activeContent, false).isEmpty()); - } - - @Test (expected=AlfrescoRuntimeException.class) - public void getHold() - { - // setup node service interactions - when(mockedNodeService.getChildByName(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), anyString())).thenReturn(null) - .thenReturn(hold) - .thenReturn(recordFolder); - - // no hold - NodeRef noHold = holdService.getHold(filePlan, "notAHold"); - assertNull(noHold); - - // found hold - NodeRef someHold = holdService.getHold(filePlan, "someHold"); - assertNotNull(someHold); - assertEquals(TYPE_HOLD, mockedNodeService.getType(someHold)); - - // ensure runtime exception is thrown - holdService.getHold(filePlan, "notHold"); - } - - @Test (expected=RuntimeException.class) - public void getHeldNotAHold() - { - holdService.getHeld(recordFolder); - } - - @Test - public void getHeldNoResults() - { - assertTrue(holdService.getHeld(hold).isEmpty()); - } - - @Test - public void getHeldWithResults() - { - // setup record folder in hold - List holds = new ArrayList<>(2); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold, ASSOC_FROZEN_CONTENT, recordFolder, true, 1)); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold, ASSOC_FROZEN_CONTENT, activeContent, true, 1)); - doReturn(holds).when(mockedNodeService).getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL); - - List list = holdService.getHeld(hold); - assertEquals(2, list.size()); - assertEquals(recordFolder, list.get(0)); - assertEquals(activeContent, list.get(1)); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test - public void createHold() - { - // setup node service interactions - when(mockedNodeService.createNode(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), any(QName.class) , eq(TYPE_HOLD), any(Map.class))) - .thenReturn(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, holdContainer, generateQName(), hold)); - - mockPoliciesForCreateHold(); - - // create hold - NodeRef newHold = holdService.createHold(filePlan, HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); - assertNotNull(newHold); - assertEquals(TYPE_HOLD, mockedNodeService.getType(newHold)); - assertEquals(hold, newHold); - - // check the node service interactions - ArgumentCaptor propertyMapCaptor = ArgumentCaptor.forClass(Map.class); - ArgumentCaptor assocNameCaptor = ArgumentCaptor.forClass(QName.class); - verify(mockedNodeService).createNode(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), assocNameCaptor.capture() , eq(TYPE_HOLD), propertyMapCaptor.capture()); - - // check property map - Map propertyMap = (Map)propertyMapCaptor.getValue(); - assertNotNull(propertyMap); - assertEquals(3, propertyMap.size()); - assertTrue(propertyMap.containsKey(ContentModel.PROP_NAME)); - assertEquals(HOLD_NAME, propertyMap.get(ContentModel.PROP_NAME)); - assertTrue(propertyMap.containsKey(ContentModel.PROP_DESCRIPTION)); - assertEquals(HOLD_DESCRIPTION, propertyMap.get(ContentModel.PROP_DESCRIPTION)); - assertTrue(propertyMap.containsKey(PROP_HOLD_REASON)); - assertEquals(HOLD_REASON, propertyMap.get(PROP_HOLD_REASON)); - - // check assoc name - assertNotNull(assocNameCaptor.getValue()); - assertEquals(NamespaceService.CONTENT_MODEL_1_0_URI, assocNameCaptor.getValue().getNamespaceURI()); - assertEquals(HOLD_NAME, assocNameCaptor.getValue().getLocalName()); - } - - @Test - public void getHoldReason() - { - // setup node service interactions - when(mockedNodeService.exists(hold)) - .thenReturn(false) - .thenReturn(true) - .thenReturn(true) - .thenReturn(true); - when(mockedNodeService.getProperty(eq(hold), eq(PROP_HOLD_REASON))) - .thenReturn(null) - .thenReturn(HOLD_REASON); - - // node does not exist - assertNull(holdService.getHoldReason(hold)); - - // node isn't a hold - assertNull(holdService.getHoldReason(recordFolder)); - - // hold reason isn't set - assertNull(holdService.getHoldReason(hold)); - - // hold reason set - assertEquals(HOLD_REASON, holdService.getHoldReason(hold)); - } - - @Test - public void setHoldReason() - { - // setup node service interactions - when(mockedNodeService.exists(hold)) - .thenReturn(false) - .thenReturn(true) - .thenReturn(true); - - // node does not exist - holdService.setHoldReason(hold, HOLD_REASON); - verify(mockedNodeService, never()).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); - - // node isn't a hold - holdService.setHoldReason(recordFolder, HOLD_REASON); - verify(mockedNodeService, never()).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); - - // set hold reason - holdService.setHoldReason(hold, HOLD_REASON); - verify(mockedNodeService).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); - } - - @Test (expected=AlfrescoRuntimeException.class) - public void deleteHoldNotAHold() - { - holdService.deleteHold(recordFolder); - verify(mockedNodeService, never()).deleteNode(hold); - } - - @Test - public void deleteHold() - { - mockPoliciesForDeleteHold(); - - // delete hold - holdService.deleteHold(hold); - verify(mockedNodeService).deleteNode(hold); - - // TODO check interactions with policy component!!! - } - - @Test (expected = AccessDeniedException.class) - public void deleteHoldNoPermissionsOnContent() - { - mockPoliciesForDeleteHold(); - - ChildAssociationRef childAssociationRef = generateChildAssociationRef(hold, record); - when(mockedNodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)) - .thenReturn(Collections.singletonList(childAssociationRef)); - - when(mockedPermissionService.hasPermission(record, RMPermissionModel.FILING)).thenReturn(AccessStatus.DENIED); - when(mockedNodeService.getProperty(record, ContentModel.PROP_NAME)).thenThrow(new AccessDeniedException(GENERIC_ERROR_MSG)); - - holdService.beforeDeleteNode(hold); - } - - @Test (expected = IntegrityException.class) - public void addToHoldNotAHold() - { - holdService.addToHold(recordFolder, recordFolder); - } - - @Test (expected = IntegrityException.class) - public void addToHoldNotARecordFolderOrRecordOrActiveContent() - { - NodeRef anotherThing = generateNodeRef(TYPE_RECORD_CATEGORY); - holdService.addToHold(hold, anotherThing); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHoldNotInHold() - { - mockPoliciesForAddToHold(); - when(mockedNodeService.getPrimaryParent(record)).thenReturn(mockChildAssociationRef); - - holdService.addToHold(hold, recordFolder); - - verify(mockedNodeService).addChild(hold, recordFolder, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - - holdService.addToHold(hold, record); - verify(mockedNodeService).addChild(hold, record, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, times(2)).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - - holdService.addToHold(hold, activeContent); - verify(mockedNodeService).addChild(hold, activeContent, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService).addAspect(eq(activeContent), eq(ASPECT_FROZEN), any(Map.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHoldAlreadyInHold() - { - doReturn(asList(recordFolder, activeContent)).when(holdService).getHeld(hold); - - holdService.addToHold(hold, recordFolder); - - verify(mockedNodeService, never()).addChild(hold, recordFolder, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService, never()).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, never()).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - - holdService.addToHold(hold, activeContent); - - verify(mockedNodeService, never()).addChild(hold, activeContent, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService, never()).addAspect(eq(activeContent), eq(ASPECT_FROZEN), any(Map.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHoldAlreadyFrozen() - { - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(activeContent, ASPECT_FROZEN); - - mockPoliciesForAddToHold(); - - holdService.addToHold(hold, recordFolder); - - verify(mockedNodeService).addChild(hold, recordFolder, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService, never()).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, never()).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - - holdService.addToHold(hold, activeContent); - verify(mockedNodeService).addChild(hold, activeContent, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService, never()).addAspect(eq(activeContent), eq(ASPECT_FROZEN), any(Map.class)); - } - - @Test (expected = AccessDeniedException.class) - public void addActiveContentToHoldsNoPermissionsOnHold() - { - when(mockedCapabilityService.getCapabilityAccessState(hold, RMPermissionModel.ADD_TO_HOLD)).thenReturn(AccessStatus.DENIED); - // build a list of holds - List holds = new ArrayList<>(2); - holds.add(hold); - holds.add(hold2); - holdService.addToHolds(holds, activeContent); - } - - @Test (expected = AccessDeniedException.class) - public void addActiveContentToHoldNoPermissionsOnContent() - { - when(mockedPermissionService.hasPermission(activeContent, PermissionService.WRITE)).thenReturn(AccessStatus.DENIED); - holdService.addToHold(hold, activeContent); - } - - @Test (expected = IntegrityException.class) - public void addArchivedContentToHold() - { - when(mockedNodeService.hasAspect(activeContent, RecordsManagementModel.ASPECT_ARCHIVED)).thenReturn(true); - holdService.addToHold(hold, activeContent); - } - - @Test (expected = IntegrityException.class) - public void addLockedContentToHold() - { - when(mockedNodeService.hasAspect(activeContent, ContentModel.ASPECT_LOCKABLE)).thenReturn(true); - holdService.addToHold(hold, activeContent); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHolds() - { - // ensure the interaction indicates that a node has the frozen aspect applied if it has - doAnswer(new Answer() - { - public Void answer(InvocationOnMock invocation) - { - NodeRef nodeRef = (NodeRef)invocation.getArguments()[0]; - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FROZEN); - return null; - } - - }).when(mockedNodeService).addAspect(any(NodeRef.class), eq(ASPECT_FROZEN), any(Map.class)); - - mockPoliciesForAddToHold(); - - // build a list of holds - List holds = new ArrayList<>(2); - holds.add(hold); - holds.add(hold2); - - // add the record folder to both holds - holdService.addToHolds(holds, recordFolder); - - // verify the interactions - verify(mockedNodeService, times(1)).addChild(hold, recordFolder, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService, times(1)).addChild(hold2, recordFolder, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_CONTENT); - verify(mockedNodeService, times(1)).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, times(1)).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - } - - @Test (expected = IntegrityException.class) - public void removeFromHoldNotAHold() - { - holdService.removeFromHold(recordFolder, recordFolder); - } - - @Test - public void removeFromHoldNotInHold() - { - mockPoliciesForRemoveFromHold(); - - holdService.removeFromHold(hold, recordFolder); - - verify(mockedNodeService, never()).removeChild(hold, recordFolder); - verify(mockedNodeService, never()).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, never()).removeAspect(record, ASPECT_FROZEN); - } - - @Test - public void removeFromHold() - { - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - mockPoliciesForRemoveFromHold(); - - holdService.removeFromHold(hold, recordFolder); - - verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); - verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); - } - - @Test - public void removeFromHolds() - { - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold2); - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - mockPoliciesForRemoveFromHold(); - - // build a list of holds - List holds = new ArrayList<>(2); - holds.add(hold); - holds.add(hold2); - - holdService.removeFromHolds(holds, recordFolder); - - verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); - verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder); - verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); - } - - @Test - public void removeFromAllHolds() - { - // build a list of holds - List holds = new ArrayList<>(2); - holds.add(hold); - holds.add(hold2); - - doAnswer(new Answer() - { - public Void answer(InvocationOnMock invocation) - { - doReturn(Collections.singletonList(hold2)).when(holdService).heldBy(recordFolder, true); - return null; - } - - }).when(mockedNodeService).removeChild(hold, recordFolder); - - mockPoliciesForRemoveFromHold(); - - doAnswer(new Answer() - { - public Void answer(InvocationOnMock invocation) - { - doReturn(new ArrayList()).when(holdService).heldBy(recordFolder, true); - return null; - } - - }).when(mockedNodeService).removeChild(hold2, recordFolder); - - // define interactions - doReturn(holds).when(holdService).heldBy(recordFolder, true); - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold2); - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - // remove record folder from all holds - holdService.removeFromAllHolds(recordFolder); - - // verify interactions - verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); - verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder); - verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); - } - - @Test (expected = AccessDeniedException.class) - public void removeActiveContentFromHoldsNoPermissionsOnHold() - { - doReturn(Collections.singletonList(activeContent)).when(holdService).getHeld(hold); - doReturn(Collections.singletonList(activeContent)).when(holdService).getHeld(hold2); - doReturn(true).when(mockedNodeService).hasAspect(activeContent, ASPECT_FROZEN); - when(mockedCapabilityService.getCapabilityAccessState(hold, RMPermissionModel.REMOVE_FROM_HOLD)).thenReturn(AccessStatus.DENIED); - // build a list of holds - List holds = new ArrayList<>(2); - holds.add(hold); - holds.add(hold2); - holdService.removeFromHolds(holds, activeContent); - } - - /** - * test before delete node throws exception for failed read permission check for content - */ - @Test (expected = AccessDeniedException.class) - public void testBeforeDeleteNodeThrowsExceptionForActiveContentWithoutReadPermission() - { - NodeRef heldContent = generateNodeRef(TYPE_CONTENT); - mockPoliciesForExistingHoldWithHeldItems(hold, heldContent); - - // mocks for held content - when(mockedRecordService.isRecord(heldContent)).thenReturn(false); - when(mockedRecordFolderService.isRecordFolder(heldContent)).thenReturn(false); - when(mockedPermissionService.hasPermission(heldContent, PermissionService.READ)).thenReturn(AccessStatus.DENIED); - when(mockedNodeService.getProperty(heldContent, ContentModel.PROP_NAME)).thenReturn("foo"); - - holdService.beforeDeleteNode(hold); - } - - /** - * test before delete node throws exception for failed read permission check for records - */ - @Test (expected = AccessDeniedException.class) - public void testBeforeDeleteNodeThrowsExceptionForARecordWithoutReadPermission() - { - NodeRef heldContent = generateNodeRef(); - mockPoliciesForExistingHoldWithHeldItems(hold, heldContent); - - when(mockedRecordService.isRecord(heldContent)).thenThrow(new AccessDeniedException("")); - - holdService.beforeDeleteNode(hold); - } - - /** - * test before delete node throws exception for failed file permission check for records - */ - @Test (expected = AccessDeniedException.class) - public void testBeforeDeleteNodeThrowsExceptionForARecordWithoutFilePermission() - { - NodeRef heldContent = generateNodeRef(); - - mockPoliciesForExistingHoldWithHeldItems(hold, heldContent); - - // mocks for held record - when(mockedRecordService.isRecord(heldContent)).thenReturn(true); - when(mockedPermissionService.hasPermission(heldContent, RMPermissionModel.FILING)).thenReturn(AccessStatus.DENIED); - when(mockedNodeService.getProperty(heldContent, ContentModel.PROP_NAME)).thenReturn("foo"); - - holdService.beforeDeleteNode(hold); - } - - /** - * Test hold deleted for active content with read permission - */ - @Test - public void testDeleteHoldChecksReadPermissionForActiveContent() - { - NodeRef heldContent = generateNodeRef(TYPE_CONTENT); - List holds = createListOfHoldAssociations(heldContent); - - mockPoliciesForDeleteHold(); - when(mockedNodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)).thenReturn(holds); - when(mockedRecordService.isRecord(heldContent)).thenReturn(false); - when(mockedRecordFolderService.isRecordFolder(heldContent)).thenReturn(false); - when(mockedPermissionService.hasPermission(heldContent, PermissionService.READ)).thenReturn(AccessStatus.ALLOWED); - when(mockedNodeService.getProperty(heldContent, ContentModel.PROP_NAME)).thenReturn("foo"); - - holdService.deleteHold(hold); - - verify(mockedNodeService, times(1)).deleteNode(hold); - } - - /** - * Helper method to create hold and associations with given content - */ - private List createListOfHoldAssociations(NodeRef heldContent) - { - List holds = new ArrayList<>(2); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_CONTENT, hold, ASSOC_FROZEN_CONTENT, heldContent, true, 1)); - return holds; - } - - /** - * mocks for existing hold with held items - */ - private void mockPoliciesForExistingHoldWithHeldItems(NodeRef hold, NodeRef heldContent) - { - when(mockedNodeService.exists(hold)).thenReturn(true); - when(holdService.isHold(hold)).thenReturn(true); - - List holds = createListOfHoldAssociations(heldContent); - when(mockedNodeService.getChildAssocs(hold, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)).thenReturn(holds); - } - - /** - * mocks policies for create hold - */ - private void mockPoliciesForCreateHold() - { - doNothing().when(holdService).invokeBeforeCreateHold(any(), anyString(), anyString()); - doNothing().when(holdService).invokeOnCreateHold(any()); - } - - /** - * mocks policies for delete hold - */ - private void mockPoliciesForDeleteHold() - { - doNothing().when(holdService).invokeBeforeDeleteHold(any()); - doNothing().when(holdService).invokeOnDeleteHold(any(), any()); - } - - /** - * mocks policies for add to hold - */ - private void mockPoliciesForAddToHold() - { - doNothing().when(holdService).invokeBeforeAddToHold(any(), any()); - doNothing().when(holdService).invokeOnAddToHold(any(), any()); - } - - /** - * mocks policies for remove from hold - */ - private void mockPoliciesForRemoveFromHold() - { - doNothing().when(holdService).invokeBeforeRemoveFromHold(any(), any()); - doNothing().when(holdService).invokeOnRemoveFromHold(any(), any()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java deleted file mode 100644 index 463b6a7745..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.job; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -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.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.mockito.stubbing.Answer; - -/** - * Disposition lifecycle job execution unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest -{ - /** disposition actions */ - private static final String CUTOFF = "cutoff"; - private static final String RETAIN = "retain"; - private static final String DESTROY = "destroy"; - - /** test query snippet */ - 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 - { - super.before(); - - Answer doInTransactionAnswer = invocation -> { - RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; - return callback.execute(); - }; - doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class), - Matchers.anyBoolean(), Matchers.anyBoolean()); - - // setup data - List dispositionActions = buildList(CUTOFF, RETAIN); - executer.setDispositionActions(dispositionActions); - executer.setBatchSize(1); - - // setup interactions - doReturn(mockedResultSet).when(mockedSearchService).query(any(SearchParameters.class)); - when(mockedResultSet.hasMore()).thenReturn(false); - } - - /** - * Helper method to verify that the query has been executed and closed - * @param numberOfInvocation number of times the query has been executed and closed - */ - private void verifyQueryTimes(int numberOfInvocation) - { - ArgumentCaptor paramsCaptor = ArgumentCaptor.forClass(SearchParameters.class); - verify(mockedSearchService, times(numberOfInvocation)).query(paramsCaptor.capture()); - assertTrue(paramsCaptor.getValue().getQuery().contains(QUERY)); - verify(mockedResultSet, times(numberOfInvocation)).getNodeRefs(); - verify(mockedResultSet, times(numberOfInvocation)).close(); - } - - /** - * When the are no results in query. - */ - @Test - public void noResultsInQuery() - { - // given - doReturn(Collections.EMPTY_LIST).when(mockedResultSet).getNodeRefs(); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQueryTimes(1); - - // 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. - */ - @SuppressWarnings("unchecked") - @Test - public void dispositionActionDoesNotMatch() - { - // test data - NodeRef node1 = generateNodeRef(); - NodeRef node2 = generateNodeRef(); - - // given - doReturn(DESTROY).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); - doReturn(DESTROY).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - - when(mockedResultSet.getNodeRefs()) - .thenReturn(buildList(node1)) - .thenReturn(buildList(node2)); - - when(mockedResultSet.hasMore()) - .thenReturn(true) - .thenReturn(false); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQueryTimes(2); - - // 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), - Matchers.anyBoolean(), Matchers.anyBoolean()); - - // 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 - */ - @Test - public void nodeDoesNotExist() - { - // 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 - verifyQueryTimes(1); - - // 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); - } - - /** - * When there are disposition actions eligible for processing - */ - @SuppressWarnings("unchecked") - @Test - public void dispositionActionProcessed() - { - // test data - NodeRef node1 = generateNodeRef(); - NodeRef node2 = generateNodeRef(); - NodeRef parent = generateNodeRef(); - ChildAssociationRef parentAssoc = new ChildAssociationRef(ASSOC_NEXT_DISPOSITION_ACTION, parent, generateQName(), generateNodeRef()); - - 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(mockedResultSet.getNodeRefs()) - .thenReturn(buildList(node1)) - .thenReturn(buildList(node2)); - - when(mockedResultSet.hasMore()) - .thenReturn(true) - .thenReturn(false); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQueryTimes(2); - - // 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), - Matchers.anyBoolean(), Matchers.anyBoolean()); - - // ensure each node is process correctly - // node1 - verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); - verify(mockedNodeService, times(1)).getPrimaryParent(node1); - verify(mockedRecordsManagementActionService, times(1)).executeRecordsManagementAction(eq(parent), eq(CUTOFF), anyMap()); - // node2 - 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); - } - - /** - * Brittle unit test that simply checks the generated query is an exact string when the supplied disposition actions - * are "CUTOFF" and "RETAIN" (see {@link #before}). - */ - @Test - public void testGetQuery() - { - String actual = executer.getQuery(); - - String expected = "TYPE:\"rma:dispositionAction\" AND " + - "(@rma\\:dispositionAction:(\"cutoff\" OR \"retain\")) " + - "AND ISUNSET:\"rma:dispositionActionCompletedAt\" " + - "AND ( @rma\\:dispositionEventsEligible:true OR @rma\\:dispositionAsOf:[MIN TO NOW] ) "; - - assertEquals(expected, actual); - } - - /** - * Given the maximum page of elements for search service is 2 - * and search service finds more than one page of elements - * When the job executer runs - * Then the executer retrieves both pages and iterates all elements - */ - @Test - public void testPagination() - { - final NodeRef node1 = generateNodeRef(); - final NodeRef node2 = generateNodeRef(); - final NodeRef node3 = generateNodeRef(); - final NodeRef node4 = generateNodeRef(); - - // mock the search service to return the right page - when(mockedSearchService.query(any(SearchParameters.class))).thenAnswer((Answer) invocation -> { - SearchParameters params = invocation.getArgumentAt(0, SearchParameters.class); - if (params.getSkipCount() == 0) - { - // mock first page - ResultSet result1 = mock(ResultSet.class); - when(result1.getNodeRefs()).thenReturn(Arrays.asList(node1, node2)); - when(result1.hasMore()).thenReturn(true); - return result1; - } - else if (params.getSkipCount() == 2) - { - // mock second page - ResultSet result2 = mock(ResultSet.class); - when(result2.getNodeRefs()).thenReturn(Arrays.asList(node3, node4)); - when(result2.hasMore()).thenReturn(false); - return result2; - } - throw new IndexOutOfBoundsException("Pagination did not stop after the second page!"); - }); - - // call the service - executer.executeImpl(); - - // check the loop iterated trough all the elements - verify(mockedNodeService).exists(node1); - verify(mockedNodeService).exists(node2); - verify(mockedNodeService).exists(node3); - verify(mockedNodeService).exists(node4); - verify(mockedSearchService, times(2)).query(any(SearchParameters.class)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java deleted file mode 100644 index f9b8d47a82..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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 java.util.Collections; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -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; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Freeze evaluator unit test. - * - * @author Roy Wetherall - */ -public class FrozenEvaluatorUnitTest extends BaseUnitTest -{ - @Mock(name="kinds") Set mockedKinds; - - @Spy @InjectMocks FrozenEvaluator evaluator; - - @Before - @Override - public void before() throws Exception - { - super.before(); - - // setup interactions - doReturn(false).when(mockedKinds).contains(FilePlanComponentKind.RECORD_CATEGORY); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD_FOLDER); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD); - } - - @Test - public void isNotRecordOrRecordFolder() - { - // setup interactions - NodeRef nodeRef = generateNodeRef(TYPE_RECORD_CATEGORY); - doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(mockedFilePlanService).getFilePlanComponentKind(nodeRef); - - // evaluate - boolean result = evaluator.evaluate(filePlanComponent); - assertFalse(result); - - // verify interactions - verify(mockedHoldService, never()).heldBy(filePlanComponent, true); - } - - @Test - public void isNotHeld() - { - // setup interactions - doReturn(FilePlanComponentKind.RECORD).when(mockedFilePlanService).getFilePlanComponentKind(record); - doReturn(Collections.EMPTY_LIST).when(mockedHoldService).heldBy(record, true); - - // evaluate - boolean result = evaluator.evaluate(record); - assertFalse(result); - - // verify interactions - verify(mockedHoldService, times(1)).heldBy(record, true); - } - - @Test - public void isHeldByAtLeastOne() - { - // setup interactions - doReturn(FilePlanComponentKind.RECORD).when(mockedFilePlanService).getFilePlanComponentKind(record); - doReturn(Collections.singletonList(generateNodeRef(TYPE_HOLD))).when(mockedHoldService).heldBy(record, true); - - // evaluate - boolean result = evaluator.evaluate(record); - assertTrue(result); - - // verify interactions - verify(mockedHoldService, times(1)).heldBy(record, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java deleted file mode 100644 index 0f9ec9e296..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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 java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; - -/** - * Transfer evaluator unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class TransferEvaluatorUnitTest extends BaseUnitTest -{ - private NodeRef transfer; - - @Spy @InjectMocks TransferEvaluator transferEvaluator; - - @Override - public void before() throws Exception - { - super.before(); - - // setup node references - transfer = generateNodeRef(TYPE_TRANSFER); - } - - private List getParentAssocs(NodeRef provided) - { - List result = new ArrayList<>(1); - result.add(new ChildAssociationRef(ASSOC_TRANSFERRED, transfer, generateQName(), provided, false, 1)); - return result; - } - - @Test - public void isNotTransferringRecord() - { - // setup interactions - doReturn(Collections.emptyList()).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertFalse(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, never()).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, times(1)).getRecordFolders(record); - - } - - @Test - public void isTransferringWhenExpectingAccending() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - transferEvaluator.setTransferAccessionIndicator(true); - - // evaluate - assertFalse(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - } - - @Test - public void transferringRecord() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertTrue(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - - } - - @Test - public void transferringRecordFolder() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(recordFolder)).when(mockedNodeService).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertTrue(transferEvaluator.evaluate(recordFolder)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - } - - @Test - public void transferringRecordWithinRecordFolder() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(Collections.emptyList()).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - doReturn(getParentAssocs(recordFolder)).when(mockedNodeService).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertTrue(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, times(1)).getRecordFolders(record); - - } - - @Test - public void accendingRecord() - { - // setup interactions - doReturn(Boolean.TRUE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - transferEvaluator.setTransferAccessionIndicator(true); - - // evaluate - assertTrue(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java deleted file mode 100644 index ab826fef23..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.compatibility; - -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 static org.mockito.Mockito.verifyZeroInteractions; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; - -/** - * Dictionary bootstrap post processor unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DictionaryBootstrapPostProcessorUnitTest extends BaseUnitTest -{ - /** bean id's */ - private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap"; - private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap"; - - @Mock private ConfigurableListableBeanFactory mockedBeanFactory; - @Mock private BeanDefinition mockedBeanDefinition; - - @InjectMocks private DictionaryBootstrapPostProcessor postProcessor; - - /** - * given the bean factory does not contain the site service bootstrap bean then ensure that it is - * not added as a dependency - */ - @Test - public void noSiteServiceBootstrapBeanAvailable() - { - // === given ==== - doReturn(false).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - - // === when === - postProcessor.postProcessBeanFactory(mockedBeanFactory); - - // === then === - verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - verifyNoMoreInteractions(mockedBeanFactory); - verifyZeroInteractions(mockedBeanDefinition); - } - - /** - * given that the site service bootstrap bean is contained within the bean factory, ensure that - * it is added as a dependency - */ - @Test - public void siteServiceBootstrapBeanAvailable() - { - // === given ==== - doReturn(true).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - doReturn(true).when(mockedBeanFactory).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP); - doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); - - // === when === - postProcessor.postProcessBeanFactory(mockedBeanFactory); - - // === then === - verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - verify(mockedBeanFactory, times(1)).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP); - - verify(mockedBeanFactory, times(1)).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); - verify(mockedBeanDefinition, times(1)).setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP}); - - verifyNoMoreInteractions(mockedBeanFactory, mockedBeanDefinition); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java deleted file mode 100644 index a540751be9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_HELD_CHILDREN; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_HELD_CHILDREN_COUNT; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.util.NodeTypeUtility; -import org.alfresco.module.org_alfresco_module_rm.util.PropertyModificationAllowedCheck; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException; -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.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.context.ApplicationContext; - -/** - * Test class for frozen aspect - * @author Ross Gale - * @since 3.2 - */ -public class FrozenAspectUnitTest -{ - @Mock - private NodeService mockNodeService; - - @Mock - private ApplicationContext mockApplicationContext; - - @Mock - private ChildAssociationRef mockChildAssociationRef; - - @Mock - private NodeTypeUtility mockedNodeTypeUtility; - - @Mock - private FreezeService mockFreezeService; - - @Mock - private TransactionalResourceHelper mockResourceHelper; - - @Mock - private ChildAssociationRef mockChildRef; - - @Mock - private ChildAssociationRef mockParentRef; - - @Mock - private ChildAssociationRef mockOldRef; - - @Mock - private Set mockSet; - - @Mock - private PropertyModificationAllowedCheck mockPropertyModificationAllowedCheck; - - @InjectMocks - private FrozenAspect frozenAspect; - - private final List children = new ArrayList<>(); - - private NodeRef record = new NodeRef("workspace://record/node"); - private NodeRef folder = new NodeRef("workspace://folder/node"); - private NodeRef content = new NodeRef("workspace://content/node"); - private NodeRef child = new NodeRef("workspace://content/child"); - private NodeRef parent = new NodeRef("workspace://content/parent"); - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - when(mockNodeService.exists(record)).thenReturn(true); - when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT); - when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(record), ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockNodeService.exists(content)).thenReturn(true); - when(mockNodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); - when(mockNodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); - when(mockApplicationContext.getBean("dbNodeService")).thenReturn(mockNodeService); - when(mockFreezeService.isFrozen(content)).thenReturn(false); - children.add(mockChildRef); - when(mockNodeService.getChildAssocs(content)).thenReturn(children); - when(mockChildRef.isPrimary()).thenReturn(true); - } - - /** - * Test that the held count is reduced on a record folder after the frozen aspect is removed from a record - */ - @Test - public void testRemoveAspectForRecords() - { - when(mockNodeService.getPrimaryParent(record)).thenReturn(mockChildAssociationRef); - when(mockChildAssociationRef.getParentRef()).thenReturn(folder); - frozenAspect.onRemoveAspect(record, null); - verify(mockNodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); - } - - /** - * Test that the held count is reduced on a folder after the frozen aspect is removed from a piece of content - */ - @Test - public void testRemoveAspectForContent() - { - when(mockNodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); - when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT); - when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(content), ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockNodeService.getPrimaryParent(content)).thenReturn(mockChildAssociationRef); - when(mockChildAssociationRef.getParentRef()).thenReturn(folder); - frozenAspect.onRemoveAspect(content, null); - verify(mockNodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); - } - - /** - * Test that the remove code is only run for records or active content - */ - @Test - public void testRemoveAspectForContentDoesntUpdateForOtherTypes() - { - when(mockNodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); - when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_FOLDER); - when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(content), ContentModel.TYPE_CONTENT)).thenReturn(false); - frozenAspect.onRemoveAspect(content, null); - verify(mockNodeService, times(0)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); - } - - /** - * Test before delete throws an error if a node is frozen - */ - @Test(expected = PermissionDeniedException.class) - public void testBeforeDeleteNodeThrowsExceptionIfNodeFrozen() - { - when(mockFreezeService.isFrozen(content)).thenReturn(true); - frozenAspect.beforeDeleteNode(content); - } - - /** - * Test before delete is fine for non-frozen nodes - */ - @Test - public void testBeforeDeleteForNonFrozenNodes() - { - frozenAspect.beforeDeleteNode(content); - verify(mockNodeService, times(1)).getChildAssocs(content); - verify(mockChildRef, times(1)).getChildRef(); - } - - /** - * Test before delete throws an error for a node with frozen children - */ - @Test (expected = PermissionDeniedException.class) - public void testBeforeDeleteThrowsExceptionForFrozenChild() - { - when(mockChildRef.getChildRef()).thenReturn(child); - when(mockFreezeService.isFrozen(child)).thenReturn(true); - frozenAspect.beforeDeleteNode(content); - } - - /** - * Test on add aspect for a record node - */ - @Test - public void testOnAddAspectForRecord() - { - when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef); - when(mockParentRef.getParentRef()).thenReturn(parent); - when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(true); - when(mockNodeService.getProperty(parent, PROP_HELD_CHILDREN_COUNT)).thenReturn(0); - frozenAspect.onAddAspect(record,null); - verify(mockNodeService, times(1)).setProperty(parent, PROP_HELD_CHILDREN_COUNT, 1); - } - - /** - * Test on add aspect for a content node - */ - @Test - public void testOnAddAspectForContent() - { - when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT); - when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(content), ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockNodeService.getPrimaryParent(content)).thenReturn(mockParentRef); - when(mockParentRef.getParentRef()).thenReturn(parent); - when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(false); - when(mockNodeService.getType(parent)).thenReturn(ContentModel.TYPE_FOLDER); - when(mockedNodeTypeUtility.instanceOf(mockNodeService.getType(parent), ContentModel.TYPE_FOLDER)).thenReturn(true); - frozenAspect.onAddAspect(content, null); - verify(mockNodeService, times(1)).addAspect(any(NodeRef.class), any(QName.class), anyMap()); - } - - /** - * Test before move throws an error for a frozen node - */ - @Test(expected = PermissionDeniedException.class) - public void testBeforeMoveThrowsExceptionForFrozenNode() - { - when(mockOldRef.getParentRef()).thenReturn(parent); - when(mockOldRef.getChildRef()).thenReturn(child); - when(mockNodeService.exists(child)).thenReturn(true); - when(mockFreezeService.isFrozen(child)).thenReturn(true); - frozenAspect.beforeMoveNode(mockOldRef, null); - } - - /** - * Test update properties throws an error for frozen nodes - */ - @Test(expected = PermissionDeniedException.class) - public void testUpdatePropertiesThrowsExceptionForFrozenNode() - { - when(mockFreezeService.isFrozen(content)).thenReturn(true); - when(mockResourceHelper.getSet(content)).thenReturn(mockSet); - when(mockSet.contains("frozen")).thenReturn(false); - when(mockPropertyModificationAllowedCheck.check(null, null)).thenReturn(false); - frozenAspect.onUpdateProperties(content, null, null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspectUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspectUnitTest.java deleted file mode 100644 index 1d0683ee30..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspectUnitTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.ContentBinDuplicationUtility; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Unit tests for the {@link RecordAspect}. - * - * @author Claudia Agache - */ -public class RecordAspectUnitTest -{ - private static final NodeRef NODE_REF = new NodeRef("node://Ref/"); - private static final NodeRef COPY_REF = new NodeRef("node://Copy/"); - private static final AssociationRef SOURCE_ASSOC_REF = new AssociationRef(COPY_REF, ContentModel.ASSOC_ORIGINAL, - NODE_REF); - private static final AssociationRef TARGET_ASSOC_REF = new AssociationRef(NODE_REF, ContentModel.ASSOC_ORIGINAL, - COPY_REF); - - @InjectMocks - private RecordAspect recordAspect; - @Mock - private NodeService mockNodeService; - @Mock - private ExtendedSecurityService mockExtendedSecurityService; - @Mock - private ContentBinDuplicationUtility mockContentBinDuplicationUtility; - - @Before - public void setUp() - { - initMocks(this); - } - - /** Check that the bin is duplicated before adding the aspect if the file has a copy. */ - @Test - public void testDuplicateBinBeforeAddingAspectForFileWithCopy() - { - when(mockNodeService.getSourceAssocs(NODE_REF, ContentModel.ASSOC_ORIGINAL)).thenReturn(asList(SOURCE_ASSOC_REF)); - - recordAspect.beforeAddAspect(NODE_REF, ASPECT_RECORD); - - verify(mockContentBinDuplicationUtility, times(1)).duplicate(NODE_REF); - } - - /** Check that the bin is duplicated before adding the aspect if the file is a copy. */ - @Test - public void testDuplicateBinBeforeAddingAspectForCopy() - { - when(mockNodeService.getTargetAssocs(NODE_REF, ContentModel.ASSOC_ORIGINAL)).thenReturn(asList(TARGET_ASSOC_REF)); - - recordAspect.beforeAddAspect(NODE_REF, ASPECT_RECORD); - - verify(mockContentBinDuplicationUtility, times(1)).duplicate(NODE_REF); - } - - /** Check that the bin is not duplicated before adding the aspect if the node has no copies. */ - @Test - public void testNotDuplicateBinForFileWithNoCopies() - { - when(mockNodeService.getSourceAssocs(NODE_REF, ContentModel.ASSOC_ORIGINAL)).thenReturn(emptyList()); - when(mockNodeService.getTargetAssocs(NODE_REF, ContentModel.ASSOC_ORIGINAL)).thenReturn(emptyList()); - - recordAspect.beforeAddAspect(NODE_REF, ASPECT_RECORD); - - verify(mockContentBinDuplicationUtility, times(0)).duplicate(NODE_REF); - } - - /** Check that the bin is duplicated when copying a record. */ - @Test - public void testDuplicateBinWhenCopyingRecord() - { - when(mockNodeService.exists(COPY_REF)).thenReturn(true); - when(mockNodeService.hasAspect(COPY_REF, ASPECT_RECORD)).thenReturn(true); - - recordAspect.onCopyComplete(null, NODE_REF, COPY_REF, true, null); - - verify(mockExtendedSecurityService, times(1)).remove(COPY_REF); - verify(mockContentBinDuplicationUtility, times(1)).duplicate(COPY_REF); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java deleted file mode 100644 index 884b809a3a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -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.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Version record aspect unit tests - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class VersionRecordAspectUnitTest extends BaseUnitTest -{ - /** service mocks */ - private @Mock VersionHistory mockedVersionHistory; - private @Mock Version mockedVersion; - private @Mock VersionService mockedVersionService; - private @Mock RelationshipService mockedRelationshipService; - - /** test object */ - private @InjectMocks VersionRecordAspect versionRecordAspect; - - /** - * given that there is no recorded version - * before delete of record - * then nothing happens - */ - @Test - public void beforeDeleteNoVersionNodeRef() - { - NodeRef nodeRef = generateNodeRef(); - - when(mockedRecordableVersionService.getRecordedVersion(nodeRef)) - .thenReturn(null); - - versionRecordAspect.beforeDeleteNode(nodeRef); - - verify(mockedNodeService, never()).getProperty(nodeRef, RecordableVersionModel.PROP_VERSION_LABEL); - verify(mockedRecordableVersionService, never()).destroyRecordedVersion(any(Version.class)); - } - - /** - * given that there is a recorded version - * before delete of record - * then the version is marked as destroyed - */ - @Test - public void beforeDeleteMarkVersionDestroyed() - { - NodeRef nodeRef = generateNodeRef(); - - when(mockedRecordableVersionService.getRecordedVersion(nodeRef)) - .thenReturn(mockedVersion); - - versionRecordAspect.beforeDeleteNode(nodeRef); - - verify(mockedRecordableVersionService).destroyRecordedVersion(mockedVersion); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanTypeUnitTest.java deleted file mode 100644 index 2e32b41570..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanTypeUnitTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Arrays; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -import com.google.common.collect.Sets; - -/** - * Unit test that test the conditions enforced by FilePlanType behavior bean - * - * @author Ana Bozianu - * @since 2.6 - */ -public class FilePlanTypeUnitTest extends BaseUnitTest -{ - - /** test object */ - private @InjectMocks FilePlanType filePlanType; - - /** existing fileplan node */ - private NodeRef filePlanContainer; - - @Before - public void setup() - { - filePlanContainer = generateNodeRef(TYPE_FILE_PLAN, true); - } - - /** - * Having the Fileplan container - * When adding a child of type TYPE_FILE_PLAN - * Then an error should be thrown - */ - @Test (expected = IntegrityException.class) - public void testAddFileplanToFileplan() - { - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_FILE_PLAN); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Having the Fileplan container - * When adding multiple child of type TYPE_RECORD_CATEGORY - * Then child associations should be created - */ - @Test - public void testAddCategoriesToFileplan() - { - // add the first child - ChildAssociationRef childAssoc1 = createFileplanContainerChild(TYPE_RECORD_CATEGORY); - filePlanType.onCreateChildAssociation(childAssoc1, true); - - // add the second child - ChildAssociationRef childAssoc2 = createFileplanContainerChild(TYPE_RECORD_CATEGORY); - filePlanType.onCreateChildAssociation(childAssoc2, true); - } - - /** - * Having the Fileplan container - * When creating the first child of type TYPE_HOLD_CONTAINER - * Then the fileplan behavior bean shouldn't complain - */ - @Test - public void testCreateHoldContainers() - { - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER); - - when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_HOLD_CONTAINER))).thenReturn(Arrays.asList(childAssoc)); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Having the Fileplan container with a child of type TYPE_HOLD_CONTAINER - * When adding another child of type TYPE_HOLD_CONTAINER - * Then an error should be thrown - */ - @Test (expected = IntegrityException.class) - public void testCreateMultipleHoldContainers() - { - ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER); - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER); - - when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_HOLD_CONTAINER))).thenReturn(Arrays.asList(existingHoldAssoc, childAssoc)); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Having the Fileplan container - * When creating the first child of type TYPE_TRANSFER_CONTAINER - * Then the fileplan behavior bean shouldn't complain - */ - @Test - public void testCreateTransferContainers() - { - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_TRANSFER_CONTAINER); - - when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_TRANSFER_CONTAINER))).thenReturn(Arrays.asList(childAssoc)); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Having the Fileplan container with a child of type TYPE_TRANSFER_CONTAINER - * When adding another child of type TYPE_TRANSFER_CONTAINER - * Then an error should be thrown - */ - @Test (expected = IntegrityException.class) - public void testCreateMultipleTransferContainers() - { - ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_TRANSFER_CONTAINER); - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_TRANSFER_CONTAINER); - - when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_TRANSFER_CONTAINER))).thenReturn(Arrays.asList(existingHoldAssoc, childAssoc)); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Having the Fileplan container - * When creating the first child of type TYPE_UNFILED_RECORD_CONTAINER - * Then the fileplan behavior bean shouldn't complain - */ - @Test - public void testCreateUnfiledRecordsContainers() - { - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER); - - when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_UNFILED_RECORD_CONTAINER))).thenReturn(Arrays.asList(childAssoc)); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Having the Fileplan container with a child of type TYPE_UNFILED_RECORD_CONTAINER - * When adding another child of type TYPE_UNFILED_RECORD_CONTAINER - * Then an error should be thrown - */ - @Test (expected = IntegrityException.class) - public void testCreateMultipleUnfiledRecordsContainers() - { - ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER); - ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER); - - when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_UNFILED_RECORD_CONTAINER))).thenReturn(Arrays.asList(existingHoldAssoc, childAssoc)); - filePlanType.onCreateChildAssociation(childAssoc, true); - } - - /** - * Helper method that creates a child of the fileplan container with the provided type - * @param childType the node type of the child to be created - * @return the child association between the fileplan and the created node - */ - private ChildAssociationRef createFileplanContainerChild(QName childType) - { - NodeRef child = generateNodeRef(childType); - return new ChildAssociationRef( ContentModel.ASSOC_CONTAINS, filePlanContainer, childType, child); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java deleted file mode 100644 index 536ffbc8ba..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for HoldContainerTypeTest - * - * @author Mihai Cozma - * @since 2.4 - */ -public class HoldContainerTypeUnitTest extends BaseUnitTest -{ - /** test object */ - private @InjectMocks HoldContainerType holdContainerType; - - /** - * Given that we try to add a non "rma:hold" type to hold container, - * Then IntegrityException is thrown. - */ - @Test (expected = IntegrityException.class) - public void testAddNonHoldTypeToHoldContainer() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_HOLD)).thenReturn(false); - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(holdContainer); - holdContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "rma:hold" type to hold container, - * Then the operation is successful. - */ - @Test - public void testAddHoldTypeToHoldContainer() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_HOLD)).thenReturn(true); - NodeRef holdFolder= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(holdFolder); - when(mockedChildAssoc.getParentRef()).thenReturn(holdContainer); - holdContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java deleted file mode 100644 index 7a7cefca75..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.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 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.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -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.cmr.repository.StoreRef; -import org.alfresco.util.GUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * @author silviudinuta - */ -public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel, ContentModel -{ - private final static NodeRef CHILD_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - GUID.generate()); - private final static NodeRef PARENT_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - GUID.generate()); - - @InjectMocks - NonElectronicRecordType nonElectronicRecordType; - - @Mock - AuthenticationUtil mockAuthenticationUtil; - - @Mock - RecordService mockedRecordService; - - @Mock - NodeService mockedNodeService; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - MockAuthenticationUtilHelper.setup(mockAuthenticationUtil); - when(mockedNodeService.exists(CHILD_NODE_REF)).thenReturn(true); - when(mockedNodeService.exists(PARENT_NODE_REF)).thenReturn(true); - - ChildAssociationRef generateChildAssociationRef = mock(ChildAssociationRef.class); - when(generateChildAssociationRef.getParentRef()).thenReturn(PARENT_NODE_REF); - when(generateChildAssociationRef.getChildRef()).thenReturn(CHILD_NODE_REF); - - when(mockedNodeService.getPrimaryParent(CHILD_NODE_REF)).thenReturn(generateChildAssociationRef); - when(mockedNodeService.getType(PARENT_NODE_REF)).thenReturn(TYPE_UNFILED_RECORD_FOLDER); - } - - @Test - public void testOnUpdateWithAspectsAlreadyPresent() - { - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(true); - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_RECORD)).thenReturn(true); - - nonElectronicRecordType.onUpdateNode(CHILD_NODE_REF); - - verify(mockedNodeService, never()).addAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT, null); - verify(mockedRecordService, never()).makeRecord(CHILD_NODE_REF); - } - - @Test - public void testOnUpdateWithoutTheAspects() - { - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_RECORD)).thenReturn(false); - - nonElectronicRecordType.onUpdateNode(CHILD_NODE_REF); - - verify(mockedNodeService, times(1)).addAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT, null); - verify(mockedRecordService, times(1)).makeRecord(CHILD_NODE_REF); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryTypeUnitTest.java deleted file mode 100644 index f55d5a3ab4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryTypeUnitTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit test class for RecordCategoryType - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -public class RecordCategoryTypeUnitTest extends BaseUnitTest -{ - @Mock - private AuthenticationUtil mockAuthenticationUtil; - - @Mock - private VitalRecordService mockedVitalRecordService; - - private @InjectMocks RecordCategoryType recordCategoryType; - - @Before - public void setup() - { - MockitoAnnotations.initMocks(this); - MockAuthenticationUtilHelper.setup(mockAuthenticationUtil); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - } - - /** - * Given that we try to add types different than "rma:recordCategory" and "rma:recordFolder" to a record category, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testCreateNonAceptedTypes() throws Exception - { - NodeRef recordCategoryNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_CATEGORY); - QName type = AlfMock.generateQName(); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordCategoryNodeRef, nodeRef); - recordCategoryType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add "rma:recordCategory" type to a record category, - * Then operation is successful. - */ - @Test - public void testCreateRecordCategory() throws Exception - { - NodeRef recordCategoryNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_CATEGORY); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_CATEGORY, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordCategoryNodeRef, nodeRef); - recordCategoryType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add "rma:recordFolder" type to a record category, - * Then operation is successful. - */ - @Test - public void testCreateRecordFolder() throws Exception - { - NodeRef recordCategoryNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_CATEGORY); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordCategoryNodeRef, nodeRef); - recordCategoryType.onCreateChildAssociation(childAssocRef, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderTypeUnitTest.java deleted file mode 100644 index 72b576f215..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderTypeUnitTest.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit test class for RecordFolderType - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -public class RecordFolderTypeUnitTest extends BaseUnitTest -{ - @Mock - private AuthenticationUtil mockAuthenticationUtil; - - @Mock - private VitalRecordService mockedVitalRecordService; - - private @InjectMocks RecordFolderType recordFolderType; - - @Before - public void setup() - { - MockitoAnnotations.initMocks(this); - MockAuthenticationUtilHelper.setup(mockAuthenticationUtil); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - } - - /** - * Given that we try to add one rma:transfer to a record folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testCreateTransferFolder() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_TRANSFER)).thenReturn(true); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add one record folder to a record folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testCreateRecordFolder() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_RECORD_FOLDER)).thenReturn(true); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add sub-type of rma:recordsManagementContainer to a record folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testCreateSubTypesOfRecordManagementContainer() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_RECORDS_MANAGEMENT_CONTAINER)).thenReturn(true); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add cm:folder sub-type to a record folder, - * Then the operation is successful. - */ - @Test - public void testCreateFolderSubType() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_FOLDER)).thenReturn(true); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add non cm:folder sub-type to a record folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testCreateNonFolderSubType() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_FOLDER)).thenReturn(false); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add cm:content sub-type to a record folder, - * Then the operation is successful. - */ - public void testCreateContent() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_CONTENT)).thenReturn(true); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add non cm:content or non cm:folder sub-type to a record folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testCreateNonContent() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_FOLDER)).thenReturn(false); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociation(childAssocRef, true); - } - - /** - * Given that we try to add not hidden cm:folder sub-type to a record folder, - * Then IntegrityException is thrown on commit. - */ - @Test(expected = IntegrityException.class) - public void testCreateNotHiddenFolderSubTypeOnCommit() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_FOLDER)).thenReturn(true); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociationOnCommit(childAssocRef, true); - } - - /** - * Given that we try to add hidden cm:folder sub-type to a record folder, - * Then the operation is successful. - */ - @Test - public void testCreateHiddenFolderSubTypeOnCommit() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - - when(mockedNodeTypeUtility.instanceOf(type, TYPE_FOLDER)).thenReturn(true); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_HIDDEN)).thenReturn(true); - - ChildAssociationRef mockedPrimaryParentAssoc = mock(ChildAssociationRef.class); - when(mockedNodeService.getPrimaryParent(nodeRef)).thenReturn(mockedPrimaryParentAssoc); - - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociationOnCommit(childAssocRef, true); - } - - /** - * Given that we try to add non cm:folder sub-type to a record folder, - * Then the operation is successful. - */ - @Test - public void testCreateNonFolderSubTypeOnCommit() throws Exception - { - NodeRef recordFolderNodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_RECORD_FOLDER); - QName type = AlfMock.generateQName(); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type, true); - - when(mockedNodeTypeUtility.instanceOf(type, TYPE_FOLDER)).thenReturn(false); - - ChildAssociationRef mockedPrimaryParentAssoc = mock(ChildAssociationRef.class); - when(mockedNodeService.getPrimaryParent(nodeRef)).thenReturn(mockedPrimaryParentAssoc); - - ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef); - recordFolderType.onCreateChildAssociationOnCommit(childAssocRef, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java deleted file mode 100644 index b2048e6d53..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for RecordsManagementContainerType - * @author Ana Bozianu - * @since 2.4 - */ -public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest -{ - /** test object */ - private @InjectMocks RecordsManagementContainerType recordManagementContainerType; - - @Before - public void before() throws Exception - { - super.before(); - - when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER)).thenReturn(true); - when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false); - - when(mockedDictionaryService.isSubClass(TestModel.NOT_RM_FOLDER_TYPE, ContentModel.TYPE_FOLDER)).thenReturn(true); - when(mockedDictionaryService.isSubClass(TestModel.NOT_RM_FOLDER_TYPE, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false); - - when(mockedDictionaryService.isSubClass(TYPE_RECORD_CATEGORY, ContentModel.TYPE_FOLDER)).thenReturn(true); - when(mockedDictionaryService.isSubClass(TYPE_RECORD_CATEGORY, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false); - } - - /** - * Having the Unfilled Record container and a non RM folder subtype node - * When adding a child association between the folder and the container - * Then the new folder should not be altered - * - * Outlook creates a hidden folder subtype to store attachments and we don't want to change the type of those folders - */ - @Test - public void testAddNonRMFolderSubtypeToRMContainer() - { - /* Having a RM container and a non RM folder subtype node */ - NodeRef rmContainer = generateRMContainer(); - NodeRef folder = generateNonRmFolderSubtypeNode(); - - /* - * When adding a child association between the folder and the container - */ - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, folder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - /* The type should not be changed and no aspects should be added */ - verify(mockedNodeService, never()).setType(any(), any()); - } - - /** - * Having the fileplan and a non RM folder node - * When adding a child association between the fileplan and the folder - * Then the new folder should be converted to a record category - */ - @Test - public void testAddFolderInFilePlan() - { - NodeRef fileplan = generateNodeRef(); - when(mockedNodeService.getType(fileplan)).thenReturn(TYPE_FILE_PLAN); - NodeRef folder = generateNonRmFolderNode(); - - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, fileplan, ContentModel.ASSOC_CONTAINS, folder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - verify(mockedNodeService).setType(folder, TYPE_RECORD_CATEGORY); - } - - /** - * Having a record category and a non RM folder node - * When adding a child association between the record category and the folder - * Then the new folder should be converted to a record folder - */ - @Test - public void testAddFolderInRecordCategory() - { - NodeRef category = generateNodeRef(); - when(mockedNodeService.getType(category)).thenReturn(TYPE_RECORD_CATEGORY); - NodeRef folder = generateNonRmFolderNode(); - - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, category, ContentModel.ASSOC_CONTAINS, folder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - verify(mockedNodeService).setType(folder, TYPE_RECORD_FOLDER); - } - - /** - * Having an unfiled record container and a non RM folder node - * When adding a child association between the container and the folder - * Then the new folder should be converted to a unfiled record folder - */ - @Test - public void testAddFolderInUnfiledRecordContainer() - { - NodeRef unfiledRecordContainer = generateNodeRef(); - when(mockedNodeService.getType(unfiledRecordContainer)).thenReturn(TYPE_UNFILED_RECORD_CONTAINER); - NodeRef folder = generateNonRmFolderNode(); - - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, unfiledRecordContainer, ContentModel.ASSOC_CONTAINS, folder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - verify(mockedNodeService).setType(folder, TYPE_UNFILED_RECORD_FOLDER); - } - - /** - * Having an unfiled record folder and a non RM folder node - * When adding a child association between the unfiled record folder and the regular folder - * Then the new folder should be converted to a unfiled record folder - */ - @Test - public void testAddFolderInUnfiledRecordFolder() - { - NodeRef unfiledRecordFolder = generateNodeRef(); - when(mockedNodeService.getType(unfiledRecordFolder)).thenReturn(TYPE_UNFILED_RECORD_FOLDER); - NodeRef folder = generateNonRmFolderNode(); - - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, unfiledRecordFolder, ContentModel.ASSOC_CONTAINS, folder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - verify(mockedNodeService).setType(folder, TYPE_UNFILED_RECORD_FOLDER); - } - - /** - * Generates a record management container - * @return reference to the generated container - */ - private NodeRef generateRMContainer() - { - NodeRef rmContainer = generateNodeRef(); - when(mockedNodeService.getType(rmContainer)).thenReturn(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - return rmContainer; - } - - /** - * Generates a non RM folder subtype node - * @return reference to the created folder - */ - private NodeRef generateNonRmFolderSubtypeNode() - { - NodeRef nonRmFolder = generateNodeRef(); - - when(mockedNodeService.getType(nonRmFolder)).thenReturn(TestModel.NOT_RM_FOLDER_TYPE); - when(mockedNodeService.exists(nonRmFolder)).thenReturn(true); - when(mockedNodeService.hasAspect(nonRmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); - return nonRmFolder; - } - - /** - * Generates a non RM folder node - * @return reference to the created folder - */ - private NodeRef generateNonRmFolderNode() - { - NodeRef regularFolder = generateNodeRef(); - when(mockedNodeService.getType(regularFolder)).thenReturn(ContentModel.TYPE_FOLDER); - when(mockedNodeService.exists(regularFolder)).thenReturn(true); - when(mockedNodeService.hasAspect(regularFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); - return regularFolder; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteTypeUnitTest.java deleted file mode 100644 index 86813cf6ab..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteTypeUnitTest.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; - -import com.google.common.collect.Sets; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.node.integrity.IntegrityException; -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.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit test for RmSiteType - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model -{ - @Mock - private AuthenticationUtil mockAuthenticationUtil; - - @Mock - private SiteService mockedSiteService; - - private @InjectMocks RmSiteType rmSiteType; - - @Before - public void setup() - { - MockitoAnnotations.initMocks(this); - MockAuthenticationUtilHelper.setup(mockAuthenticationUtil); - } - - /** - * Given that we try to add non allowed type to rm site, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddNonAcceptedTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - - QName type = AlfMock.generateQName(); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type); - - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(rmSiteNodeRef); - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add one cm:folder to rm site, - * Then operation is successful. - */ - @Test - public void testAddOneFolderTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(assocs); - - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add two cm:folder to rm site, - * Then operation is successful. - */ - @Test - public void testAddTwoFolderTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - //create first folder - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - - //create second cm:folder - nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER); - mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add more than two cm:folder to rm site, - * Then IntegrityException is thrown. - */ - @Test - public void testAddMoreThanTwhoFolderTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(new ArrayList<>()); - - //create first folder - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(assocs); - - //create second cm:folder - nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER); - mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - - //create third cm:folder - nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FOLDER); - mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FOLDER))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add one rma:filePlan to rm site, - * Then operation is successful. - */ - @Test - public void testAddOneFilePlanTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FILE_PLAN); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FILE_PLAN))).thenReturn(assocs); - - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add one dod:filePlan to standard rm site, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddDODFilePlanTypeToStandardRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_DOD_5015_FILE_PLAN); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add more than one rma:filePlan to rm site, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddMoreThanOneFilePlanTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - //first file plan creation - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FILE_PLAN); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FILE_PLAN))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - - //second filePlan creation - nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FILE_PLAN); - mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_FILE_PLAN))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add one dod:filePlan to rm site, - * Then operation is successful. - */ - @Test - public void testAddOneDODFilePlanTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteInfo.getNodeRef()).thenReturn(rmSiteNodeRef); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - when(mockedDictionaryService.isSubClass(TYPE_DOD_5015_SITE, TYPE_RM_SITE)).thenReturn(true); - when(mockedDictionaryService.isSubClass(TYPE_DOD_5015_FILE_PLAN, TYPE_FILE_PLAN)).thenReturn(true); - rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN); - - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_DOD_5015_FILE_PLAN); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_DOD_5015_FILE_PLAN))).thenReturn(assocs); - - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add more than one dod:filePlan to rm site, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddMoreThanOneDODFilePlanTypeToRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true); - ArrayList assocs = new ArrayList<>(); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteInfo.getNodeRef()).thenReturn(rmSiteNodeRef); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - when(mockedDictionaryService.isSubClass(TYPE_DOD_5015_SITE, TYPE_RM_SITE)).thenReturn(true); - when(mockedDictionaryService.isSubClass(TYPE_DOD_5015_FILE_PLAN, TYPE_FILE_PLAN)).thenReturn(true); - rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN); - - //first dod:filePlan creation - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_DOD_5015_FILE_PLAN); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_DOD_5015_FILE_PLAN))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - - //second dod:filePlan creation - nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_DOD_5015_FILE_PLAN); - mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - assocs.add(mockedChildAssoc); - when(mockedNodeService.getChildAssocs(rmSiteNodeRef, Sets.newHashSet(TYPE_DOD_5015_FILE_PLAN))).thenReturn(assocs); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add one rma:filePlan to DOD rm site, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddStandardFilePlanTypeToDODRmSite() - { - NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true); - - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - when(mockedSiteInfo.getNodeRef()).thenReturn(rmSiteNodeRef); - when(mockedSiteService.getSite(rmSiteNodeRef)).thenReturn(mockedSiteInfo); - when(mockedApplicationContext.getBean("dbNodeService")).thenReturn(mockedNodeService); - - when(mockedDictionaryService.isSubClass(TYPE_DOD_5015_SITE, TYPE_RM_SITE)).thenReturn(true); - when(mockedDictionaryService.isSubClass(TYPE_DOD_5015_FILE_PLAN, TYPE_FILE_PLAN)).thenReturn(true); - rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN); - - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, TYPE_FILE_PLAN); - ChildAssociationRef mockedChildAssoc = generateChildAssociationRef(rmSiteNodeRef, nodeRef); - rmSiteType.onCreateChildAssociation(mockedChildAssoc, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java deleted file mode 100644 index e860c6b1b9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for TransferContainerType - * - * @author Mihai Cozma - * @since 2.4 - */ -public class TransferContainerTypeUnitTest extends BaseUnitTest -{ - /** test object */ - private @InjectMocks TransferContainerType transferContainerType; - - /** - * Given that we try to add to transfer container, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddToTransferContainerTest() - { - NodeRef transferContainer = generateNodeRef(TYPE_TRANSFER_CONTAINER, true); - - QName type = AlfMock.generateQName(); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type); - - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(transferContainer); - transferContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferTypeUnitTest.java deleted file mode 100644 index d7bee9b049..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferTypeUnitTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for TransferType - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class TransferTypeUnitTest extends BaseUnitTest -{ - /** test object */ - private @InjectMocks TransferType transferType; - - /** - * Given that we try to add to transfer type folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddToTransferFolderTest() - { - NodeRef transferFolder = generateNodeRef(TYPE_TRANSFER, true); - - QName type = AlfMock.generateQName(); - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type); - - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(transferFolder); - transferType.onCreateChildAssociation(mockedChildAssoc, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordContainerTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordContainerTypeUnitTest.java deleted file mode 100644 index 0dd5ade362..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordContainerTypeUnitTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for UnfiledRecordContainerType - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class UnfiledRecordContainerTypeUnitTest extends BaseUnitTest -{ - @InjectMocks - private UnfiledRecordContainerType unfiledRecordContainerType; - - /** - * Given that we try to add a type that is not one of "rma:unfiledRecordFolder", "cm:content" or "rma:nonElectronicDocument" types to unfiled record container, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddNonAcceptedTypeToUnfiledRecordContainer() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(false); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordContainer = generateNodeRef(TYPE_UNFILED_RECORD_CONTAINER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordContainer); - unfiledRecordContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "rma:unfiledRecordFolder" sub-type to unfiled record container, - * Then the operation is successful. - */ - @Test - public void testAddUnfiledRecordFolderTypeToUnfiledRecordContainer() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(true); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(false); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordContainer = generateNodeRef(TYPE_UNFILED_RECORD_CONTAINER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordContainer); - unfiledRecordContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "cm:content" sub-type to unfiled record container, - * Then the operation is successful. - */ - @Test - public void testAddContentTypeToUnfiledRecordContainer() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(false); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordContainer = generateNodeRef(TYPE_UNFILED_RECORD_CONTAINER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordContainer); - unfiledRecordContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "rma:nonElectronicDocument" sub-type to unfiled record container, - * Then the operation is successful. - */ - @Test - public void testNonElectronicDocumentTypeToUnfiledRecordContainer() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(true); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordContainer = generateNodeRef(TYPE_UNFILED_RECORD_CONTAINER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordContainer); - unfiledRecordContainerType.onCreateChildAssociation(mockedChildAssoc, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordFolderTypeUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordFolderTypeUnitTest.java deleted file mode 100644 index cb428663a4..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/UnfiledRecordFolderTypeUnitTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for UnfiledRecordFolderType - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class UnfiledRecordFolderTypeUnitTest extends BaseUnitTest -{ - @InjectMocks - private UnfiledRecordFolderType unfiledRecordFolderType; - - /** - * Given that we try to add a type that is not one of "rma:unfiledRecordFolder", "cm:content" or "rma:nonElectronicDocument" types to unfiled record folder, - * Then IntegrityException is thrown. - */ - @Test(expected = IntegrityException.class) - public void testAddNonAcceptedTypeToUnfiledRecordFolder() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(false); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordFolder = generateNodeRef(TYPE_UNFILED_RECORD_FOLDER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordFolder); - unfiledRecordFolderType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "rma:unfiledRecordFolder" sub-type to unfiled record folder, - * Then the operation is successful. - */ - @Test - public void testAddUnfiledRecordFolderTypeToUnfiledRecordFolder() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(true); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(false); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordFolder = generateNodeRef(TYPE_UNFILED_RECORD_FOLDER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordFolder); - unfiledRecordFolderType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "cm:content" sub-type to unfiled record folder, - * Then the operation is successful. - */ - @Test - public void testAddContentTypeToUnfiledRecordFolder() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(false); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordFolder = generateNodeRef(TYPE_UNFILED_RECORD_FOLDER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordFolder); - unfiledRecordFolderType.onCreateChildAssociation(mockedChildAssoc, true); - } - - /** - * Given that we try to add "rma:nonElectronicDocument" sub-type to unfiled record folder, - * Then the operation is successful. - */ - @Test - public void testNonElectronicDocumentTypeToUnfiledRecordFolder() - { - QName type = AlfMock.generateQName(); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_UNFILED_RECORD_FOLDER)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, ContentModel.TYPE_CONTENT)).thenReturn(false); - when(mockedNodeTypeUtility.instanceOf(type, TYPE_NON_ELECTRONIC_DOCUMENT)).thenReturn(true); - - NodeRef nodeRef= AlfMock.generateNodeRef(mockedNodeService, type); - - NodeRef unfiledRecordFolder = generateNodeRef(TYPE_UNFILED_RECORD_FOLDER, true); - ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); - when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef); - when(mockedChildAssoc.getParentRef()).thenReturn(unfiledRecordFolder); - unfiledRecordFolderType.onCreateChildAssociation(mockedChildAssoc, true); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java deleted file mode 100644 index 697f613c9f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java deleted file mode 100644 index 7b8896f714..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v22; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -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.test.util.BaseUnitTest; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for remove in-place roles from 'all roles' group patch unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22RemoveInPlaceRolesFromAllPatchUnitTest extends BaseUnitTest -{ - /** test data */ - private static final String ALL_ROLES = "allroles"; - - /** patch */ - @InjectMocks private RMv22RemoveInPlaceRolesFromAllPatch patch; - - /** - * Given there are no file plans to update then the 'all roles' group should not - * be changed. - */ - @Test - public void noFilePlans() - { - // given - doReturn(Collections.EMPTY_SET).when(mockedFilePlanService).getFilePlans(); - - // when - patch.applyInternal(); - - // then - verifyZeroInteractions(mockedAuthorityService); - } - - /** - * Given that there is one file plan whose 'all roles' group does not contain the - * in-place roles the 'all roles' groups should not be changed. - */ - @Test - public void rolesDontNeedRemovingFromGroup() - { - // given - doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan); - doReturn(Collections.EMPTY_SET).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true); - - // when - patch.applyInternal(); - - // then - verify(mockedAuthorityService, times(1)).getContainedAuthorities(null, ALL_ROLES, true); - verifyNoMoreInteractions(mockedAuthorityService); - } - - /** - * Given that there is one file plan whose 'all roles' group contains the in-place - * roles then they should be revoved. - */ - @Test - public void removeRolesFromGroup() - { - // given - doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan); - Set contains = new HashSet<>(2); - contains.add(FilePlanRoleService.ROLE_EXTENDED_READERS); - contains.add(FilePlanRoleService.ROLE_EXTENDED_WRITERS); - doReturn(contains).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true); - - // when - patch.applyInternal(); - - // then - verify(mockedAuthorityService, times(1)).getContainedAuthorities(null, ALL_ROLES, true); - verify(mockedAuthorityService, times(1)).removeAuthority(ALL_ROLES, FilePlanRoleService.ROLE_EXTENDED_READERS); - verify(mockedAuthorityService, times(1)).removeAuthority(ALL_ROLES, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - verifyNoMoreInteractions(mockedAuthorityService); - } - - /** - * Helper method to create a mocked role. - */ - private Role getMockedRole(String name) - { - Role mockedRole = mock(Role.class); - doReturn(name).when(mockedRole).getRoleGroupName(); - return mockedRole; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23SavedSearchesPatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23SavedSearchesPatchUnitTest.java deleted file mode 100644 index 0fae57a562..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23SavedSearchesPatchUnitTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v23; - -import static java.util.Arrays.asList; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_SAVED_SEARCH; -import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * patch.v23 unit test - * - * @author Ross Gale - * @since 2.3 - */ -public class RMv23SavedSearchesPatchUnitTest -{ - - @Mock - private NodeService nodeService; - - @Mock - private SiteService siteService; - - @Mock - private SiteInfo siteInfo; - - @Mock - private RecordsManagementSearchServiceImpl recordsManagementSearchService; - - @Mock - private SavedSearchDetails mockSavedSearchDetails1, mockSavedSearchDetails2; - - @InjectMocks - private RMv23SavedSearchesPatch patch; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - } - - /** - * Given that I am upgrading an existing repository to v2.3 - * When I execute the patch - * Then any existing rm saved searches will have the saved search aspect applied - */ - @Test - public void executePatch() - { - NodeRef noderef1 = new NodeRef("foo://123/456"); - NodeRef noderef2 = new NodeRef("bar://123/456"); - List searches = asList(mockSavedSearchDetails1, mockSavedSearchDetails2); - when(mockSavedSearchDetails1.getNodeRef()).thenReturn(noderef1); - when(mockSavedSearchDetails2.getNodeRef()).thenReturn(noderef2); - when(recordsManagementSearchService.getSavedSearches("rm")).thenReturn(searches); - when(siteService.getSite(DEFAULT_SITE_NAME)).thenReturn(siteInfo); - - // execute patch - patch.applyInternal(); - - verify(nodeService, times(1)).addAspect(noderef1, ASPECT_SAVED_SEARCH, null); - verify(nodeService, times(1)).addAspect(noderef2, ASPECT_SAVED_SEARCH, null); - } - - /** - * Test patch code doesnt run with an rm site - */ - @Test - public void testPatchDoesntRunWithoutRmSite() - { - when(siteService.getSite(DEFAULT_SITE_NAME)).thenReturn(null); - - // execute patch - patch.applyInternal(); - - verify(nodeService, times(0)).addAspect(any(NodeRef.class), any(QName.class), anyMap()); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java deleted file mode 100644 index 8a6af9371a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v24; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateNodeRef; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.util.Collections; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.rule.RuleModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * RM V2.4 File Plan container rule inheritance patch unit test. - * - * @author Roy Wetherall - * @since 2.4 - */ -public class RMv24FilePlanContainerRuleInheritancePatchUnitTest -{ - private @Mock NodeService mockedNodeService; - private @Mock FilePlanService mockedFilePlanService; - - private @InjectMocks RMv24FilePlanContainerRuleInheritancePatch patch; - - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - } - - /** - * Given there are not file plans, - * When the patch is executed, - * Then nothing happens - */ - @SuppressWarnings("unchecked") - @Test - public void noFilePlans() - { - // given - when(mockedFilePlanService.getFilePlans()) - .thenReturn(Collections.EMPTY_SET); - - // when - patch.applyInternal(); - - // then - verifyZeroInteractions(mockedNodeService); - } - - /** - * Given there is a file plan, - * When the patch is executed, - * Then the file plan containers are updated - */ - @Test - public void atLeastOneFilePlan() - { - NodeRef filePlan = generateNodeRef(mockedNodeService, RecordsManagementModel.TYPE_FILE_PLAN); - NodeRef holdsContainer = generateNodeRef(mockedNodeService); - NodeRef transferContainer = generateNodeRef(mockedNodeService); - NodeRef unfiledRecordsContainer = generateNodeRef(mockedNodeService); - - // given - when(mockedFilePlanService.getFilePlans()) - .thenReturn(Collections.singleton(filePlan)); - when(mockedFilePlanService.getHoldContainer(filePlan)) - .thenReturn(holdsContainer); - when(mockedFilePlanService.getTransferContainer(filePlan)) - .thenReturn(transferContainer); - when(mockedFilePlanService.getUnfiledContainer(filePlan)) - .thenReturn(unfiledRecordsContainer); - - // when - patch.applyInternal(); - - // then - verify(mockedNodeService).addAspect(holdsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - verify(mockedNodeService).addAspect(transferContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - verify(mockedNodeService).addAspect(unfiledRecordsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldChildAssocPatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldChildAssocPatchUnitTest.java deleted file mode 100644 index 9bae123f2e..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldChildAssocPatchUnitTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v32; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_RECORDS; -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.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.Pair; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * RM V3.2 Hold child assoc patch unit test - * - * @author Ross Gale - * @since 3.2 - */ -public class RMv32HoldChildAssocPatchUnitTest -{ - @Mock - private QNameDAO qNameDAO; - - @Mock - private NodeService nodeService; - - @Mock - private FilePlanService filePlanService; - - @Mock - private HoldService holdService; - - @InjectMocks - private RMv32HoldChildAssocPatch patch; - - private NodeRef filePlanRef, holdRef, heldItemRef; - - private Set fileplans; - - private List holds; - - @Mock - private ChildAssociationRef childAssociationRef; - - private List childAssocs; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - filePlanRef = new NodeRef("workspace://SpacesStore/filePlan"); - holdRef = new NodeRef("workspace://SpacesStore/hold"); - heldItemRef = new NodeRef("workspace://SpacesStore/heldItem"); - fileplans = new HashSet<>(); - fileplans.add(filePlanRef); - holds = new ArrayList<>(); - holds.add(holdRef); - childAssocs = new ArrayList<>(); - childAssocs.add(childAssociationRef); - } - - /** - * Test held items are removed from a hold and re-add to make sure the association is correct - */ - @Test - public void testAHoldIsRemovedAndReplacedDuringUpgrade() - { - when(qNameDAO.getQName(ASSOC_FROZEN_RECORDS)).thenReturn(new Pair(ASSOC_FROZEN_CONTENT,null)); - when(filePlanService.getFilePlans()).thenReturn(fileplans); - when(holdService.getHolds(filePlanRef)).thenReturn(holds); - when(nodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, ASSOC_FROZEN_RECORDS)).thenReturn(childAssocs); - when(childAssociationRef.getChildRef()).thenReturn(heldItemRef); - patch.applyInternal(); - verify(holdService, times(1)).removeFromHold(holdRef, heldItemRef); - verify(holdService, times(1)).addToHold(holdRef, heldItemRef); - } - - /** - * Test patch doesnt run without an association added during rm site creation - */ - @Test - public void testAHoldIsntRemovedAndReplacedDuringUpgradeWithNoRmSite() - { - when(qNameDAO.getQName(ASSOC_FROZEN_RECORDS)).thenReturn(null); - patch.applyInternal(); - verify(qNameDAO, never()).updateQName(ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_CONTENT); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldReportUpdatePatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldReportUpdatePatchUnitTest.java deleted file mode 100644 index 8b9c03d142..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v32/RMv32HoldReportUpdatePatchUnitTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v32; - -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.InputStream; - -import org.alfresco.model.ContentModel; -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.cmr.version.VersionService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * RM V3.2 Hold report update patch unit test - * - * @author Ramona Popa - * @since 3.2 - */ -public class RMv32HoldReportUpdatePatchUnitTest -{ - @Mock - private NodeService mockedNodeService; - - @Mock - private ContentService mockedContentService; - - @Mock - private VersionService mockedVersionService; - - @Mock - private ContentWriter mockedContentWriter; - - @InjectMocks - private RMv32HoldReportUpdatePatch patch; - - private NodeRef hold_report; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - hold_report = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rmr_holdReport"); - } - - /** - * Test report content is updated after the patch is executed - */ - @Test - public void testReportContentIsUpdatedAfterUpgrade() - { - when(mockedNodeService.exists(hold_report)).thenReturn(true); - when(mockedNodeService.hasAspect(hold_report, ContentModel.ASPECT_VERSIONABLE)).thenReturn(false); - when(mockedContentService.getWriter(hold_report, ContentModel.PROP_CONTENT, true)).thenReturn(mockedContentWriter); - - patch.applyInternal(); - verify(mockedNodeService, times(1)).addAspect(hold_report, ContentModel.ASPECT_VERSIONABLE, null); - verify(mockedVersionService, times(1)).createVersion((NodeRef) anyObject(), anyMap()); - verify(mockedContentWriter, times(1)).putContent((InputStream) anyObject()); - } -} - - diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v33/RMv33HoldAuditEntryValuesPatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v33/RMv33HoldAuditEntryValuesPatchUnitTest.java deleted file mode 100644 index 209970fdb9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v33/RMv33HoldAuditEntryValuesPatchUnitTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v33; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.repo.domain.propval.PropertyStringValueEntity; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * RM V3.3 Hold audit entries values patch unit test - * - * @author Ramona Popa - * @since 3.3 - */ -public class RMv33HoldAuditEntryValuesPatchUnitTest -{ - @Mock - private RecordsManagementQueryDAO mockedRecordsManagementQueryDAO; - - @InjectMocks - private RMv33HoldAuditEntryValuesPatch patch; - - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - } - - /** - * addtohold, removeFromHold and deleteHold audit entries values are updated after the patch is executed - */ - @Test - public void holdAuditEntriesAreUpdatedAfterUpgrade() - { - PropertyStringValueEntity addToHoldPropertyStringValueEntity = new PropertyStringValueEntity(); - addToHoldPropertyStringValueEntity.setValue("addToHold"); - when(mockedRecordsManagementQueryDAO.getPropertyStringValueEntity("addToHold")).thenReturn(addToHoldPropertyStringValueEntity); - when(mockedRecordsManagementQueryDAO.updatePropertyStringValueEntity(addToHoldPropertyStringValueEntity)).thenReturn(1); - - PropertyStringValueEntity removeFromHoldPropertyStringValueEntity = new PropertyStringValueEntity(); - removeFromHoldPropertyStringValueEntity.setValue("removeFromHold"); - when(mockedRecordsManagementQueryDAO.getPropertyStringValueEntity("removeFromHold")).thenReturn(removeFromHoldPropertyStringValueEntity); - when(mockedRecordsManagementQueryDAO.updatePropertyStringValueEntity(removeFromHoldPropertyStringValueEntity)).thenReturn(1); - - PropertyStringValueEntity deleteHoldPropertyStringValueEntity = new PropertyStringValueEntity(); - deleteHoldPropertyStringValueEntity.setValue("deleteHold"); - when(mockedRecordsManagementQueryDAO.getPropertyStringValueEntity("deleteHold")).thenReturn(deleteHoldPropertyStringValueEntity); - when(mockedRecordsManagementQueryDAO.updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity)).thenReturn(1); - - patch.applyInternal(); - - verify(mockedRecordsManagementQueryDAO, times(1)).getPropertyStringValueEntity("addToHold"); - verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(addToHoldPropertyStringValueEntity); - verify(mockedRecordsManagementQueryDAO, times(1)).getPropertyStringValueEntity("removeFromHold"); - verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(removeFromHoldPropertyStringValueEntity); - verify(mockedRecordsManagementQueryDAO, times(1)).getPropertyStringValueEntity("deleteHold"); - verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity); - - assertEquals("Add To Hold", addToHoldPropertyStringValueEntity.getStringValue()); - assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringEndLower()); - assertEquals(Long.valueOf(770_786_109L), addToHoldPropertyStringValueEntity.getStringCrc()); - - assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStringValue()); - assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringEndLower()); - assertEquals(Long.valueOf(2_967_613_012L), removeFromHoldPropertyStringValueEntity.getStringCrc()); - - assertEquals("Delete Hold", deleteHoldPropertyStringValueEntity.getStringValue()); - assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringEndLower()); - assertEquals(Long.valueOf(132_640_810L), deleteHoldPropertyStringValueEntity.getStringCrc()); - } - - /** - * if there are no hold audit entries, the patch is executed with success; no entries are updated - */ - @Test - public void patchRunWithSuccessWhenNoHoldEntries() - { - when(mockedRecordsManagementQueryDAO.getPropertyStringValueEntity("addToHold")).thenReturn(null); - when(mockedRecordsManagementQueryDAO.getPropertyStringValueEntity("removeFromHold")).thenReturn(null); - when(mockedRecordsManagementQueryDAO.getPropertyStringValueEntity("deleteHold")).thenReturn(null); - - patch.applyInternal(); - - verify(mockedRecordsManagementQueryDAO, times(1)).getPropertyStringValueEntity("addToHold"); - verify(mockedRecordsManagementQueryDAO, times(1)).getPropertyStringValueEntity("removeFromHold"); - verify(mockedRecordsManagementQueryDAO, times(1)).getPropertyStringValueEntity("deleteHold"); - verify(mockedRecordsManagementQueryDAO, times(0)).updatePropertyStringValueEntity(any()); - } -} - - diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java deleted file mode 100644 index 351ca02bb0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v35/RMv35HoldNewChildAssocPatchUnitTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.patch.v35; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; - -import static org.alfresco.model.ContentModel.ASSOC_CONTAINS; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASSOC_FROZEN_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.patch.v35.RMv35HoldNewChildAssocPatch.PATCH_ASSOC_NAME; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -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 static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.repo.policy.BehaviourFilter; -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; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * RM V3.5 Create new hold child association to link the record to the hold - * - * @since 3.5 - */ -public class RMv35HoldNewChildAssocPatchUnitTest -{ - @Mock - private FilePlanService mockFilePlanService; - - @Mock - private HoldService mockHoldService; - - @Mock - private NodeService mockNodeService; - - @Mock - private BehaviourFilter mockBehaviourFilter; - - @InjectMocks - private RMv35HoldNewChildAssocPatch patch; - - private NodeRef filePlanRef, holdRef, heldItemRef; - - private Set fileplans; - private List holds; - - @Mock - private ChildAssociationRef childAssociationRef; - - private List childAssocs; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - filePlanRef = new NodeRef("workspace://SpacesStore/filePlan"); - holdRef = new NodeRef("workspace://SpacesStore/hold"); - heldItemRef = new NodeRef("workspace://SpacesStore/heldItem"); - fileplans = new HashSet<>(); - fileplans.add(filePlanRef); - holds = new ArrayList<>(); - holds.add(holdRef); - childAssocs = new ArrayList<>(); - childAssocs.add(childAssociationRef); - } - - /** - * Test secondary associations are created for held items so that they are "contained" in the hold. - */ - @Test - public void testAddChildDuringUpgrade() - { - when(mockFilePlanService.getFilePlans()).thenReturn(fileplans); - when(mockHoldService.getHolds(filePlanRef)).thenReturn(holds); - when(mockNodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)).thenReturn(childAssocs); - when(childAssociationRef.getChildRef()).thenReturn(heldItemRef); - - patch.applyInternal(); - - verify(mockNodeService, times(1)).addChild(holdRef, heldItemRef, ASSOC_CONTAINS, PATCH_ASSOC_NAME); - } - - @Test - public void patchRunWithSuccessWhenNoHeldChildren() - { - when(mockFilePlanService.getFilePlans()).thenReturn(fileplans); - when(mockHoldService.getHolds(filePlanRef)).thenReturn(holds); - when(mockNodeService.getChildAssocs(holdRef, ASSOC_FROZEN_CONTENT, RegexQNamePattern.MATCH_ALL)).thenReturn(emptyList()); - - patch.applyInternal(); - - verify(mockNodeService, never()).addChild(any(NodeRef.class), any(NodeRef.class), any(QName.class), any(QName.class)); - } - - @Test - public void patchRunWithSuccessWhenNoHolds() - { - //no holds - List holdList = emptyList(); - when(mockFilePlanService.getFilePlans()).thenReturn(fileplans); - when(mockHoldService.getHolds(filePlanRef)).thenReturn(holdList); - - patch.applyInternal(); - - verify(mockNodeService, never()).addChild(any(NodeRef.class), any(NodeRef.class), any(QName.class), any(QName.class)); - } - - @Test - public void patchRunWithSuccessWhenNoFilePlan() - { - // given - doReturn(Collections.EMPTY_SET).when(mockFilePlanService).getFilePlans(); - - // when - patch.applyInternal(); - - // then - verify(mockNodeService, never()).addChild(any(NodeRef.class), any(NodeRef.class), any(QName.class), any(QName.class)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessorUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessorUnitTest.java deleted file mode 100644 index 95e66a95bb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessorUnitTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.permission; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.repo.security.permissions.impl.model.PermissionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import com.google.common.collect.Sets; - -/** - * Unit tests for {@link RecordsManagementPermissionPostProcessor}. - * - * @author David Webster - * @author Tom Page - * @since 2.4.1 - */ -public class RecordsManagementPermissionPostProcessorUnitTest -{ - @InjectMocks - private RecordsManagementPermissionPostProcessor recordsManagementPermissionPostProcessor = new RecordsManagementPermissionPostProcessor(); - - @Mock - private NodeService mockNodeService; - @Mock - private PermissionService mockPermissionService; - @Mock - private PermissionModel mockPermissionModel; - - @Before - public void setup() - { - MockitoAnnotations.initMocks(this); - } - - /** - * Given the configured permissions are set - * When process is called - * Then access is allowed - */ - @Test - public void configurePermissionsAllowed() - { - AccessStatus accessStatus = AccessStatus.DENIED; - NodeRef nodeRef = new NodeRef("node://ref/"); - String perm = AlfMock.generateText(); - // permissions includes the perm created above - List configuredReadPermissions = asList("ReadProperties", "ReadChildren", perm); - List configuredFilePermissions = asList("WriteProperties", "AddChildren"); - - when(mockNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - .thenReturn(true); - when(mockPermissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - AccessStatus result = recordsManagementPermissionPostProcessor.process(accessStatus, nodeRef, perm, configuredReadPermissions, configuredFilePermissions); - - assertEquals(AccessStatus.ALLOWED, result); - } - - /** - * Given the configured permissions are not set - * When process is called - * Then access is denied - */ - @Test - public void configurePermissionsDenied() - { - AccessStatus accessStatus = AccessStatus.DENIED; - NodeRef nodeRef = new NodeRef("node://ref/"); - String perm = AlfMock.generateText(); - // permissions do not include perm created above - List configuredReadPermissions = asList("ReadProperties", "ReadChildren"); - List configuredFilePermissions = asList("WriteProperties", "AddChildren"); - - when(mockNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - .thenReturn(true); - when(mockPermissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - AccessStatus result = recordsManagementPermissionPostProcessor.process(accessStatus, nodeRef, perm, configuredReadPermissions, configuredFilePermissions); - - assertEquals(AccessStatus.DENIED, result); - } - - /** - * Test that the permission groups configured in the global properties file imply descendant permission groups. - *

- * Given a configured permission is an ancestor of another permission P - * And the post processor checks if the user has P - * Then the post processor says that they do. - */ - @Test - public void permissionInherittedFromConfiguredGroup() - { - NodeRef nodeRef = new NodeRef("node://ref/"); - // permissions do not include perm created above - List configuredReadPermissions = asList(); - List configuredFilePermissions = asList("WriteProperties"); - - when(mockNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - .thenReturn(true); - when(mockPermissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - // Set up "WriteProperties" to imply three other permission groups. - PermissionReference mockWritePropsPermRef = mock(PermissionReference.class); - when(mockPermissionModel.getPermissionReference(null, "WriteProperties")).thenReturn(mockWritePropsPermRef); - PermissionReference childOne = mock(PermissionReference.class); - when(childOne.getName()).thenReturn("Not this one"); - PermissionReference childTwo = mock(PermissionReference.class); - when(childTwo.getName()).thenReturn("This is the requested permission"); - PermissionReference childThree = mock(PermissionReference.class); - when(childThree.getName()).thenReturn("Not this one either"); - when(mockPermissionModel.getGranteePermissions(mockWritePropsPermRef)).thenReturn(Sets.newHashSet(childOne, childTwo, childThree)); - - // Call the method under test. - AccessStatus result = recordsManagementPermissionPostProcessor.process(AccessStatus.DENIED, nodeRef, - "This is the requested permission", configuredReadPermissions, configuredFilePermissions); - - assertEquals(AccessStatus.ALLOWED, result); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java deleted file mode 100644 index adeff31aed..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import static org.mockito.Mockito.verify; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for RecordMetadataBootstrap - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordMetadataBootstrapUnitTest extends BaseUnitTest -{ - @InjectMocks private RecordMetadataBootstrap bootstrap; - - /** - * Test init method to ensure set map will register correctly with record service. - */ - @Test - public void testInit() - { - // create and set map - Map map = new HashMap<>(2); - map.put("rma:test1", "rma:filePlan"); - map.put("rma:test2", "rma:filePlan"); - bootstrap.setRecordMetadataAspects(map); - - // call init - bootstrap.init(); - - // verify that the metedata aspects where registered - QName test1 = QName.createQName(RM_URI, "test1"); - QName test2 = QName.createQName(RM_URI, "test2"); - verify(mockedRecordService).registerRecordMetadataAspect(test1, TYPE_FILE_PLAN); - verify(mockedRecordService).registerRecordMetadataAspect(test2, TYPE_FILE_PLAN); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java deleted file mode 100644 index 15aed71fe0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java +++ /dev/null @@ -1,715 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.record; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -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.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -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.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.node.integrity.IntegrityException; -import org.alfresco.repo.policy.Behaviour; -import org.alfresco.repo.security.permissions.AccessDeniedException; -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.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -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.Mock; -import org.mockito.Spy; - -/** - * Unit test for RecordServiceImpl - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordServiceImplUnitTest extends BaseUnitTest -{ - private NodeRef nonStandardFilePlanComponent; - private NodeRef nonStandardFilePlan; - private NodeRef dmNodeRef; - private NodeRef unfiledRecordContainer; - private NodeRef frozenRecordFolder; - private NodeRef closedRecordFolder; - private ChildAssociationRef parentAssoc; - - private final String recordId = "recordId"; - private final String documentOwner = "Bob"; - private final String originalName = "originalName"; - private final NodeRef originatingLocation = new NodeRef("workspace://SpacesStore/originalLocation"); - private final NodeRef link = new NodeRef("workspace://SpacesStore/linkLocation"); - - @Mock - private RenditionService mockedRenditionService; - - @Mock - private RecordsManagementNotificationHelper mockedNotificationHelper; - @Mock - private ChildAssociationRef mockedChildAssoc; - @Mock - private ChildAssociationRef mockedLinkAssoc; - @Mock - private ChildAssociationRef mockedParentAssoc; - - private static QName TYPE_MY_FILE_PLAN = generateQName(); - private static QName ASPECT_FOR_FILE_PLAN = generateQName(); - - @Spy @InjectMocks private RecordServiceImpl recordService; - - @SuppressWarnings("unchecked") - @Before - @Override - public void before() throws Exception - { - super.before(); - - nonStandardFilePlanComponent = generateNodeRef(TYPE_RECORD_CATEGORY); - nonStandardFilePlan = generateNodeRef(TYPE_MY_FILE_PLAN); - dmNodeRef = generateNodeRef(TYPE_CONTENT); - unfiledRecordContainer = generateNodeRef(TYPE_UNFILED_RECORD_CONTAINER); - frozenRecordFolder = generateNodeRef(TYPE_RECORD_FOLDER); - closedRecordFolder = generateNodeRef(TYPE_RECORD_FOLDER); - parentAssoc = mock(ChildAssociationRef.class); - - // set-up node service - when(mockedNodeService.getProperty(nonStandardFilePlanComponent, PROP_ROOT_NODEREF)).thenReturn(nonStandardFilePlan); - - // 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 - public void testRegisterRecordMetadataAspect() - { - Map> map = recordService.getRecordMetadataAspectsMap(); - assertTrue(map.isEmpty()); - recordService.registerRecordMetadataAspect(ASPECT_FOR_FILE_PLAN, TYPE_FILE_PLAN); - map = recordService.getRecordMetadataAspectsMap(); - assertEquals(1, map.size()); - assertTrue(map.containsKey(ASPECT_FOR_FILE_PLAN)); - Set types = map.get(ASPECT_FOR_FILE_PLAN); - assertNotNull(types); - 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.getOriginDispositionSchedule(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); - - // 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); - } - - /** - * Given a file that is not yet a record - * When I create the record without specifying a location - * Then the record is created in the unfiled record container - */ - @Test - public void createRecordIntoUnfiledRecordContainer() - { - mocksForRecordCreation(); - - // create the record - recordService.createRecord(filePlan, dmNodeRef); - - // verify record was created in unfiled record container - verify(mockedNodeService, times(1)).moveNode( - dmNodeRef, - unfiledRecordContainer, - ContentModel.ASSOC_CONTAINS, - parentAssoc.getQName()); - } - - /** - * Given a file that is not yet a record - * And the unfiled record container can't be found - * When I create the record without specifying a location - * Then an exception is thrown - */ - @Test (expected = AlfrescoRuntimeException.class) - public void createRecordWhenUnfiledRecordContainerIsNull() - { - mocksForRecordCreation(); - when(mockedFilePlanService.getUnfiledContainer(filePlan)).thenReturn(null); - - // create the record - recordService.createRecord(filePlan, dmNodeRef); - } - - /** - * Given a file that is not yet a record - * When I create the record specifying the unfiled record container - * Then the record is created in the unfiled record container - */ - @Test - public void createRecordIntoSpecifiedUnfiledRecordContainer() - { - mocksForRecordCreation(); - - // create the record - recordService.createRecord(filePlan, dmNodeRef, unfiledRecordContainer); - - // verify record was created in specified unfiled record container - verify(mockedNodeService, times(1)).moveNode( - dmNodeRef, - unfiledRecordContainer, - ContentModel.ASSOC_CONTAINS, - parentAssoc.getQName()); - } - - /** - * Given a file that is not yet a record - * When I create the record specifying a location - * Then the record is created in the specified record folder - */ - @Test - public void createRecordIntoSpecifiedRecordFolder() - { - mocksForRecordCreation(); - - // create the record - recordService.createRecord(filePlan, dmNodeRef, recordFolder); - - // verify record was created in specified record folder - verify(mockedNodeService, times(1)).moveNode( - dmNodeRef, - recordFolder, - ContentModel.ASSOC_CONTAINS, - parentAssoc.getQName()); - } - - /** - * Given a file that is not yet a record - * When I create the record specifying an invalid location - * Then an exception is thrown - */ - @Test(expected=AlfrescoRuntimeException.class) - public void createRecordIntoInvalidRecordFolder() - { - mocksForRecordCreation(); - NodeRef recordCategory = generateNodeRef(TYPE_RECORD_CATEGORY); - - // create the record - recordService.createRecord(filePlan, dmNodeRef, recordCategory); - } - - /** - * Given a file that is not yet a record - * When I create the record specifying a location where I don't have permissions - * Then an exception is thrown - */ - @Test (expected = AccessDeniedException.class) - public void createRecordIntoSpecifiedRecordFolderWithoutFilePermission() - { - mocksForRecordCreation(); - when(mockedExtendedPermissionService.hasPermission(recordFolder, RMPermissionModel.FILING)).thenReturn(AccessStatus.DENIED); - - // create the record - recordService.createRecord(filePlan, dmNodeRef, recordFolder); - } - - /** - * Given a file that is not yet a record - * When I create the record specifying a folder which is in a hold - * Then an exception is thrown - */ - @Test(expected= IntegrityException.class) - public void createRecordIntoRecordFolderInHold() - { - mocksForRecordCreation(); - - // create the record - recordService.createRecord(filePlan, dmNodeRef, frozenRecordFolder); - } - - /** - * Given a file that is not yet a record - * When I create the record specifying a closed destination record folder - * Then an exception is thrown - */ - @Test(expected= IntegrityException.class) - public void createRecordIntoClosedRecordFolder() - { - mocksForRecordCreation(); - - // create the record - recordService.createRecord(filePlan, dmNodeRef, closedRecordFolder); - } - - /* Helper method to set up the mocks for record creation */ - private void mocksForRecordCreation() - { - when(mockedNodeService.getPrimaryParent(dmNodeRef)) - .thenReturn(parentAssoc); - when(parentAssoc.getQName()).thenReturn(generateQName()); - - // mocks for sanity checks on node, folder and fileplan - when(mockedExtendedPermissionService.hasPermission(dmNodeRef, PermissionService.WRITE)).thenReturn(AccessStatus.ALLOWED); - when(mockedDictionaryService.isSubClass(mockedNodeService.getType(dmNodeRef), ContentModel.TYPE_CONTENT)).thenReturn(true); - when(mockedFilePlanService.isFilePlan(nonStandardFilePlan)).thenReturn(true); - when(mockedFreezeService.isFrozen(recordFolder)).thenReturn(false); - when(mockedFreezeService.isFrozen(frozenRecordFolder)).thenReturn(true); - when(mockedNodeService.getProperty(closedRecordFolder, PROP_IS_CLOSED)).thenReturn(true); - - // mocks for policies - doNothing().when(recordService).invokeBeforeRecordDeclaration(dmNodeRef); - doNothing().when(recordService).invokeOnRecordDeclaration(dmNodeRef); - - when(mockedFilePlanService.getUnfiledContainer(filePlan)).thenReturn(unfiledRecordContainer); - - when(mockedVersionService.getVersionHistory(dmNodeRef)).thenReturn(null); - } - - /** - * Setup the mocks for the reject record scenarios - * @param mockProperties the mock for the node properties - */ - private void setUpReject(Map mockProperties) - { - when(mockedNodeService.getProperties(dmNodeRef)).thenReturn(mockProperties); - when(mockedVersionService.getVersionHistory(dmNodeRef)).thenReturn(null); - when(mockProperties.get(PROP_IDENTIFIER)).thenReturn(recordId); - when(mockProperties.get(PROP_ORIGIONAL_NAME)).thenReturn(originalName); - when(mockProperties.get(PROP_RECORD_ORIGINATING_LOCATION)).thenReturn(originatingLocation); - List assocs = new ArrayList<>(); - assocs.add(mockedChildAssoc); - assocs.add(mockedLinkAssoc); - when(mockedNodeService.getParentAssocs(dmNodeRef)).thenReturn(assocs); - when(mockedChildAssoc.getParentRef()).thenReturn(originatingLocation); - when(mockedLinkAssoc.getParentRef()).thenReturn(link); - when(mockedNodeService.getType(link)).thenReturn(TYPE_RECORD_FOLDER); - when(mockedNodeService.getPrimaryParent(dmNodeRef)).thenReturn(mockedParentAssoc); - when(mockedParentAssoc.getQName()).thenReturn(ContentModel.TYPE_CATEGORY); - doNothing().when(recordService).invokeBeforeRecordRejection(dmNodeRef); - doNothing().when(recordService).invokeOnRecordRejection(dmNodeRef); - } - /** - * Test for the reject record method - */ - @Test - public void testRejectRecord() - { - Map mockProperties = mock(HashMap.class); - setUpReject(mockProperties); - when(mockProperties.get(PROP_RECORD_ORIGINATING_USER_ID)).thenReturn(documentOwner); - recordService.rejectRecord(dmNodeRef, "Just because.."); - verify(mockedNodeService, times(1)).removeChildAssociation(mockedChildAssoc); - verify(mockedNodeService, times(1)).removeChildAssociation(mockedLinkAssoc); - } - - /** - * Test for the reject record method throws an error without document owner - */ - @Test (expected = AlfrescoRuntimeException.class) - public void testRejectRecordThrowsErrorWithoutDocumentOwner() - { - Map mockProperties = mock(HashMap.class); - setUpReject(mockProperties); - when(mockProperties.get(PROP_RECORD_ORIGINATING_USER_ID)).thenReturn(null); - recordService.rejectRecord(dmNodeRef, "Just because.."); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java deleted file mode 100644 index 18c9166f7b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java deleted file mode 100644 index d5a2abaa82..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; - -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 RecordedVersionConfigGetUnitTest 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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java deleted file mode 100644 index 825e287170..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.doReturn; - -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 RecordedVersionConfigPostUnitTest 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/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java deleted file mode 100644 index 6f5e079349..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * Base hold web script unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest -{ - /** test holds */ - protected NodeRef hold1NodeRef; - protected NodeRef hold2NodeRef; - protected NodeRef dmNodeRef; - protected List holds; - protected List records; - protected List recordFolders; - protected List filePlanComponents; - protected List activeContents; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // generate test holds - hold1NodeRef = generateHoldNodeRef("hold1"); - hold2NodeRef = generateHoldNodeRef("hold2"); - - // generate active content - dmNodeRef = generateNodeRef(TYPE_CONTENT); - when(mockedExtendedPermissionService.hasPermission(dmNodeRef, PermissionService.WRITE)).thenReturn(AccessStatus.ALLOWED); - when(mockedDictionaryService.isSubClass(mockedNodeService.getType(dmNodeRef), ContentModel.TYPE_CONTENT)).thenReturn(true); - - // list of active contents - activeContents = Collections.singletonList(dmNodeRef); - - // list of holds - holds = new ArrayList<>(2); - Collections.addAll(holds, hold1NodeRef, hold2NodeRef); - - // list of records - records = Collections.singletonList(record); - - // list of record folders - recordFolders = Collections.singletonList(recordFolder); - - // list of file plan components - filePlanComponents = Collections.singletonList(filePlanComponent); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java deleted file mode 100644 index 2652f385d1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.WebScriptExceptionMatcher.badRequest; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Test; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Base hold web script with content unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebScriptUnitTest -{ - /** - * Helper method to build JSON content to send to hold webscripts. - */ - protected String buildContent(List nodeRefs, List holds) - { - StringBuilder builder = new StringBuilder(255); - builder.append("{"); - - if (nodeRefs != null) - { - builder.append("'nodeRefs':["); - - boolean bFirst = true; - for (NodeRef nodeRef : nodeRefs) - { - if (!bFirst) - { - builder.append(","); - } - else - { - bFirst = false; - } - - builder.append("'" + nodeRef.toString() + "'"); - } - - builder.append("]"); - } - - if (nodeRefs != null && holds != null) - { - builder.append(","); - } - - if (holds != null) - { - builder.append("'holds':["); - - boolean bFirst = true; - for (NodeRef hold : holds) - { - if (!bFirst) - { - builder.append(","); - } - else - { - bFirst = false; - } - - builder.append("'" + hold.toString() + "'"); - } - - builder.append("]"); - } - - builder.append("}"); - - return builder.toString(); - } - - /** - * Test for expected exception when invalid JSON sent - */ - @SuppressWarnings("unchecked") - @Test - public void sendInvalidJSON() throws Exception - { - // invalid JSON - String content = "invalid JSON"; - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when one of the holds doesn't exist. - */ - @SuppressWarnings("unchecked") - @Test - public void holdDoesNotExist() throws Exception - { - // setup interactions - when(mockedNodeService.exists(eq(hold1NodeRef))).thenReturn(false); - - // build content - String content = buildContent(records, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when the item being added to the hold - * does not exist. - */ - @SuppressWarnings("unchecked") - @Test - public void nodeRefDoesNotExist() throws Exception - { - // setup interactions - when(mockedNodeService.exists(eq(record))).thenReturn(false); - - // build content - String content = buildContent(records, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when hold information is missing from - * sent JSON. - */ - @SuppressWarnings("unchecked") - @Test - public void holdMissingFromContent() throws Exception - { - // build content - String content = buildContent(records, null); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when noderef information is missing - * from send JSON. - */ - @SuppressWarnings("unchecked") - @Test - public void nodeRefMissingFromContent() throws Exception - { - // build content - String content = buildContent(null, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when adding an item to something - * that isn't a hold. - */ - @SuppressWarnings("unchecked") - @Test - public void holdIsNotAHold() throws Exception - { - // build json content to send to server - List notAHold = Collections.singletonList(recordFolder); - String content = buildContent(records, notAHold); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when adding an item to a hold - * that isn't a record, record folder or active content. - */ - @SuppressWarnings("unchecked") - @Test - public void nodeRefIsNotARecordOrRecordFolderOrActiveContent() throws Exception - { - // build json content to send to server - String content = buildContent(filePlanComponents, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java deleted file mode 100644 index 1ec204a454..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import static org.junit.Assert.assertNotNull; -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.service.cmr.repository.NodeRef; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Hold ReST API POST implementation unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest -{ - /** classpath location of ftl template for web script */ - private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.post.json.ftl"; - - /** HoldPost webscript instance */ - protected @Spy @InjectMocks HoldPost 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 WEBSCRIPT_TEMPLATE; - } - - /** - * Test that a record can be added to holds. - */ - @SuppressWarnings("unchecked") - @Test - public void addRecordToHolds() throws Exception - { - // build json to send to server - String content = buildContent(records, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was added to the holds - verify(mockedHoldService, times(1)).addToHolds(holds, records); - } - - /** - * Test that a record folder can be added to holds. - */ - @SuppressWarnings("unchecked") - @Test - public void addRecordFolderToHolds() throws Exception - { - // build json to send to server - String content = buildContent(recordFolders, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was added to the holds - verify(mockedHoldService, times(1)).addToHolds(holds, recordFolders); - } - - /** - * Test that active content can be added to holds. - */ - @Test - public void addActiveContentToHolds() throws Exception - { - // build json to send to server - String content = buildContent(activeContents, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the active content was added to the holds - verify(mockedHoldService, times(1)).addToHolds(holds, activeContents); - } - - /** - * Test that active content can be added to holds along with records and record folders. - */ - @Test - public void addActiveContentAndRecordsAndRecordFoldersToHolds() throws Exception - { - List items = new ArrayList<>(3); - Collections.addAll(items, dmNodeRef, record, recordFolder); - // build json to send to server - String content = buildContent(items, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the active content was added to the holds along with records and record folders - verify(mockedHoldService, times(1)).addToHolds(holds, items); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java deleted file mode 100644 index 0e3f91b754..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import static org.junit.Assert.assertNotNull; -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.service.cmr.repository.NodeRef; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Hold ReST API PUT implementation unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest -{ - /** classpath location of ftl template for web script */ - private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.put.json.ftl"; - - /** HoldPut webscript instance */ - protected @Spy @InjectMocks HoldPut 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 WEBSCRIPT_TEMPLATE; - } - - /** - * Test that a record can be removed from holds. - */ - @SuppressWarnings("unchecked") - @Test - public void removeRecordFromHolds() throws Exception - { - // build json to send to server - String content = buildContent(records, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was removed from holds - verify(mockedHoldService, times(1)).removeFromHolds(holds, records); - } - - /** - * Test that a record folder can be removed from holds. - */ - @SuppressWarnings("unchecked") - @Test - public void removeRecordFolderFromHolds() throws Exception - { - // build json to send to server - String content = buildContent(recordFolders, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was removed from holds - verify(mockedHoldService, times(1)).removeFromHolds(holds, recordFolders); - } - - /** - * Test that active content can be removed from holds. - */ - @Test - public void removeActiveContentFromHolds() throws Exception - { - // build json to send to server - String content = buildContent(activeContents, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the active content was removed from holds - verify(mockedHoldService, times(1)).removeFromHolds(holds, activeContents); - } - - /** - * Test that active content can be removed from holds along with records and record folders. - */ - @Test - public void removeActiveContentAndRecordsAndRecordFoldersToHolds() throws Exception - { - List items = new ArrayList<>(3); - Collections.addAll(items, dmNodeRef, record, recordFolder); - // build json to send to server - String content = buildContent(items, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the active content was removed from holds along with records and record folders - verify(mockedHoldService, times(1)).removeFromHolds(holds, items); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java deleted file mode 100644 index a700f31655..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.hold; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.WebScriptExceptionMatcher.fileNotFound; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; - -import java.util.Collections; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Holds ReST API GET implementation unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldsGetUnitTest extends BaseHoldWebScriptUnitTest -{ - /** classpath location of ftl template for web script */ - private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "holds.get.json.ftl"; - - /** HoldsGet webscript instance */ - protected @Spy @InjectMocks HoldsGet 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 WEBSCRIPT_TEMPLATE; - } - - /** - * Test the outcome of calling the web script with an invalid file plan - */ - @Test - public void invalidFilePlan() throws Exception - { - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", "imadethisup" - ); - - // setup expected exception - exception.expect(WebScriptException.class); - exception.expect(fileNotFound()); - - // execute web script - executeWebScript(parameters); - } - - /** - * Test the outcome of calling the web script with no file plan specified - * and with no default file plan created. - */ - @SuppressWarnings("unchecked") - @Test - public void defaultFilePlanDoesNotExist() throws Exception - { - // setup expected exception - exception.expect(WebScriptException.class); - exception.expect(fileNotFound()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP); - } - - /** - * Test the successful retrieval of holds defined for a specified file - * plan. - */ - @Test - public void getHoldsForFilePlan() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).getHolds(filePlan); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId() - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - /** - * Test the retrieval of holds for the default file plan. - */ - @SuppressWarnings("unchecked") - @Test - public void getHoldsForDefaultFilePlan() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).getHolds(filePlan); - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - /** - * Test the retrieval of holds that hold a specified node. - */ - @Test - public void getHoldsThatNodeRefIsHeldBy() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).heldBy(record, true); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", record.toString() - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - - } - - /** - * Test the retrieval of holds that a node is not held in. - */ - @Test - public void getHoldsThatNodeRefIsNotHeldBy() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).heldBy(record, false); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", record.toString(), - "includedInHold", "false" - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - /** - * Test the retrieval of holds that hold active content. - */ - @Test - public void getHoldsThatActiveContentIsHeldBy() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).heldBy(dmNodeRef, true); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", dmNodeRef.toString() - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - - } - - /** - * Test the retrieval of holds that do not hold active content. - */ - @Test - public void getHoldsThatActiveContentIsNotHeldBy() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).heldBy(dmNodeRef, false); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", dmNodeRef.toString(), - "includedInHold", "false" - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - public void getFileOnlyHolds() throws Exception - { - doReturn(AccessStatus.ALLOWED).when(mockedPermissionService).hasPermission(hold1NodeRef, RMPermissionModel.FILING); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold2NodeRef, RMPermissionModel.FILING); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", record.toString(), - "includedInHold", "false", - "fileOnly", "true" - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - assertTrue(json.has("data")); - assertTrue(json.getJSONObject("data").has("holds")); - - JSONArray jsonHolds = json.getJSONObject("data").getJSONArray("holds"); - assertNotNull(jsonHolds); - assertEquals(1, jsonHolds.length()); - - JSONObject hold1 = jsonHolds.getJSONObject(0); - assertNotNull(hold1); - assertEquals("hold1", hold1.getString("name")); - assertEquals(hold1NodeRef.toString(), hold1.getString("nodeRef")); - } - - /** - * Helper method to test JSON object for the presence of both test holds. - * - * @param json json result from web script - */ - private void testForBothHolds(JSONObject json) throws Exception - { - // check the JSON result - assertTrue(json.has("data")); - assertTrue(json.getJSONObject("data").has("holds")); - - JSONArray jsonHolds = json.getJSONObject("data").getJSONArray("holds"); - assertNotNull(jsonHolds); - assertEquals(2, jsonHolds.length()); - - JSONObject hold1 = jsonHolds.getJSONObject(0); - assertNotNull(hold1); - assertEquals("hold1", hold1.getString("name")); - assertEquals(hold1NodeRef.toString(), hold1.getString("nodeRef")); - - JSONObject hold2 = jsonHolds.getJSONObject(1); - assertNotNull(hold2); - assertEquals("hold2", hold2.getString("name")); - assertEquals(hold2NodeRef.toString(), hold2.getString("nodeRef")); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/ClassificationReasonsUtilUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/ClassificationReasonsUtilUnitTest.java deleted file mode 100644 index 8e788505c8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/ClassificationReasonsUtilUnitTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.model.ContentModel.ASSOC_CHILDREN; -import static org.alfresco.model.ContentModel.PROP_NAME; -import static org.alfresco.module.org_alfresco_module_rm.script.slingshot.ClassificationReasonsUtil.CLASSIFICATION_REASONS_CONTAINER; -import static org.alfresco.module.org_alfresco_module_rm.script.slingshot.ClassificationReasonsUtil.PROP_CLASSIFICATION_REASON_CODE; -import static org.alfresco.service.cmr.repository.StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -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.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * @author Ross Gale - * @since 2.7 - */ -public class ClassificationReasonsUtilUnitTest -{ - - @Mock - private NodeService nodeService; - - @Mock - private ChildAssociationRef childAssociationRef; - - @Mock - private ChildAssociationRef reason; - - @Mock - private Map properties; - - @InjectMocks - private ClassificationReasonsUtil classificationReasonsUtil; - - private NodeRef childNodeRef; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - NodeRef rootNodeRef = new NodeRef("workspace://SpacesStore/rootNodeRef"); - NodeRef containerNodeRef = new NodeRef("workspace://SpacesStore/containerNodeRef"); - childNodeRef = new NodeRef("workspace://SpacesStore/childNodeRef"); - List assocRefs = new ArrayList<>(); - List childAssocRefs = new ArrayList<>(); - assocRefs.add(childAssociationRef); - childAssocRefs.add(reason); - when(reason.getChildRef()).thenReturn(childNodeRef); - when(nodeService.getRootNode(STORE_REF_WORKSPACE_SPACESSTORE)).thenReturn(rootNodeRef); - when(nodeService.getChildAssocs(rootNodeRef, ASSOC_CHILDREN, CLASSIFICATION_REASONS_CONTAINER)).thenReturn(assocRefs); - when(childAssociationRef.getChildRef()).thenReturn(containerNodeRef); - when(nodeService.getChildAssocs(containerNodeRef)).thenReturn(childAssocRefs); - } - - /** - * Check no modifications are made to non matching parts of the query string - */ - @Test - public void testNoChangeMadeToStringIfKeyNotFound() - { - String stringToTest = "noChangeMadeToString"; - assertEquals("Change made to string",stringToTest, classificationReasonsUtil.replaceReasonWithNodeRef(stringToTest).trim()); - } - - /** - * Check no modifications made if the plain text parameter doesn't have a stored match - */ - @Test - public void testNoChangeMadeToStringIfMatchNotFound() - { - when(nodeService.getProperties(childNodeRef)).thenReturn(properties); - when(properties.get(PROP_CLASSIFICATION_REASON_CODE)).thenReturn("not a match!"); - String stringToTest = "clf:classificationReasons:noChangeMadeToString"; - assertEquals("Change made to string", stringToTest, classificationReasonsUtil.replaceReasonWithNodeRef(stringToTest).trim()); - } - - /** - * Check the query is updated correctly when a match is found - */ - @Test - public void testChangeMadeToStringIfMatchFound() - { - when(nodeService.getProperties(childNodeRef)).thenReturn(properties); - when(properties.get(PROP_CLASSIFICATION_REASON_CODE)).thenReturn("stringToChange"); - when(properties.get(PROP_NAME)).thenReturn("newString"); - String stringToTest = "clf:classificationReasons:stringToChange"; - assertEquals("No change made to string", "clf:classificationReasons:newString", classificationReasonsUtil.replaceReasonWithNodeRef(stringToTest).trim()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordCategoryUtilUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordCategoryUtilUnitTest.java deleted file mode 100644 index 45d979cf38..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordCategoryUtilUnitTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_IDENTIFIER; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RECORD_CATEGORY; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RECORD_FOLDER; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.when; - -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.cmr.repository.Path; -import org.alfresco.service.cmr.repository.Path.ChildAssocElement; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Tests for methods in the RecordsCategoryUtil class - * - * @author Ross Gale - * @since 2.7 - */ -public class RecordCategoryUtilUnitTest -{ - @Mock - private NodeService nodeService; - - @Mock - private ChildAssocElement element; - - @Mock - private ChildAssociationRef childAssociationRef; - - @InjectMocks - private RecordCategoryUtil recordCategoryUtil; - - private Path path; - - private NodeRef recordNodeRef; - - private NodeRef recordFolderNodeRef; - - private NodeRef categoryNodeRef; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - recordNodeRef = new NodeRef("test://recordNode/"); - recordFolderNodeRef = new NodeRef("test://recordFolderNode/"); - categoryNodeRef = new NodeRef("test://categoryNode/"); - path = new Path(); - path.append(element); - when(nodeService.getType(recordFolderNodeRef)).thenReturn(TYPE_RECORD_FOLDER); - when(nodeService.getType(recordNodeRef)).thenReturn(TYPE_NON_ELECTRONIC_DOCUMENT); - when(nodeService.getPath(recordNodeRef)).thenReturn(path); - when(nodeService.getPath(recordFolderNodeRef)).thenReturn(path); - when(element.getRef()).thenReturn(childAssociationRef); - when(childAssociationRef.getChildRef()).thenReturn(categoryNodeRef); - when(nodeService.getType(categoryNodeRef)).thenReturn(TYPE_RECORD_CATEGORY); - when(nodeService.getProperty(categoryNodeRef, PROP_IDENTIFIER)).thenReturn("RecordCategoryId"); - } - - /** - * Tests an id is returned from a valid node ref - */ - @Test - public void testGetIdFromNodeRef() - { - assertEquals("RecordCategoryId",recordCategoryUtil.getCategoryIdFromNodeId(recordNodeRef,false)); - } - - /** - * Tests an id can be returned for a non record with the correct option selected - */ - @Test - public void testGetIdFromNodeRefReturnsForNonRecordWhenOptionSelected() - { - assertEquals("RecordCategoryId", recordCategoryUtil.getCategoryIdFromNodeId(recordFolderNodeRef, true)); - } - - /** - * Tests no id is returned for a folder if option isn't selected - */ - @Test - public void testGetIdFromNodeRefReturnsNullForNonRecordWhenOptionSelected() - { - assertNull(recordCategoryUtil.getCategoryIdFromNodeId(recordFolderNodeRef,false)); - } - - /** - * Tests no id is returned when a categories isn't found on the path - */ - @Test - public void testGetIdFromNodeRefReturnsNullWithNoCategory() - { - when(nodeService.getPath(recordNodeRef)).thenReturn(new Path()); - assertNull(recordCategoryUtil.getCategoryIdFromNodeId(recordNodeRef, false)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java deleted file mode 100644 index 13f7c5f9b1..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java +++ /dev/null @@ -1,928 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.security; - -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.READER_GROUP_PREFIX; -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.ROOT_IPR_GROUP; -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.WRITER_GROUP_PREFIX; -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anySet; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.alfresco.model.RenditionModel; -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.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -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.cmr.security.AccessPermission; -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.security.PermissionService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.context.ApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Extended security service implementation unit test. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class ExtendedSecurityServiceImplUnitTest -{ - /** service mocks*/ - @Mock private FilePlanService mockedFilePlanService; - @Mock private FilePlanRoleService mockedFilePlanRoleService; - @Mock private AuthorityService mockedAuthorityService; - @Mock private PermissionService mockedPermissionService; - @Mock private TransactionService mockedTransactionService; - @Mock private RetryingTransactionHelper mockedRetryingTransactionHelper; - @Mock private NodeService mockedNodeService; - @Mock private PagingResults mockedReadPagingResults; - @Mock private PagingResults mockedWritePagingResults; - @Mock private ApplicationContext mockedApplicationContext; - @Mock private ChildAssociationRef mockedChildAssociationRef; - - /** test component */ - @InjectMocks private ExtendedSecurityServiceImpl extendedSecurityService; - - /** read/write group full names */ - private static final String READER_GROUP_FULL_PREFIX = GROUP_PREFIX + READER_GROUP_PREFIX; - private static final String WRITER_GROUP_FULL_PREFIX = GROUP_PREFIX + WRITER_GROUP_PREFIX; - - /** test authorities */ - private static final String USER = "USER"; - private static final String GROUP = GROUP_PREFIX + "GROUP"; - private static final String USER_W = "USER_W"; - private static final String GROUP_W = GROUP_PREFIX + "GROUP_W"; - private static final Set READERS = Stream.of(USER, GROUP).collect(Collectors.toSet()); - private static final Set WRITERS = Stream.of(USER_W, GROUP_W).collect(Collectors.toSet()); - - /** has extended security permission set */ - private static final Set HAS_EXTENDED_SECURITY = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, READER_GROUP_FULL_PREFIX, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, WRITER_GROUP_FULL_PREFIX, 2)) - .collect(Collectors.toSet()); - - /** has no extended security permission set */ - private static final Set HAS_NO_EXTENDED_SECURITY = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 2)) - .collect(Collectors.toSet()); - - /** test data */ - private NodeRef nodeRef; - private NodeRef filePlan; - private String readGroupPrefix; - private String writeGroupPrefix; - - /** - * Before tests - */ - @SuppressWarnings("unchecked") - @Before public void before() - { - // initialise mocks - MockitoAnnotations.initMocks(this); - - // setup node - nodeRef = AlfMock.generateNodeRef(mockedNodeService); - - // setup file plan - filePlan = AlfMock.generateNodeRef(mockedNodeService); - when(mockedFilePlanService.getFilePlan(any(NodeRef.class))) - .thenReturn(filePlan); - - // set-up application context - when(mockedApplicationContext.getBean("dbNodeService")) - .thenReturn(mockedNodeService); - - // setup retrying transaction helper - Answer doInTransactionAnswer = new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; - return callback.execute(); - } - }; - doAnswer(doInTransactionAnswer) - .when(mockedRetryingTransactionHelper) - .doInTransaction(any(RetryingTransactionCallback.class)); - when(mockedTransactionService.getRetryingTransactionHelper()) - .thenReturn(mockedRetryingTransactionHelper); - - // setup create authority - Answer createAuthorityAnswer = new Answer() - { - public String answer(InvocationOnMock invocation) throws Throwable - { - return PermissionService.GROUP_PREFIX + (String)invocation.getArguments()[1]; - } - - }; - when(mockedAuthorityService.createAuthority(any(AuthorityType.class), anyString(), anyString(), anySet())) - .thenAnswer(createAuthorityAnswer); - - // setup group prefixes - readGroupPrefix = extendedSecurityService.getIPRGroupPrefixShortName(READER_GROUP_PREFIX, READERS); - writeGroupPrefix = extendedSecurityService.getIPRGroupPrefixShortName(WRITER_GROUP_PREFIX, WRITERS); - - // make sure the users and groups exist - Stream - .of(USER, USER_W, GROUP, GROUP_W) - .forEach((a) -> - when(mockedAuthorityService.authorityExists(a)) - .thenReturn(true)); - } - - /** - * Given that the root authority does not exist - * When the application context is refreshed - * Then the root authority is created - */ - @Test public void rootAuthorityDoesNotExist() - { - // group doesn't exist - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + ExtendedSecurityServiceImpl.ROOT_IPR_GROUP)) - .thenReturn(false); - - // refresh context - extendedSecurityService.onApplicationEvent(mock(ContextRefreshedEvent.class)); - - // verify group is created - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); - } - - /** - * Given that the root authority exists - * When the application context is refreshed - * Then nothing happens - */ - @Test public void rootAuthorityDoesExist() - { - // group doesn't exist - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + ROOT_IPR_GROUP)) - .thenReturn(true); - - // refresh context - extendedSecurityService.onApplicationEvent(mock(ContextRefreshedEvent.class)); - - // verify group is created - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); - } - - /** - * Given that an IPR read group has read on a node - * And that an IPR write group has filling on a node - * When checking for the existence of extended permissions on that node - * Then it will be confirmed - */ - @Test public void hasExtendedSecurityWithReadAndWriteGroups() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_EXTENDED_SECURITY); - - // has extended security - assertTrue(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that there is no IPR read group has read on a node - * When checking for the existence of extended permissions on that node - * Then it will be denied - */ - @Test public void hasExtendedSecurityWithNoReadGroup() - { - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, GROUP_PREFIX + WRITER_GROUP_PREFIX, 2)) - .collect(Collectors.toSet()); - - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // has extended security - assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that there is no IPR write group has read on a node - * When checking for the existence of extended permissions on that node - * Then it will be denied - */ - @Test public void hasExtendedSecurityWithNoWriteGroup() - { - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, GROUP_PREFIX + READER_GROUP_PREFIX, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 2)) - .collect(Collectors.toSet()); - - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // has extended security - assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that an IPR read group has no groups assigned permission - * When checking for the existence of extended permissions on that node - * Then it will be denied - */ - @Test public void hasExtendedSecurityWithNoAssignedGroups() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // has extended security - assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that there are no IPR groups assigned - * When I try and get the extended readers - * The I will get an empty set - */ - @Test public void getExtendedReadersNoIPRGroupsAssigned() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // get extended readers - assertTrue(extendedSecurityService.getReaders(nodeRef).isEmpty()); - } - - /** - * Given that there are IPR groups assigned - * When I try and get the extended readers - * The I will get the set of readers - */ - @Test public void getExtendedReaders() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_EXTENDED_SECURITY); - - when(mockedAuthorityService.getContainedAuthorities(null, READER_GROUP_FULL_PREFIX, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - - // get extended readers - Set extendedReaders = extendedSecurityService.getReaders(nodeRef); - assertEquals(Stream - .of(USER, GROUP) - .collect(Collectors.toSet()), - extendedReaders); - } - - /** - * Given that there are no IPR groups assigned - * When I try and get the extended writers - * The I will get an empty set - */ - @Test public void getExtendedWritersNoIPRGroupsAssigned() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // get extended writers - assertTrue(extendedSecurityService.getWriters(nodeRef).isEmpty()); - } - - /** - * Given that there are IPR groups assigned - * When I try and get the extended writers - * The I will get the set of writers - */ - @Test public void getExtendedWriters() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_EXTENDED_SECURITY); - - when(mockedAuthorityService.getContainedAuthorities(null, WRITER_GROUP_FULL_PREFIX, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - - // get extended writers - Set extendedWriters = extendedSecurityService.getWriters(nodeRef); - assertEquals(Stream - .of(USER, GROUP) - .collect(Collectors.toSet()), - extendedWriters); - } - - /** - * Given a node with no previous IPR groups assigned - * And no IPR group matching authorities - * When I add some read and write authorities - * Then new IPR groups are created - * And they are assigned to the node - * And they are added to the RM roles - */ - @Test public void addExtendedSecurityForTheFirstTimeAndCreateGroups() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 0); - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Collections.emptyList()); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - any(String.class), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService).addAuthority(readGroup, USER); - verify(mockedAuthorityService).addAuthority(readGroup, GROUP); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); - verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - } - - /** - * Given a node with no previous IPR groups assigned - * And existing IPR groups matching - * When I add some read and write authorities - * Then the existing IPR groups are used - * And they are assigned to the node - * And do not not need to be re-added to the RM roles - */ - @Test public void addExtendedSecurityForTheFirstTimeAndReuseGroups() - { - // group names - String readGroup = readGroupPrefix + "0"; - String writeGroup = writeGroupPrefix + "0"; - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(readGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - when(mockedWritePagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(writeGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedWritePagingResults); - - // setup exact match - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) - .thenReturn(true); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) - .thenReturn(Stream - .of(USER_W, GROUP_W) - .collect(Collectors.toSet())); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService, never()).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService, never()).addAuthority(readGroup, USER); - verify(mockedAuthorityService, never()).addAuthority(readGroup, GROUP); - - // verify write group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService, never()).addAuthority(readGroup, writeGroup); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - - } - - /** - * Given a node with no previous IPR groups assigned - * And existing IPR groups matches existing has, but not exact match - * When I add some read and write authorities - * Then new groups are created - * And they are assigned to the node - * And added to the RM roles - */ - @Test public void addExtendedSecurityForTheFirstTimeAndCreateGroupsAfterClash() - { - // group names - String readGroup = readGroupPrefix + "0"; - String writeGroup = writeGroupPrefix + "0"; - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(readGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - when(mockedWritePagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(writeGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedWritePagingResults); - - // setup exact match - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) - .thenReturn(true); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) - .thenReturn(Stream - .of(USER, GROUP, AlfMock.generateText()) - .collect(Collectors.toSet())); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) - .thenReturn(Stream - .of(USER_W, AlfMock.generateText()) - .collect(Collectors.toSet())); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // new group names - readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 1); - writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 1); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService).addAuthority(readGroup, USER); - verify(mockedAuthorityService).addAuthority(readGroup, GROUP); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); - verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - } - - /** - * Given a node with no previous IPR groups assigned - * And existing IPR groups matching, but found on second page of find results - * When I add some read and write authorities - * Then the existing IPR groups are used - * And they are assigned to the node - * And do not not need to be re-added to the RM roles - */ - @Test public void addExtendedSecurityWithResultPaging() - { - // group names - String readGroup = readGroupPrefix + "0"; - String writeGroup = writeGroupPrefix + "0"; - - // create fity results - List fiftyResults = new ArrayList<>(50); - for (int i = 0; i < 50; i++) - { - fiftyResults.add(AlfMock.generateText()); - } - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(fiftyResults) - .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(readGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - when(mockedWritePagingResults.getPage()) - .thenReturn(fiftyResults) - .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(writeGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedWritePagingResults); - - // setup exact match - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) - .thenReturn(true); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) - .thenReturn(Stream - .of(USER_W, GROUP_W) - .collect(Collectors.toSet())); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService, never()).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService, never()).addAuthority(readGroup, USER); - verify(mockedAuthorityService, never()).addAuthority(readGroup, GROUP); - - // verify write group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService, never()).addAuthority(readGroup, writeGroup); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - - } - - /** - * Given that a node already has extended security - * When I add extended security - * Then the existing extended security is replaced with the new extended security - */ - @Test public void addExtendedSecurityToNodeWithExtendedSecurity() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); - - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) - .collect(Collectors.toSet()); - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // set revised reader and writers - String user = generateText(); - String group = generateText(); - String userW = generateText(); - String groupW = generateText(); - Set newReaders = Stream.of(user, group).collect(Collectors.toSet()); - Set newWriters = Stream.of(userW, groupW).collect(Collectors.toSet()); - - // new group names - String newReadGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, newReaders, 0); - String newWriteGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, newWriters, 0); - - // make sure users and groups exist - Stream - .of(user, group, userW, groupW) - .forEach((a) -> - when(mockedAuthorityService.authorityExists(a)) - .thenReturn(true)); - - // setup query results for no group matches - when(mockedReadPagingResults.getPage()) - .thenReturn(Collections.emptyList()); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - any(String.class), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - // set extended security - extendedSecurityService.set(nodeRef, newReaders, newWriters); - - // verify that the old permissions are cleared - verify(mockedPermissionService).clearPermission(nodeRef, readGroup); - verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, newReadGroup, newReadGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - newReadGroup = GROUP_PREFIX + newReadGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, newReadGroup); - verify(mockedAuthorityService).addAuthority(newReadGroup, user); - verify(mockedAuthorityService).addAuthority(newReadGroup, group); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, newWriteGroup, newWriteGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - newWriteGroup = GROUP_PREFIX + newWriteGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, newWriteGroup); - verify(mockedAuthorityService).addAuthority(newWriteGroup, userW); - verify(mockedAuthorityService).addAuthority(newWriteGroup, groupW); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, newReadGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, newWriteGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, newReadGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, newWriteGroup, RMPermissionModel.FILING, true); - - } - - /** - * Given that a node has renditions - * When I add extended security - * Then they are applied to the renditions - */ - @Test public void extendedSecurityAddedToRenditions() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 0); - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Collections.emptyList()); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - any(String.class), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - // setup renditions - NodeRef renditionNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - .thenReturn(true); - when(mockedChildAssociationRef.getChildRef()) - .thenReturn(renditionNodeRef); - when(mockedNodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL)) - .thenReturn(Collections.singletonList(mockedChildAssociationRef)); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService).addAuthority(readGroup, USER); - verify(mockedAuthorityService).addAuthority(readGroup, GROUP); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); - verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - - // verify permissions are assigned to the rendition - verify(mockedPermissionService).setPermission(renditionNodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(renditionNodeRef, writeGroup, RMPermissionModel.FILING, true); - } - - /** - * Given that a node has extended security - * When I remove the extended security - * Then the inplace groups permissions are removed - */ - @Test public void removeAllExtendedSecurity() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); - - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) - .collect(Collectors.toSet()); - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // remove extended security - extendedSecurityService.remove(nodeRef); - - // verify that the groups permissions have been removed - verify(mockedPermissionService).clearPermission(nodeRef, readGroup); - verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); - } - - /** - * Given that a node has no extended security - * When I remove the extended security - * Then nothing happens - */ - @Test public void noExtendedSecurityToRemove() - { - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // remove extended security - extendedSecurityService.remove(nodeRef); - - // verify that the groups permissions have been removed - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - } - - /** - * Given that node has renditions - * When I remove the extended security for a node - * Then the extended security is also removed from the renditions - */ - @Test public void removeExtendedSecurityFromRenditions() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); - - // setup renditions - NodeRef renditionNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - .thenReturn(true); - when(mockedChildAssociationRef.getChildRef()) - .thenReturn(renditionNodeRef); - when(mockedNodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL)) - .thenReturn(Collections.singletonList(mockedChildAssociationRef)); - - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) - .collect(Collectors.toSet()); - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // remove extended security - extendedSecurityService.remove(nodeRef); - - // verify that the groups permissions have been removed - verify(mockedPermissionService).clearPermission(nodeRef, readGroup); - verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); - - // verify that the groups permissions have been removed from the rendition - verify(mockedPermissionService).clearPermission(renditionNodeRef, readGroup); - verify(mockedPermissionService).clearPermission(renditionNodeRef, writeGroup); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java deleted file mode 100644 index b07e16b4d6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java +++ /dev/null @@ -1,449 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.security; - -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 java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -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.test.util.BaseUnitTest; -import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl; -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.OwnableService; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.mockito.verification.VerificationMode; - -/** - * File plan permission service implementation unit test. - *

- * Primarily tests the file plan permission service interaction with the - * permission service. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class FilePlanPermissionServiceImplUnitTest extends BaseUnitTest -{ - /** test authority */ - protected static final String AUTHORITY = "anAuthority"; - protected static final String AUTHORITY2 = "anOtherAuthority"; - - /** fileplan nodes */ - protected NodeRef rootRecordCategory; - protected NodeRef recordCategory; - protected NodeRef newRecordFolder; - protected NodeRef newRecord; - - /** unfiled nodes */ - protected NodeRef unfiledRecordContainer; - protected NodeRef unfiledRecordFolder; - protected NodeRef unfiledRecordFolderChild; - protected NodeRef unfiledRecord; - - /** held nodes */ - protected NodeRef holdContainer; - protected NodeRef hold; - protected NodeRef heldRecord; - - /** file plan permission service implementation */ - @Spy @InjectMocks FilePlanPermissionServiceImpl filePlanPermissionService; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // initialize node's - unfiledRecordContainer = generateContainerNodeRef(TYPE_UNFILED_RECORD_CONTAINER); - unfiledRecordFolder = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); - unfiledRecordFolderChild = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); - unfiledRecord = generateRecord(); - holdContainer = generateContainerNodeRef(TYPE_HOLD_CONTAINER); - hold = generateHoldNodeRef("my test hold"); - heldRecord = generateRecord(); - rootRecordCategory = generateContainerNodeRef(TYPE_RECORD_CATEGORY); - recordCategory = generateContainerNodeRef(TYPE_RECORD_CATEGORY); - newRecordFolder = generateRecordFolder(); - newRecord = generateRecord(); - - // setup parent hierarchy - makePrimaryParentOf(filePlan, generateNodeRef(ContentModel.TYPE_FOLDER)); - - makePrimaryParentOf(rootRecordCategory, filePlan); - makePrimaryParentOf(recordCategory, rootRecordCategory); - makePrimaryParentOf(newRecordFolder, recordCategory); - makePrimaryParentOf(newRecord, newRecordFolder); - - makePrimaryParentOf(unfiledRecordFolder, unfiledRecordContainer); - makePrimaryParentOf(unfiledRecordContainer, filePlan); - - makePrimaryParentOf(hold, holdContainer); - makePrimaryParentOf(holdContainer, filePlan); - - - // setup child hierarchy - makeChildrenOf(filePlan, rootRecordCategory); - makeChildrenOf(rootRecordCategory, recordCategory); - makeChildrenOf(recordCategory, newRecordFolder); - makeChildrenOf(newRecordFolder, newRecord); - - makeChildrenOf(unfiledRecordFolder, unfiledRecordFolderChild); - makeChildrenOf(unfiledRecordFolderChild, unfiledRecord); - - makeChildrenOf(holdContainer, hold); - makeChildrenOf(hold, heldRecord); - - doReturn(FilePlanComponentKind.FILE_PLAN).when(filePlanPermissionService).getFilePlanComponentKind(filePlan); - doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(filePlanPermissionService).getFilePlanComponentKind(rootRecordCategory); - doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(filePlanPermissionService).getFilePlanComponentKind(recordCategory); - doReturn(FilePlanComponentKind.RECORD_FOLDER).when(filePlanPermissionService).getFilePlanComponentKind(newRecordFolder); - doReturn(FilePlanComponentKind.RECORD).when(filePlanPermissionService).getFilePlanComponentKind(newRecord); - doReturn(FilePlanComponentKind.UNFILED_RECORD_FOLDER).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecordFolder); - doReturn(FilePlanComponentKind.UNFILED_RECORD_CONTAINER).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecordContainer); - doReturn(FilePlanComponentKind.RECORD).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecord); - doReturn(FilePlanComponentKind.HOLD_CONTAINER).when(filePlanPermissionService).getFilePlanComponentKind(holdContainer); - doReturn(FilePlanComponentKind.HOLD).when(filePlanPermissionService).getFilePlanComponentKind(hold); - } - - /** - * Helper method to generate a container node ref of a perticular type. - * - * @param type type of node reference - * @return {@link NodeRef} node reference that behaves like a container of the type given. - */ - private NodeRef generateContainerNodeRef(QName type) - { - NodeRef nodeRef = generateNodeRef(type); - setupAsFilePlanComponent(nodeRef); - doReturn(true).when(filePlanPermissionService).isFilePlanContainer(nodeRef); - return nodeRef; - } - - /** - * Set read permission on unfiled record folder. - */ - @Test - public void setReadPermissionOnUnfiledRecordFolder() - { - // set read permission on unfiled record folder - filePlanPermissionService.setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - - /** - * Set filling permission on unfiled record folder - */ - @Test - public void setReadAndFilePermissionOnUnfileRecordFolder() - { - // set read permission on unfiled record folder - filePlanPermissionService.setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.FILING); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.FILING, true); - } - - /** - * Remove permission from unfiled record folders. - */ - @Test - public void deletePermissionFromUnfiledRecordFolder() - { - // delete read permission from unfiled record folder - filePlanPermissionService.deletePermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission deleted on target node - verify(mockedPermissionService, times(1)).deletePermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); - } - - /** - * Set read permission on hold container - */ - @Test - public void setReadPermissionOnHoldContainer() - { - // set read permission on hold - filePlanPermissionService.setPermission(holdContainer, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(holdContainer, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - - /** - * Set filing permission on hold container - */ - @Test - public void setFilingPermissionOnHoldContainer() - { - // set read permission on hold - filePlanPermissionService.setPermission(holdContainer, AUTHORITY, RMPermissionModel.FILING); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(holdContainer, AUTHORITY, RMPermissionModel.FILING, true); - } - - /** - * Set read permission on hold. - */ - @Test - public void setReadPermissionOnHold() - { - // set read permission on hold - filePlanPermissionService.setPermission(hold, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(hold, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - - /** - * Set filing permission on hold. - */ - @Test - public void setFilingPermissionOnHold() - { - // set filing permission on hold - filePlanPermissionService.setPermission(hold, AUTHORITY, RMPermissionModel.FILING); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(hold, AUTHORITY, RMPermissionModel.FILING, true); - } - - /** - * Helper method to setup permissions on mock objects - */ - private void setupPermissions(NodeRef nodeRef) - { - Set perms = new HashSet<>(4); - - // setup basic file and read for authorities - perms.add(new AccessPermissionImpl(RMPermissionModel.READ_RECORDS, AccessStatus.ALLOWED, AUTHORITY, 0)); - perms.add(new AccessPermissionImpl(RMPermissionModel.FILING, AccessStatus.ALLOWED, AUTHORITY2, 1)); - - doReturn(perms).when(mockedPermissionService).getAllSetPermissions(nodeRef); - } - - /** - * Helper to verify the core permissions have been initialized correctly - */ - private void verifyInitPermissions(NodeRef nodeRef, boolean isInherited) - { - verify(mockedPermissionService).getAllSetPermissions(nodeRef); - verify(mockedPermissionService).setInheritParentPermissions(nodeRef, isInherited); - verify(mockedPermissionService).clearPermission(nodeRef, null); - verify(mockedOwnableService).setOwner(nodeRef, OwnableService.NO_OWNER); - } - - /** - * Helper to verify that permissions have been set correctly on the child - * - * @param parent parent node - * @param child child node - * @param read verification mode relating to setting read on the child - * @param filling verification mode relating to setting filling on the child - */ - private void verifyInitPermissions(NodeRef parent, NodeRef child, VerificationMode read, VerificationMode filling, boolean isParentFilePlan, boolean isInherited) - { - // verify the core permissions are set-up correctly - verifyInitPermissions(child, isInherited); - - if (isParentFilePlan) - { - // verify the permissions came from the correct parent - verify(mockedPermissionService).getAllSetPermissions(parent); - - // verify all the inherited permissions are set correctly (note read are not inherited from fileplan) - verify(mockedPermissionService, filling).setPermission(child, AUTHORITY2, RMPermissionModel.FILING, true); - verify(mockedPermissionService, read).setPermission(child, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - } - - /** - * Test the initialisation of permissions for a new root category - */ - @Test - public void initPermissionsForNewRootRecordCategory() - { - // setup permissions for file plan - setupPermissions(filePlan); - - // setup permissions - filePlanPermissionService.setupRecordCategoryPermissions(rootRecordCategory); - - // verify permission init - verifyInitPermissions(filePlan, rootRecordCategory, never(), times(1), true, false); - } - - /** - * Test the initialisation of permissions for a new category - */ - @Test - public void initPermissionsForNewRecordCategory() - { - // setup permissions for parent - setupPermissions(rootRecordCategory); - - // setup permissions - filePlanPermissionService.setupRecordCategoryPermissions(recordCategory); - - // verify permission init - verifyInitPermissions(rootRecordCategory, recordCategory, times(1), times(1), false, true); - } - - /** - * Test initialisation new record folder permissions - */ - @Test - public void initPermissionsForNewRecordFolder() - { - // setup permissions for parent - setupPermissions(recordCategory); - - // setup permissions - filePlanPermissionService.setupPermissions(recordCategory, newRecordFolder); - - // verify permission init - verifyInitPermissions(recordCategory, newRecordFolder, times(1), times(1), false, true); - - } - - /** - * Test setup of new record permissions - */ - @Test - public void initPermissionsForNewRecord() - { - // setup permissions for parent - setupPermissions(newRecordFolder); - - // setup permissions for record - filePlanPermissionService.setupPermissions(newRecordFolder, newRecord); - - // verify permission init - verifyInitPermissions(newRecordFolder, newRecord, times(1), times(1), false, true); - } - - /** - * Test setup of permissions for new hold container - */ - @Test - public void initPermnissionsForNewHoldContainer() - { - // setup permissions for parent - setupPermissions(filePlan); - - // setup permissions for record - filePlanPermissionService.setupPermissions(filePlan, holdContainer); - - // verify permissions are set-up correctly - verifyInitPermissions(filePlan, holdContainer, times(1), times(1), false, true); - } - - /** - * Test setup of permissions for new hold - */ - @Test - public void initPermissionsForNewHold() - { - // setup permissions for parent - setupPermissions(holdContainer); - - // setup permissions for record - filePlanPermissionService.setupPermissions(holdContainer, hold); - - // verify permissions are set-up correctly - verifyInitPermissions(holdContainer, hold, never(), times(1), false, false); - - } - - /** - * Test setup of permissions for new unfiled container - */ - @Test - public void initPermissionsForNewUnfiledContainer() - { - // setup permissions for parent - setupPermissions(filePlan); - - // setup permissions for record - filePlanPermissionService.setupPermissions(filePlan, unfiledRecordContainer); - - // verify permissions are set-up correctly - verifyInitPermissions(filePlan, unfiledRecordContainer, times(1), times(1), false, false); - } - - /** - * Test setup of permissions for new unfiled record folder - */ - @Test - public void initPermissionsForNewUnfiledRecordFolder() - { - // setup permissions for parent - setupPermissions(unfiledRecordContainer); - - // setup permissions for record - filePlanPermissionService.setupPermissions(unfiledRecordContainer, unfiledRecordFolder); - - // verify permissions are set-up correctly - verifyInitPermissions(unfiledRecordContainer, unfiledRecordFolder, never(), times(1), false, true); - - } - - /** - * Test setup of permissions for new unfiled record - */ - @Test - public void initPermissionsForNewUnfiledRecord() - { - // setup permissions for parent - setupPermissions(unfiledRecordFolder); - - // setup permissions for record - filePlanPermissionService.setupPermissions(unfiledRecordFolder, unfiledRecord); - - // verify permission init - verifyInitPermissions(unfiledRecordFolder, unfiledRecord, times(1), times(1), false, true); - - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessorUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessorUnitTest.java deleted file mode 100644 index 282423ad04..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessorUnitTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.security; - -import static java.util.Collections.emptyMap; - -import static org.junit.Assert.assertEquals; - -import java.util.Map; - -import com.google.common.collect.ImmutableMap; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.junit.Test; - -/** - * Unit tests for {@link RMMethodSecurityPostProcessor}. - * - * See RM-7119. - */ -public class RMMethodSecurityPostProcessorUnitTest -{ - /** The class under test. */ - private RMMethodSecurityPostProcessor rmMethodSecurityPostProcessor = new RMMethodSecurityPostProcessor(); - - @Test - public void testConvertToMap_emptyString() - { - Map actual = rmMethodSecurityPostProcessor.convertToMap(""); - assertEquals("Unexpectedly included empty string in output.", emptyMap(), actual); - } - - @Test - public void testConvertToMap_normalPairs() - { - Map actual = rmMethodSecurityPostProcessor.convertToMap("a=b\nc=d"); - assertEquals("Failed to handle multiline input string.", ImmutableMap.of("a", "b", "c", "d"), actual); - } - - @Test - public void testConvertToMap_stripWhitespace() - { - Map actual = rmMethodSecurityPostProcessor.convertToMap(" \n \t a=b \n \t "); - assertEquals("Failed to strip whitespace.", ImmutableMap.of("a", "b"), actual); - } - - @Test - public void testConvertToMap_ignoreBlankLine() - { - Map actual = rmMethodSecurityPostProcessor.convertToMap("a=b\n\nc=d"); - assertEquals("Failed to ignore blank line.", ImmutableMap.of("a", "b", "c", "d"), actual); - } - - @Test - public void testConvertToMap_multipleEquals() - { - Map actual = rmMethodSecurityPostProcessor.convertToMap("a=b=c\nd=e=f"); - assertEquals("Issue with handling of = symbol in value.", ImmutableMap.of("a", "b=c", "d", "e=f"), actual); - } - - /** Check that if a line is missing an equals sign then we get an exception. */ - @Test(expected = AlfrescoRuntimeException.class) - public void testConvertToMap_missingEquals() - { - rmMethodSecurityPostProcessor.convertToMap("a=b\ncd"); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java deleted file mode 100644 index 5a3b004c9a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test; - -import org.junit.extensions.cpsuite.ClasspathSuite; -import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters; -import org.junit.runner.RunWith; - -/** - * All unit test suite. - * - * @author Roy Wetherall - * @since 2.2 - */ -@RunWith(ClasspathSuite.class) -@ClassnameFilters({ - // Execute all test classes ending with "UnitTest" - ".*UnitTest" -}) -public class AllUnitTestSuite -{ -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java deleted file mode 100644 index 787072a541..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - -import java.util.UUID; - -import org.alfresco.model.ContentModel; -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.QName; -import org.alfresco.util.GUID; - -/** - * Utilities helpful when mocking Alfresco constructs. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class AlfMock -{ - /** - * Helper to generate random text value suitable for a property - * value or node name - */ - public static String generateText() - { - return UUID.randomUUID().toString(); - } - - /** - * Helper method to generate a qname. - */ - public static QName generateQName() - { - return generateQName(GUID.generate()); - } - - /** - * Helper method to generate a qname. - */ - public static QName generateQName(String uri) - { - return QName.createQName(uri, GUID.generate()); - } - - /** - * Helper method to generate a node reference. - * - * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store - */ - public static NodeRef generateNodeRef(NodeService mockedNodeService) - { - return generateNodeRef(mockedNodeService, 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 - */ - public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type) - { - return generateNodeRef(mockedNodeService, type, true); - } - - /** - * Helper method to generate a cm:content node reference with a given name. - * - * @param name content name - * @return NodeRef node reference - */ - public static NodeRef generateCmContent(NodeService mockedNodeService, String name) - { - NodeRef nodeRef = generateNodeRef(mockedNodeService, 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 - * the content type provided - */ - public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type, boolean exists) - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); - if (type != null) - { - when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); - } - return nodeRef; - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java deleted file mode 100644 index 0c231a23c5..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.mockito.Matchers.any; -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 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.NodeTypeUtility; -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.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; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.QNamePattern; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.GUID; -import org.alfresco.util.collections.CollectionUtils; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.ExpectedException; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.context.ApplicationContext; - -/** - * Base unit test. - *

- * 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 -{ - protected NodeRef filePlanComponent; - protected NodeRef filePlan; - - protected NodeRef recordFolder; - protected NodeRef record; - - /** core service mocks */ - @Mock(name="nodeService") protected NodeService mockedNodeService; - @Mock(name="dictionaryService") protected DictionaryService mockedDictionaryService; - @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; - @Mock(name="ruleService") protected RuleService mockedRuleService; - @Mock(name="versionService") protected VersionService mockedVersionService; - - /** rm service mocks */ - @Mock(name="filePlanService") protected FilePlanService mockedFilePlanService; - @Mock(name="recordFolderService") protected RecordFolderService mockedRecordFolderService; - @Mock(name="recordService") protected RecordService mockedRecordService; - @Mock(name="holdService") protected HoldService mockedHoldService; - @Mock(name="recordsManagementActionService") protected RecordsManagementActionService mockedRecordsManagementActionService; - @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; - - @Mock protected NodeTypeUtility mockedNodeTypeUtility; - - /** expected exception rule */ - @Rule - public ExpectedException exception = ExpectedException.none(); - - /** - * Test method setup - */ - @SuppressWarnings("unchecked") - @Before - public void before() throws Exception - { - MockitoAnnotations.initMocks(this); - - // setup application context - doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); - - // setup retrying transaction helper - Answer doInTransactionAnswer = new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; - return callback.execute(); - } - }; - doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class)); - - // setup mocked authentication util - MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); - - // 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(RM_URI), 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); - } - - /** - * Helper method to generate hold reference - * - * @param name hold name - * @return {@link NodeRef} node reference that will behave like a hold - */ - protected NodeRef generateHoldNodeRef(String name) - { - NodeRef hold = generateNodeRef(TYPE_HOLD); - doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME); - 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); - doReturn(true).when(mockedRecordFolderService).isRecordFolder(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(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) - { - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT); - doReturn(true).when(mockedFilePlanService).isFilePlanComponent(nodeRef); - doReturn(filePlan).when(mockedFilePlanService).getFilePlan(nodeRef); - doReturn(filePlan).when(mockedNodeService).getProperty(nodeRef, PROP_ROOT_NODEREF); - } - - /** - * 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 - */ - protected NodeRef generateNodeRef(QName type) - { - 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 - * the content type provided - */ - protected NodeRef generateNodeRef(QName type, boolean exists) - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); - if (type != null) - { - when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); - when(mockedNodeTypeUtility.instanceOf(type, type)).thenReturn(true); - } - 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)) - .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 - */ - protected void makeChildrenOf(NodeRef parent, NodeRef ... children) - { - List assocs = new ArrayList<>(children.length); - 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); - } - - @SuppressWarnings("unchecked") - protected List buildList(T ... values) - { - List result = new ArrayList<>(values.length); - for (T value : values) - { - result.add(value); - } - return result; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java deleted file mode 100644 index d9bbfa1de7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static java.util.Collections.emptyMap; - -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.io.StringWriter; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.repo.jscript.People; -import org.alfresco.repo.jscript.ScriptNode; -import org.json.JSONObject; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.extensions.surf.util.Content; -import org.springframework.extensions.webscripts.AbstractWebScript; -import org.springframework.extensions.webscripts.Container; -import org.springframework.extensions.webscripts.Description; -import org.springframework.extensions.webscripts.Description.RequiredCache; -import org.springframework.extensions.webscripts.DescriptionExtension; -import org.springframework.extensions.webscripts.FormatRegistry; -import org.springframework.extensions.webscripts.Match; -import org.springframework.extensions.webscripts.ScriptProcessorRegistry; -import org.springframework.extensions.webscripts.SearchPath; -import org.springframework.extensions.webscripts.TemplateProcessorRegistry; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; -import org.springframework.extensions.webscripts.json.JSONUtils; -import org.springframework.extensions.webscripts.processor.FTLTemplateProcessor; - -import freemarker.cache.ClassTemplateLoader; -import freemarker.cache.TemplateLoader; - -/** - * Base Web Script Unit Test. - *

- * Provides helper methods that mock the nessesery classes needed to execute - * a Java backed webscript that implements DeclarativeWebScript. - *

- * Note that execution of java script controllers is not currently supported. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseWebScriptUnitTest extends BaseUnitTest -{ - /** web script root folder for RM webscripts */ - protected static final String WEBSCRIPT_ROOT_RM = "alfresco/templates/webscripts/org/alfresco/rma/"; - - /** - * @return declarative webscript - */ - protected abstract AbstractWebScript getWebScript(); - - /** - * @return classpath location of webscript template - */ - protected abstract String getWebScriptTemplate(); - - /** - * Helper method to build a map of web script parameter values - * mimicking those provided on the URL - * - * @param values - * @return - */ - protected Map buildParameters(String ... values) - { - Map result = new HashMap<>(values.length / 2); - for (int i = 0; i < values.length; i=i+2) - { - String key = values[i]; - String value = values[i+1]; - result.put(key, value); - } - return result; - } - - /** - * - * @param parameters - * @return - * @throws Exception - */ - protected JSONObject executeJSONWebScript(Map parameters) throws Exception - { - return executeJSONWebScript(parameters, null); - } - - /** - * Execute web script and convert result into a JSON object. - * - * @param parameters map of all parameter values - * @return {@link JSONObject} result, parsed into a JSON object - */ - protected JSONObject executeJSONWebScript(Map parameters, String content) throws Exception - { - String result = executeWebScript(parameters, content); - return new JSONObject(result); - } - - /** - * - * @param parameters - * @return - * @throws Exception - */ - protected String executeWebScript(Map parameters) throws Exception - { - return executeWebScript(parameters, null); - } - - /** - * Execute web script and return result as a string. - * - * @param parameters map of all parameter values - * @return {@link String} result of web script - */ - protected String executeWebScript(Map parameters, String content) throws Exception - { - AbstractWebScript webScript = getWebScript(); - String template = getWebScriptTemplate(); - - // initialise webscript - webScript.init(getMockedContainer(template), getMockedDescription()); - - // execute webscript - WebScriptResponse mockedResponse = getMockedWebScriptResponse(); - webScript.execute(getMockedWebScriptRequest(webScript, parameters, content), mockedResponse); - - // return results - return mockedResponse.getWriter().toString(); - } - - /** - * Helper method to get the mocked web script request. - * - * @param webScript declarative web script - * @param parameters web script parameter values - * @return {@link WebScriptRequest} mocked web script request - */ - @SuppressWarnings("rawtypes") - protected WebScriptRequest getMockedWebScriptRequest(AbstractWebScript webScript, final Map parameters, String content) throws Exception - { - Match match = new Match(null, parameters, null, webScript); - org.springframework.extensions.webscripts.Runtime mockedRuntime = mock(org.springframework.extensions.webscripts.Runtime.class); - - WebScriptRequest mockedRequest = mock(WebScriptRequest.class); - doReturn(match).when(mockedRequest).getServiceMatch(); - doReturn(mockedRuntime).when(mockedRequest).getRuntime(); - - if (content != null && !content.isEmpty()) - { - Content mockedContent = mock(Content.class); - doReturn(content).when(mockedContent).getContent(); - doReturn(mockedContent).when(mockedRequest).getContent(); - } - - String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]); - doReturn(paramNames).when(mockedRequest).getParameterNames(); - doAnswer(new Answer() - { - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - String paramName = (String)invocation.getArguments()[0]; - return parameters.get(paramName); - } - - }).when(mockedRequest).getParameter(anyString()); - - doReturn(new String[0]).when(mockedRequest).getHeaderNames(); - doReturn("json").when(mockedRequest).getFormat(); - - return mockedRequest; - } - - /** - * Helper method to get mocked web script response - * - * @return {@link WebScriptResponse} mocked web script response - */ - protected WebScriptResponse getMockedWebScriptResponse() throws Exception - { - WebScriptResponse mockedResponse = mock(WebScriptResponse.class); - StringWriter writer = new StringWriter(); - doReturn(writer).when(mockedResponse).getWriter(); - return mockedResponse; - } - - /** - * Helper method to get mocked container object. - * - * @param template classpath location of webscripts ftl template - * @return {@link Container} mocked container - */ - protected Container getMockedContainer(String template) throws Exception - { - FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class); - doReturn("application/json").when(mockedFormatRegistry).getMimeType(anyString(), anyString()); - - ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class); - doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString()); - - TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class); - doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString()); - - FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor() - { - @Override - protected TemplateLoader getTemplateLoader() - { - return new ClassTemplateLoader(getClass(), "/"); - } - }; - ftlTemplateProcessor.init(); - - doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString()); - - Container mockedContainer = mock(Container.class); - doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry(); - doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry(); - doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry(); - - Map containerTemplateParameters = new HashMap<>(5); - containerTemplateParameters.put("jsonUtils", new JSONUtils()); - containerTemplateParameters.put("people", getMockedPeopleObject()); - doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters(); - - SearchPath mockedSearchPath = mock(SearchPath.class); - doReturn(false).when(mockedSearchPath).hasDocument(anyString()); - doReturn(mockedSearchPath).when(mockedContainer).getSearchPath(); - - // setup description - Description mockDescription = mock(Description.class); - doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache(); - - return mockedContainer; - } - - /** - * Creates a mock {@code people} object for use as a root object within FTL. - * This {@code people} object will return person nodes as specified in {@link #getMockedPeople()}. - */ - protected People getMockedPeopleObject() - { - People p = mock(People.class); - getMockedPeople().forEach((name, person) -> when(p.getPerson(eq(name))).thenReturn(person) ); - return p; - } - - /** - * Creates a map of person ScriptNodes for use within FTL. - * The default implementation is an empty map, but this can be overridden by subclasses. - * @return a map of usernames to mocked ScriptNode objects representing person nodes. - */ - protected Map getMockedPeople() - { - return emptyMap(); - } - - /** - * Helper method to get mocked description class - * - * @return {@link DescriptionExtension} mocked description class - */ - protected Description getMockedDescription() - { - Description mockedDescription = mock(Description.class); - doReturn(mock(RequiredCache.class)).when(mockedDescription).getRequiredCache(); - return mockedDescription; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseYamlUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseYamlUnitTest.java deleted file mode 100644 index a61e7bfda3..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseYamlUnitTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.github.fge.jackson.JsonLoader; -import com.github.fge.jsonschema.core.exceptions.ProcessingException; -import com.github.fge.jsonschema.core.report.ProcessingMessage; -import com.github.fge.jsonschema.core.report.ProcessingReport; -import com.github.fge.jsonschema.main.JsonSchema; -import com.github.fge.jsonschema.main.JsonSchemaFactory; - -import io.swagger.models.Swagger; -import io.swagger.parser.SwaggerParser; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.io.filefilter.WildcardFileFilter; - -/** - * Base class for unit tests for Yaml files. - * - * @author Sara Aspery - * @since 2.6 - */ -public class BaseYamlUnitTest -{ - private static String SWAGGER_2_SCHEMA_LOCATION = "/rest/schema.json"; - private static String OPEN_API_SPECIFICATION = "2.0"; - - /** - * Helper method to obtain path names for all yaml files found on the given path - */ - protected Set getYamlFilesList(String pathName) throws Exception - { - Set yamlFilePathNames = new HashSet<>(); - File directory = new File(pathName); - Collection yamlFiles = FileUtils.listFiles(directory, new WildcardFileFilter("*.yaml"), null); - for (File file : yamlFiles) { - yamlFilePathNames.add(file.getCanonicalPath()); - } - return yamlFilePathNames; - } - - /** - * Helper method to validate that all given yaml files are valid readable Swagger format - */ - protected void validateYamlFiles(final Set yamlFileNames) throws ProcessingException, IOException - { - assertFalse("Expected at least 1 yaml file to validate", yamlFileNames.isEmpty()); - - final JsonSchema swaggerSchema = getSwaggerSchema(SWAGGER_2_SCHEMA_LOCATION); - assertNotNull("Failed to obtain the Swagger schema", swaggerSchema); - - for (String yamlFilePath : yamlFileNames) - { - try - { - // check the yaml file is valid against Swagger JSON schema - assertTrue("Yaml file is not valid Swagger " + OPEN_API_SPECIFICATION + ": " + yamlFilePath, - validateYamlFile(yamlFilePath, swaggerSchema)); - - // check can read the swagger object to obtain the swagger version - Swagger swagger = new SwaggerParser().read(yamlFilePath); - assertEquals("Failed to obtain Swagger version from yaml file " + yamlFilePath, - swagger.getSwagger(), OPEN_API_SPECIFICATION); - } - catch (ProcessingException ex) - { - // ensure the yaml filename is included in the message - String context = String.format(yamlFilePath + ": %n" + ex.getMessage()); - throw new ProcessingException(context) ; - } - } - } - - /** - * Helper method to read in the Swagger JSON schema file - */ - private JsonSchema getSwaggerSchema(final String schemaLocation) throws IOException, ProcessingException - { - JsonSchema swaggerSchema = null; - final InputStream in = this.getClass().getResourceAsStream(schemaLocation); - if (in != null) - { - final String swaggerSchemaAsString = IOUtils.toString(in); - final JsonNode schemaNode = JsonLoader.fromString(swaggerSchemaAsString); - final JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); - swaggerSchema = factory.getJsonSchema(schemaNode); - } - return swaggerSchema; - } - - /** - * Helper method to validate Yaml file against JSON schema - */ - private boolean validateYamlFile(final String yamlFilePath, final JsonSchema jsonSchema) throws IOException, ProcessingException - { - // Get yaml file as a string - final String yaml = new String(Files.readAllBytes(Paths.get(yamlFilePath))); - - // Convert yaml string to JSON string - final ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory()); - final Object obj = yamlReader.readValue(yaml, Object.class); - final ObjectMapper jsonWriter = new ObjectMapper(); - final String yamlAsJsonString = jsonWriter.writeValueAsString(obj); - - return validateJSON(yamlAsJsonString, jsonSchema); - } - - /** - * Helper method to validate JSON string against JSON schema - */ - private boolean validateJSON(final String jsonData, final JsonSchema schema) throws IOException, ProcessingException - { - final JsonNode dataNode = JsonLoader.fromString(jsonData); - final ProcessingReport report = schema.validate(dataNode); - boolean isOk = report.isSuccess(); - if (!isOk) - { - Iterator messages = report.iterator(); - if (messages.hasNext()) - { - throw new ProcessingException(messages.next().toString()); - } - } - return isOk; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java deleted file mode 100644 index 3383727d66..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import java.util.Optional; -import java.util.function.Supplier; - -/** - * Utility class to help with Java exceptions, particularly in test code. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class ExceptionUtils -{ - /** This represents a situation where a throwable of an unexpected type was thrown. */ - public static class UnexpectedThrowableException extends RuntimeException - { - /** serial version uid */ - private static final long serialVersionUID = 3900164716673246207L; - - private final Class expected; - private final Throwable actual; - - public UnexpectedThrowableException(Class expected, Throwable actual) - { - this.expected = expected; - this.actual = actual; - } - - public Class getExpected() { return this.expected; } - public Throwable getActual() { return this.actual; } - - @Override public String toString() - { - return String.join("", "Expected ", expected.getSimpleName(), " but ", - actual.getClass().getSimpleName(), " was thrown."); - } - } - - /** This represents a situation where an expected throwable was not thrown. */ - public static class MissingThrowableException extends RuntimeException - { - /** serial version uid */ - private static final long serialVersionUID = -988022536370047222L; - - private final Class expected; - - public MissingThrowableException(Class expected) - { - this.expected = expected; - } - - public Class getExpected() { return this.expected; } - @Override public String toString() - { - return String.join("", "Expected ", expected.getSimpleName(), " but nothing was thrown."); - } - } - - /** - * Utility method to help with expected exceptions (unchecked - see below) in test code. This can be used in place - * of {@code try/catch} blocks within test code and can sometimes make code more readable. - * A single expected exception would usually be let escape from the test method and be handled e.g. by JUnit's - * {@code @Test(expected="Exception.class")} pattern. - * However if you have multiple expected exceptions in a sequence, you need to either add a sequence of - * {@code try/catch} or use this method. Likewise if you need to make assertions about state within the expected - * exception, such as root cause or other internal state, this method will be useful. - *

- * Examples: - *

    - *
  • - * Calling a local method which throws a {@code RuntimeException}. (An expression lambda) - *
    -     * expectedException(RuntimeException.class, () -> badMethod() );
    -     *         
    - *
  • - *
  • - * Executing a block of code. (Requires return statement) - *
    -     * expectedException(RuntimeException.class, () -> {
    -     *   for (int i = 0; i < 10; i++) {
    -     *     goodMethod();
    -     *   }
    -     *   badMethod();
    -     *   return "result";
    -     * });
    -     *         
    - *
  • - *
  • - * Examining the expected exception e.g. to assert the root cause is correct. - *
    -     * UnsupportedOperationException e = expectedException(UnsupportedOperationException.class, () -> badMethod2() );
    -     * assertEquals(RuntimeException.class, e.getCause().getClass());
    -     *         
    - *
  • - *
  • - * Note that if your lambda expression returns 'void' then you cannot use an expression - * and must explicitly return null from a lambda block. - *
    -     * expectedException(Exception.class, () -> { methodReturningVoid(); return null; } );
    -     * expectedException(Exception.class, () -> { methodReturningVoid("parameter"); return null; } );
    -     *         
    - *
  • - *
- * - * A note on checked exceptions: currently this method does not provide any support for working around the normal - * integration of Java 8 lambdas and checked exceptions. If your {@code code} block must deal with checked exceptions, - * you must add {@code try}/{@code catch} blocks within your lambda which obviously makes this method less useful. - * This may change in the future. - * - * - * @param expected the class of the expected throwable (subtypes will also match). - * @param code a lambda containing the code block which should throw the expected throwable. - * @param the return type of the code block (which should not matter as it should not complete). - * @param the type of the expected throwable (subtypes will also match). - * @return the expected throwable object if it was thrown. - * @throws UnexpectedThrowableException if a non-matching throwable was thrown out of the code block. - * @throws MissingThrowableException if the expected throwable was not thrown out of the code block. - */ - @SuppressWarnings("unchecked") - public static T expectedException(final Class expected, final Supplier code) - { - // The code block may throw an exception or it may not. - Optional maybeThrownByCode; - - try - { - // evaluate the lambda - code.get(); - - // It didn't throw an exception. - maybeThrownByCode = Optional.empty(); - } - catch (Throwable t) - { - maybeThrownByCode = Optional.of(t); - } - - Throwable thrownByCode = maybeThrownByCode.orElseThrow(() -> new MissingThrowableException(expected)); - - if (expected.isAssignableFrom(thrownByCode.getClass())) - { - return (T)thrownByCode; - } - else - { - throw new UnexpectedThrowableException(expected, thrownByCode); - } - } - - /** - * Helper method to work around the difficulties of working with lambdas and checked exceptions. - * Use as follows: - *
-     *     expectedException(WebScriptException.class, () ->
-     *         // "Wash away" any checked exceptions in the inner code block.
-     *         smuggleCheckedExceptions( () -> methodThrowsException())
-     *     );
-     * 
- * @param code a block of code which is declared to throw a checked exception. - * @param the return type of the block of code. - * @param the type of the checked exception. - * @return the value returned by the block of code. - * @throws SmuggledException if the code block threw an exception of type T. - */ - public static R smuggleCheckedExceptions(final ThrowingSupplier code) - { - try - { - return code.get(); - } - catch (RuntimeException e) - { - throw e; - } - catch (Exception e) - { - throw new SmuggledException(e); - } - } - - /** - * Equivalent to `java.util.function.Supplier` but its method declares that it - * throws checked exceptions. - * - * @param The result type of this supplier. - * @param The exception type declared to be thrown by this supplier. - */ - @FunctionalInterface - public interface ThrowingSupplier - { - /** Gets the value */ - R get() throws T; - } - - /** - * A wrapper for checked exceptions so that they can be handled as unchecked exceptions, namely by not requiring - * try/catch blocks etc. - *

- * This type is expected to be most useful when handling Java 8 lambdas containing code which throws checked - * exceptions. - */ - public static class SmuggledException extends RuntimeException - { - private static final long serialVersionUID = -606404592461576013L; - private final Exception e; - - public SmuggledException(Exception e) - { - this.e = e; - } - - public Exception getCheckedException() - { - return this.e; - } - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java deleted file mode 100644 index c9eaf3d924..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException; -import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.smuggleCheckedExceptions; -import static org.junit.Assert.assertEquals; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.MissingThrowableException; -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.SmuggledException; -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.UnexpectedThrowableException; -import org.junit.Test; - -/** - * Unit tests showing usage of {@link ExceptionUtils}. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class ExceptionUtilsUsageExamplesUnitTest -{ - private String goodMethod() { return "hello"; } - - private String badMethod1() { throw new RuntimeException("Bad method"); } - - private String badMethod2() { throw new UnsupportedOperationException("Bad method", new RuntimeException("root cause")); } - - @Test public void swallowExpectedExceptions() - { - // Calling a local method. (An expression lambda) - expectedException(RuntimeException.class, () -> badMethod1() ); - - // Executing a block of code. (Requires return statement) - expectedException(RuntimeException.class, () -> - { - for (int i = 0; i < 10; i++) { - goodMethod(); - } - // Also works for subtypes of expected exception. - badMethod2(); - return null; - }); - } - - @Test public void examineTheExpectedException() - { - UnsupportedOperationException e = expectedException(UnsupportedOperationException.class, () -> badMethod2() ); - assertEquals(RuntimeException.class, e.getCause().getClass()); - } - - @Test(expected=MissingThrowableException.class) - public void expectedExceptionNotThrown() - { - expectedException(IOException.class, () -> - { - // Do nothing - return null; - }); - } - - @Test(expected=UnexpectedThrowableException.class) - public void unexpectedExceptionThrown() - { - expectedException(IOException.class, () -> - { - throw new UnsupportedOperationException(); - }); - } - - private void onlySideEffectsHere() { throw new IllegalStateException(); } - - private void onlySideEffectsHere(String s) { throw new IllegalStateException(); } - - // If you use lambdas that return void, then they cannot be lambda expressions. They must be blocks. - @Test public void usingVoidLambdas() - { - expectedException(IllegalStateException.class, () -> { - onlySideEffectsHere(); - return null; - }); - - expectedException(IllegalStateException.class, () -> { - onlySideEffectsHere("hello"); - return null; - }); - } - - // If you use lambdas that throw checked exceptions, the standard Java 8 types are insufficient. - @Test public void smuggleCheckedExceptionsShouldHideCheckedExceptionsInAnUncheckedException() - { - SmuggledException e = expectedException(SmuggledException.class, () -> smuggleCheckedExceptions(() -> methodThrowsException())); - - assertEquals(Exception.class, e.getCheckedException().getClass()); - assertEquals("Checked", e.getCheckedException().getMessage()); - } - - /** This method declares that it throws `java.lang.Exception`. */ - private Object methodThrowsException() throws Exception - { - throw new Exception("Checked"); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java deleted file mode 100644 index 2ffcb70352..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static java.util.Arrays.asList; -import static java.util.stream.Collectors.toList; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Stream; - -/** - * Utility class to help with Java 8 FP stuff. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class FPUtils -{ - /** - * This method is intended to work exactly like {@code java.util.Arrays.asList()} but it takes - * a vararg of {@code Supplier}s instead of actual objects. - * - * @param suppliers a vararg of {@link Supplier}s giving a sequence of values for the list. - * @param the type of elements in the list. - * @return the list with each element being the first retrieved from a {@code Supplier}. - */ - @SafeVarargs - public static List asListFrom(Supplier... suppliers) - { - if (suppliers == null || suppliers.length == 0) - { - return Collections.emptyList(); - } - else - { - return Stream.of(suppliers) - .map(s -> s.get()) - .collect(toList()); - } - } - - /** - * This method is intended to work exactly like {@link #asSet(Object[])}} but it takes - * a vararg of {@code Supplier}s instead of actual objects. - * - * @param suppliers a vararg of {@link Supplier}s giving a sequence of values for the set. - * @param the type of elements in the set. - * @return the set with each element being the first retrieved from a {@code Supplier} (duplicates removed). - */ - @SafeVarargs - public static Set asSetFrom(Supplier... suppliers) - { - List l = asListFrom(suppliers); - return new HashSet<>(l); - } - - /** - * This utility method converts a vararg of objects into a Set. - * - * @param objects the objects to be added to the set - * @return a Set of objects (any equal objects will of course not be duplicated) - */ - @SafeVarargs - public static Set asSet(T... objects) - { - return new HashSet<>(asList(objects)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java deleted file mode 100644 index e092b25d92..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asListFrom; -import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asSet; -import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asSetFrom; -import static org.junit.Assert.assertEquals; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.Test; - -/** - * Unit tests for {@link FPUtils}. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class FPUtilsUnitTest -{ - @Test public void asListShouldProduceList() - { - List l = asListFrom(() -> "hello", - () -> "world", - () -> { - String s1 = "abc"; - String s2 = "xyz"; - return s1 + s2; - }); - assertEquals(asList("hello", "world", "abcxyz"), l); - } - - @Test public void asListShouldWorkForEmptyVarArgs() - { - assertEquals(emptyList(), FPUtils.asListFrom()); - } - - @Test public void asSetShouldProduceSet() - { - assertEquals(new HashSet<>(asList("hello", "world")), - asSet("hello", "hello", "world")); - } - - @Test public void asSetFromShouldWork() - { - Set s = asSetFrom(() -> "hello", - () -> "hello", - () -> "world", - () -> { - String s1 = "wo"; - String s2 = "rld"; - return s1 + s2; - }); - assertEquals(new HashSet<>(asList("hello", "world")), s); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java deleted file mode 100644 index f8b4e3b2a0..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -/** - * A helper to initialise a mock {@link AuthenticationUtil}. - * - * @author tpage - */ -public class MockAuthenticationUtilHelper -{ - public static final String SYSTEM_USER = "system"; - public static final String ADMIN_USER = "admin"; - public static final String GUEST_USER = "guest"; - - /** - * Set up a Mockito mock AuthenticationUtil so that it executes all methods assuming the user has - * permissions. If the mock is asked for details about the user then it assumes the currently authenticated user is - * "admin". - * - * @param mockAuthenticationUtil The mock to initialise. - */ - public static void setup(AuthenticationUtil mockAuthenticationUtil) - { - setup(mockAuthenticationUtil, "admin"); - } - - /** - * Set up a Mockito mock AuthenticationUtil so that it executes all methods assuming the user has - * permissions. - * - * @param mockAuthenticationUtil The mock to initialise. - * @param fullyAuthenticatedUser The name of the user that last authenticated. - */ - @SuppressWarnings("unchecked") - public static void setup(AuthenticationUtil mockAuthenticationUtil, String fullyAuthenticatedUser) - { - reset(mockAuthenticationUtil); - - // 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(mockAuthenticationUtil). 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(mockAuthenticationUtil). runAs(any(RunAsWork.class), anyString()); - - when(mockAuthenticationUtil.getAdminUserName()).thenReturn(ADMIN_USER); - when(mockAuthenticationUtil.getFullyAuthenticatedUser()).thenReturn(fullyAuthenticatedUser); - when(mockAuthenticationUtil.getRunAsUser()).thenReturn(fullyAuthenticatedUser); - when(mockAuthenticationUtil.getSystemUserName()).thenReturn(SYSTEM_USER); - when(mockAuthenticationUtil.getGuestUserName()).thenReturn(GUEST_USER); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java deleted file mode 100644 index 0dc0d4eaef..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.junit.internal.matchers.TypeSafeMatcher; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Web script exception matcher. - *

- * Allows use to check whether the raised web script exception has the correct - * status number or not. - * - * @author Roy Wetherall - * @since 2.2 - */ -@SuppressWarnings("deprecation") -public class WebScriptExceptionMatcher extends TypeSafeMatcher -{ - /** - * Helper method to create a matcher for the file not found (404) - * exception status. - * - * @return {@link WebScriptExceptionMatcher} - */ - public static WebScriptExceptionMatcher fileNotFound() - { - return new WebScriptExceptionMatcher(Status.STATUS_NOT_FOUND); - } - - /** - * Helper method to create a matcher for the bad request status (400) - * exception status. - * - * @return {@link WebScriptExceptionMatcher} - */ - public static WebScriptExceptionMatcher badRequest() - { - return new WebScriptExceptionMatcher(Status.STATUS_BAD_REQUEST); - } - - /** expected status */ - public int expectedStatus; - - /** actual status */ - public int actualStatus; - - /** - * Constructor - * - * @param expectedStatus expected status - */ - public WebScriptExceptionMatcher(int expectedStatus) - { - this.expectedStatus = expectedStatus; - } - - /** - * Determines if the expected outcome matches the actual - * outcome. - * - * @return true if matches, false otherwise - */ - @Override - public boolean matchesSafely(WebScriptException exception) - { - actualStatus = exception.getStatus(); - return (actualStatus == expectedStatus); - } - - /** - * Describe unexpected outcome. - */ - @Override - public void describeTo(org.hamcrest.Description description) - { - description.appendValue(actualStatus) - .appendText(" was found instead of ") - .appendValue(expectedStatus); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/ContentBinDuplicationUtilityUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/ContentBinDuplicationUtilityUnitTest.java deleted file mode 100644 index 5e2674dacb..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/ContentBinDuplicationUtilityUnitTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_ARCHIVED; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.repo.policy.BehaviourFilter; -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.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Test class for the ContentBinDuplicationUtility - * @author Ross Gale - * @since 2.7.2 - */ -public class ContentBinDuplicationUtilityUnitTest -{ - private final static NodeRef NODE_REF = new NodeRef("some://test/noderef"); - private final static NodeRef NODE_REF2 = new NodeRef("some://test/anothernoderef"); - private final static String CONTENT_URL = "someContentUrl"; - - @Mock - private ContentService mockContentService; - - @Mock - private BehaviourFilter mockBehaviourFilter; - - @Mock - private ContentReader mockContentReader; - - @Mock - private ContentWriter mockContentWriter; - @Mock - private NodeService mockNodeService; - - @Mock - private RecordsManagementQueryDAO recordsManagementQueryDAO; - - @InjectMocks - private ContentBinDuplicationUtility contentBinDuplicationUtility; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - } - - /** - * Tests that the requests are made to disable and re-enable the audit and versioning and to update the content bin - */ - @Test - public void testContentUrlIsUpdated() - { - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(mockContentReader); - when(mockContentService.getWriter(NODE_REF, ContentModel.PROP_CONTENT, true)).thenReturn(mockContentWriter); - contentBinDuplicationUtility.duplicate(NODE_REF); - verify(mockContentWriter, times(1)).putContent(mockContentReader); - checkBehaviours(1); - } - - /** - * Test content duplication doesn't happen when node has no content - */ - @Test - public void testDuplicationDoesntHappenWithNoContent() - { - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(null); - contentBinDuplicationUtility.duplicate(NODE_REF); - verify(mockContentWriter, times(0)).putContent(mockContentReader); - checkBehaviours(1); - } - - /** - * This is testing the fix for RM-6788 where archived content couldn't be declared as a record - * This was caused by attempting to copy the bin file and updating the content url of the - * archived piece of content which failed as this is a protected property. This is done if - * the node is/has a copy but the same duplication already happens during archive. - */ - @Test - public void testBinFileNotDuplicatedForArchivedContent() - { - NodeRef nodeRef = new NodeRef("some://test/noderef"); - when(mockNodeService.hasAspect(nodeRef, ASPECT_ARCHIVED)).thenReturn(true); - contentBinDuplicationUtility.duplicate(nodeRef); - verify(mockContentReader, times(0)).getReader(); - checkBehaviours(0); - } - /** - * Test hasAtLeastOneOtherReference returns true when node has another reference to it - */ - @Test - public void testHasAtLeastOneOtherReference() - { - Set multipleReferences = new HashSet<>(); - Collections.addAll(multipleReferences, NODE_REF, NODE_REF2); - - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(mockContentReader); - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT).getContentUrl()).thenReturn(CONTENT_URL); - when(recordsManagementQueryDAO.getNodeRefsWhichReferenceContentUrl(CONTENT_URL)).thenReturn(multipleReferences); - - assertTrue(contentBinDuplicationUtility.hasAtLeastOneOtherReference(NODE_REF)); - } - - /** - * Test hasAtLeastOneOtherReference returns false when node has no other reference to it other than its own content ref - */ - @Test - public void testHasNoOtherReference() - { - Set singleReference = Collections.singleton(NODE_REF); - - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(mockContentReader); - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT).getContentUrl()).thenReturn(CONTENT_URL); - when(recordsManagementQueryDAO.getNodeRefsWhichReferenceContentUrl(CONTENT_URL)).thenReturn(singleReference); - - assertFalse(contentBinDuplicationUtility.hasAtLeastOneOtherReference(NODE_REF)); - } - - /** - * Test hasAtLeastOneOtherReference returns false when node has no references to it at all - */ - @Test - public void testHasNoReferences() - { - Set noReferences = Collections. emptySet(); - - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT)).thenReturn(mockContentReader); - when(mockContentService.getReader(NODE_REF, ContentModel.PROP_CONTENT).getContentUrl()).thenReturn(CONTENT_URL); - when(recordsManagementQueryDAO.getNodeRefsWhichReferenceContentUrl(CONTENT_URL)).thenReturn(noReferences); - - assertFalse(contentBinDuplicationUtility.hasAtLeastOneOtherReference(NODE_REF)); - } - - /** - * Check that the behaviours are disabled and re-enabled the correct number of times - * @param times the times the behaviours should be called - */ - private void checkBehaviours(int times) - { - verify(mockBehaviourFilter, times(times)).disableBehaviour(); - verify(mockBehaviourFilter, times(times)).enableBehaviour(); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/NodeTypeUtilityUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/NodeTypeUtilityUnitTest.java deleted file mode 100644 index 8cba6ca27d..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/NodeTypeUtilityUnitTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit test class for NodeTypeUtility - * - * @author Claudia Agache - * @since 3.2 - */ -public class NodeTypeUtilityUnitTest -{ - @InjectMocks - private NodeTypeUtility nodeTypeUtility; - - @Mock - private DictionaryService mockedDictionaryService; - - private QName type, ofType; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - type = AlfMock.generateQName(); - ofType = AlfMock.generateQName(); - } - - /** test that instanceOf returns false if verified type is not subtype of the other */ - @Test - public void testNotInstanceOf() - { - when(mockedDictionaryService.isSubClass(type, ofType)).thenReturn(false); - assertFalse(nodeTypeUtility.instanceOf(type, ofType)); - } - - /** test that instanceOf returns true if verified type is subtype of the other */ - @Test - public void testIsInstanceOf() - { - when(mockedDictionaryService.isSubClass(type, ofType)).thenReturn(true); - assertTrue(nodeTypeUtility.instanceOf(type, ofType)); - } - - /** test that instanceOf checks the cache when verifying the same type twice */ - @Test - public void testInstanceOfCacheSameTypes() - { - nodeTypeUtility.instanceOf(type, ofType); - nodeTypeUtility.instanceOf(type, ofType); - verify(mockedDictionaryService, times(1)).isSubClass(any(), any()); - } - - /** test the invocations when verifying different types */ - @Test - public void testInstanceOfDifferentTypes() - { - QName anotherType = AlfMock.generateQName(); - nodeTypeUtility.instanceOf(type, ofType); - nodeTypeUtility.instanceOf(anotherType, ofType); - verify(mockedDictionaryService, times(2)).isSubClass(any(), any()); - } - - /** test that instanceOf returns true if verified type is equal to the other */ - @Test - public void testTypesAreEqual() - { - assertTrue(nodeTypeUtility.instanceOf(type, type)); - verify(mockedDictionaryService, times(0)).isSubClass(any(), any()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java deleted file mode 100644 index 279edd18af..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/PropertyModificationAllowedCheckUnitTest.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - - -import static junit.framework.TestCase.assertFalse; -import static junit.framework.TestCase.assertTrue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit test class for PropertyModificationAllowedCheck - * - * @author Ross Gale - * @since 3.2 - */ -public class PropertyModificationAllowedCheckUnitTest -{ - - private PropertyModificationAllowedCheck propertyModificationAllowedCheck; - - private Map before, after; - - private QName qName, qName2; - - private List list; - private List editableURIs; - - @Mock - private Serializable serializable, serializable2; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - propertyModificationAllowedCheck = new PropertyModificationAllowedCheck(); - before = new HashMap(); - after = new HashMap(); - qName = QName.createQName("foo", "bar"); - qName2 = QName.createQName("bar", "foo"); - before.put(qName, serializable); - after.put(qName, serializable2); - list = new ArrayList(); - editableURIs = new ArrayList<>(); - propertyModificationAllowedCheck.setWhiteList(list); - propertyModificationAllowedCheck.setEditableURIs(editableURIs); - } - - /** - * Test modification check passes when property is in whitelist - */ - @Test - public void testCheckMethodReturnsTrueWhenPropertyInList() - { - list.add(qName); - propertyModificationAllowedCheck.setWhiteList(list); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check fails when property is not in whitelist - */ - @Test - public void testCheckMethodReturnsFalseIfAnyNonAllowedPropertyInListIsChanged() - { - list.add(qName); - before.put(qName2, serializable2); - after.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check fails when first property is not in whitelist - */ - @Test - public void testCheckMethodReturnsFalseIfFirstPropertyInListIsChangedWithoutWhitelist() - { - list.add(qName2); - before.put(qName2, serializable2); - after.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check passes when all properties are in whitelist - */ - @Test - public void testCheckMethodReturnsTrueIfAllEditedPropertiesInWhitelist() - { - list.add(qName); - list.add(qName2); - before.put(qName2, serializable2); - after.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check fails when property added - */ - @Test - public void testCheckMethodReturnsFalseIfPropertyNotInBeforeList() - { - list.add(qName); - after.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check passes when allowed property added - */ - @Test - public void testCheckMethodReturnsTrueIfAllowedPropertyNotInBeforeList() - { - list.add(qName2); - after.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check fails when property removed - */ - @Test - public void testCheckMethodReturnsFalseIfPropertyNotInAfterList() - { - list.add(qName); - before.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check passes when allowed property removed - */ - @Test - public void testCheckMethodReturnsTrueIfAllowedPropertyNotInAfterList() - { - list.add(qName); - list.add(qName2); - before.put(qName2, serializable); - propertyModificationAllowedCheck.setWhiteList(list); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check for empty property in before map without whitelist - */ - @Test - public void testNullValueInBeforeList() - { - before.put(qName, null); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check for empty property in after map without whitelist - */ - @Test - public void testNullValueInAfterList() - { - after.put(qName, null); - propertyModificationAllowedCheck.setWhiteList(list); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check for empty property in before map with whitelist - */ - @Test - public void testNullValueInBeforeListWithAllowedProperty() - { - list.add(qName); - before.put(qName, null); - propertyModificationAllowedCheck.setWhiteList(list); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check for empty property in after list with whitelist - */ - @Test - public void testNullValueInAfterListWithAllowedProperty() - { - list.add(qName); - after.put(qName, null); - propertyModificationAllowedCheck.setWhiteList(list); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test modification check for empty property in both maps - */ - @Test - public void testNullValueInBoth() - { - before.put(qName, null); - after.put(qName, null); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test update of a property from the model URI for which properties can be updated - */ - @Test - public void testUpdatePropertyFromAllowedModelURI() - { - editableURIs.add("foo"); - propertyModificationAllowedCheck.setEditableURIs(editableURIs); - assertTrue(propertyModificationAllowedCheck.check(before, after)); - } - - /** - * Test update of a property that is not in the model URI for which properties can be updated - */ - @Test - public void testUpdatePropertyFromNotAllowedModelURI() - { - editableURIs.add("bar"); - propertyModificationAllowedCheck.setEditableURIs(editableURIs); - assertFalse(propertyModificationAllowedCheck.check(before, after)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java deleted file mode 100644 index 20119899ce..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; - -import static com.google.common.collect.Sets.newHashSet; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.asSet; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.diffKey; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.head; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.tail; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.Difference; -import org.junit.Test; - -/** - * Unit tests for {@link RMCollectionUtils}. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class RMCollectionUtilsUnitTest -{ - @Test public void getDuplicateElements() - { - List l = asList("A", "B", "C", "B", "A"); - assertEquals("Failed to identify duplicate elements", asList("B", "A"), RMCollectionUtils.getDuplicateElements(l)); - - assertEquals(Collections.emptyList(), RMCollectionUtils.getDuplicateElements(asList("A", "B", "C"))); - } - - @Test public void compareMaps() - { - // Set up two maps to compare - final Map mapA = new HashMap<>(); - final Map mapB = new HashMap<>(); - - // Fill one map with numbers and their squares... - for (int i : asList(1, 2, 3, 4, 5)) - { - mapA.put(i, i*i); - } - - // ... the other one has the same entries... - mapB.putAll(mapA); - - // ... but with an addition, a deletion and a value change. - mapB.put(6, 36); - mapB.remove(1); - mapB.put(3, 100); - - // Now ensure that various changes are correctly identified - assertEquals(Difference.REMOVED, diffKey(mapA, mapB, 1)); - assertEquals(Difference.ADDED, diffKey(mapA, mapB, 6)); - assertEquals(Difference.UNCHANGED, diffKey(mapA, mapB, 2)); - assertEquals(Difference.UNCHANGED, diffKey(mapA, mapB, -1)); - assertEquals(Difference.CHANGED, diffKey(mapA, mapB, 3)); - } - - @Test public void tailsOfLists() - { - assertEquals(asList(2), tail(asList(1, 2))); - assertEquals(emptyList(), tail(asList(1))); - expectedException(UnsupportedOperationException.class, () -> tail(emptyList())); - } - - @Test public void headsOfLists() - { - assertEquals("a", head(asList("a", "b"))); - assertEquals("a", head(asList("a"))); - assertNull(head(emptyList())); - } - - @Test public void elementsAsSet() - { - assertEquals(newHashSet("hello", "world"), asSet("hello", "world")); - assertEquals(newHashSet(3, 7, 31, 127), asSet(3, 7, 31, 127)); - } - - @Test public void elementsAsSerializableList() - { - // If these lines compile, then we're good - Serializable s = RMCollectionUtils.>asSerializableList("one", "two", "three"); - List l = RMCollectionUtils.>asSerializableList("one", "two", "three"); - - assertEquals(s, l); - } - - @Test public void toImmutableSet_nullInput() - { - Set output = RMCollectionUtils.toImmutableSet(null); - assertNull("toImmutableSet should pass through with null.", output); - } - - @Test public void toImmutableSet_nullElement() - { - Set input = newHashSet("One", null, "Three"); - - // Call the method under test. - Set output = RMCollectionUtils.toImmutableSet(input); - - assertEquals("Unexpected handling of null input element", output, newHashSet("One", "Three")); - assertEquals("Input should not have been changed.", input, newHashSet("One", null, "Three")); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java deleted file mode 100644 index 495d23dba8..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.util; - -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils; -import org.junit.Test; - -/** - * Unit tests for the {@link RMParameter} utility class. - * - * @author tpage - */ -public class RMParameterCheckUnitTest -{ - @Test - public void checkNotBlank() - { - // Check that supplying null causes an exception. - ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { - RMParameterCheck.checkNotBlank("name", null); - return null; - }); - - // Check that supplying an empty string causes an exception. - ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { - RMParameterCheck.checkNotBlank("name", ""); - return null; - }); - - // Check that supplying a whitespace only string causes an exception. - ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { - RMParameterCheck.checkNotBlank("name", "\n\r \t"); - return null; - }); - - // Check that supplying a mainly whitespace string throws no exceptions. - RMParameterCheck.checkNotBlank("name", "\n\r *\t"); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImplUnitTest.java deleted file mode 100644 index ab7174790c..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImplUnitTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.context.ApplicationContext; - -/** - * Service Base unit test. - * - * @author Roxana Lucanu - * @since 2.4 - */ -public class ServiceBaseImplUnitTest -{ - @InjectMocks private ServiceBaseImpl serviceBase; - - @Mock (name = "nodeService") - private NodeService mockedNodeService; - @Mock (name = "transactionalResourceHelper") - private TransactionalResourceHelper mockedTransactionalResourceHelper; - @Mock (name = "applicationContext") - protected ApplicationContext mockedApplicationContext; - @Mock (name = "nodeTypeUtility") - protected NodeTypeUtility mockedNodeTypeUtility; - @Mock private Map mockedCache; - - /** - * Test method setup - */ - @Before - public void before() throws Exception - { - MockitoAnnotations.initMocks(this); - // setup application context - doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); - - } - - /** - * Given a node that is not a record - * When retrieving the file plan for it - * Then never put null in cache - */ - @Test - public void getFilePlan() - { - NodeRef nodeRef = new NodeRef("test://node/"); - - when(mockedNodeService.getType(nodeRef)) - .thenReturn(ContentModel.TYPE_CONTENT); - when(mockedNodeTypeUtility.instanceOf(ContentModel.TYPE_CONTENT, RecordsManagementModel.TYPE_FILE_PLAN)) - .thenReturn(false); - when(mockedTransactionalResourceHelper.getMap("rm.servicebase.getFilePlan")) - .thenReturn(mockedCache); - when(mockedCache.containsKey(nodeRef)).thenReturn(false); - - serviceBase.getFilePlan(nodeRef); - - verify(mockedCache, never()).put(nodeRef, null); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java deleted file mode 100644 index 8e400b0b2b..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.version; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -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.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.lock.LockService; -import org.alfresco.service.cmr.lock.LockStatus; -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.version.VersionService; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.extensions.webscripts.GUID; - -/** - * Extended versionable aspect unit test. - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class ExtendedVersionableAspectUnitTest implements RecordsManagementModel -{ - /** Transaction resource key */ - private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs"; - - /** test data */ - private NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private NodeRef anotherNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private QName oldType = QName.createQName(RM_URI, GUID.generate()); - private QName newType = QName.createQName(RM_URI, GUID.generate()); - - /** service mocks */ - private @Mock NodeService mockedNodeService; - private @Mock VersionService mockedVersionService; - private @Mock LockService mockedLockService; - private @Mock AlfrescoTransactionSupport mockedAlfrescoTransactionSupport; - private @Mock AuthenticationUtil mockedAuthenticationUtil; - - /** test instance of extended versionable aspect behaviour bean */ - private @InjectMocks ExtendedVersionableAspect extendedVersionableAspect; - - @SuppressWarnings("unchecked") - @Before - public void testSetup() - { - MockitoAnnotations.initMocks(this); - - // 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((RunAsWork) any(RunAsWork.class)); - } - - /** - * given that autoversion on type change is configured off - * when the type set behvaiour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void autoVersionOff() - { - // auto version off - extendedVersionableAspect.setAutoVersionOnTypeChange(false); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given the node doesn't exist - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeDoesNotExist() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does not exist - when(mockedNodeService.exists(nodeRef)) - .thenReturn(false); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node is locked - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeLocked() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.LOCKED); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node does not have the versionable aspect - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeIsNotVersionable() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node does not have the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(false); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).isLockedAndReadOnly(nodeRef); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node has the temporary aspect - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeIsTemporary() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node has the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(true); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).isLockedAndReadOnly(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node is already being versioned - * when the type set behvaiour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeIsBeingVersioned() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node does not have the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(false); - - // node is currently being processed for versioning - when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) - .thenReturn(Collections.singletonMap(nodeRef, nodeRef)); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).isLockedAndReadOnly(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node has the auto version property set to false - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void autoVersionFalse() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node does not have the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(false); - - // node is not being processed for versioning - when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) - .thenReturn(Collections.singletonMap(anotherNodeRef, anotherNodeRef)); - - // auto version false - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION)) - .thenReturn(Boolean.FALSE); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).isLockedAndReadOnly(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); - verify(mockedAlfrescoTransactionSupport).getResource(KEY_VERSIONED_NODEREFS); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that autoversion on type change is configured on - * and the node exists - * and the node is not locked - * and the node has the versionable aspect - * and the node doesn't have the temporary aspect - * and the node isn't already being versioned - * and the auto version property is true - * when the type set behavour is executed - * then a new version is created - */ - @SuppressWarnings("unchecked") - @Test - public void createVersion() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node does not have the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(false); - - // node is not being processed for versioning - when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) - .thenReturn(new HashMap<>(Collections.singletonMap(anotherNodeRef, anotherNodeRef))); - - // auto version false - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION)) - .thenReturn(Boolean.TRUE); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).isLockedAndReadOnly(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); - verify(mockedAlfrescoTransactionSupport, times(2)).getResource(KEY_VERSIONED_NODEREFS); - verify(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); - - // assert the version was not created - verify(mockedVersionService).createVersion(eq(nodeRef), any(Map.class)); - } - -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java deleted file mode 100644 index 07de63a294..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java +++ /dev/null @@ -1,670 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.version; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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 static org.mockito.Mockito.when; - -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); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(true); - 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)); - } - - - /** - * given the destroyed prop isn't set - * when I ask if the version is destroyed - * then the result is false - */ - @Test - public void propNotSetVersionNotDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - // set prop not set - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) - .thenReturn(null); - - // is version destroyed - assertFalse(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); - } - - /** - * given the destroyed prop is set - * when I ask if the version is destroyed - * then the result matches the value set in the destroy property - */ - @Test - public void propSetVersionDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - // set prop - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) - .thenReturn(Boolean.TRUE); - - // is version destroyed - assertTrue(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); - - // set prop - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) - .thenReturn(Boolean.FALSE); - - // is version destroyed - assertFalse(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); - } - - /** - * given that the version node doesn't have the recorded version aspect applied - * when I mark the version as destroyed - * then nothing happens - */ - @Test - public void noAspectMarkAsDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - // indicate that the version doesn't have the aspect - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(false); - - // mark as destroyed - recordableVersionService.destroyRecordedVersion(mockedVersion); - - // verify nothing happened - verify(mockedDbNodeService, never()) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); - } - - /** - * given that the version node ref has the recorded version aspect applied - * and the record version reference exists - * when I mark the version as destroyed - * then the version is marked as destroyed - */ - @Test - public void markAsDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - NodeRef versionRecordNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - when(mockedDbNodeService.exists(versionRecordNodeRef)) - .thenReturn(true); - - // indicate that the version doesn't have the aspect - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(true); - - // indicate that the associated version record exists - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF)) - .thenReturn(versionRecordNodeRef); - - // mark as destroyed - recordableVersionService.destroyRecordedVersion(mockedVersion); - - // verify that the version was marked as destroyed - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); - // and the reference to the version record was cleared - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); - } - - /** - * given that the version node ref has the recorded version aspect applied - * and the associated version record has been deleted - * when I mark the version as destroyed - * then the version is marked as destroyed - * and the reference to the deleted version record is removed - */ - @Test - public void markAsDestroyedClearNodeRef() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - NodeRef versionRecordNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - when(mockedDbNodeService.exists(versionRecordNodeRef)) - .thenReturn(false); - - // indicate that the version doesn't have the aspect - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(true); - - // indicate that the associated version record exists - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF)) - .thenReturn(versionRecordNodeRef); - - // mark as destroyed - recordableVersionService.destroyRecordedVersion(mockedVersion); - - // verify that the version was marked as destroyed - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); - // and the reference to the version record was cleared - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java deleted file mode 100644 index 8296a07fa6..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.module.org_alfresco_module_rm.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"; - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedActionUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedActionUnitTest.java deleted file mode 100644 index 55c5f20234..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedActionUnitTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.module.org_alfresco_module_rm.vital; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.dictionary.types.period.Days; -import org.alfresco.repo.dictionary.types.period.Immediately; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Date; - -import static org.mockito.Mockito.verify; - -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.repository.StoreRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.extensions.webscripts.GUID; - -/** - * Unit test for {@link ReviewedAction} class - * - * @author Ana Bozianu - * @sincev 2.6 - */ -public class ReviewedActionUnitTest implements RecordsManagementModel -{ - private @Mock VitalRecordService mockedVitalRecordService; - private @Mock RecordService mockedRecordService; - private @Mock NodeService mockedNodeService; - - private @InjectMocks ReviewedAction reviewedAction; - - @Before - public void testSetup() - { - MockitoAnnotations.initMocks(this); - } - - /** - * Given a record having the vital record definition of immediately - * When I mark the record as reviewed - * Then review as of date is removed from the record - */ - @Test - public void testReviewRecordWithAdHocReviewPeriod() - { - /* - * Given - */ - NodeRef mockedRecord = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - when(mockedRecordService.isRecord(mockedRecord)).thenReturn(true); - - VitalRecordDefinition mockedVRDef = mock(VitalRecordDefinition.class); - when(mockedVRDef.isEnabled()).thenReturn(true); - when(mockedVitalRecordService.getVitalRecordDefinition(mockedRecord)).thenReturn(mockedVRDef); - - Period mockedReviewPeriod = mock(Period.class); - when(mockedReviewPeriod.getPeriodType()).thenReturn(Immediately.PERIOD_TYPE); - when(mockedVRDef.getReviewPeriod()).thenReturn(mockedReviewPeriod); - - /* - * When - */ - reviewedAction.executeImpl(null, mockedRecord); - - /* - * Then - */ - verify(mockedNodeService).removeProperty(mockedRecord, PROP_REVIEW_AS_OF); - } - - /** - * Given a record having a recurent vital record definition - * When I mark the record as reviewed - * Then the review as of date is updated according to the next review period computed by the vital record definition - */ - @Test - public void testReviewRecordWithRecurentReviewPeriod() - { - /* - * Given - */ - NodeRef mockedRecord = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - when(mockedRecordService.isRecord(mockedRecord)).thenReturn(true); - - VitalRecordDefinition mockedVRDef = mock(VitalRecordDefinition.class); - when(mockedVRDef.isEnabled()).thenReturn(true); - when(mockedVitalRecordService.getVitalRecordDefinition(mockedRecord)).thenReturn(mockedVRDef); - - Date mockedNextReviewDate = mock(Date.class); - when(mockedVRDef.getNextReviewDate()).thenReturn(mockedNextReviewDate); - - Period mockedReviewPeriod = mock(Period.class); - when(mockedReviewPeriod.getPeriodType()).thenReturn(Days.PERIOD_TYPE); - when(mockedVRDef.getReviewPeriod()).thenReturn(mockedReviewPeriod); - - /* - * When - */ - reviewedAction.executeImpl(null, mockedRecord); - - /* - * Then - */ - verify(mockedNodeService).setProperty(mockedRecord, PROP_REVIEW_AS_OF, mockedNextReviewDate); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java deleted file mode 100644 index e458dd379a..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.action.parameter; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.Before; -import org.junit.Test; - -/** - * Tests for the DateParameterProcessor - * - * @author Mark Hibbins - * @since 2.2 - */ -public class DateParameterProcessorUnitTest -{ - private DateParameterProcessor dateParameterProcessor; - - @Before - public void setUp() throws Exception - { - this.dateParameterProcessor = new DateParameterProcessor(); - this.dateParameterProcessor.setName("date"); - } - - @Test - public void testGetSubstitutionSuggestions_01() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("date"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertEquals(10, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_02() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("dat"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertEquals(10, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_03() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("at"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertEquals(10, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_05() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("ay"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertEquals(6, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_06() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("on"); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertTrue(suggestions.contains("date.year.long")); - assertTrue(suggestions.contains("date.day.month")); - assertEquals(7, suggestions.size()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java deleted file mode 100644 index 2f206ef778..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.repo.imap; - -import static org.mockito.Mockito.when; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.extensions.webscripts.GUID; - -/** - * Unit test for ExtendedImapServiceImpl - * @author Ana Bozianu - */ -public class ExtendedImapServiceImplUnitTest -{ - /* service mocks */ - private @Mock NodeService mockedNodeService; - private @Mock BehaviourFilter mockedPolicyBehaviourFilter; - private @Mock DictionaryService mockedDictionaryService; - private @Mock AuthenticationUtil mockedAuthenticationUtil; - - /* test instance of extended IMAP service implementation */ - private @InjectMocks ExtendedImapServiceImpl extendedImapServiceImpl; - - /* test data */ - private NodeRef rmSite = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private final String RM_SITE_NAME = "RM"; - private NodeRef rmFilePlan = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private final String RM_FILEPLAN_NAME = "fileplan"; - private NodeRef rmCategory = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private final String RM_CATEGORY_NAME = "C1"; - - @Before - public void setup() - { - MockitoAnnotations.initMocks(this); - // setup mocked authentication util - MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); - - // node names - when(mockedNodeService.getProperty(rmSite, ContentModel.PROP_NAME)).thenReturn(RM_SITE_NAME); - when(mockedNodeService.getProperty(rmCategory, ContentModel.PROP_NAME)).thenReturn(RM_CATEGORY_NAME); - when(mockedNodeService.getProperty(rmFilePlan, ContentModel.PROP_NAME)).thenReturn(RM_FILEPLAN_NAME); - - // node types - when(mockedNodeService.getType(rmSite)).thenReturn(RecordsManagementModel.TYPE_RM_SITE); - when(mockedNodeService.getType(rmFilePlan)).thenReturn(RecordsManagementModel.TYPE_FILE_PLAN); - when(mockedNodeService.getType(rmCategory)).thenReturn(RecordsManagementModel.TYPE_RECORD_CATEGORY); - - // type hierarchy - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RM_SITE, SiteModel.TYPE_SITE)).thenReturn(true); - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_FILE_PLAN, SiteModel.TYPE_SITE)).thenReturn(false); - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RECORD_CATEGORY, SiteModel.TYPE_SITE)).thenReturn(false); - - // node associations - ChildAssociationRef filePlanParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmSite, QName.createQName(GUID.generate()), rmFilePlan); - when(mockedNodeService.getPrimaryParent(rmFilePlan)).thenReturn(filePlanParentAssoc); - - ChildAssociationRef categoryParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmFilePlan, QName.createQName(GUID.generate()), rmCategory); - when(mockedNodeService.getPrimaryParent(rmCategory)).thenReturn(categoryParentAssoc); - } - - /** - * given the method is called on the rm site node - * check if the result is the site name - */ - @Test - public void testGetPathFromRMSite() - { - String rmSitePath = extendedImapServiceImpl.getPathFromSites(rmSite); - Assert.assertEquals("Incorrect return value", RM_SITE_NAME.toLowerCase(), rmSitePath); - } - - /** - * given the method is called on a rm category - * check if the result is the full path relative to the rm site - */ - @Test - public void testGetPathFromRMCategory() - { - String rmCategoryPath = extendedImapServiceImpl.getPathFromSites(rmCategory); - Assert.assertEquals("Incorrect return value", (RM_SITE_NAME + "/" + RM_FILEPLAN_NAME + "/" + RM_CATEGORY_NAME).toLowerCase(), rmCategoryPath); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java deleted file mode 100644 index 0a644f2977..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.security.permissions.impl; - -import static java.util.Arrays.asList; -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.util.Pair; -import org.apache.commons.lang3.StringUtils; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Extended permission service implementation unit test - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class ExtendedPermissionServiceImplUnitTest extends BaseUnitTest -{ - /** test data */ - private static final Long NODE_ACL_ID = 100l; - private static final Set READERS = Stream.of(generateText(), generateText()).collect(Collectors.toSet()); - private static final Set WRITERS = Stream.of(generateText(), generateText()).collect(Collectors.toSet()); - private static final String OWNER = generateText(); - - /** permission service impl, default */ - private @InjectMocks @Spy ExtendedPermissionServiceImpl extendedPermissionServiceImpl = new ExtendedPermissionServiceImpl() - { - protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; } - }; - - /** permission service impl instance extended for reader/writer tests */ - private @InjectMocks ExtendedPermissionServiceImpl extendedPermissionServiceImplWithReaderWritersSet = new ExtendedPermissionServiceImpl() - { - protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; } - - public java.util.Set getReaders(Long aclId) { return READERS; } - - public java.util.Set getWriters(Long aclId) { return WRITERS; } - }; - - /** mocks */ - private @Mock PermissionProcessorRegistry mockedPermissionProcessorRegistry; - private @Mock PermissionPreProcessor mockedPermissionPreProcessor; - private @Mock PermissionPostProcessor mockedPermissionPostProcessor; - - /** - * Given a permission pre-processor has been registered - * And does not DENY - * When hasPermission is called - * Then the pre-processor is executed - * And the ACL's are evaluated as normal - */ - @Test - public void preProcessorDoesNotDeny() - { - NodeRef nodeRef = generateCmContent("anyname"); - String perm = AlfMock.generateText(); - when(mockedPermissionProcessorRegistry.getPermissionPreProcessors()) - .thenReturn(asList(mockedPermissionPreProcessor)); - when(mockedPermissionPreProcessor.process(nodeRef, perm)) - .thenReturn(AccessStatus.UNDETERMINED); - - AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); - - assertEquals(AccessStatus.UNDETERMINED, result); - verify(mockedPermissionPreProcessor).process(nodeRef, perm); - verify(extendedPermissionServiceImpl).hasPermissionImpl(nodeRef, perm); - } - - /** - * Given a permission pre-processor has been registered - * And DENY's - * When hasPermission is called - * Then the pre-processor is executed - * And the remaining permission evaluations do not take place - */ - @Test - public void preProcessorDenys() - { - NodeRef nodeRef = generateCmContent("anyname"); - String perm = AlfMock.generateText(); - when(mockedPermissionProcessorRegistry.getPermissionPreProcessors()) - .thenReturn(asList(mockedPermissionPreProcessor)); - when(mockedPermissionPreProcessor.process(nodeRef, perm)) - .thenReturn(AccessStatus.DENIED); - - AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); - - assertEquals(AccessStatus.DENIED, result); - verify(mockedPermissionPreProcessor).process(nodeRef, perm); - verify(extendedPermissionServiceImpl, never()).hasPermissionImpl(nodeRef, perm); - } - - /** - * Given a permission post-processor has been registered - * When hasPermission is called - * Then the permission post-processor is called - */ - @Test - public void postProcessorRegistered() - { - NodeRef nodeRef = generateCmContent("anyname"); - String perm = AlfMock.generateText(); - List configuredReadPermissions = asList("ReadProperties", "ReadChildren"); - List configuredFilePermissions = asList("WriteProperties", "AddChildren"); - - extendedPermissionServiceImpl.setConfiguredReadPermissions("ReadProperties,ReadChildren"); - extendedPermissionServiceImpl.setConfiguredFilePermissions("WriteProperties,AddChildren"); - - when(mockedPermissionProcessorRegistry.getPermissionPostProcessors()) - .thenReturn(asList(mockedPermissionPostProcessor)); - when(mockedPermissionPostProcessor.process(AccessStatus.UNDETERMINED, nodeRef, perm, configuredReadPermissions, configuredFilePermissions)) - .thenReturn(AccessStatus.ALLOWED); - - AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); - - assertEquals(AccessStatus.ALLOWED, result); - verify(mockedPermissionPostProcessor).process(AccessStatus.UNDETERMINED, nodeRef, perm, configuredReadPermissions, configuredFilePermissions); - verify(extendedPermissionServiceImpl).hasPermissionImpl(nodeRef, perm); - } - - /** - * Given a node with no owner aspect - * When we ask for the readers and writers - * Then the owner isn't included in the result - */ - @Test - public void getReadersAndWritersForNodeWithNoOwnerAspect() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(false); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - assertEquals(WRITERS, result.getSecond()); - } - - /** - * Given a node with no owner set - * When we ask for the readers and writers - * Then the owner isn't included in the result - */ - @Test - public void getReadersAndWritersForNodeWithNoOwnerSet() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(true); - when(mockedOwnableService.getOwner(nodeRef)) - .thenReturn(StringUtils.EMPTY); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - assertEquals(WRITERS, result.getSecond()); - } - - /** - * Given a node with NO_OWNER value set - * When we ask for the readers and writers - * Then the owner isn't included in the result - */ - @Test - public void getReadersAndWritersForNodeWithNoOwnerValueSet() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(false); - when(mockedOwnableService.getOwner(nodeRef)) - .thenReturn(OwnableService.NO_OWNER); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - assertEquals(WRITERS, result.getSecond()); - } - - /** - * Given a node with an owner - * When we ask for the readers and writers - * Then the owner is included in the writers set - */ - @Test - public void getReadersAndWritersForNodeWithOwner() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(true); - when(mockedOwnableService.getOwner(nodeRef)) - .thenReturn(OWNER); - when(mockedAuthorityService.authorityExists(OWNER)) - .thenReturn(true); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - Set writersWithOwner = new HashSet<>(WRITERS); - writersWithOwner.add(OWNER); - assertEquals(writersWithOwner, result.getSecond()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/web/scripts/actions/RmActionDefinitionsGetUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/web/scripts/actions/RmActionDefinitionsGetUnitTest.java deleted file mode 100644 index f34a07f0fe..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/web/scripts/actions/RmActionDefinitionsGetUnitTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.repo.web.scripts.actions; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; -import org.alfresco.repo.action.ActionDefinitionImpl; -import org.alfresco.repo.web.scripts.rule.RmActionDefinitionsGet; -import org.alfresco.repo.web.scripts.rule.WhitelistedDMActions; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.action.ActionService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.extensions.webscripts.AbstractWebScript; - - -/** - * Unit test for {@link RmActionDefinitionsGet} that checks if the whitelisted actions for rm are available. - */ -public class RmActionDefinitionsGetUnitTest extends BaseWebScriptUnitTest -{ - @Mock - private RecordsManagementActionService mockedRecordsManagementActionService; - @Mock - private ActionService mockedExtendedActionService; - - @InjectMocks - private RmActionDefinitionsGet webScript; - - private List whitelistedActions = WhitelistedDMActions.getActionsList(); - - @Override - protected AbstractWebScript getWebScript() - { - return webScript; - } - - @Override - protected String getWebScriptTemplate() - { - return "alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl"; - } - - /** - * Before test - */ - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - webScript.setRecordsManagementActionService(mockedRecordsManagementActionService); - webScript.setExtendedActionService(mockedExtendedActionService); - } - - /** - * Given the extendedActionService contains all dm actions - * When retrieving RM Action Definitions - * Then the whitelisted dm actions are present in the response - */ - @Test - public void getRmActionDefinitionsWithWhitelistedDMActions() throws Exception - { - List dmActionDefinitions = new ArrayList<>(); - - for (String action : whitelistedActions) - { - dmActionDefinitions.add(new ActionDefinitionImpl(action)); - } - - when(mockedRecordsManagementActionService.getRecordsManagementActions()).thenReturn(Collections.emptyList()); - when(mockedExtendedActionService.getActionDefinitions()).thenReturn(dmActionDefinitions); - - String jsonResponse = executeWebScript(Collections.emptyMap()); - assertNotNull(jsonResponse); - - ObjectMapper mapper = new ObjectMapper(); - Map>> responseMap = mapper.readValue(jsonResponse, Map.class); - ArrayList> actionDefinitions = responseMap.get("data"); - - assertEquals(WhitelistedDMActions.getActionsList().size(), actionDefinitions.size()); - - for (LinkedHashMap actionDefinition : actionDefinitions) - { - assertTrue(whitelistedActions.contains(actionDefinition.get("name"))); - } - } - - /** - * Given the extendedActionService only contains non whitelisted actions - * When retrieving RM Action Definitions - * Then the response does not contain the non whitelisted actions - */ - @Test - public void getRmActionDefinitionsWithNonWhitelistedDMActions() throws Exception - { - String dmAction = "notWhitelisted"; - List dmActionDefinitions = Arrays.asList(new ActionDefinitionImpl(dmAction)); - when(mockedRecordsManagementActionService.getRecordsManagementActions()).thenReturn(Collections.emptyList()); - when(mockedExtendedActionService.getActionDefinitions()).thenReturn(dmActionDefinitions); - - String jsonResponse = executeWebScript(Collections.emptyMap()); - assertNotNull(jsonResponse); - - ObjectMapper mapper = new ObjectMapper(); - Map>> responseMap = mapper.readValue(jsonResponse, Map.class); - ArrayList> actionDefinitions = responseMap.get("data"); - - // Action definitions should only contain whitelisted DM actions and rm actions - assertFalse(actionDefinitions.contains(dmAction)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/web/scripts/roles/DynamicAuthoritiesGetUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/web/scripts/roles/DynamicAuthoritiesGetUnitTest.java deleted file mode 100644 index 7f0c280a36..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/web/scripts/roles/DynamicAuthoritiesGetUnitTest.java +++ /dev/null @@ -1,726 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.repo.web.scripts.roles; - -import static java.util.Collections.emptyMap; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -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.io.File; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.ImmutableMap; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.json.JSONObject; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.extensions.webscripts.AbstractWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * DynamicAuthoritiesGet Unit Test - * - * @author Silviu Dinuta - */ -@SuppressWarnings("deprecation") -public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest implements RecordsManagementModel -{ - /** test data */ - private static final Long ASPECT_ID = 123l; - private static final QName ASPECT = AlfMock.generateQName(); - - /** mocks */ - @Mock - private PatchDAO mockedPatchDAO; - @Mock - private NodeDAO mockedNodeDAO; - @Mock - private QNameDAO mockedQnameDAO; - @Mock - private NodeService mockedNodeService; - @Mock - private PermissionService mockedPermissionService; - @Mock - private ExtendedSecurityService mockedExtendedSecurityService; - @Mock - private TransactionService mockedTransactionService; - @Mock - private RetryingTransactionHelper mockedRetryingTransactionHelper; - @Mock - private ContentStreamer contentStreamer; - @Mock - private FileFolderService mockedFileFolderService; - - /** test component */ - @InjectMocks - private DynamicAuthoritiesGet webScript; - - @Override - protected AbstractWebScript getWebScript() - { - return webScript; - } - - @Override - protected String getWebScriptTemplate() - { - return "alfresco/templates/webscripts/org/alfresco/repository/roles/rm-dynamicauthorities.get.json.ftl"; - } - - /** - * Before test - */ - @SuppressWarnings("unchecked") - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - webScript.setNodeService(mockedNodeService); - webScript.setPermissionService(mockedPermissionService); - webScript.setExtendedSecurityService(mockedExtendedSecurityService); - webScript.setFileFolderService(mockedFileFolderService); - // setup retrying transaction helper - Answer doInTransactionAnswer = new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RetryingTransactionCallback callback = (RetryingTransactionCallback) invocation.getArguments()[0]; - return callback.execute(); - } - }; - - doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper) - . doInTransaction(any(RetryingTransactionCallback.class), anyBoolean(), anyBoolean()); - - when(mockedTransactionService.getRetryingTransactionHelper()).thenReturn(mockedRetryingTransactionHelper); - - // max node id - when(mockedPatchDAO.getMaxAdmNodeID()).thenReturn(500000L); - - // aspect - when(mockedQnameDAO.getQName(ASPECT_EXTENDED_SECURITY)).thenReturn(new Pair<>(ASPECT_ID, ASPECT)); - } - - /** - * Given that there are no nodes with the extended security aspect - * When the action is executed Nothing happens - * - * @throws Exception - */ - @SuppressWarnings({ "unchecked" }) - @Test - public void noNodesWithExtendedSecurity() throws Exception - { - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())) - .thenReturn(Collections.emptyList()); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "3"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - - // Check the JSON result using Jackson to allow easy equality testing. - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 0 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - - verify(mockedNodeService, never()).getProperty(any(NodeRef.class), eq(PROP_READERS)); - verify(mockedNodeService, never()).getProperty(any(NodeRef.class), eq(PROP_WRITERS)); - verify(mockedNodeService, never()).removeAspect(any(NodeRef.class), eq(ASPECT_EXTENDED_SECURITY)); - verify(mockedPermissionService, never()).clearPermission(any(NodeRef.class), - eq(ExtendedReaderDynamicAuthority.EXTENDED_READER)); - verify(mockedPermissionService, never()).clearPermission(any(NodeRef.class), - eq(ExtendedWriterDynamicAuthority.EXTENDED_WRITER)); - verify(mockedExtendedSecurityService, never()).set(any(NodeRef.class), any(Set.class), any(Set.class)); - } - - /** - * Given that there are records with the extended security aspect - * When the action is executed - * Then the aspect is removed - * And the dynamic authorities permissions are cleared - * And extended security is set via the updated API - * - * @throws Exception - */ - @SuppressWarnings("unchecked") - @Test - public void recordsWithExtendedSecurityAspect() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - }); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "4"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_READERS)); - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_WRITERS)); - verify(mockedNodeService, times(3)).removeAspect(any(NodeRef.class), eq(ASPECT_EXTENDED_SECURITY)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedReaderDynamicAuthority.EXTENDED_READER)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedWriterDynamicAuthority.EXTENDED_WRITER)); - verify(mockedExtendedSecurityService, times(3)).set(any(NodeRef.class), any(Set.class), any(Set.class)); - - } - - /** - * Given that there are non-records with the extended security aspect - * When the web script is executed - * Then the aspect is removed And the dynamic authorities permissions are cleared - * - * @throws Exception - */ - @SuppressWarnings("unchecked") - @Test - public void nonRecordsWithExtendedSecurityAspect() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(false); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - }); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "4"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - - - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_READERS)); - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_WRITERS)); - verify(mockedNodeService, times(3)).removeAspect(any(NodeRef.class), eq(ASPECT_EXTENDED_SECURITY)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedReaderDynamicAuthority.EXTENDED_READER)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedWriterDynamicAuthority.EXTENDED_WRITER)); - verify(mockedExtendedSecurityService, never()).set(any(NodeRef.class), any(Set.class), any(Set.class)); - } - - @Test - public void missingBatchSizeParameter() throws Exception - { - try - { - executeJSONWebScript(emptyMap()); - fail("Expected exception as parameter batchsize is mandatory."); - } - catch (WebScriptException e) - { - assertEquals("If parameter batchsize is not provided then 'Bad request' should be returned.", - Status.STATUS_BAD_REQUEST, e.getStatus()); - } - } - - @Test - public void invalidBatchSizeParameter() throws Exception - { - try - { - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "dd"); - executeJSONWebScript(parameters); - fail("Expected exception as parameter batchsize is invalid."); - } - catch (WebScriptException e) - { - assertEquals("If parameter batchsize is invalid then 'Bad request' should be returned.", - Status.STATUS_BAD_REQUEST, e.getStatus()); - } - } - - @Test - public void batchSizeShouldBeGraterThanZero() throws Exception - { - try - { - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "0"); - executeJSONWebScript(parameters); - fail("Expected exception as parameter batchsize is not a number greater than 0."); - } - catch (WebScriptException e) - { - assertEquals("If parameter batchsize is not a number greater than 0 then 'Bad request' should be returned.", - Status.STATUS_BAD_REQUEST, e.getStatus()); - } - } - - @Test - public void extendedSecurityAspectNotCreated() throws Exception - { - when(mockedQnameDAO.getQName(ASPECT_EXTENDED_SECURITY)).thenReturn(null); - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "3"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"There where no records to be processed.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - } - - @Test - public void processAllRecordsWhenMaxProcessedRecordsIsZero() throws Exception - { - List ids = Stream.of(1l, 2l, 3l,4l).collect(Collectors.toList()); - - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(false); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - }); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "0"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 4 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - } - - @Test - public void whenMaxProcessedRecordsIsMissingItDefaultsToBatchSize() throws Exception - { - List ids = Stream.of(1l, 2l, 3l, 4l, 5l).collect(Collectors.toList()); - - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(false); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - }); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "4"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed first 4 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test - public void recordsWithExtendedSecurityAspectAndNullWritersAndReaders() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)).thenReturn(null); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)).thenReturn(null); - - }); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "4"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - ArgumentCaptor readerKeysCaptor = ArgumentCaptor.forClass(Set.class); - ArgumentCaptor writersKeysCaptor = ArgumentCaptor.forClass(Set.class); - - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_READERS)); - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_WRITERS)); - verify(mockedNodeService, times(3)).removeAspect(any(NodeRef.class), eq(ASPECT_EXTENDED_SECURITY)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedReaderDynamicAuthority.EXTENDED_READER)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedWriterDynamicAuthority.EXTENDED_WRITER)); - verify(mockedExtendedSecurityService, times(3)).set(any(NodeRef.class), readerKeysCaptor.capture(), - writersKeysCaptor.capture()); - List allReaderKeySets = readerKeysCaptor.getAllValues(); - List allWritersKeySets = writersKeysCaptor.getAllValues(); - for (Set keySet : allReaderKeySets) - { - assertNull(keySet); - } - for (Set keySet : allWritersKeySets) - { - assertNull(keySet); - } - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test - public void recordsWithExtendedSecurityAspectAndNullWriters() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)).thenReturn(null); - - }); - - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "4"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - ArgumentCaptor readerKeysCaptor = ArgumentCaptor.forClass(Set.class); - ArgumentCaptor writersKeysCaptor = ArgumentCaptor.forClass(Set.class); - - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_READERS)); - verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_WRITERS)); - verify(mockedNodeService, times(3)).removeAspect(any(NodeRef.class), eq(ASPECT_EXTENDED_SECURITY)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedReaderDynamicAuthority.EXTENDED_READER)); - verify(mockedPermissionService, times(3)).clearPermission(any(NodeRef.class), - eq(ExtendedWriterDynamicAuthority.EXTENDED_WRITER)); - verify(mockedExtendedSecurityService, times(3)).set(any(NodeRef.class), readerKeysCaptor.capture(), - writersKeysCaptor.capture()); - List allReaderKeySets = readerKeysCaptor.getAllValues(); - List allWritersKeySets = writersKeysCaptor.getAllValues(); - for (Set keySet : allReaderKeySets) - { - assertNotNull(keySet); - } - for (Set keySet : allWritersKeySets) - { - assertNull(keySet); - } - } - - /** - * Given I have records that require migration - * And I am interested in knowning which records are migrated - * When I run the migration tool - * Then I will be returned a CSV file containing the name and node reference of the record migrated - * - * @throws Exception - */ - @SuppressWarnings("unchecked") - @Test - public void processWithCSVFile() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - String name = "name" + i; - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_NAME)).thenReturn((Serializable) name); - }); - - ArgumentCaptor csvFileCaptor = ArgumentCaptor.forClass(File.class); - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "4", "export", - "true"); - executeWebScript(parameters); - - verify(contentStreamer, times(1)).streamContent(any(WebScriptRequest.class), any(WebScriptResponse.class), - csvFileCaptor.capture(), any(Long.class), any(Boolean.class), any(String.class), any(Map.class)); - - File fileForDownload = csvFileCaptor.getValue(); - assertNotNull(fileForDownload); - } - - /** - * Given that I have record that require migration - * And I'm not interested in knowing which records were migrated - * When I run the migration tool - * Then I will not be returned a CSV file of details. - * - * @throws Exception - */ - @SuppressWarnings("unchecked") - @Test - public void processedWithouthCSVFile() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids) - .thenReturn(Collections.emptyList()); - - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeDAO.getNodePair(i)).thenReturn(new Pair<>(i, nodeRef)); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - }); - - Map parameters = ImmutableMap.of("batchsize", "10", "maxProcessedRecords", "4", "export", - "false"); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - - verify(contentStreamer, never()).streamContent(any(WebScriptRequest.class), any(WebScriptResponse.class), - any(File.class), any(Long.class), any(Boolean.class), any(String.class), any(Map.class)); - } - - @Test - public void invalidParentNodeRefParameter() throws Exception - { - try - { - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "parentNodeRef", "invalidNodeRef"); - executeJSONWebScript(parameters); - fail("Expected exception as parameter parentNodeRef is invalid."); - } - catch (WebScriptException e) - { - assertEquals("If parameter parentNodeRef is invalid then 'Internal server error' should be returned.", - Status.STATUS_INTERNAL_SERVER_ERROR, e.getStatus()); - } - } - - @Test - public void inexistentParentNodeRefParameter() throws Exception - { - try - { - NodeRef parentNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.exists(parentNodeRef)).thenReturn(false); - // Set up parameters. - Map parameters = ImmutableMap.of("batchsize", "10", "parentNodeRef", - parentNodeRef.toString()); - executeJSONWebScript(parameters); - fail("Expected exception as parameter parentNodeRef does not exist."); - } - catch (WebScriptException e) - { - assertEquals("If parameter parentNodeRef is does not exist then 'Bad Reequest' should be returned.", - Status.STATUS_BAD_REQUEST, e.getStatus()); - } - } - - @SuppressWarnings("unchecked") - @Test - public void processedWithParentNodeRef() throws Exception - { - List ids = Stream.of(1l, 2l, 3l).collect(Collectors.toList()); - NodeRef parentNodeRef = AlfMock.generateNodeRef(mockedNodeService); - List children = new ArrayList<>(); - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - when(mockedNodeService.hasAspect(nodeRef, ASPECT)).thenReturn(true); - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - String name = "name" + i; - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_NAME)).thenReturn((Serializable) name); - FileInfo mockedFileInfo = mock(FileInfo.class); - when(mockedFileInfo.getNodeRef()).thenReturn(nodeRef); - children.add(mockedFileInfo); - }); - when(mockedFileFolderService.search(eq(parentNodeRef), eq("*"), eq(true), eq(true), eq(true))) - .thenReturn(children); - - Map parameters = ImmutableMap.of("batchsize", "3", "maxProcessedRecords", "4", "export", - "false", "parentNodeRef", parentNodeRef.toString()); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - - verify(contentStreamer, never()).streamContent(any(WebScriptRequest.class), any(WebScriptResponse.class), - any(File.class), any(Long.class), any(Boolean.class), any(String.class), any(Map.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void processedWithParentNodeRefWithFirstTwoBatchesAlreadyProcessed() throws Exception - { - List ids = Stream.of(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l).collect(Collectors.toList()); - NodeRef parentNodeRef = AlfMock.generateNodeRef(mockedNodeService); - List children = new ArrayList<>(); - ids.stream().forEach((i) -> { - NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.hasAspect(nodeRef, ASPECT_RECORD)).thenReturn(true); - if (i <= 6l) - { - when(mockedNodeService.hasAspect(nodeRef, ASPECT)).thenReturn(false); - } - else - { - when(mockedNodeService.hasAspect(nodeRef, ASPECT)).thenReturn(true); - } - when(mockedNodeService.getProperty(nodeRef, PROP_READERS)) - .thenReturn((Serializable) Collections.emptyMap()); - when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS)) - .thenReturn((Serializable) Collections.emptyMap()); - String name = "name" + i; - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_NAME)).thenReturn((Serializable) name); - FileInfo mockedFileInfo = mock(FileInfo.class); - when(mockedFileInfo.getNodeRef()).thenReturn(nodeRef); - children.add(mockedFileInfo); - }); - when(mockedFileFolderService.search(eq(parentNodeRef), eq("*"), eq(true), eq(true), eq(true))) - .thenReturn(children); - - Map parameters = ImmutableMap.of("batchsize", "3", "parentNodeRef", parentNodeRef.toString()); - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - String actualJSONString = json.toString(); - ObjectMapper mapper = new ObjectMapper(); - String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 2 records.\"}"; - assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString)); - - verify(contentStreamer, never()).streamContent(any(WebScriptRequest.class), any(WebScriptResponse.class), - any(File.class), any(Long.class), any(Boolean.class), any(String.class), any(Map.class)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RMSitesImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RMSitesImplUnitTest.java deleted file mode 100644 index ca703a5dd9..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RMSitesImplUnitTest.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.impl; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -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 org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.rest.api.impl.SiteImportPackageHandler; -import org.alfresco.rest.api.model.Site; -import org.alfresco.rest.api.model.SiteUpdate; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.model.RMSite; -import org.alfresco.rm.rest.api.model.RMSiteCompliance; -import org.alfresco.service.cmr.favourites.FavouritesService; -import org.alfresco.service.cmr.repository.NodeRef; -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.view.ImporterBinding; -import org.alfresco.service.cmr.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit Test class for RMSitesImpl. - * - * @author Silviu Dinuta - * @since 2.6 - * - */ -public class RMSitesImplUnitTest extends BaseUnitTest -{ - private static final String RM_SITE_TITLE_AFTER_UPDATE = "Updated Title"; - private static final String RM_SITE_DESCRIPTION_AFTER_UPDATE = "Updated Description"; - private static final String RM_SITE_ID = "rm"; - private static final String RM_SITE_MANAGER_ROLE = "SiteManager"; - private static final String RM_SITE_TITLE = "RM Site Title"; - private static final String RM_SITE_DESCRIPTION = "RM Site Description"; - private static final String RM_SITE_PRESET = "rm-site-dashboard"; - private static final String PARAM_SKIP_ADDTOFAVORITES = "skipAddToFavorites"; - @InjectMocks - private RMSitesImpl rmSitesImpl; - @Mock - private SiteService mockedSiteService; - @Mock - AuthenticationUtil mockAuthenticationUtil; - @Mock - private ImporterService mockedImporterService; - @Mock - private FavouritesService mockedFavouritesService; - - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - } - - @Test - public void createRMStandardSite() throws Exception - { - RMSite toCreate = new RMSite(); - toCreate.setTitle(RM_SITE_TITLE); - toCreate.setDescription(RM_SITE_DESCRIPTION); - - //mocked SiteInfo - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedSiteInfo.getShortName()).thenReturn(RM_SITE_ID); - when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef); - when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION); - when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE); - when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC); - - when(mockedSiteService.createSite(any(String.class), any(String.class), any(String.class), any(String.class), any(SiteVisibility.class), any(QName.class))).thenReturn(mockedSiteInfo); - - //mock Parameters - Parameters mockedParameters = mock(Parameters.class); - //call createRMSite method - RMSite createdRMSite = rmSitesImpl.createRMSite(toCreate, mockedParameters); - - //check siteService.createSite parameters - ArgumentCaptor sitePresetCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor idCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor titleCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor descriptionCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor visibilityCaptor = ArgumentCaptor.forClass(SiteVisibility.class); - ArgumentCaptor siteTypeCaptor = ArgumentCaptor.forClass(QName.class); - verify(mockedSiteService, times(1)).createSite(sitePresetCaptor.capture(), idCaptor.capture(), titleCaptor.capture(), descriptionCaptor.capture(), visibilityCaptor.capture(), siteTypeCaptor.capture()); - assertEquals(RM_SITE_PRESET, sitePresetCaptor.getValue()); - assertEquals(RM_SITE_ID, idCaptor.getValue()); - assertEquals(RM_SITE_TITLE, titleCaptor.getValue()); - assertEquals(RM_SITE_DESCRIPTION, descriptionCaptor.getValue()); - assertEquals(SiteVisibility.PUBLIC, visibilityCaptor.getValue()); - assertEquals(RecordsManagementModel.TYPE_RM_SITE, siteTypeCaptor.getValue()); - - verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null)); - verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null); - verify(mockedFavouritesService, times(1)).addFavourite(any(String.class), any(NodeRef.class)); - - //verify returned values for RM site are the right ones - assertEquals(RMSiteCompliance.STANDARD, createdRMSite.getCompliance()); - assertEquals(null, createdRMSite.getRole()); - assertEquals(RM_SITE_ID, createdRMSite.getId()); - assertEquals(siteNodeRef.getId(), createdRMSite.getGuid()); - assertEquals(RM_SITE_DESCRIPTION, createdRMSite.getDescription()); - assertEquals(RM_SITE_TITLE, createdRMSite.getTitle()); - assertEquals(SiteVisibility.PUBLIC, createdRMSite.getVisibility()); - } - - @Test - public void createRMDOD5015Site() throws Exception - { - RMSite toCreate = new RMSite(); - toCreate.setTitle(RM_SITE_TITLE); - toCreate.setDescription(RM_SITE_DESCRIPTION); - toCreate.setCompliance(RMSiteCompliance.DOD5015); - - //mocked SiteInfo - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedSiteInfo.getShortName()).thenReturn(RM_SITE_ID); - when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef); - when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION); - when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE); - when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC); - - when(mockedSiteService.createSite(any(String.class), any(String.class), any(String.class), any(String.class), any(SiteVisibility.class), any(QName.class))).thenReturn(mockedSiteInfo); - - //mock Parameters - Parameters mockedParameters = mock(Parameters.class); - //call createRMSite method - RMSite createdRMSite = rmSitesImpl.createRMSite(toCreate, mockedParameters); - - //check siteService.createSite parameters - ArgumentCaptor sitePresetCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor idCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor titleCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor descriptionCaptor = ArgumentCaptor.forClass(String.class); - ArgumentCaptor visibilityCaptor = ArgumentCaptor.forClass(SiteVisibility.class); - ArgumentCaptor siteTypeCaptor = ArgumentCaptor.forClass(QName.class); - verify(mockedSiteService, times(1)).createSite(sitePresetCaptor.capture(), idCaptor.capture(), titleCaptor.capture(), descriptionCaptor.capture(), visibilityCaptor.capture(), siteTypeCaptor.capture()); - assertEquals(RM_SITE_PRESET, sitePresetCaptor.getValue()); - assertEquals(RM_SITE_ID, idCaptor.getValue()); - assertEquals(RM_SITE_TITLE, titleCaptor.getValue()); - assertEquals(RM_SITE_DESCRIPTION, descriptionCaptor.getValue()); - assertEquals(SiteVisibility.PUBLIC, visibilityCaptor.getValue()); - assertEquals(DOD5015Model.TYPE_DOD_5015_SITE, siteTypeCaptor.getValue()); - - verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null)); - verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null); - verify(mockedFavouritesService, times(1)).addFavourite(any(String.class), any(NodeRef.class)); - - //verify returned values for RM site are the right ones - assertEquals(RMSiteCompliance.DOD5015, createdRMSite.getCompliance()); - assertEquals(null, createdRMSite.getRole()); - assertEquals(RM_SITE_ID, createdRMSite.getId()); - assertEquals(siteNodeRef.getId(), createdRMSite.getGuid()); - assertEquals(RM_SITE_DESCRIPTION, createdRMSite.getDescription()); - assertEquals(RM_SITE_TITLE, createdRMSite.getTitle()); - assertEquals(SiteVisibility.PUBLIC, createdRMSite.getVisibility()); - } - - @Test - public void createRMSiteWithSkipAddToFavouritesParameter() throws Exception - { - RMSite toCreate = new RMSite(); - toCreate.setTitle(RM_SITE_TITLE); - toCreate.setDescription(RM_SITE_DESCRIPTION); - - //mocked SiteInfo - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedSiteInfo.getShortName()).thenReturn(RM_SITE_ID); - when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef); - when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION); - when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE); - when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC); - - when(mockedSiteService.createSite(any(String.class), any(String.class), any(String.class), any(String.class), any(SiteVisibility.class), any(QName.class))).thenReturn(mockedSiteInfo); - - //mock Parameters - Parameters mockedParameters = mock(Parameters.class); - when(mockedParameters.getParameter(PARAM_SKIP_ADDTOFAVORITES)).thenReturn(Boolean.toString(true)); - - //call createRMSite method - rmSitesImpl.createRMSite(toCreate, mockedParameters); - - verify(mockedSiteService, times(1)).createSite(RM_SITE_PRESET, RM_SITE_ID, RM_SITE_TITLE, RM_SITE_DESCRIPTION, SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE); - verify(mockedImporterService, times(1)).importView(any(SiteImportPackageHandler.class), any(Location.class), any(ImporterBinding.class), eq(null)); - verify(mockedSiteService, times(1)).createContainer(RM_SITE_ID, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null); - verify(mockedFavouritesService, never()).addFavourite(any(String.class), any(NodeRef.class)); - } - - @Test - public void updateRMSite() throws Exception - { - String siteId = RM_SITE_ID; - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService); - - //mock SiteInfo - when(mockedSiteInfo.getShortName()).thenReturn(siteId); - when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef); - when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION) - .thenReturn(RM_SITE_DESCRIPTION_AFTER_UPDATE); - when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE) - .thenReturn(RM_SITE_TITLE_AFTER_UPDATE); - when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC); - - when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE); - - when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo); - when(mockedSiteService.getMembersRole(eq(siteId), any(String.class))).thenReturn(RM_SITE_MANAGER_ROLE); - - //mock UpdateSite - SiteUpdate mockedSiteUpdate= mock(SiteUpdate.class); - when(mockedSiteUpdate.getDescription()).thenReturn(RM_SITE_DESCRIPTION_AFTER_UPDATE); - when(mockedSiteUpdate.getTitle()).thenReturn(RM_SITE_TITLE_AFTER_UPDATE); - when(mockedSiteUpdate.getVisibility()).thenReturn(null); - when(mockedSiteUpdate.wasSet(Site.TITLE)).thenReturn(true); - when(mockedSiteUpdate.wasSet(Site.DESCRIPTION)).thenReturn(true); - - //mock Parameters - Parameters mockedParameters = mock(Parameters.class); - - //call updateRMSite method - RMSite updatedRMSite = rmSitesImpl.updateRMSite(siteId, mockedSiteUpdate, mockedParameters); - - //check if the new title is set to siteInfo - ArgumentCaptor titleCaptor = ArgumentCaptor.forClass(String.class); - verify(mockedSiteInfo, times(1)).setTitle(titleCaptor.capture()); - assertEquals(RM_SITE_TITLE_AFTER_UPDATE, titleCaptor.getValue()); - - //check that new description is set to siteInfo - ArgumentCaptor descriptionCaptor = ArgumentCaptor.forClass(String.class); - verify(mockedSiteInfo, times(1)).setDescription(descriptionCaptor.capture()); - assertEquals(RM_SITE_DESCRIPTION_AFTER_UPDATE, descriptionCaptor.getValue()); - - //check that site visibility is not changed - verify(mockedSiteInfo, never()).setVisibility(any(SiteVisibility.class)); - - //check that updateSite is called - verify(mockedSiteService, times(1)).updateSite(any(SiteInfo.class)); - - //verify returned values for RM site are the right ones - assertEquals(RMSiteCompliance.STANDARD, updatedRMSite.getCompliance()); - assertEquals(RM_SITE_MANAGER_ROLE, updatedRMSite.getRole()); - assertEquals(siteId, updatedRMSite.getId()); - assertEquals(siteNodeRef.getId(), updatedRMSite.getGuid()); - assertEquals(RM_SITE_DESCRIPTION_AFTER_UPDATE, updatedRMSite.getDescription()); - assertEquals(RM_SITE_TITLE_AFTER_UPDATE, updatedRMSite.getTitle()); - assertEquals(SiteVisibility.PUBLIC, updatedRMSite.getVisibility()); - } - - @Test - public void getRMSite() throws Exception - { - String siteId = RM_SITE_ID; - SiteInfo mockedSiteInfo = mock(SiteInfo.class); - NodeRef siteNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedSiteInfo.getShortName()).thenReturn(siteId); - when(mockedSiteInfo.getNodeRef()).thenReturn(siteNodeRef); - when(mockedSiteInfo.getDescription()).thenReturn(RM_SITE_DESCRIPTION); - when(mockedSiteInfo.getTitle()).thenReturn(RM_SITE_TITLE); - when(mockedSiteInfo.getVisibility()).thenReturn(SiteVisibility.PUBLIC); - when(mockedNodeService.getType(siteNodeRef)).thenReturn(RecordsManagementModel.TYPE_RM_SITE); - - when(mockedSiteService.getSite(siteId)).thenReturn(mockedSiteInfo); - when(mockedSiteService.getMembersRole(eq(siteId), any(String.class))).thenReturn(RM_SITE_MANAGER_ROLE); - - //STANDARD compliance - RMSite rmSite = rmSitesImpl.getRMSite(siteId); - assertEquals(RMSiteCompliance.STANDARD, rmSite.getCompliance()); - assertEquals(RM_SITE_MANAGER_ROLE, rmSite.getRole()); - assertEquals(siteId, rmSite.getId()); - assertEquals(siteNodeRef.getId(), rmSite.getGuid()); - assertEquals(RM_SITE_DESCRIPTION, rmSite.getDescription()); - assertEquals(RM_SITE_TITLE, rmSite.getTitle()); - assertEquals(SiteVisibility.PUBLIC, rmSite.getVisibility()); - - //DOD5015 compliance - when(mockedNodeService.getType(siteNodeRef)).thenReturn(DOD5015Model.TYPE_DOD_5015_SITE); - rmSite = rmSitesImpl.getRMSite(siteId); - assertEquals(RMSiteCompliance.DOD5015, rmSite.getCompliance()); - assertEquals(RM_SITE_MANAGER_ROLE, rmSite.getRole()); - assertEquals(siteId, rmSite.getId()); - assertEquals(siteNodeRef.getId(), rmSite.getGuid()); - assertEquals(RM_SITE_DESCRIPTION, rmSite.getDescription()); - assertEquals(RM_SITE_TITLE, rmSite.getTitle()); - assertEquals(SiteVisibility.PUBLIC, rmSite.getVisibility()); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RMYamlUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RMYamlUnitTest.java deleted file mode 100644 index 9e8eba540f..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RMYamlUnitTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.impl; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseYamlUnitTest; -import org.junit.Test; - -/** - * Unit Test class for RM Yaml file validation. - * - * @author Sara Aspery - * @since 2.6 - * - */ -public class RMYamlUnitTest extends BaseYamlUnitTest -{ - private static String RM_COMMUNITY_YAML_FILES_PATH = "../rm-community-rest-api-explorer/src/main/webapp/definitions"; - - @Test - public void validateYamlFile() throws Exception - { - validateYamlFiles(getYamlFilesList(RM_COMMUNITY_YAML_FILES_PATH)); - } -} - diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RecordsImplUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RecordsImplUnitTest.java deleted file mode 100644 index 9dccfcd951..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/impl/RecordsImplUnitTest.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rm.rest.api.impl; - -import static org.alfresco.model.ContentModel.TYPE_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_RECORD_FOLDER; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.security.InvalidParameterException; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rm.rest.api.model.TargetContainer; -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.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; - -/** - * Unit tests for RecordsImpl - * - * @author Ana Bozianu - * @since 2.6 - */ -public class RecordsImplUnitTest -{ -// @Mock -// private RecordService mockedRecordService; -// @Mock -// protected FilePlanService mockedFilePlanService; -// @Mock -// protected NodeService mockedNodeService; -// @Mock -// protected FileFolderService mockedFileFolderService; -// @Mock -// protected DictionaryService mockedDictionaryService; -// @Mock -// protected AuthenticationUtil mockedAuthenticationUtil; -// @Mock -// protected RMNodes mockedNodes; -// -// @InjectMocks -// private RecordsImpl recordsImpl; -// -// @Before -// public void before() -// { -// MockitoAnnotations.initMocks(this); -// -// // setup mocked authentication util -// MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); -// } -// -// /** -// * Given a file and an existing fileplan -// * When declaring a file as record -// * Then a record is created under the existing fileplan from the provided file -// */ -// @Test -// public void testDeclareFileAsRecord() -// { -// /* -// * Given a file and an existing fileplan -// */ -// NodeRef mockedFile = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.validateNode(mockedFile.getId())).thenReturn(mockedFile); -// -// NodeRef fileplan = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedFilePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID)).thenReturn(fileplan); -// -// /* -// * When declare the file as record -// */ -// Parameters params = Mockito.mock(Parameters.class); -// when(params.getParameter(Records.PARAM_HIDE_RECORD)).thenReturn("true"); -// recordsImpl.declareFileAsRecord(mockedFile.getId(), params); -// -// /* -// * Then a record is created under the existing fileplan from the provided file -// */ -// verify(mockedRecordService).createRecord(fileplan, mockedFile, false); -// verify(mockedNodes).getFolderOrDocument(mockedFile.getId(), params); -// } -// -// /** -// * Given a record -// * When trying to filing a record providing a blank destination path -// * Then an InvalidParameterException is thrown -// */ -// @Test(expected=InvalidParameterException.class) -// public void testFileRecord_BlankDestinationPath() -// { -// /* -// * Given a record -// */ -// NodeRef mockedRecord = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.validateNode(mockedRecord.getId())).thenReturn(mockedRecord); -// -// /* -// * When trying to filing a record providing a blank destination path -// */ -// Parameters params = Mockito.mock(Parameters.class); -// TargetContainer target = new TargetContainer(); -// recordsImpl.fileOrLinkRecord(mockedRecord.getId(), target, params); -// } -// -// /** -// * Given an unfiled record and an existing record folder -// * When trying to file the record in the record folder -// * Then the record is moved under the destination folder -// */ -// @Test -// public void testFileRecord_DestinationById() throws Exception -// { -// /* -// * Given an unfiled record and an existing record folder -// */ -// // mock the record to file -// NodeRef mockedRecord = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.validateNode(mockedRecord.getId())).thenReturn(mockedRecord); -// -// // mock the current primary parent -// NodeRef mockedPrimaryParent = AlfMock.generateNodeRef(mockedNodeService); -// ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); -// when(mockedChildAssoc.getParentRef()).thenReturn(mockedPrimaryParent); -// when(mockedNodeService.getPrimaryParent(mockedRecord)).thenReturn(mockedChildAssoc); -// when(mockedNodeService.getType(mockedPrimaryParent)).thenReturn(TYPE_UNFILED_RECORD_CONTAINER); -// when(mockedDictionaryService.isSubClass(TYPE_UNFILED_RECORD_CONTAINER, TYPE_RECORD_FOLDER)).thenReturn(false); -// -// // mock the target record folder to file the record into -// NodeRef mockedTargetRecordFolder = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.getOrCreatePath(mockedTargetRecordFolder.getId(), null, TYPE_CONTENT)).thenReturn(mockedTargetRecordFolder); -// when(mockedNodeService.getType(mockedTargetRecordFolder)).thenReturn(TYPE_RECORD_FOLDER); -// when(mockedDictionaryService.isSubClass(TYPE_RECORD_FOLDER, TYPE_RECORD_FOLDER)).thenReturn(true); -// -// /* -// * When trying to file the record in the record folder -// */ -// TargetContainer destination = new TargetContainer(); -// destination.setTargetParentId(mockedTargetRecordFolder.getId()); -// -// Parameters params = Mockito.mock(Parameters.class); -// recordsImpl.fileOrLinkRecord(mockedRecord.getId(), destination, params); -// -// /* -// * Then the record is moved under the destination folder -// */ -// verify(mockedNodes).getOrCreatePath(mockedTargetRecordFolder.getId(), null, TYPE_CONTENT); -// verify(mockedFileFolderService).moveFrom(mockedRecord, mockedPrimaryParent, mockedTargetRecordFolder, null); -// } -// -// /** -// * Given an unfiled record -// * and an existing record folder with relative path category/recordFolder from fileplan -// * When trying to file the record using a relative path and no target id -// * Then the record is moved under the destination folder relative to the fileplan -// */ -// @Test -// public void testFileRecord_DestinationRelativeToFileplan() throws Exception -// { -// /* -// * Given an unfiled record and an existing record folder -// */ -// // mock the record to file -// NodeRef mockedRecord = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.validateNode(mockedRecord.getId())).thenReturn(mockedRecord); -// -// // mock the current primary parent -// NodeRef mockedPrimaryParent = AlfMock.generateNodeRef(mockedNodeService); -// ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); -// when(mockedChildAssoc.getParentRef()).thenReturn(mockedPrimaryParent); -// when(mockedNodeService.getPrimaryParent(mockedRecord)).thenReturn(mockedChildAssoc); -// when(mockedNodeService.getType(mockedPrimaryParent)).thenReturn(TYPE_UNFILED_RECORD_CONTAINER); -// when(mockedDictionaryService.isSubClass(TYPE_UNFILED_RECORD_CONTAINER, TYPE_RECORD_FOLDER)).thenReturn(false); -// -// // mock the fileplan -// NodeRef fileplan = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedFilePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID)).thenReturn(fileplan); -// -// // mock the target record folder to file the record into -// String relativePath = "category/recordFolder"; -// NodeRef mockedTargetRecordFolder = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.getOrCreatePath(fileplan.getId(), relativePath, TYPE_CONTENT)).thenReturn(mockedTargetRecordFolder); -// when(mockedNodeService.getType(mockedTargetRecordFolder)).thenReturn(TYPE_RECORD_FOLDER); -// when(mockedDictionaryService.isSubClass(TYPE_RECORD_FOLDER, TYPE_RECORD_FOLDER)).thenReturn(true); -// -// /* -// * When trying to file the record using a relative path and no target id -// */ -// TargetContainer destination = new TargetContainer(); -// destination.setRelativePath(relativePath); -// -// Parameters params = Mockito.mock(Parameters.class); -// recordsImpl.fileOrLinkRecord(mockedRecord.getId(), destination, params); -// -// /* -// * Then the record is moved under the destination folder relative to the fileplan -// */ -// verify(mockedNodes).getOrCreatePath(fileplan.getId(), relativePath, TYPE_CONTENT); -// verify(mockedFileFolderService).moveFrom(mockedRecord, mockedPrimaryParent, mockedTargetRecordFolder, null); -// } -// -// /** -// * Given an unfiled record -// * and an existing record folder with relative path category/recordFolder from a given category -// * When trying to file the record describing the target folder with the category id and the relative path -// * Then the record is moved under the correct destination folder -// */ -// @Test -// public void testFileRecord_DestinationRelativeToProvidedId() throws Exception -// { -// /* -// * Given an unfiled record and an existing record folder with relative path category/recordFolder from a given category -// */ -// // mock the record to file -// NodeRef mockedRecord = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.validateNode(mockedRecord.getId())).thenReturn(mockedRecord); -// -// // mock the current primary parent -// NodeRef mockedPrimaryParent = AlfMock.generateNodeRef(mockedNodeService); -// ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); -// when(mockedChildAssoc.getParentRef()).thenReturn(mockedPrimaryParent); -// when(mockedNodeService.getPrimaryParent(mockedRecord)).thenReturn(mockedChildAssoc); -// when(mockedNodeService.getType(mockedPrimaryParent)).thenReturn(TYPE_UNFILED_RECORD_CONTAINER); -// when(mockedDictionaryService.isSubClass(TYPE_UNFILED_RECORD_CONTAINER, TYPE_RECORD_FOLDER)).thenReturn(false); -// -// // mock the target category -// NodeRef mockedTargetCategory = AlfMock.generateNodeRef(mockedNodeService); -// -// // mock the target record folder to file the record into -// String relativePath = "category/recordFolder"; -// NodeRef mockedTargetRecordFolder = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.getOrCreatePath(mockedTargetCategory.getId(), relativePath, TYPE_CONTENT)).thenReturn(mockedTargetRecordFolder); -// when(mockedNodeService.getType(mockedTargetRecordFolder)).thenReturn(TYPE_RECORD_FOLDER); -// when(mockedDictionaryService.isSubClass(TYPE_RECORD_FOLDER, TYPE_RECORD_FOLDER)).thenReturn(true); -// -// /* -// * When trying to file the record describing the target folder with the category id and the relative path -// */ -// TargetContainer destination = new TargetContainer(); -// destination.setTargetParentId(mockedTargetCategory.getId()); -// destination.setRelativePath(relativePath); -// -// Parameters params = Mockito.mock(Parameters.class); -// recordsImpl.fileOrLinkRecord(mockedRecord.getId(), destination, params); -// -// /* -// * Then the record is moved under the correct destination folder -// */ -// verify(mockedNodes).getOrCreatePath(mockedTargetCategory.getId(), relativePath, TYPE_CONTENT); -// verify(mockedFileFolderService).moveFrom(mockedRecord, mockedPrimaryParent, mockedTargetRecordFolder, null); -// } -// -// /** -// * Given an filed record and an existing record folder -// * When trying to link the record to the record folder -// * Then the record is linked to the destination folder -// */ -// @Test -// public void testLinkRecord() -// { -// /* -// * Given an filed record and an existing record folder -// */ -// // mock the record to link -// NodeRef mockedRecord = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.validateNode(mockedRecord.getId())).thenReturn(mockedRecord); -// -// // mock the current primary parent -// NodeRef mockedPrimaryParent = AlfMock.generateNodeRef(mockedNodeService); -// ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class); -// when(mockedChildAssoc.getParentRef()).thenReturn(mockedPrimaryParent); -// when(mockedNodeService.getPrimaryParent(mockedRecord)).thenReturn(mockedChildAssoc); -// when(mockedNodeService.getType(mockedPrimaryParent)).thenReturn(TYPE_RECORD_FOLDER); -// when(mockedDictionaryService.isSubClass(TYPE_RECORD_FOLDER, TYPE_RECORD_FOLDER)).thenReturn(true); -// -// // mock the target record folder to file the record into -// NodeRef mockedTargetRecordFolder = AlfMock.generateNodeRef(mockedNodeService); -// when(mockedNodes.getOrCreatePath(mockedTargetRecordFolder.getId(), null, TYPE_CONTENT)).thenReturn(mockedTargetRecordFolder); -// when(mockedNodeService.getType(mockedTargetRecordFolder)).thenReturn(TYPE_RECORD_FOLDER); -// -// /* -// * When trying to link the record to the record folder -// */ -// TargetContainer destination = new TargetContainer(); -// destination.setTargetParentId(mockedTargetRecordFolder.getId()); -// -// Parameters params = Mockito.mock(Parameters.class); -// recordsImpl.fileOrLinkRecord(mockedRecord.getId(), destination, params); -// -// /* -// * Then the record is linked to the destination folder -// */ -// verify(mockedNodes).getOrCreatePath(mockedTargetRecordFolder.getId(), null, TYPE_CONTENT); -// verify(mockedRecordService).link(mockedRecord, mockedTargetRecordFolder); -// } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/sites/RMSiteEntityResourceUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/sites/RMSiteEntityResourceUnitTest.java deleted file mode 100644 index c8061063c7..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/rm/rest/api/sites/RMSiteEntityResourceUnitTest.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ - -package org.alfresco.rm.rest.api.sites; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -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.security.InvalidParameterException; -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.rest.api.model.SiteUpdate; -import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; -import org.alfresco.rest.framework.resource.parameters.Parameters; -import org.alfresco.rest.framework.resource.parameters.Params; -import org.alfresco.rm.rest.api.RMSites; -import org.alfresco.rm.rest.api.model.RMSite; -import org.alfresco.rm.rest.api.model.RMSiteCompliance; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * Unit Test class for RMSiteEntityResource. - * - * @author Silviu Dinuta - * @since 2.6 - */ -public class RMSiteEntityResourceUnitTest extends BaseUnitTest -{ - private static final String NON_RM_SITE_ID = "not_rm"; - - private static final String PERMANENT_PARAMETER = "permanent"; - - private static final String RM_SITE_ID = "rm"; - - private static final String RM_SITE_DESCRIPTION = "RM Site Description"; - - private static final String RM_SITE_TITLE = "RM Site Title"; - - @Mock - private RMSites mockedRMSites; - - @InjectMocks - private RMSiteEntityResource rmSiteEntityResource; - - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - } - - @Test - public void create() throws Exception - { - RMSite rmSite = new RMSite(); - rmSite.setTitle(RM_SITE_TITLE); - rmSite.setId(RM_SITE_ID); - rmSite.setDescription(RM_SITE_DESCRIPTION); - rmSite.setCompliance(RMSiteCompliance.STANDARD); - - List entity = new ArrayList<>(); - Params parameters = mock(Params.class); - entity.add(rmSite); - when(mockedRMSites.createRMSite(rmSite, parameters)).thenReturn(rmSite); - List createdRMSites = rmSiteEntityResource.create(entity, parameters); - - verify(mockedRMSites, times(1)).createRMSite(rmSite, parameters); - - assertEquals("Created sites size should be 1.", 1, createdRMSites.size()); - assertNotNull(createdRMSites.get(0)); - assertEquals(rmSite, createdRMSites.get(0)); - } - - @Test - public void happyPathDelete() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - when(parameters.getParameter(PERMANENT_PARAMETER)).thenReturn(null); - rmSiteEntityResource.delete(siteId, parameters); - verify(mockedRMSites, times(1)).deleteRMSite(siteId, parameters); - } - - @Test - public void deleteNonRMSite() throws Exception - { - String siteId = NON_RM_SITE_ID; - Params parameters = mock(Params.class); - when(parameters.getParameter(PERMANENT_PARAMETER)).thenReturn(null); - try - { - rmSiteEntityResource.delete(siteId, parameters); - fail("Expected ecxeption as siteId was different than rm"); - } - catch(InvalidParameterException ex) - { - assertEquals("The Deletion is supported only for siteId = rm.", ex.getMessage()); - } - verify(mockedRMSites, never()).deleteRMSite(siteId, parameters); - } - - @Test - public void deleteRMSiteWithPermanentParam() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - when(parameters.getParameter(PERMANENT_PARAMETER)).thenReturn(Boolean.toString(true)); - try - { - rmSiteEntityResource.delete(siteId, parameters); - fail("Expected ecxeption as parameter permanent was present in the request."); - } - catch(InvalidArgumentException ex) - { - assertEquals("DELETE does not support parameter: permanent", ex.getMsgId()); - } - verify(mockedRMSites, never()).deleteSite(siteId, parameters); - } - - @Test - public void happyPathGet() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - rmSiteEntityResource.readById(siteId, parameters); - verify(mockedRMSites, times(1)).getRMSite(siteId); - } - - @Test - public void getNonRMSite() throws Exception - { - String siteId = NON_RM_SITE_ID; - Params parameters = mock(Params.class); - try - { - rmSiteEntityResource.readById(siteId, parameters); - fail("Expected ecxeption as siteId was different than rm"); - } - catch(InvalidParameterException ex) - { - assertEquals("GET is supported only for siteId = rm.", ex.getMessage()); - } - verify(mockedRMSites, never()).getRMSite(siteId); - } - - @Test - public void happyPathUpdate() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - rmSiteEntityResource.update(siteId, site, parameters); - verify(mockedRMSites, times(1)).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } - - @Test - public void updateNonRMSite() throws Exception - { - String siteId = NON_RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - try - { - rmSiteEntityResource.update(siteId, site, parameters); - fail("Expected ecxeption as siteId was different than rm"); - } - catch(InvalidParameterException ex) - { - assertEquals("The Update is supported only for siteId = rm.", ex.getMessage()); - } - verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } - - @Test - public void updateRMSiteId() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - site.setId("newSiteID"); - try - { - rmSiteEntityResource.update(siteId, site, parameters); - fail("Expected ecxeption as rm site id cannot be changed."); - } - catch(InvalidArgumentException ex) - { - assertEquals("Site update does not support field: id", ex.getMsgId()); - } - verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } - - @Test - public void updateRMSiteGuid() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - site.setGuid("newGUID"); - try - { - rmSiteEntityResource.update(siteId, site, parameters); - fail("Expected ecxeption as rm site guid cannot be changed."); - } - catch(InvalidArgumentException ex) - { - assertEquals("Site update does not support field: guid", ex.getMsgId()); - } - verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } - - @Test - public void updateRMSiteRole() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - site.setRole("newRole"); - try - { - rmSiteEntityResource.update(siteId, site, parameters); - fail("Expected ecxeption as rm site role cannot be changed."); - } - catch(InvalidArgumentException ex) - { - assertEquals("Site update does not support field: role", ex.getMsgId()); - } - verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } - - @Test - public void updateRMSiteCompliance() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - site.setCompliance(RMSiteCompliance.STANDARD); - try - { - rmSiteEntityResource.update(siteId, site, parameters); - fail("Expected ecxeption as rm site compliance cannot be changed."); - } - catch(InvalidArgumentException ex) - { - assertEquals("Site update does not support field: compliance", ex.getMsgId()); - } - verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } - - @Test - public void updateRMSiteVisibility() throws Exception - { - String siteId = RM_SITE_ID; - Params parameters = mock(Params.class); - RMSite site = new RMSite(); - site.setTitle("New Title"); - site.setDescription("New Description"); - site.setVisibility(SiteVisibility.PRIVATE); - try - { - rmSiteEntityResource.update(siteId, site, parameters); - fail("Expected ecxeption as rm site visibility cannot be changed."); - } - catch(InvalidArgumentException ex) - { - assertEquals("Site update does not support field: visibility", ex.getMsgId()); - } - verify(mockedRMSites, never()).updateRMSite(any(String.class), any(SiteUpdate.class), any(Parameters.class)); - } -} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/resources/rest/schema.json b/amps/ags/rm-community/rm-community-repo/unit-test/resources/rest/schema.json deleted file mode 100644 index f12a8c0e47..0000000000 --- a/amps/ags/rm-community/rm-community-repo/unit-test/resources/rest/schema.json +++ /dev/null @@ -1,1607 +0,0 @@ -{ - "title": "A JSON Schema for Swagger 2.0 API.", - "id": "http://swagger.io/v2/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ - "swagger", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "swagger": { - "type": "string", - "enum": [ - "2.0" - ], - "description": "The Swagger version of this document." - }, - "info": { - "$ref": "#/definitions/info" - }, - "host": { - "type": "string", - "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", - "description": "The host (name or ip) of the API. Example: 'swagger.io'" - }, - "basePath": { - "type": "string", - "pattern": "^/", - "description": "The base path to the API. Example: '/api'." - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "consumes": { - "description": "A list of MIME types accepted by the API.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "definitions": { - "$ref": "#/definitions/definitions" - }, - "parameters": { - "$ref": "#/definitions/parameterDefinitions" - }, - "responses": { - "$ref": "#/definitions/responseDefinitions" - }, - "security": { - "$ref": "#/definitions/security" - }, - "securityDefinitions": { - "$ref": "#/definitions/securityDefinitions" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "info": { - "type": "object", - "description": "General information about the API.", - "required": [ - "version", - "title" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "title": { - "type": "string", - "description": "A unique and precise title of the API." - }, - "version": { - "type": "string", - "description": "A semantic version number of the API." - }, - "description": { - "type": "string", - "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." - }, - "termsOfService": { - "type": "string", - "description": "The terms of service for the API." - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the owners of the API.", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information.", - "format": "uri" - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization.", - "format": "email" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "license": { - "type": "object", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the license type. It's encouraged to use an OSI compatible license." - }, - "url": { - "type": "string", - "description": "The URL pointing to the license.", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "paths": { - "type": "object", - "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false - }, - "definitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "description": "One or more JSON objects describing the schemas being consumed and produced by the API." - }, - "parameterDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameter" - }, - "description": "One or more JSON representations for parameters" - }, - "responseDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response" - }, - "description": "One or more JSON representations for parameters" - }, - "externalDocs": { - "type": "object", - "additionalProperties": false, - "description": "information about external documentation", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "examples": { - "type": "object", - "additionalProperties": true - }, - "mimeType": { - "type": "string", - "description": "The MIME type of the HTTP message." - }, - "operation": { - "type": "object", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string", - "description": "A brief summary of the operation." - }, - "description": { - "type": "string", - "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string", - "description": "A unique identifier of the operation." - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "consumes": { - "description": "A list of MIME types the API can consume.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "parameters": { - "$ref": "#/definitions/parametersList" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "security": { - "$ref": "#/definitions/security" - } - } - }, - "pathItem": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "parameters": { - "$ref": "#/definitions/parametersList" - } - } - }, - "responses": { - "type": "object", - "description": "Response objects names can either be any valid HTTP status code or 'default'.", - "minProperties": 1, - "additionalProperties": false, - "patternProperties": { - "^([0-9]{3})$|^(default)$": { - "$ref": "#/definitions/responseValue" - }, - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "not": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - } - }, - "responseValue": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "response": { - "type": "object", - "required": [ - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/fileSchema" - } - ] - }, - "headers": { - "$ref": "#/definitions/headers" - }, - "examples": { - "$ref": "#/definitions/examples" - } - }, - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "headers": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/header" - } - }, - "header": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "vendorExtension": { - "description": "Any property starting with x- is valid.", - "additionalProperties": true, - "additionalItems": true - }, - "bodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "schema" - ], - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "body" - ] - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "schema": { - "$ref": "#/definitions/schema" - } - }, - "additionalProperties": false - }, - "headerParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "header" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "queryParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "formDataParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "formData" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array", - "file" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "pathParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "required" - ], - "properties": { - "required": { - "type": "boolean", - "enum": [ - true - ], - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "path" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "nonBodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "type" - ], - "oneOf": [ - { - "$ref": "#/definitions/headerParameterSubSchema" - }, - { - "$ref": "#/definitions/formDataParameterSubSchema" - }, - { - "$ref": "#/definitions/queryParameterSubSchema" - }, - { - "$ref": "#/definitions/pathParameterSubSchema" - } - ] - }, - "parameter": { - "oneOf": [ - { - "$ref": "#/definitions/bodyParameter" - }, - { - "$ref": "#/definitions/nonBodyParameter" - } - ] - }, - "schema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "boolean" - } - ], - "default": {} - }, - "type": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/type" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - } - ], - "default": {} - }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, - "discriminator": { - "type": "string" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "fileSchema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "type" - ], - "properties": { - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "type": { - "type": "string", - "enum": [ - "file" - ] - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "primitivesItems": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "securityRequirement": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "xml": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "securityDefinitions": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/basicAuthenticationSecurity" - }, - { - "$ref": "#/definitions/apiKeySecurity" - }, - { - "$ref": "#/definitions/oauth2ImplicitSecurity" - }, - { - "$ref": "#/definitions/oauth2PasswordSecurity" - }, - { - "$ref": "#/definitions/oauth2ApplicationSecurity" - }, - { - "$ref": "#/definitions/oauth2AccessCodeSecurity" - } - ] - } - }, - "basicAuthenticationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "basic" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "apiKeySecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "name", - "in" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "apiKey" - ] - }, - "name": { - "type": "string" - }, - "in": { - "type": "string", - "enum": [ - "header", - "query" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ImplicitSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "implicit" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2PasswordSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "password" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ApplicationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "application" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2AccessCodeSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "accessCode" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2Scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "mediaTypeList": { - "type": "array", - "items": { - "$ref": "#/definitions/mimeType" - }, - "uniqueItems": true - }, - "parametersList": { - "type": "array", - "description": "The parameters needed to send a valid API call.", - "additionalItems": false, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "uniqueItems": true - }, - "schemesList": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ - "http", - "https", - "ws", - "wss" - ] - }, - "uniqueItems": true - }, - "collectionFormat": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes" - ], - "default": "csv" - }, - "collectionFormatWithMulti": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes", - "multi" - ], - "default": "csv" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "jsonReference": { - "type": "object", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/README.md b/amps/ags/rm-community/rm-community-rest-api-explorer/README.md deleted file mode 100644 index 6568fe23e3..0000000000 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Alfresco Records Management Community REST API Explorer -Records Management Community REST API Definition Explorer - - -#### Building and deploying the war -- `mvn clean install` - -You now have a `target/alfresco-rm-community-rest-api-explorer-2.6-SNAPSHOT.war`, drop this into your Application server that is running alfresco.war - - -#### For development only -You can run the project as a packaged web application using an embedded Tomcat server. -This is useful for changing documentation and endpoint descriptions but it means that the "Try it Out!" button will not work. - -- ` mvn clean install -Pstart-api-explorer` - -Now the application is running at [http://localhost:8085/api-explorer](http://localhost:8085/api-explorer/) - -#### Config option -You can run tomcat on another port using the following command - -- ` mvn clean install -Pstart-api-explorer` - -Then the application will run at [http://localhost:8086/api-explorer](http://localhost:8086/api-explorer/) - -### License -Copyright (C) 2016 Alfresco Software Limited - -This file is part of an unsupported extension to Alfresco. - -Alfresco Software Limited licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml deleted file mode 100644 index bd52185c56..0000000000 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - alfresco-governance-services-community-rest-api-explorer - war - Alfresco Governance Services Community REST API Explorer - - - org.alfresco - alfresco-governance-services-community-repo-parent - 11.28-SNAPSHOT - - - - - - org.apache.maven.plugins - maven-war-plugin - - false - - - org.alfresco - api-explorer - - definitions/* - - - - - - - - - - - start-api-explorer - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - - - run-war - - run-war - - verify - - - - /api-explorer - 8085 - - - - - - - - - - org.alfresco - api-explorer - ${alfresco.api-explorer.version} - war - - - diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/gs-core-api.yaml b/amps/ags/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/gs-core-api.yaml deleted file mode 100644 index f6e3a390d4..0000000000 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/gs-core-api.yaml +++ /dev/null @@ -1,3762 +0,0 @@ -swagger: '2.0' -info: - description: | - **GS Core API** - - Provides access to the core features of Alfresco Governance Services. - version: '1' - title: Alfresco Governance Services REST API -basePath: /alfresco/api/-default-/public/gs/versions/1 -securityDefinitions: - basicAuth: - type: basic - description: HTTP Basic Authentication -security: - - basicAuth: [] -consumes: - - application/json -produces: - - application/json -tags: - - name: file-plans - description: Retrieve and manage file plans - - name: record-categories - description: Retrieve and manage record categories - - name: record-folders - description: Retrieve and manage record folders - - name: gs-sites - description: Retrieve and manage the Records Management site - - name: records - description: Perform record specific operations - - name: files - description: Perform operations on non-record files - - name: transfer-containers - description: Retrieve and manage transfer containers - - name: transfers - description: Retrieve and manage transfers - - name: unfiled-containers - description: Retrieve and manage unfiled records containers - - name: unfiled-record-folders - description: Retrieve and manage unfiled record folders -paths: - ## GS sites - '/gs-sites': - post: - tags: - - gs-sites - summary: Create the Records Management (RM) site - description: | - - Creates the RM site with the given details. - - **Note:** The default site id is rm and the default site name is Records Management. The id of a site cannot be updated once the site has been created. - - For example, to create an RM site named "Records Management" with "Records Management Description" as description, the following body could be used: - ```JSON - { - "title": "Records Management", - "description": "Records Management Description" - } - ``` - - The creator will be added as a member with Site Manager role. - - When you create the RM site, the **filePlan** structure is also created including special containers, such as containers for transfers, holds and, unfiled records. - - operationId: createRMSite - produces: - - application/json - parameters: - - name: skipAddToFavorites - in: query - description: Flag to indicate whether the RM site should not be added to the user's site favorites. - type: boolean - default: false - - in: body - name: siteBodyCreate - description: The site details - required: true - schema: - $ref: '#/definitions/RMSiteBodyCreate' - responses: - '201': - description: Successful response - schema: - $ref: '#/definitions/RMSiteEntry' - '400': - description: | - Invalid parameter: **title**, or **description** exceed the maximum length; - or **siteBodyCreate** invalid - '401': - description: Authentication failed - '409': - description: Site with the given identifier already exists - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/gs-sites/rm': - get: - tags: - - gs-sites - summary: Get the Records Management (RM) site - description: | - - Gets information for RM site. - - operationId: getRMSite - produces: - - application/json - parameters: - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RMSiteEntry' - '400': - description: | - Invalid parameter: GET request is only supported for the RM site - '401': - description: Authentication failed - '404': - description: | - RM site does not exist - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - delete: - tags: - - gs-sites - summary: Delete the Records Management (RM) site - description: | - - Deletes the RM site. - operationId: deleteRMSite - produces: - - application/json - responses: - '204': - description: Successful response - '400': - description: | - Invalid parameter: DELETE request is only supported for the RM site - '401': - description: Authentication failed - '403': - description: Current user does not have permission to delete the site that is visible to them. - '404': - description: | - RM site does not exist - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - gs-sites - summary: Update the Records Management (RM) site - description: | - - Update the details for the RM site. Site Manager or other (site) admin can update title or description. - - **Note**: the id, site visibility, or compliance of the RM site cannot be updated once the site has been created. - - operationId: updateRMSite - produces: - - application/json - parameters: - - $ref: '#/parameters/fieldsParam' - - in: body - name: siteBodyUpdate - description: The RM site information to update. - required: true - schema: - $ref: '#/definitions/RMSiteBodyUpdate' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RMSiteEntry' - '400': - description: | - Invalid parameter: PUT request is supported only for the RM site, or **siteBodyUpdate** invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update the RM site that is visible to them. - '404': - description: | - RM site does not exist - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - ## File plans - '/file-plans/{filePlanId}': - get: - tags: - - file-plans - summary: Get a file plan - description: | - Gets information for file plan **filePlanId** - - Mandatory fields and the file plan's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getFilePlan - parameters: - - $ref: '#/parameters/filePlanIdWithAliasParam' - - $ref: '#/parameters/filePlanEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/FilePlanEntry' - '400': - description: | - Invalid parameter: **filePlanId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **filePlanId** - '404': - description: "**filePlanId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - file-plans - summary : Update a file plan - description: | - Updates file plan **filePlanId**. - You can only set or update description and title properties: - ```JSON - { - "properties": - { - "cm:description": "New Description", - "cm:title":"New Title" - } - } - ``` - - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateFilePlan - parameters: - - $ref: '#/parameters/filePlanIdWithAliasParam' - - $ref: '#/parameters/filePlanEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: filePlanBodyUpdate - description: The file plan information to update. - required: true - schema: - $ref: '#/definitions/FilePlanBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/FilePlanEntry' - '400': - description: | - Invalid parameter: The update request is invalid or **filePlanId** is not a valid format or **filePlanBodyUpdate** is invalid - '401': - description: Authentication failed - '403': - description: If current user does not have permission to update **filePlanId** - '404': - description: "**filePlanId** does not exist" - '409': - description: Updated name clashes with an existing fileplan - '422': - description: Model integrity exception, including file name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/file-plans/{filePlanId}/categories': - get: - tags: - - file-plans - summary: List file plans's children - description: | - Returns a list of record categories. - - Minimal information for each child is returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - - operationId: getFilePlanCategories - produces: - - application/json - parameters: - - $ref: '#/parameters/filePlanIdWithAliasParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/filePlanCategoriesEntryIncludeParam' - - $ref: '#/parameters/filePlanIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordCategoryPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **filePlanId** - '404': - description: "**filePlanId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - post: - tags: - - file-plans - summary: Create record categories for a file plan - description: | - Creates a record category as a primary child of **filePlanId**. - - You can set the **autoRename** boolean field to automatically resolve name clashes. If there is a name clash, then - the API method tries to create - a unique name using an integer suffix. - - This API method also supports record category creation using application/json. - - You must specify at least a **name**. - - You can create a category like this: - ```JSON - { - "name":"My Record Category" - } - ``` - You can set properties when creating a record category: - ```JSON - { - "name":"My Record Category", - "properties": - { - "rma:vitalRecordIndicator":"true", - "rma:reviewPeriod":"month|1" - } - } - ``` - - Any missing aspects are applied automatically. You can set aspects explicitly, if needed, using an **aspectNames** field. - - If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: - - ```JSON - { - "list": { - "pagination": { - "count": 2, - "hasMoreItems": false, - "totalItems": 2, - "skipCount": 0, - "maxItems": 100 - }, - "entries": [ - { - "entry": { - ... - } - }, - { - "entry": { - ... - } - } - ] - } - } - ``` - operationId: createFilePlanCategories - parameters: - - $ref: '#/parameters/filePlanIdWithAliasParam' - - $ref: '#/parameters/autoRenameParam' - - $ref: '#/parameters/recordCategoryEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: nodeBodyCreate - description: The node information to create. - required: true - schema: - $ref: '#/definitions/RootCategoryBodyCreate' - consumes: - - application/json - - multipart/form-data - produces: - - application/json - responses: - '201': - description: Successful response - schema: - $ref: '#/definitions/RecordCategoryEntry' - '400': - description: | - Invalid parameter: **filePlanId** is not a valid format or **filePlanId** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to add children to **filePlanId** - '404': - description: "**filePlanId** does not exist" - '409': - description: New name clashes with an existing node in the current parent container - '422': - description: Model integrity exception, including node name with invalid characters - ## Unfiled records containers - '/unfiled-containers/{unfiledContainerId}': - get: - tags: - - unfiled-containers - summary: Get the unfiled records container - description: | - Gets information for unfiled records container **unfiledContainerId** - - Mandatory fields and the unfiled records container's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getUnfiledContainer - parameters: - - $ref: '#/parameters/unfiledContainerIdParam' - - $ref: '#/parameters/unfiledContainerEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/UnfiledContainerEntry' - '400': - description: | - Invalid parameter: **unfiledContainerId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **unfiledContainerId** - '404': - description: "**unfiledContainerId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - unfiled-containers - summary : Update an unfiled record container - description: | - Updates unfiled record container **unfiledContainerId**. For example, you can rename an unfiled record container: - ```JSON - { - "name":"My new name" - } - ``` - You can also set or update description and title properties: - ```JSON - { - "properties": - { - "cm:description": "New Description", - "cm:title":"New Title" - } - } - ``` - - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateUnfiledContainer - parameters: - - $ref: '#/parameters/unfiledContainerIdParam' - - $ref: '#/parameters/unfiledContainerEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: unfiledContainerBodyUpdate - description: The unfiled record container information to update. - required: true - schema: - $ref: '#/definitions/UnfiledRecordContainerBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/UnfiledContainerEntry' - '400': - description: | - Invalid parameter: The update request is invalid or **unfiledContainerId** is not a valid format or **unfiledContainerBodyUpdate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update **unfiledContainerId** - '404': - description: "**unfiledContainerId** does not exist" - '409': - description: Updated name clashes with an existing root category of special container in the current fileplan - '422': - description: Model integrity exception, including file name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/unfiled-containers/{unfiledContainerId}/children': - get: - tags: - - unfiled-containers - summary: List unfiled record container's children - description: | - Returns a list of records or unfiled record folders. - - Minimal information for each child is returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: listUnfiledContainerChildren - produces: - - application/json - parameters: - - $ref: '#/parameters/unfiledContainerIdParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/unfiledRecordFolderAndContainerWhereParam' - - $ref: '#/parameters/unfiledContainerChildEntryIncludeParam' - - $ref: '#/parameters/unfiledContainerIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/UnfiledContainerAssociationPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **unfiledContainerId** - '404': - description: "**unfiledContainerId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - post: - tags: - - unfiled-containers - summary: Create a record or an unfiled record folder - description: | - Creates a record or an unfiled record folder as a primary child of **unfiledContainerId**. - - You can set the **autoRename** boolean field to automatically resolve name clashes. If there is a name clash, then - the API method tries to create a unique name using an integer suffix. - - This endpoint supports both JSON and multipart/form-data (file upload). - - **Using multipart/form-data** - - Use the **filedata** field to represent the content to upload, for example, the following curl command will - create a node with the contents of test.txt in the test user's home folder. - - ```curl -utest:test -X POST host:port/alfresco/api/-default-/public/gs/versions/1/unfiled-containers/{unfiledContainerId}/children -F filedata=@test.txt``` - - This API method also supports record and unfiled record folder creation using application/json. - - You must specify at least a **name** and **nodeType**. - - You can create a non-electronic record like this: - ```JSON - { - "name":"My Non-electronic Record", - "nodeType":"rma:nonElectronicDocument", - "properties": - { - "cm:description":"My Non-electronic Record Description", - "cm:title":"My Non-electronic Record Title", - "rma:box":"My Non-electronic Record Box", - "rma:file":"My Non-electronic Record File", - "rma:numberOfCopies":1, - "rma:physicalSize":30, - "rma:shelf":"My Non-electronic Record Shelf", - "rma:storageLocation":"My Non-electronic Record Location" - } - } - ``` - - You can create an empty electronic record: - ```JSON - { - "name":"My Electronic Record", - "nodeType":"cm:content" - } - ``` - - You can create an unfiled record folder like this: - ```JSON - { - "name": "My Unfiled Record Folder", - "nodeType": "rma:unfiledRecordFolder", - "properties": - { - "cm:title": "My Unfiled Record Folder Title" - } - } - ``` - - Any missing aspects are applied automatically. You can set aspects explicitly, if needed, using an **aspectNames** field. - - **Note:** You can create more than one child by - specifying a list of nodes in the JSON body. For example, the following JSON - body creates a record and an unfiled record folder inside the specified **unfiledContainerId**: - ```JSON - [ - { - "name":"My Record", - "nodeType":"cm:content" - }, - { - "name":"My Unfiled Record Folder", - "nodeType":"rma:unfiledRecordFolder" - } - ] - ``` - If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: - - ```JSON - { - "list": { - "pagination": { - "count": 2, - "hasMoreItems": false, - "totalItems": 2, - "skipCount": 0, - "maxItems": 100 - }, - "entries": [ - { - "entry": { - ... - } - }, - { - "entry": { - ... - } - } - ] - } - } - ``` - operationId: createUnfiledContainerChildren - parameters: - - $ref: '#/parameters/unfiledContainerIdParam' - - $ref: '#/parameters/autoRenameParam' - - $ref: '#/parameters/unfiledRecordFolderEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: nodeBodyCreate - description: The node information to create. - required: true - schema: - $ref: '#/definitions/RMNodeBodyCreate' - consumes: - - application/json - - multipart/form-data - produces: - - application/json - responses: - '201': - description: Successful response - schema: - $ref: '#/definitions/UnfiledContainerAssociationPaging' - '400': - description: | - Invalid parameter: **unfiledContainerId** is not a valid format or **unfiledContainerId** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to add children to **unfiledContainerId** - '404': - description: "**unfiledContainerId** does not exist" - '409': - description: New name clashes with an existing node in the current parent container - '422': - description: Model integrity exception, including node name with invalid characters - ## Unfiled record folders - '/unfiled-record-folders/{unfiledRecordFolderId}': - get: - tags: - - unfiled-record-folders - summary: Get the unfiled record folder - description: | - Gets information for unfiled record folder id **unfiledRecordFolderId** - - Mandatory fields and the unfiled record folder's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getUnfiledRecordFolder - parameters: - - $ref: '#/parameters/unfiledRecordFolderIdParam' - - $ref: '#/parameters/unfiledRecordFolderEntryIncludeParam' - - $ref: '#/parameters/unfiledRecordFolderRelativePathParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/UnfiledRecordFolderEntry' - '400': - description: | - Invalid parameter: **unfiledRecordFolderId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **unfiledRecordFolderId** - '404': - description: "**unfiledRecordFolderId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - unfiled-record-folders - summary : Update an unfiled record folder - description: | - Updates unfiled record folder **unfiledRecordFolderId**. For example, you can rename a record folder: - ```JSON - { - "name":"My new name" - } - ``` - You can also set or update one or more properties: - ```JSON - { - "properties": - { - "cm:title":"New title", - "cm:description":"New description" - } - } - ``` - **Note:** if you want to add or remove aspects, then you must use **GET /unfiled-record-folders/{unfiledRecordFolderId}** first to get the complete set of *aspectNames*. - - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateUnfiledRecordFolder - parameters: - - $ref: '#/parameters/unfiledRecordFolderIdParam' - - $ref: '#/parameters/unfiledRecordFolderEntryIncludeParam' - - $ref: '#/parameters/unfiledRecordFolderIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: unfiledRecordFolderBodyUpdate - description: The record folder information to update. - required: true - schema: - $ref: '#/definitions/UnfiledRecordFolderBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/UnfiledRecordFolderEntry' - '400': - description: | - Invalid parameter: The update request is invalid or **unfiledRecordFolderId** is not a valid format or **unfiledRecordFolderBodyUpdate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update **unfiledRecordFolderId** - '404': - description: "**unfiledRecordFolderId** does not exist" - '409': - description: Updated name clashes with an existing unfiled record folder in the current parent category - '422': - description: Model integrity exception, including file name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - delete: - tags: - - unfiled-record-folders - summary : Delete an unfiled record folder. Deleted file plan components cannot be recovered, they are deleted permanently. - description: | - Deletes the unfiled record folder **unfiledRecordFolderId**. - operationId: deleteUnfiledRecordFolder - parameters: - - $ref: '#/parameters/unfiledRecordFolderIdParam' - produces: - - application/json - responses: - '204': - description: Successful response - '400': - description: | - Invalid parameter: **unfiledRecordFolderId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to delete **unfiledRecordFolderId** - '404': - description: "**unfiledRecordFolderId** does not exist" - '409': - description: "**unfiledRecordFolderId** is locked and cannot be deleted" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/unfiled-record-folders/{unfiledRecordFolderId}/children': - get: - tags: - - unfiled-record-folders - summary: List unfiled record folder's children - description: | - Returns a list of records or unfiled record folders. - - Minimal information for each child is returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: listUnfiledRecordFolderChildren - produces: - - application/json - parameters: - - $ref: '#/parameters/unfiledRecordFolderIdParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/unfiledRecordFolderAndContainerWhereParam' - - $ref: '#/parameters/unfiledRecordFolderChildEntryIncludeParam' - - $ref: '#/parameters/unfiledRecordFolderRelativePathParam' - - $ref: '#/parameters/unfiledRecordFolderIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/UnfiledRecordFolderAssociationPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **unfiledRecordFolderId** - '404': - description: "**unfiledRecordFolderId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - post: - tags: - - unfiled-record-folders - summary: Create a record or an unfiled record folder - description: | - Create a record or an unfiled record folder as a primary child of **unfiledRecordFolderId**. - - You can set the **autoRename** boolean field to automatically resolve name clashes. If there is a name clash, then - the API method tries to create a unique name using an integer suffix. - - This endpoint supports both JSON and multipart/form-data (file upload). - - **Using multipart/form-data** - - Use the **filedata** field to represent the content to upload, for example, the following curl command will - create a node with the contents of test.txt in the test user's home folder. - - ```curl -utest:test -X POST host:port/alfresco/api/-default-/public/gs/versions/1/unfiled-record-folders/{unfiledRecordFolderId}/children -F filedata=@test.txt``` - - This API method also supports record and unfiled record folder creation using application/json. - - You must specify at least a **name** and **nodeType**. - - You can create a non-electronic record like this: - ```JSON - { - "name":"My Non-electronic Record", - "nodeType":"rma:nonElectronicDocument", - "properties": - { - "cm:description":"My Non-electronic Record Description", - "cm:title":"My Non-electronic Record Title", - "rma:box":"My Non-electronic Record Box", - "rma:file":"My Non-electronic Record File", - "rma:numberOfCopies":1, - "rma:physicalSize":30, - "rma:shelf":"My Non-electronic Record Shelf", - "rma:storageLocation":"My Non-electronic Record Location" - } - } - ``` - - You can create an empty electronic record like this: - ```JSON - { - "name":"My Electronic Record", - "nodeType":"cm:content" - } - ``` - - You can create an unfiled record folder like this: - ```JSON - { - "name": "My Unfiled Record Folder", - "nodeType": "rma:unfiledRecordFolder", - "properties": - { - "cm:title": "My Unfiled Record Folder Title" - } - } - ``` - - Any missing aspects are applied automatically. You can set aspects explicitly, if needed, using an **aspectNames** field. - - **Note:** You can create more than one child by - specifying a list of nodes in the JSON body. For example, the following JSON - body creates a record and an unfiled record folder inside the specified **unfiledRecordFolderId**: - ```JSON - [ - { - "name":"My Record", - "nodeType":"cm:content" - }, - { - "name":"My Unfiled Record Folder", - "nodeType":"rma:unfiledRecordFolder" - } - ] - ``` - If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: - - ```JSON - { - "list": { - "pagination": { - "count": 2, - "hasMoreItems": false, - "totalItems": 2, - "skipCount": 0, - "maxItems": 100 - }, - "entries": [ - { - "entry": { - ... - } - }, - { - "entry": { - ... - } - } - ] - } - } - ``` - operationId: createUnfiledRecordFolderChildren - parameters: - - $ref: '#/parameters/unfiledRecordFolderIdParam' - - $ref: '#/parameters/autoRenameParam' - - $ref: '#/parameters/unfiledRecordFolderEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: nodeBodyCreate - description: The node information to create. - required: true - schema: - $ref: '#/definitions/RMNodeBodyCreateWithRelativePath' - consumes: - - application/json - - multipart/form-data - produces: - - application/json - responses: - '201': - description: Successful response - schema: - $ref: '#/definitions/UnfiledRecordFolderAssociationPaging' - '400': - description: | - Invalid parameter: **unfiledRecordFolderId** is not a valid format or **unfiledRecordFolderId** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to add children to **unfiledRecordFolderId** - '404': - description: "**unfiledRecordFolderId** does not exist" - '409': - description: New name clashes with an existing node in the current parent container - '422': - description: Model integrity exception, including node name with invalid characters - ## Record categories - '/record-categories/{recordCategoryId}': - get: - tags: - - record-categories - summary: Get a record category - description: | - Gets information for record category **recordCategoryId** - - Mandatory fields and the record category's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getRecordCategory - parameters: - - $ref: '#/parameters/recordCategoryIdParam' - - $ref: '#/parameters/recordCategoryEntryIncludeParam' - - $ref: '#/parameters/recordCategoryRelativePathParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordCategoryEntry' - '400': - description: | - Invalid parameter: **recordCategoryId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **recordCategoryId** - '404': - description: "**recordCategoryId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - record-categories - summary : Update a record category - description: | - Updates record category **recordCategoryId**. For example, you can rename a record category: - ```JSON - { - "name":"My new name" - } - ``` - You can also set or update one or more properties: - ```JSON - { - "properties": - { - "rma:vitalRecordIndicator": true, - "rma:reviewPeriod":"month|6" - } - } - ``` - **Note:** If you want to add or remove aspects, then you must use **GET /record-categories/{recordCategoryId}** first to get the complete set of *aspectNames*. - - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateRecordCategory - parameters: - - $ref: '#/parameters/recordCategoryIdParam' - - $ref: '#/parameters/recordCategoryEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: recordCategoryBodyUpdate - description: The record category information to update. - required: true - schema: - $ref: '#/definitions/FilePlanComponentBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordCategoryEntry' - '400': - description: | - Invalid parameter: The update request is invalid or **recordCategoryId** is not a valid format or **recordCategoryBodyUpdate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update **recordCategoryId** - '404': - description: "**recordCategoryId** does not exist" - '409': - description: Updated name clashes with an existing record category in the current parent category - '422': - description: Model integrity exception, including file name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - delete: - tags: - - record-categories - summary : Delete a record category - description: | - Deletes record category **recordCategoryId**. - operationId: deleteRecordCategory - parameters: - - $ref: '#/parameters/recordCategoryIdParam' - produces: - - application/json - responses: - '204': - description: Successful response - '400': - description: | - Invalid parameter: **recordCategoryId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to delete **recordCategoryId** - '404': - description: "**recordCategoryId** does not exist" - '409': - description: "**recordCategoryId** is locked and cannot be deleted" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/record-categories/{recordCategoryId}/children': - get: - tags: - - record-categories - summary: List record category's children - description: | - Returns a list of record categories and/or record folders. - - Minimal information for each child is returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - - The list of child nodes includes primary children and secondary children, if there are any. - operationId: listRecordCategoryChildren - produces: - - application/json - parameters: - - $ref: '#/parameters/recordCategoryIdParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/recordCategoryWhereParam' - - $ref: '#/parameters/recordCategoryChildEntryIncludeParam' - - $ref: '#/parameters/recordCategoryRelativePathParam' - - $ref: '#/parameters/recordCategoryIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordCategoryChildPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **recordCategoryId** - '404': - description: "**recordCategoryId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - post: - tags: - - record-categories - summary: Create a record category or a record folder - description: | - Create a record category or a record folder as a primary child of **recordCategoryId**. - - You can set the **autoRename** boolean field to automatically resolve name clashes. If there is a name clash, then - the API method tries to create - a unique name using an integer suffix. - - This API method also supports record category or record folder creation using application/json. - - You must specify at least a **name** and **nodeType**. - - You can create a category like this: - ```JSON - { - "name":"My Record Category", - "nodeType":"rma:recordCategory" - } - ``` - - You can create a record folder like this: - ```JSON - { - "name":"My Record Folder", - "nodeType":"rma:recordFolder" - } - ``` - - You can create a record folder inside a container hierarchy (applies to record categories as well): - ```JSON - { - "name":"My Fileplan Component", - "nodeType":"rma:recordFolder", - "relativePath":"X/Y/Z" - } - ``` - The **relativePath** specifies the container structure to create relative to the node (record category or record folder). Containers in the - **relativePath** that do not exist are created before the node is created. The container type is decided considering - the type of the parent container and the type of the node to be created. - - You can set properties when creating a record category (applies to record folders as well): - ```JSON - { - "name":"My Record Category", - "nodeType":"rma:recordCategory", - "properties": - { - "rma:vitalRecordIndicator":"true", - "rma:reviewPeriod":"month|1" - } - } - ``` - - Any missing aspects are applied automatically. You can set aspects explicitly, if needed, using an **aspectNames** field. - - **Note:** You can create more than one child by - specifying a list of nodes in the JSON body. For example, the following JSON - body creates a record category and a record folder inside the specified **categoryId**: - ```JSON - [ - { - "name":"My Record Category", - "nodeType":"rma:recordCategory" - }, - { - "name":"My Record Folder", - "nodeType":"rma:recordFolder" - } - ] - ``` - If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: - - ```JSON - { - "list": { - "pagination": { - "count": 2, - "hasMoreItems": false, - "totalItems": 2, - "skipCount": 0, - "maxItems": 100 - }, - "entries": [ - { - "entry": { - ... - } - }, - { - "entry": { - ... - } - } - ] - } - } - ``` - operationId: createRecordCategoryChild - parameters: - - $ref: '#/parameters/recordCategoryIdParam' - - $ref: '#/parameters/autoRenameParam' - - $ref: '#/parameters/recordCategoryEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: nodeBodyCreate - description: | - The node information to create. - required: true - schema: - $ref: '#/definitions/RMNodeBodyCreateWithRelativePath' - consumes: - - application/json - - multipart/form-data - produces: - - application/json - responses: - '201': - description: Successful response - schema: - $ref: '#/definitions/RecordCategoryChildEntry' - '400': - description: | - Invalid parameter: **recordCategoryId** is not a valid format or **nodeBodyCreate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to add children to **recordCategoryId** - '404': - description: "**recordCategoryId** does not exist" - '409': - description: Name clashes with an existing node in the current parent container - '422': - description: Model integrity exception, including node name with invalid characters - ## Record folders - '/record-folders/{recordFolderId}': - get: - tags: - - record-folders - summary: Get a record folder - description: | - Gets information for record folder **recordFolderId** - - Mandatory fields and the record folder's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getRecordFolder - parameters: - - $ref: '#/parameters/recordFolderIdParam' - - $ref: '#/parameters/recordFolderEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordFolderEntry' - '400': - description: | - Invalid parameter: **recordFolderId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **recordFolderId** - '404': - description: "**recordFolderId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - record-folders - summary : Update a record folder - description: | - Updates record folder **recordFolderId**. For example, you can rename a record folder: - ```JSON - { - "name":"My new name" - } - ``` - You can also set or update one or more properties: - ```JSON - { - "properties": - { - "rma:vitalRecordIndicator": true, - "rma:reviewPeriod":"month|6" - } - } - ``` - **Note:** if you want to add or remove aspects, then you must use **GET /record-folders/{recordFolderId}** first to get the complete set of *aspectNames*. - - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateRecordFolder - parameters: - - $ref: '#/parameters/recordFolderIdParam' - - $ref: '#/parameters/recordFolderEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: recordFolderBodyUpdate - description: The record folder information to update. - required: true - schema: - $ref: '#/definitions/FilePlanComponentBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordFolderEntry' - '400': - description: | - Invalid parameter: The update request is invalid or **recordFolderId** is not a valid format or **recordFolderBodyUpdate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update **recordFolderId** - '404': - description: "**recordFolderId** does not exist" - '409': - description: Updated name clashes with an existing record folder in the current parent category - '422': - description: Model integrity exception, including file name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - delete: - tags: - - record-folders - summary : Delete a record folder - description: | - Deletes record folder **recordFolderId**. Deleted file plan components cannot be recovered, they are deleted permanently. - operationId: deleteRecordFolder - parameters: - - $ref: '#/parameters/recordFolderIdParam' - produces: - - application/json - responses: - '204': - description: Successful response - '400': - description: | - Invalid parameter: **recordFolderId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to delete **recordFolderId** - '404': - description: "**recordFolderId** does not exist" - '409': - description: "**recordFolderId** is locked and cannot be deleted" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/record-folders/{recordFolderId}/records': - get: - tags: - - record-folders - summary: List records - description: | - Gets a list of records. - - Minimal information for each record is returned by default. - - The list of records includes primary children and secondary children, if there are any. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: listRecordFolderChildren - produces: - - application/json - parameters: - - $ref: '#/parameters/recordFolderIdParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/recordFolderWhereParam' - - $ref: '#/parameters/recordFolderChildEntryIncludeParam' - - $ref: '#/parameters/recordFolderIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordFolderAssociationPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **recordFolderId** - '404': - description: "**recordFolderId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - post: - tags: - - record-folders - summary: Create a record - description: | - Create a record as a primary child of **recordFolderId**. - - This endpoint supports both JSON and multipart/form-data (file upload). - - **Using multipart/form-data** - - Use the **filedata** field to represent the content to upload, for example, the following curl command will - create a node with the contents of test.txt in the test user's home folder. - - ```curl -utest:test -X POST host:port/alfresco/api/-default-/public/gs/versions/1/record-folders/{recordFolderId}/records -F filedata=@test.txt``` - - This API method also supports record creation using application/json. - - You must specify at least a **name** and **nodeType**. - - - You can create a non-electronic record like this: - ```JSON - { - "name":"My Non-electronic Record", - "nodeType":"rma:nonElectronicDocument", - "properties": - { - "cm:description":"My Non-electronic Record Description", - "cm:title":"My Non-electronic Record Title", - "rma:box":"My Non-electronic Record Box", - "rma:file":"My Non-electronic Record File", - "rma:numberOfCopies":1, - "rma:physicalSize":30, - "rma:shelf":"My Non-electronic Record Shelf", - "rma:storageLocation":"My Non-electronic Record Location" - } - } - ``` - - You can create an empty electronic record: - ```JSON - { - "name":"My Electronic Record", - "nodeType":"cm:content" - } - ``` - - Any missing aspects are applied automatically. You can set aspects explicitly, if needed, using an **aspectNames** field. - - **Note:** You can create more than one child by - specifying a list of nodes in the JSON body. For example, the following JSON - body creates a record category and a record folder inside the specified **categoryId**: - ```JSON - [ - { - "name":"Record 1", - "nodeType":"cm:content" - }, - { - "name":"Record 2", - "nodeType":"cm:content" - } - ] - ``` - If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: - - ```JSON - { - "list": { - "pagination": { - "count": 2, - "hasMoreItems": false, - "totalItems": 2, - "skipCount": 0, - "maxItems": 100 - }, - "entries": [ - { - "entry": { - ... - } - }, - { - "entry": { - ... - } - } - ] - } - } - ``` - operationId: createRecordFolderChild - parameters: - - $ref: '#/parameters/recordFolderIdParam' - - $ref: '#/parameters/recordEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: recordBodyCreate - description: | - The record information to create. - - This field is ignored for multipart/form-data content uploads. - required: true - schema: - $ref: '#/definitions/RMNodeBodyCreate' - consumes: - - application/json - - multipart/form-data - produces: - - application/json - responses: - '201': - description: Successful response - schema: - $ref: '#/definitions/RecordEntry' - '400': - description: | - Invalid parameter: **recordFolderId** is not a valid format or **recordBodyCreate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to add children to **recordFolderId** - '404': - description: "**recordFolderId** does not exist" - '422': - description: Model integrity exception, including node name with invalid characters - ## Records - '/records/{recordId}': - get: - tags: - - records - summary: Get a record - description: | - Gets information for record **recordId** - - Mandatory fields and the record's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getRecord - parameters: - - $ref: '#/parameters/recordIdParam' - - $ref: '#/parameters/recordEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordEntry' - '400': - description: | - Invalid parameter: **recordId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **recordId** - '404': - description: "**recordId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - records - summary : Update record - description: | - Updates the record **recordId**. For example, you can rename a record: - ```JSON - { - "name":"My new name" - } - ``` - You can also set or update one or more properties: - ```JSON - { - "properties": - { - "cm:title":"New title", - "cm:description":"New description" - } - } - ``` - **Note:** if you want to add or remove aspects, then you must use **GET /records/{recordId}** first to get the complete set of *aspectNames*. - - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateRecord - parameters: - - $ref: '#/parameters/recordIdParam' - - $ref: '#/parameters/recordEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: recordBodyUpdate - description: The record information to update. - required: true - schema: - $ref: '#/definitions/FilePlanComponentBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordEntry' - '400': - description: | - Invalid parameter: the update request is invalid or **recordId** is not a valid format or **recordBodyUpdate** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update **recordId** - '404': - description: "**recordId** does not exist" - '409': - description: Updated name clashes with an existing node in the current parent folder - '422': - description: Model integrity exception, including file name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - delete: - tags: - - records - summary : Delete a record - description: | - Deletes the record **recordId**. Deleted file plan components cannot be recovered, they are deleted permanently. - operationId: deleteRecord - parameters: - - $ref: '#/parameters/recordIdParam' - produces: - - application/json - responses: - '204': - description: Successful response - '400': - description: | - Invalid parameter: **recordId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to delete **recordId** - '404': - description: "**recordId** does not exist" - '409': - description: "**recordId** is locked and cannot be deleted" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/records/{recordId}/content': - get: - tags: - - records - summary: Get record content - description: | - - Gets the content of the record with identifier **recordId**. - operationId: getRecordContent - parameters: - - $ref: '#/parameters/recordIdParam' - - $ref: '#/parameters/attachmentParam' - - $ref: '#/parameters/ifModifiedSinceHeader' - responses: - '200': - description: Successful response - '304': - description: Content has not been modified since the date provided in the If-Modified-Since header - '400': - description: | - Invalid parameter: **recordId** is not a valid format, or is not a record - '401': - description: Authentication failed - '404': - description: | - **recordId** does not exist - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/records/{recordId}/file': - post: - tags: - - records - summary: File a record - description: | - Files the record **recordId** in the target record folder. - - You need to specify the target record folder by providing its id **targetParentId** - - If the record is already filed, a link to the target record folder is created. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: fileRecord - parameters: - - $ref: '#/parameters/recordIdParam' - - $ref: '#/parameters/recordEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: nodeBodyFile - description: The target record folder id - required: true - schema: - $ref: '#/definitions/RequestBodyFile' - consumes: - - application/json - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordEntry' - '400': - description: | - Invalid parameter: **recordIdParam** or **targetParentId** is not a valid format, - **recordIdParam** is not a record, **targetParentId** is not a record container or **nodeBodyFile** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to create children of **nodeId** - '404': - description: | - **recordIdParam** or **targetParentId** does not exist - '422': - description: | - Model integrity exception: the action breaks system's integrity restrictions - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/records/{recordId}/complete': - post: - tags: - - records - summary: Complete a record - description: | - Completes the record **recordId**. - operationId: completeRecord - parameters: - - $ref: '#/parameters/recordIdParam' - - $ref: '#/parameters/recordEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - consumes: - - application/json - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordEntry' - '400': - description: | - Invalid parameter: **recordIdParam** is not a valid format or - **recordIdParam** is not a record - '401': - description: Authentication failed - '403': - description: >- - Current user does not have permission to complete record - **recordIdParam** - '404': - description: | - **recordIdParam** does not exist - '422': - description: | - Model integrity exception: the action breaks system's integrity restrictions - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - ## Files - '/files/{fileId}/declare': - post: - tags: - - files - summary: Declare as record - description: Declares the file **fileId** in the unfiled records container. The original file is moved to the Records Management site and a secondary parent association is created in the file's original site. Optionally, a destination record folder may be specified, enabling the record to be filed directly into that folder. - operationId: declareRecord - parameters: - - name: fileId - in: path - description: The identifier of a non-record file. - required: true - type: string - - name: hideRecord - in: query - description: Flag to indicate whether the record should be hidden from the current parent folder. - type: boolean - default: false - - name: parentId - in: query - description: The identifier of the destination record folder. - required: false - type: string - - $ref: '#/parameters/recordEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - consumes: - - application/json - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/RecordEntry' - '400': - description: | - Invalid parameter: **fileId** is not a valid format or **parentId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to declare a record - '404': - description: | - **fileId** does not exist or **parentId** does not exist - '422': - description: | - Model integrity exception: the action breaks system's integrity restrictions - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - ## Transfer Containers - '/transfer-containers/{transferContainerId}': - get: - tags: - - transfer-containers - summary: Get a transfer container - description: | - Gets information for transfer container **transferContainerId** - - Mandatory fields and the transfer container's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getTransferContainer - parameters: - - $ref: '#/parameters/transferContainerIdWithAliasParam' - - $ref: '#/parameters/transferContainerEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/TransferContainerEntry' - '400': - description: | - Invalid parameter: **transferContainerId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **transferContainerId** - '404': - description: "**transferContainerId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - put: - tags: - - transfer-containers - summary : Update transfer container - description: | - Updates the transfer container **transferContainerId**. For example, you can rename transfer container: - ```JSON - { - "name":"My new name" - } - ``` - You can also set or update description and title properties: - ```JSON - { - "properties": - { - "cm:description": "New Description", - "cm:title":"New Title" - } - } - ``` - **Note:** Currently there is no optimistic locking for updates, so they are applied in "last one wins" order. - operationId: updateTransferContainer - parameters: - - $ref: '#/parameters/transferContainerIdWithAliasParam' - - $ref: '#/parameters/transferContainerEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - - in: body - name: nodeBodyUpdate - description: The node information to update. - required: true - schema: - $ref: '#/definitions/TransferContainerBodyUpdate' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/TransferContainerEntry' - '400': - description: | - Invalid parameter: the update request is invalid or **transferContainerId** is not a valid format or **nodeBody** is invalid - '401': - description: Authentication failed - '403': - description: Current user does not have permission to update **transferContainerId** - '404': - description: "**transferContainerId** does not exist" - '409': - description: Updated name clashes with an existing node in the current parent folder - '422': - description: Model integrity exception, including transfer container name with invalid characters - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/transfer-containers/{transferContainerId}/transfers': - get: - tags: - - transfer-containers - summary: List transfer container's children - description: | - Returns a list of transfers. - - Minimal information for each child is returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: listTransfers - produces: - - application/json - parameters: - - $ref: '#/parameters/transferContainerIdWithAliasParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/transferContainerChildEntryIncludeParam' - - $ref: '#/parameters/transferContainerIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/TransferContainerAssociationPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **transferContainerId** - '404': - description: "**transferContainerId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - ## Transfers - '/transfers/{transferId}': - get: - tags: - - transfers - summary: Get a transfer - description: | - Gets information for transfer **transferId** - - Mandatory fields and the transfer's aspects and properties are returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: getTransfer - parameters: - - $ref: '#/parameters/transferIdParam' - - $ref: '#/parameters/transferEntryIncludeParam' - - $ref: '#/parameters/fieldsParam' - produces: - - application/json - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/TransferEntry' - '400': - description: | - Invalid parameter: **transferId** is not a valid format - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **transferId** - '404': - description: "**transferId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' - '/transfers/{transferId}/children': - get: - tags: - - transfers - summary: List transfer's children - description: | - Gets a list of transfer's children. - - Minimal information for each child is returned by default. - - You can use the **include** parameter (include=allowableOperations) to return additional information. - operationId: listTransfersChildren - produces: - - application/json - parameters: - - $ref: '#/parameters/transferIdParam' - - $ref: '#/parameters/skipCountParam' - - $ref: '#/parameters/maxItemsParam' - - $ref: '#/parameters/transferChildEntryIncludeParam' - - $ref: '#/parameters/transferIncludeSourceParam' - - $ref: '#/parameters/fieldsParam' - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/TransferAssociationPaging' - '401': - description: Authentication failed - '403': - description: Current user does not have permission to read **transferId** - '404': - description: "**transferId** does not exist" - default: - description: Unexpected error - schema: - $ref: '#/definitions/Error' -parameters: - ## File plans - filePlanEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the file plan. Any optional field from the response model can be requested. For example: - * allowableOperations - * path - required: false - type: array - items: - type: string - collectionFormat: csv - filePlanCategoriesEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the record category. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * hasRetentionSchedule - * path - * properties - required: false - type: array - items: - type: string - collectionFormat: csv - filePlanIdWithAliasParam: - name: filePlanId - in: path - description: The identifier of a file plan. You can also use the -filePlan- alias. - required: true - type: string - filePlanIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with folder information on the parent node – the specified parent **filePlanId** - required: false - type: boolean - ## Unfiled records containers - unfiledContainerIdParam: - name: unfiledContainerId - in: path - description: - The identifier of an unfiled records container. You can use the **-unfiled-** alias. - required: true - type: string - unfiledContainerEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the unfiled records container's children. Any optional field from the response model can be requested. For example: - * allowableOperations - * path - required: false - type: array - items: - type: string - collectionFormat: csv - unfiledContainerChildEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the unfiled records container's children. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * association - * path - * properties - required: false - type: array - items: - type: string - collectionFormat: csv - unfiledContainerIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with folder information on the parent node – the specified parent **unfiledContainerId** - required: false - type: boolean -## Unfiled record folders - unfiledRecordFolderIdParam: - name: unfiledRecordFolderId - in: path - description: - The identifier of an unfiled record folder. - required: true - type: string - unfiledRecordFolderEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the unfiled records container's children. Any optional field from the response model can be requested. For example: - * allowableOperations - * path - required: false - type: array - items: - type: string - collectionFormat: csv - unfiledRecordFolderChildEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the unfiled records container's children. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * association - * path - * properties - required: false - type: array - items: - type: string - collectionFormat: csv - unfiledRecordFolderRelativePathParam: - name: relativePath - in: query - description: | - Return information on children in the unfiled records container resolved by this path. The path is relative to **unfiledRecordFolderId**. - required: false - type: string - unfiledRecordFolderIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with folder information on the parent node – either the specified parent **unfiledRecordFolderId**, or as resolved by **relativePath**. - required: false - type: boolean - unfiledRecordFolderAndContainerWhereParam: - name: where - in: query - description: | - Optionally filter the list. Here are some examples: - - * ```where=(isRecord=true)``` - - * ```where=(isUnfiledRecordFolder=false)``` - - * ```where=(nodeType='cm:content INCLUDESUBTYPES')``` - - required: false - type: string - ## Record categories - recordCategoryIdParam: - name: recordCategoryId - in: path - description: - The identifier of a record category. - required: true - type: string - recordCategoryEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the record category. Any optional field from the response model can be requested. For example: - * allowableOperations - * hasRetentionSchedule - * path - required: false - type: array - items: - type: string - collectionFormat: csv - recordCategoryRelativePathParam: - name: relativePath - in: query - description: | - Return information on children in the record category resolved by this path. The path is relative to **recordCategoryId**. - required: false - type: string - recordCategoryIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with folder information on the parent node – either the specified parent **recordCategoryId**, or as resolved by **relativePath**. - required: false - type: boolean - recordCategoryChildEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the record category child. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * hasRetentionSchedule - * isClosed - * isRecordCategory - * isRecordFolder - * path - * properties - required: false - type: array - items: - type: string - collectionFormat: csv - recordCategoryWhereParam: - name: where - in: query - description: | - Optionally filter the list. Here are some examples: - - * ```where=(nodeType='rma:recordFolder')``` - - * ```where=(nodeType='rma:recordCategory')``` - - * ```where=(isRecordFolder=true AND isClosed=false)``` - - required: false - type: string - ## Record folders - recordFolderIdParam: - name: recordFolderId - in: path - description: - The identifier of a record folder. - required: true - type: string - recordFolderEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the record folders. Any optional field from the response model can be requested. For example: - * allowableOperations - * isClosed - * path - required: false - type: array - items: - type: string - collectionFormat: csv - recordFolderIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with record information on the parent folder – the specified parent **recordFolderId** - required: false - type: boolean - recordFolderChildEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the records. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * association - * content - * isCompleted - * path - * properties - required: false - type: array - items: - type: string - collectionFormat: csv - recordFolderWhereParam: - name: where - in: query - description: | - Optionally filter the list. Here are some examples: - - * ```where=(nodeType='my:specialNodeType')``` - - * ```where=(nodeType='my:specialNodeType INCLUDESUBTYPES')``` - - * ```where=(isPrimary=true)``` - - required: false - type: string - ## Transfer Containers - transferContainerIdWithAliasParam: - name: transferContainerId - in: path - description: The identifier of a transfer container. You can also use the -transfers- alias. - required: true - type: string - transferContainerEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the transfer container. Any optional field from the response model can be requested. For example: - * allowableOperations - * path - required: false - type: array - items: - type: string - collectionFormat: csv - transferContainerChildEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the transfer folders. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * properties - * transferPDFIndicator - * transferLocation - * transferAccessionIndicator - required: false - type: array - items: - type: string - collectionFormat: csv - transferContainerIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with folder information on the specified parent **transferContainerId**. - required: false - type: boolean - ## Transfers - transferEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the transfer folder. Any optional field from the response model can be requested. For example: - * allowableOperations - * transferPDFIndicator - * transferLocation - * transferAccessionIndicator - required: false - type: array - items: - type: string - collectionFormat: csv - transferIdParam: - name: transferId - in: path - description: The identifier of a transfer. - required: true - type: string - transferIncludeSourceParam: - name: includeSource - in: query - description: Also include **source** (in addition to **entries**) with folder information on the specified parent **transferId**. - required: false - type: boolean - transferChildEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the transfer's child. Any optional field from the response model can be requested. For example: - * allowableOperations - * aspectNames - * isClosed - * isRecord - * isRecordFolder - * path - * properties - required: false - type: array - items: - type: string - collectionFormat: csv - ## Record - recordIdParam: - name: recordId - in: path - description: The identifier of a record. - required: true - type: string - recordEntryIncludeParam: - name: include - in: query - description: | - Returns additional information about the record. Any optional field from the response model can be requested. For example: - * allowableOperations - * content - * isCompleted - * path - required: false - type: array - items: - type: string - collectionFormat: csv - ## Core definition - fieldsParam: - name: fields - in: query - description: | - A list of field names. - - You can use this parameter to restrict the fields - returned within a response if, for example, you want to save on overall bandwidth. - - The list applies to a returned individual - entity or entries within a collection. - - If the API method also supports the **include** - parameter, then the fields specified in the **include** - parameter are returned in addition to those specified in the **fields** parameter. - required: false - type: array - items: - type: string - collectionFormat: csv - ## Core definition - skipCountParam: - name: skipCount - in: query - description: The number of entities that exist in the collection before those included in this list. - required: false - type: integer - minimum: 0 - ## Core definition - maxItemsParam: - name: maxItems - in: query - description: The maximum number of items to return in the list. - required: false - type: integer - minimum: 1 - # Core definition - attachmentParam: - name: attachment - in: query - description: | - **true** enables a web browser to download the file as an attachment. - **false** means a web browser may preview the file in a new tab or window, but not - download the file. - - You can only set this parameter to **false** if the content type of the file is in the supported list; - for example, certain image files and PDF files. - - If the content type is not supported for preview, then a value of **false** is ignored, and - the attachment will be returned in the response. - required: false - default: true - type: boolean - # Core definition - ifModifiedSinceHeader: - name: If-Modified-Since - in: header - description: | - Only returns the content if it has been modified since the date provided. - Use the date format defined by HTTP. For example, `Wed, 09 Mar 2016 16:56:34 GMT`. - required: false - type: string - format: date-time - # Core definition - autoRenameParam: - name: autoRename - in: query - description: | - If true, then a name clash will cause an attempt to auto rename by finding a unique name using an integer suffix. - required: false - type: boolean -definitions: - FilePlanComponentBodyUpdate: - type: object - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - aspectNames: - type: array - items: - type: string - properties: - type: object - additionalProperties: - type: string - ## File plans - FilePlan: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - FilePlanEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/FilePlan' - FilePlanBodyUpdate: - type: object - properties: - properties: - type: object - additionalProperties: - type: string - RootCategoryBodyCreate: - type: object - required: - - name - - nodeType - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - aspectNames: - type: array - items: - type: string - properties: - type: object - additionalProperties: - type: string - ## Unfiled records containers - UnfiledContainer: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - UnfiledContainerEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/UnfiledContainer' - UnfiledContainerChild: - type: object - required: - - id - - name - - nodeType - - isUnfiledRecordFolder - - isRecord - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - isUnfiledRecordFolder: - type: boolean - isRecord: - type: boolean - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - UnfiledContainerAssociationPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/UnfiledContainerChildAssociationEntry' - source: - $ref: '#/definitions/UnfiledContainer' - UnfiledContainerChildAssociationEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/UnfiledContainerChildAssociation' - UnfiledContainerChildAssociation: - allOf: - - $ref: '#/definitions/UnfiledContainerChild' - - type: object - properties: - association: - $ref: '#/definitions/ChildAssociationInfo' - UnfiledRecordContainerBodyUpdate: - type: object - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - properties: - type: object - additionalProperties: - type: string - ## Unfiled record folder - UnfiledRecordFolder: - type: object - required: - - id - - name - - nodeType - - isUnfiledRecordFolder - - isRecord - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - isUnfiledRecordFolder: - type: boolean - isRecord: - type: boolean - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - UnfiledRecordFolderEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/UnfiledRecordFolder' - UnfiledRecordFolderChild: - type: object - required: - - id - - name - - nodeType - - isUnfiledRecordFolder - - isRecord - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - isUnfiledRecordFolder: - type: boolean - isRecord: - type: boolean - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - UnfiledRecordFolderAssociationPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/UnfiledRecordFolderChildAssociationEntry' - source: - $ref: '#/definitions/UnfiledRecordFolder' - UnfiledRecordFolderChildAssociationEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/UnfiledRecordFolderChildAssociation' - UnfiledRecordFolderChildAssociation: - allOf: - - $ref: '#/definitions/UnfiledRecordFolderChild' - - type: object - properties: - association: - $ref: '#/definitions/ChildAssociationInfo' - UnfiledRecordFolderBodyUpdate: - type: object - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - properties: - type: object - additionalProperties: - type: string - ## Record categories - RecordCategory: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - hasRetentionSchedule: - type: boolean - default: false - description: Indicates if the record category has a retention schedule defined - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - RecordCategoryChild: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - hasRetentionSchedule: - type: boolean - default: false - description: Indicates if the record category has a retention schedule defined - isClosed: - type: boolean - default: false - description: Indicates if the record folder is closed - isRecordCategory: - type: boolean - isRecordFolder: - type: boolean - default: false - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - RecordCategoryEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/RecordCategory' - RecordCategoryChildEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/RecordCategoryChild' - RecordCategoryPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/RecordCategoryEntry' - source: - $ref: '#/definitions/FilePlan' - RecordCategoryChildPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/RecordCategoryChildEntry' - source: - $ref: '#/definitions/RecordCategory' - ## Record folder - RecordFolder: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - isClosed: - type: boolean - default: false - description: Indicates if the record folder is closed - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - RecordFolderEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/RecordFolder' - RecordFolderAssociationPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/RecordFolderChildAssociationEntry' - source: - $ref: '#/definitions/RecordFolder' - RecordFolderChildAssociationEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/RecordFolderChildAssociation' - RecordFolderChildAssociation: - allOf: - - $ref: '#/definitions/Record' - - type: object - properties: - association: - $ref: '#/definitions/ChildAssociationInfo' - ## Record - Record: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - isCompleted: - type: boolean - default: false - description: Present only for record nodes. Indicates if the record is completed - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - content: - $ref: '#/definitions/ContentInfo' - path: - $ref: '#/definitions/PathInfo' - RecordEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/Record' - ## Transfer Containers - TransferContainer: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - TransferContainerEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/TransferContainer' - TransferContainerChild: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - transferPDFIndicator: - type: boolean - default: false - description: Present only for transfer nodes. - transferLocation: - type: string - description: Present only for transfer nodes. - transferAccessionIndicator: - type: boolean - default: false - description: Present only for transfer nodes. - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - TransferContainerAssociationPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/TransferContainerChildAssociationEntry' - source: - $ref: '#/definitions/TransferContainer' - TransferContainerChildAssociationEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/TransferContainerChildAssociation' - TransferContainerChildAssociation: - allOf: - - $ref: '#/definitions/TransferContainerChild' - - type: object - properties: - association: - $ref: '#/definitions/ChildAssociationInfo' - TransferContainerBodyUpdate: - type: object - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - properties: - type: object - additionalProperties: - type: string - ## Transfers - Transfer: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - transferPDFIndicator: - type: boolean - default: false - description: Present only for transfer nodes. - transferLocation: - type: string - description: Present only for transfer nodes. - transferAccessionIndicator: - type: boolean - default: false - description: Present only for transfer nodes. - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - TransferEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/Transfer' - TransferChild: - type: object - required: - - id - - name - - nodeType - - createdAt - - createdByUser - - modifiedAt - - modifiedByUser - - parentId - properties: - id: - type: string - parentId: - type: string - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - isRecordFolder: - type: boolean - default: false - isRecord: - type: boolean - default: false - isClosed: - type: boolean - default: false - description: Indicates if the record folder is closed - modifiedAt: - type: string - format: date-time - modifiedByUser: - $ref: '#/definitions/UserInfo' - createdAt: - type: string - format: date-time - createdByUser: - $ref: '#/definitions/UserInfo' - aspectNames: - type: array - items: - type: string - properties: - type: object - allowableOperations: - type: array - items: - type: string - path: - $ref: '#/definitions/PathInfo' - TransferAssociationPaging: - type: object - properties: - list: - type: object - properties: - pagination: - $ref: '#/definitions/Pagination' - entries: - type: array - items: - $ref: '#/definitions/TransferChildAssociationEntry' - source: - $ref: '#/definitions/Transfer' - TransferChildAssociationEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/TransferChildAssociation' - TransferChildAssociation: - allOf: - - $ref: '#/definitions/TransferChild' - - type: object - properties: - association: - $ref: '#/definitions/ChildAssociationInfo' - ## - RequestBodyFile: - type: object - required: - - targetParentId - properties: - targetParentId: - type: string - ## Core definition - ChildAssociationInfo: - type: object - required: - - assocType - - isPrimary - properties: - assocType: - type: string - isPrimary: - type: boolean - ## Core definition - Pagination: - type: object - required: - - count - - hasMoreItems - - skipCount - - maxItems - properties: - count: - type: integer - format: int64 - description: | - The number of objects in the entries array. - hasMoreItems: - type: boolean - description: | - A boolean value which is **true** if there are more entities in the collection - beyond those in this response. A true value means a request with a larger value - for the **skipCount** or the **maxItems** parameter will return more entities. - totalItems: - type: integer - format: int64 - description: | - An integer describing the total number of entities in the collection. - The API might not be able to determine this value, - in which case this property will not be present. - skipCount: - type: integer - format: int64 - description: | - An integer describing how many entities exist in the collection before - those included in this list. - maxItems: - type: integer - format: int64 - description: | - The value of the **maxItems** parameter used to generate this list, - or if there was no **maxItems** parameter the default value is 100 - ## Core definition - Error: - type: object - required: - - error - properties: - error: - type: object - required: - - statusCode - - briefSummary - - stackTrace - - descriptionURL - properties: - errorKey: - type: string - statusCode: - type: integer - format: int32 - briefSummary: - type: string - stackTrace: - type: string - descriptionURL: - type: string - logId: - type: string - ## Core definition - UserInfo: - type: object - required: - - displayName - - id - properties: - displayName: - type: string - id: - type: string - ## Core definition - ContentInfo: - type: object - required: - - mimeType - - mimeTypeName - - sizeInBytes - - encoding - properties: - mimeType: - type: string - mimeTypeName: - type: string - sizeInBytes: - type: integer - encoding: - type: string - ## Core definition - PathElement: - type: object - properties: - id: - type: string - name: - type: string - ## Core definition - PathInfo: - type: object - properties: - elements: - type: array - items: - $ref: '#/definitions/PathElement' - name: - type: string - isCompleted: - type: boolean - RMNodeBodyCreate: - type: object - required: - - name - - nodeType - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - aspectNames: - type: array - items: - type: string - properties: - type: object - additionalProperties: - type: string - RMNodeBodyCreateWithRelativePath: - type: object - required: - - name - - nodeType - properties: - name: - type: string - pattern: "^(?!(.*[\\\"\\*\\\\\\>\\<\\?\\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))" - description: | - The name must not contain spaces or the following special characters: * " < > \ / ? : and |. - The character . must not be used at the end of the name. - nodeType: - type: string - aspectNames: - type: array - items: - type: string - properties: - type: object - additionalProperties: - type: string - relativePath: - type: string - RMSiteBodyCreate: - type: object - required: - - title - properties: - title: - type: string - description: - type: string - compliance: - type: string - default: STANDARD - enum: - - STANDARD - - DOD5015 - RMSiteBodyUpdate: - type: object - properties: - title: - type: string - description: - type: string - RMSiteEntry: - type: object - required: - - entry - properties: - entry: - $ref: '#/definitions/RMSite' - RMSite: - type: object - required: - - id - - guid - - title - - visibility - - compliance - properties: - id: - type: string - guid: - type: string - title: - type: string - description: - type: string - visibility: - type: string - enum: - - PRIVATE - - MODERATED - - PUBLIC - compliance: - type: string - enum: - - STANDARD - - DOD5015 - role: - type: string - enum: - - SiteConsumer - - SiteCollaborator - - SiteContributor - - SiteManager diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/src/main/webapp/index.html b/amps/ags/rm-community/rm-community-rest-api-explorer/src/main/webapp/index.html deleted file mode 100644 index dd62f3770e..0000000000 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/src/main/webapp/index.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - Alfresco Governance Services REST API Explorer - - - - - - - - - -
- - - - - - \ No newline at end of file diff --git a/amps/ags/srcclr.yml b/amps/ags/srcclr.yml deleted file mode 100644 index 73aea3ff53..0000000000 --- a/amps/ags/srcclr.yml +++ /dev/null @@ -1,2 +0,0 @@ -# The scope of this file is to have a custom scan directive for SourceClear excluding automation and benchmark projects from the scan. -custom_maven_command: install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file diff --git a/amps/ags/travis/scripts/getLogs.sh b/amps/ags/travis/scripts/getLogs.sh deleted file mode 100644 index b84c408689..0000000000 --- a/amps/ags/travis/scripts/getLogs.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -x - -# Display running containers -docker ps - -alfrescoContainerId=$(docker ps -a | grep '_alfresco_' | awk '{print $1}') -shareContainerId=$(docker ps -a | grep '_share_' | awk '{print $1}') -solrContainerId=$(docker ps -a | grep '_search_' | awk '{print $1}') - -docker logs $alfrescoContainerId > alfresco.log -if [ -n "$shareContainerId" ]; then - docker logs $shareContainerId > share.log -fi -if [ -n "$solrContainerId" ]; then - docker logs $solrContainerId > solr.log -fi diff --git a/amps/pom.xml b/amps/pom.xml deleted file mode 100644 index 5bf9ddcd63..0000000000 --- a/amps/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - 4.0.0 - alfresco-community-repo-amps - AMPs - pom - - - org.alfresco - alfresco-community-repo - 11.28-SNAPSHOT - - - - share-services - - - - - - ags - - ags - - - - diff --git a/amps/share-services/pom.xml b/amps/share-services/pom.xml deleted file mode 100644 index 728b60cf41..0000000000 --- a/amps/share-services/pom.xml +++ /dev/null @@ -1,253 +0,0 @@ - - 4.0.0 - alfresco-share-services - Alfresco Share Services AMP - Module to be applied to alfresco.war, containing APIs for Alfresco Share - amp - - - org.alfresco - alfresco-community-repo-amps - 11.28-SNAPSHOT - - - - ${project.parent.scm.url} - ${buildNumber} - - - - - org.alfresco - alfresco-remote-api - ${project.version} - provided - - - org.alfresco - alfresco-core - - - - javax.servlet - jstl - - - commons-collections - commons-collections - - - - - org.alfresco - alfresco-core - ${project.version} - provided - - - dom4j - dom4j - - - - - commons-lang - commons-lang - provided - - - - - org.alfresco - alfresco-sync-events - 1.2.14 - provided - - - - - junit - junit - test - - - org.postgresql - postgresql - test - - - org.alfresco - alfresco-core - ${project.version} - tests - test - - - org.alfresco - alfresco-repository - ${project.version} - tests - test - - - dom4j - dom4j - - - org.alfresco - alfresco-core - - - - javax.servlet - jstl - - - commons-collections - commons-collections - - - - - org.alfresco - alfresco-remote-api - ${project.version} - tests - test - - - org.alfresco.surf - spring-webscripts - ${dependency.webscripts.version} - tests - test - - - commons-collections - commons-collections - - - - - org.springframework - spring-test - test - - - javax.servlet - javax.servlet-api - provided - - - - - org.apache.taglibs - taglibs-standard-spec - provided - - - org.apache.taglibs - taglibs-standard-impl - provided - - - org.apache.taglibs - taglibs-standard-jstlel - provided - - - - - - - src/main/resources - - - - src/main/amp - ../${project.build.finalName} - true - - - - - src/test/resources - - - - src/main/amp/config - true - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - true - - - - true - true - - - ${acs.version.major}.${acs.version.minor}.${acs.version.revision} - ${project.version} - ${maven.build.timestamp} - ${bamboo_planName} - ${bamboo_fullBuildKey} - ${build-number} - ${scm-revision} - - - - - - - maven-surefire-plugin - - - default-test - - - - - nothing - - - - - - - - - - - integration-tests - - false - - - - - maven-surefire-plugin - - - integration-tests - - test - - - - **/*Test.java - - - - - - - - - - diff --git a/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/alfresco-global.properties b/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/alfresco-global.properties deleted file mode 100644 index 07e6af8e37..0000000000 --- a/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/alfresco-global.properties +++ /dev/null @@ -1,5 +0,0 @@ -# -# Disable load of sample site -# -sample.site.disabled=false - diff --git a/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/module-bootstrap-context.xml b/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/module-bootstrap-context.xml deleted file mode 100644 index 6b16204ddb..0000000000 --- a/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/module-bootstrap-context.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - alfresco/model/datalistModel.xml - - - - - alfresco/messages/data-list-model - - - - - - diff --git a/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/module-context.xml b/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/module-context.xml deleted file mode 100644 index 266f9e8f5c..0000000000 --- a/amps/share-services/src/main/amp/config/alfresco/module/alfresco-share-services/module-context.xml +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - - - - patch.siteLoadPatch.swsdp - patch.siteLoadPatch.description - 0 - ${version.schema} - 100000 - ${sample.site.disabled} - - - - - - - - - - - - - swsdp - - - - - - alfresco/bootstrap/team-sample-sites/swsdp/Users.acp - - - - - alfresco/bootstrap/team-sample-sites/swsdp/People.acp - - - - - alfresco/bootstrap/team-sample-sites/swsdp/Groups.txt - - - - - alfresco/bootstrap/team-sample-sites/swsdp/Contents.acp - - - - - - - - - - - - - - - - - - dl:todoTitle,dl:todoDueDate,dl:todoPriority,dl:todoStatus,dl:todoNotes,dl:assignee,dl:attachments - - - cm:title,cm:description,dl:ganttStartDate,dl:ganttEndDate,dl:taskAssignee,dl:taskPriority,dl:taskStatus,dl:ganttPercentComplete,dl:taskComments,cm:attachments - - - cm:title,cm:description,dl:simpletaskDueDate,dl:simpletaskPriority,dl:simpletaskStatus,dl:simpletaskComments - - - dl:contactFirstName,dl:contactLastName,dl:contactEmail,dl:contactCompany,dl:contactJobTitle,dl:contactPhoneOffice,dl:contactPhoneMobile,dl:contactNotes - - - dl:issueID,cm:title,dl:issueAssignedTo,dl:issueStatus,dl:issuePriority,cm:description,dl:issueDueDate,dl:issueComments,cm:attachments - - - cm:title,cm:description,dl:eventLocation,dl:eventStartDate,dl:eventEndDate,dl:eventRegistrations,cm:attachments,dl:eventNote - - - cm:title,dl:locationAddress1,dl:locationAddress2,dl:locationAddress3,dl:locationZip,dl:locationState,dl:locationCountry,cm:description,cm:attachments - - - dl:meetingAgendaRef,cm:title,cm:description,dl:meetingAgendaTime,dl:meetingAgendaOwner,cm:attachments - - - dl:eventAgendaRef,dl:eventAgendaStartTime,dl:eventAgendaEndTime,dl:eventAgendaSessionName,dl:eventAgendaPresenter,dl:eventAgendaAudience,cm:attachments,dl:eventAgendaNotes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.service.cmr.wiki.WikiService.listWikiPages=ACL_ALLOW,AFTER_ACL_NODE.sys:base.ReadProperties - - - - - - - - - - - - - - org.alfresco.service.cmr.wiki.WikiService - - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.readOnly} - ${server.transaction.mode.readOnly} - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - slingshotDocLib - - - - - - - - - - - diff --git a/amps/share-services/src/main/amp/module.properties b/amps/share-services/src/main/amp/module.properties deleted file mode 100644 index 917011abe0..0000000000 --- a/amps/share-services/src/main/amp/module.properties +++ /dev/null @@ -1,5 +0,0 @@ -module.id=${project.artifactId} -module.title=${project.name} -module.description=${project.description} -module.version=${version} -module.repo.version.min=6.1 diff --git a/amps/share-services/src/main/java/org/alfresco/repo/jscript/SlingshotDocLibCustomResponse.java b/amps/share-services/src/main/java/org/alfresco/repo/jscript/SlingshotDocLibCustomResponse.java deleted file mode 100644 index eb216f8f2f..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/jscript/SlingshotDocLibCustomResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.jscript; - -import org.alfresco.repo.jscript.app.CustomResponse; -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.Serializable; -import java.util.Map; - -/** - * Populates DocLib webscript response with custom metadata output - * - * @author mikeh - */ -public final class SlingshotDocLibCustomResponse extends BaseScopableProcessorExtension -{ - private Map customResponses; - - /** - * Set the custom response beans - * - * @param customResponses - */ - public void setCustomResponses(Map customResponses) - { - this.customResponses = customResponses; - } - - /** - * Returns a JSON string to be added to the DocLib webscript response. - * - * @return The JSON string - */ - public String getJSON() - { - return this.getJSONObj().toString(); - } - - /** - * Returns a JSON object to be added to the DocLib webscript response. - * - * @return The JSON object - */ - protected Object getJSONObj() - { - JSONObject json = new JSONObject(); - - - for (Map.Entry entry : this.customResponses.entrySet()) - { - try - { - Serializable response = ((CustomResponse) entry.getValue()).populate(); - json.put(entry.getKey(), response == null ? JSONObject.NULL: response); - } - catch (JSONException error) - { - error.printStackTrace(); - } - } - - return json; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/jscript/SlingshotDocLibCustomResponseRegistrar.java b/amps/share-services/src/main/java/org/alfresco/repo/jscript/SlingshotDocLibCustomResponseRegistrar.java deleted file mode 100644 index ca33588755..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/jscript/SlingshotDocLibCustomResponseRegistrar.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.jscript; - -import java.util.Map; - -/** - * Register an additional custom metadata output for the DocLib webscript response - * - * @author Will Abson - */ -public final class SlingshotDocLibCustomResponseRegistrar -{ - private Map responsesMap; - private String key; - private Object value; - - public String getKey() - { - return key; - } - - public void setKey(String key) - { - this.key = key; - } - - public Object getValue() - { - return value; - } - - public void setValue(Object value) - { - this.value = value; - } - - public Map getResponsesMap() - { - return responsesMap; - } - - public void setResponsesMap(Map responsesMap) - { - this.responsesMap = responsesMap; - } - - public void addCustomResponse() - { - responsesMap.put(key, value); - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/datalist/DataListDownloadWebScript.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/datalist/DataListDownloadWebScript.java deleted file mode 100644 index 61d605be46..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/datalist/DataListDownloadWebScript.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.datalist; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.DataListModel; -import org.alfresco.repo.web.scripts.DeclarativeSpreadsheetWebScript; -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.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.InvalidQNameException; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.apache.commons.csv.CSVPrinter; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.poi.ss.usermodel.*; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - - -/** - * Data List Download - * - * Exports the contents of a Data List as an Excel file - * - * @author Nick Burch - */ -public class DataListDownloadWebScript extends DeclarativeSpreadsheetWebScript - implements InitializingBean -{ - // Logger - private static final Log logger = LogFactory.getLog(DataListDownloadWebScript.class); - - private static final QName DATA_LIST_ITEM_TYPE = DataListModel.PROP_DATALIST_ITEM_TYPE; - - private NodeService nodeService; - private SiteService siteService; - private NamespaceService namespaceService; - private Map> modelOrder; - private Map rawModelOrder; - - public DataListDownloadWebScript() - { - this.filenameBase = "DataListExport"; - } - - /** - * @param nodeService NodeService - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param siteService SiteService - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService NamespaceService - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - public void setModelOrder(Map rawModelOrder) - { - this.rawModelOrder = rawModelOrder; - } - - - @Override - public void afterPropertiesSet() throws Exception { - modelOrder = new HashMap>(); - for(String key : rawModelOrder.keySet()) - { - QName model; - List order = new ArrayList(); - - try - { - model= QName.createQName(key, namespaceService); - } - catch(InvalidQNameException e) - { - logger.warn("Skipping invalid model type " + key); - continue; - } - - StringTokenizer st = new StringTokenizer(rawModelOrder.get(key), ","); - while(st.hasMoreTokens()) - { - order.add( QName.createQName(st.nextToken(), namespaceService) ); - } - modelOrder.put(model, order); - } - } - - /** - * Identify the datalist - */ - @Override - protected Object identifyResource(String format, WebScriptRequest req) { - // Try to find the datalist they requested - NodeRef list; - Map args = req.getServiceMatch().getTemplateVars(); - if(args.get("store_type") != null) - { - list = new NodeRef( - args.get("store_type"), - args.get("store_id"), - args.get("id") - ); - } - else - { - // Get the site - SiteInfo site = siteService.getSite(args.get("site")); - if(site == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found with supplied name"); - } - - // Now find the data list container with in - NodeRef container = nodeService.getChildByName( - site.getNodeRef(), - ContentModel.ASSOC_CONTAINS, - args.get("container") - ); - if(container == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Container not found within site"); - } - - // Now get the data list itself - list = nodeService.getChildByName( - container, - ContentModel.ASSOC_CONTAINS, - args.get("list") - ); - } - if(list == null || !nodeService.exists(list)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The Data List could not be found"); - } - - return list; - } - - /** - * We don't have a HTML version - */ - @Override - protected boolean allowHtmlFallback() { - return false; - } - - /** - * Fetch the properties, in the requested order, from - * the data list definition - */ - @Override - protected List> buildPropertiesForHeader( - Object resource, String format, WebScriptRequest req) { - NodeRef list = (NodeRef)resource; - QName type = buildType(list); - - // Has the user given us rules for what to do - // with this type? - List props; - if(modelOrder.containsKey(type)) - { - props = modelOrder.get(type); - } - else - { - // We'll have to try to guess it for them - // For now, just use DataList properties for the type - TypeDefinition typeDef = dictionaryService.getType(type); - Map allProps = typeDef.getProperties(); - props = new ArrayList(); - - for(QName prop : allProps.keySet()) - { - if(NamespaceService.DATALIST_MODEL_1_0_URI.equals(prop.getNamespaceURI())) - { - props.add(prop); - } - } - } - - // Everything is required - List> properties = new ArrayList>(); - for(QName qname : props) - { - properties.add(new Pair(qname, true)); - } - return properties; - } - - private QName buildType(NodeRef list) - { - String typeS = (String)nodeService.getProperty(list, DATA_LIST_ITEM_TYPE); - if(! typeS.startsWith(NamespaceService.DATALIST_MODEL_PREFIX + ":")) - { - throw new WebScriptException(Status.STATUS_NOT_IMPLEMENTED, "Unexpected list type " + typeS); - } - QName type = QName.createQName(NamespaceService.DATALIST_MODEL_1_0_URI, typeS.substring(typeS.indexOf(':')+1)); - return type; - } - - private List getItems(NodeRef list) - { - Set typeSet = new HashSet(Arrays.asList(new QName[] { buildType(list) })); - - List items = new ArrayList(); - for(ChildAssociationRef ca : nodeService.getChildAssocs(list, typeSet)) - { - items.add(ca.getChildRef()); - } - return items; - } - - @Override - protected void populateBody(Object resource, CSVPrinter csv, - List properties) throws IOException { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "CSV not currently supported"); - } - - @Override - protected void populateBody(Object resource, Workbook workbook, - Sheet sheet, List properties) throws IOException { - NodeRef list = (NodeRef)resource; - List items = getItems(list); - - // Our various formats - DataFormat formatter = workbook.createDataFormat(); - - CellStyle styleInt = workbook.createCellStyle(); - styleInt.setDataFormat( formatter.getFormat("0") ); - CellStyle styleDate = workbook.createCellStyle(); - styleDate.setDataFormat( formatter.getFormat("yyyy-mm-dd") ); - CellStyle styleDouble = workbook.createCellStyle(); - styleDouble.setDataFormat( formatter.getFormat("General") ); - CellStyle styleNewLines = workbook.createCellStyle(); - styleNewLines.setWrapText(true); - - // Export the items - int rowNum = 1, colNum = 0; - for(NodeRef item : items) - { - Row r = sheet.createRow(rowNum); - - colNum = 0; - for(QName prop : properties) - { - Cell c = r.createCell(colNum); - - Serializable val = nodeService.getProperty(item, prop); - if(val == null) - { - // Is it an association, or just missing? - List assocs = nodeService.getTargetAssocs(item, prop); - if(assocs.size() > 0) - { - StringBuffer text = new StringBuffer(); - int lines = 1; - - for(AssociationRef ref : assocs) - { - NodeRef child = ref.getTargetRef(); - QName type = nodeService.getType(child); - if(ContentModel.TYPE_PERSON.equals(type)) - { - if(text.length() > 0) { - text.append('\n'); - lines++; - } - text.append(nodeService.getProperty( - child, ContentModel.PROP_USERNAME - )); - } - else if(ContentModel.TYPE_CONTENT.equals(type)) - { - // TODO Link to the content - if(text.length() > 0) { - text.append('\n'); - lines++; - } - text.append(nodeService.getProperty( - child, ContentModel.PROP_TITLE - )); - } - else - { - System.err.println("TODO: handle " + type + " for " + child); - } - } - - String v = text.toString(); - c.setCellValue( v ); - if(lines > 1) - { - c.setCellStyle(styleNewLines); - r.setHeightInPoints( lines*sheet.getDefaultRowHeightInPoints() ); - } - } - else - { - // This property isn't set - c.setCellType(CellType.BLANK); - } - } - else - { - // Regular property, set - if(val instanceof String) - { - c.setCellValue((String)val); - } - else if(val instanceof Date) - { - c.setCellValue((Date)val); - c.setCellStyle(styleDate); - } - else if(val instanceof Integer || val instanceof Long) - { - double v = 0.0; - if(val instanceof Long) v = (double)(Long)val; - if(val instanceof Integer) v = (double)(Integer)val; - c.setCellValue(v); - c.setCellStyle(styleInt); - } - else if(val instanceof Float || val instanceof Double) - { - double v = 0.0; - if(val instanceof Float) v = (double)(Float)val; - if(val instanceof Double) v = (double)(Double)val; - c.setCellValue(v); - c.setCellStyle(styleDouble); - } - else - { - // TODO - System.err.println("TODO: handle " + val.getClass().getName() + " - " + val); - } - } - - colNum++; - } - - rowNum++; - } - - // Sensible column widths please! - colNum = 0; - for(QName prop : properties) - { - sheet.autoSizeColumn(colNum); - colNum++; - } - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/search/AutoSuggestSearchGet.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/search/AutoSuggestSearchGet.java deleted file mode 100644 index 9731afcd78..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/search/AutoSuggestSearchGet.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.search; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.service.cmr.search.SuggesterParameters; -import org.alfresco.service.cmr.search.SuggesterResult; -import org.alfresco.service.cmr.search.SuggesterService; -import org.alfresco.util.Pair; -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.WebScriptRequest; - -/** - * This class is the controller for the auto-suggest-search.get web - * script. - * - * @author Jamal Kaabi-Mofrad - * @since 5.0 - */ -public class AutoSuggestSearchGet extends DeclarativeWebScript -{ - private static final Log logger = LogFactory.getLog(AutoSuggestSearchGet.class); - - private static final String TERM = "t"; - private static final String LIMIT = "limit"; - private static final String SUGGESTIONS = "suggestions"; - - private SuggesterService suggesterService; - - public void setSuggesterService(SuggesterService suggesterService) - { - this.suggesterService = suggesterService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - - List list = new ArrayList<>(); - Map model = new HashMap(1); - model.put(SUGGESTIONS, list); - - if (!suggesterService.isEnabled()) - { - return model; - } - - String term = req.getParameter(TERM); - int limit = getLimit(req.getParameter(LIMIT)); - - if (term == null || term.isEmpty()) - { - return model; - } - - SuggesterResult result = suggesterService.getSuggestions(new SuggesterParameters(term, limit, false)); - List> suggestedTerms = result.getSuggestions(); - for (Pair pair : suggestedTerms) - { - list.add(new SearchSuggestionData(pair.getFirst(), pair.getSecond())); - - } - - if (logger.isDebugEnabled()) - { - logger.debug("Suggested terms for the [" + term + "] are: " + list); - } - - return model; - } - - private int getLimit(String limit) - { - if (limit == null) - { - return -1; - } - try - { - return Integer.parseInt(limit); - } - catch (NumberFormatException ne) - { - return -1; - } - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/search/SearchSuggestionData.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/search/SearchSuggestionData.java deleted file mode 100644 index 05dc53592d..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/search/SearchSuggestionData.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.search; - -/** - * Basic POJO to represent a term suggestion. - * - * @author Jamal Kaabi-Mofrad - * @since 5.0 - */ -public class SearchSuggestionData -{ - private final String term; - private final int weight; - - public SearchSuggestionData(String term, int weight) - { - this.term = term; - this.weight = weight; - } - - public String getTerm() - { - return this.term; - } - - public int getWeight() - { - return this.weight; - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(100); - builder.append("SearchSuggestionData [term=").append(this.term).append(", weight=").append(this.weight) - .append("]"); - return builder.toString(); - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/site/SiteShareViewUrlGet.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/site/SiteShareViewUrlGet.java deleted file mode 100644 index 99ee2d78bf..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/site/SiteShareViewUrlGet.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.site; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.DataListModel; -import org.alfresco.model.ForumModel; -import org.alfresco.repo.admin.SysAdminParams; -import org.alfresco.repo.calendar.CalendarModel; -import org.alfresco.repo.site.SiteModel; -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.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.UrlUtil; -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; - -/** - * Returns the Share URL to view a given NodeRef. - * - * The supplied NodeRef must be within a Site, and must be - * of a type supported by Share - * - * @author Nick Burch - * @since 4.0.2 - */ -public class SiteShareViewUrlGet extends DeclarativeWebScript -{ - private static Log logger = LogFactory.getLog(SiteShareViewUrlGet.class); - - protected NodeService nodeService; - protected SiteService siteService; - protected SysAdminParams sysAdminParams; - protected DictionaryService dictionaryService; - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Grab the NodeRef - String nodeRefS = req.getParameter("nodeRef"); - if (nodeRefS == null) - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "NodeRef must be supplied"); - if (! NodeRef.isNodeRef(nodeRefS)) - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Invalid NodeRef"); - - // Check the node exists - NodeRef nodeRef = new NodeRef(nodeRefS); - if (! nodeService.exists(nodeRef)) - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Node Does Not Exist"); - - - // Work out what site it's in, and what container in the site - SiteInfo site = null; - NodeRef siteContainer = null; - { - NodeRef current = nodeRef; - NodeRef prev = null; - while (current != null) - { - // Are we at a site yet? - QName type = nodeService.getType(current); - if (dictionaryService.isSubClass(type, SiteModel.TYPE_SITE)) - { - // Found it! - siteContainer = prev; - site = siteService.getSite(current); - break; - } - - // Step down - prev = current; - current = nodeService.getPrimaryParent(current).getParentRef(); - } - } - if (site == null) - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Node isn't part of a site"); - - // Grab the main URL for the site - String baseUrl = getShareSiteRootStem(req, site); - - // Identify the appropriate Share URL, based on the Node Type - QName nodeType = nodeService.getType(nodeRef); - - - // Start on the model - Map model = new HashMap(); - model.put("node", nodeRef); - model.put("site", site); - model.put("type", nodeType); - - // Get the URL, and we're done - String page = identifySharePage(nodeRef, site, siteContainer, nodeType); - model.put("url", baseUrl + page); - - return model; - } - - private static QName TYPE_LINK = QName.createQName(NamespaceService.LINKS_MODEL_1_0_URI, "link"); - protected String identifySharePage(NodeRef nodeRef, SiteInfo site, NodeRef siteContainer, QName nodeType) - { - // Grab the name of the Node itself - often used for the URL - String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - - - // Wiki and Blog both use cm:content in special containers - if (siteContainer != null && dictionaryService.isSubClass(nodeType, ContentModel.TYPE_CONTENT)) - { - QName containerName = nodeService.getPrimaryParent(siteContainer).getQName(); - if (containerName.equals( QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "blog") )) - { - // Wiki - cm:content in folder called cm:wiki - return "wiki-page?title=" + name; - } - if (containerName.equals( QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "wiki") )) - { - // Blog - cm:content in cm:blog - return "blog-postview?postId=" + name; - } - } - - // Is it a Data List? - if (dictionaryService.isSubClass(nodeType, DataListModel.TYPE_DATALIST)) - { - return "data-lists?list=" + name; - } - - // Is it a Link? - if (dictionaryService.isSubClass(nodeType, TYPE_LINK)) - { - return "links-view?linkId=" + name; - } - - // Is it a Calendar Entry? - if (dictionaryService.isSubClass(nodeType, CalendarModel.TYPE_EVENT)) - { - // Find the date - Date date = (Date)nodeService.getProperty(nodeRef, CalendarModel.PROP_FROM_DATE); - SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); - - // Build the URL based on it - return "calendar?date=" + fmt.format(date); - } - - // Is it a discussions topic or post? - if (dictionaryService.isSubClass(nodeType, ForumModel.TYPE_TOPIC)) - { - // Topic is easy - return "discussions-topicview?topicId=" + name; - } - if (dictionaryService.isSubClass(nodeType, ForumModel.TYPE_POST)) - { - // Go from post to the topic, then list from there - NodeRef postTopic = nodeService.getPrimaryParent(nodeRef).getParentRef(); - String topicName = (String)nodeService.getProperty(postTopic, ContentModel.PROP_NAME); - return "discussions-topicview?topicId=" + topicName; - } - - // Is it just regular content? - if (dictionaryService.isSubClass(nodeType, ContentModel.TYPE_CONTENT)) - { - // Simple, Document Details with a noderef - return "document-details?nodeRef=" + nodeRef.toString(); - } - - // Is it a normal folder? - if (dictionaryService.isSubClass(nodeType, ContentModel.TYPE_FOLDER)) - { - // Need the path within the site - List paths = new ArrayList(); - NodeRef current = nodeRef; - while (current != null && !current.equals(siteContainer) && !current.equals(site.getNodeRef())) - { - paths.add( (String)nodeService.getProperty(current, ContentModel.PROP_NAME) ); - current = nodeService.getPrimaryParent(current).getParentRef(); - } - - // Invert to build the path - StringBuilder path = new StringBuilder(); - for (int i=paths.size()-1; i>=0; i--) - { - path.append('/'); - path.append(paths.get(i)); - } - - if (path.length() > 0) - { - // Becomes documentlibrary?path=/Docs/Beta - return "documentlibrary?path=" + path.toString(); - } - else - { - // Just the root of the document library - return "documentlibrary"; - } - } - - // If we can't work out what it is, log and take them to the site dashboard - if (logger.isDebugEnabled()) - logger.debug("COuldn't identify specific URL for Node " + nodeRef + " of type " + nodeType); - return "dashboard"; - } - - /** - * Returns the root of the Share Site pages for a given site, eg - * https://test.alfresco.com/share/page/site/test-site/ - */ - protected String getShareSiteRootStem(WebScriptRequest req, SiteInfo site) - { - return getShareRootUrl(req) + "page/site/" + site.getShortName() + "/"; - } - /** - * Returns the root of the Share WebApp, eg - * http://localhost:8081/share/ - */ - protected String getShareRootUrl(WebScriptRequest req) - { - return UrlUtil.getShareUrl(sysAdminParams) + "/"; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - public void setSysAdminParams(SysAdminParams sysAdminParams) - { - this.sysAdminParams = sysAdminParams; - } - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } -} \ No newline at end of file diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/AbstractWikiWebScript.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/AbstractWikiWebScript.java deleted file mode 100644 index bfcc7f5962..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/AbstractWikiWebScript.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.io.IOException; -import java.io.StringWriter; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.query.PagingRequest; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.activities.ActivityService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.NoSuchPersonException; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.alfresco.service.cmr.wiki.WikiService; -import org.alfresco.util.ScriptPagingDetails; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; -import org.springframework.extensions.surf.util.URLEncoder; -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; -import org.springframework.extensions.webscripts.json.JSONWriter; - -/** - * @author Nick Burch - * @since 4.0 - */ -public abstract class AbstractWikiWebScript extends DeclarativeWebScript -{ - public static final String WIKI_SERVICE_ACTIVITY_APP_NAME = "wiki"; - - /** - * When no maximum or paging info is given, what should we use? - */ - protected static final int MAX_QUERY_ENTRY_COUNT = 1000; - - private static Log logger = LogFactory.getLog(AbstractWikiWebScript.class); - - // Injected services - protected NodeService nodeService; - protected SiteService siteService; - protected WikiService wikiService; - protected PersonService personService; - protected ActivityService activityService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - public void setWikiService(WikiService wikiService) - { - this.wikiService = wikiService; - } - - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - public void setActivityService(ActivityService activityService) - { - this.activityService = activityService; - } - - - protected String getOrNull(JSONObject json, String key) - { - if (json.containsKey(key)) - { - return (String)json.get(key); - } - return null; - } - - /** - * Builds up a listing Paging request, based on the arguments - * specified in the URL - */ - protected PagingRequest buildPagingRequest(WebScriptRequest req) - { - return new ScriptPagingDetails(req, MAX_QUERY_ENTRY_COUNT); - } - - protected void addActivityEntry(String event, WikiPageInfo wikiPage, SiteInfo site, - WebScriptRequest req, JSONObject json) - { - addActivityEntry(event, wikiPage, site, req, json, Collections.emptyMap()); - } - - /** - * Generates an activity entry for the link - * - * @param event a String representing the event. - * @param wikiPage the wiki page generating the activity. - * @param site the site in which the wiki page was created. - * @param req the {@link WebScriptRequest}. - * @param json JSONObject - * @param additionalData any additional data required for the activity. - */ - protected void addActivityEntry(String event, - WikiPageInfo wikiPage, SiteInfo site, - WebScriptRequest req, JSONObject json, - Map additionalData) - { - // What page is this for? - String page = req.getParameter("page"); - if (page == null && json != null) - { - if (json.containsKey("page")) - { - page = (String)json.get("page"); - } - } - if (page == null) - { - // Default - page = "wiki"; - } - - try - { - StringWriter activityJson = new StringWriter(); - JSONWriter activity = new JSONWriter(activityJson); - activity.startObject(); - activity.writeValue("title", wikiPage.getTitle()); - activity.writeValue("page", page + "?title=" + URLEncoder.encodeUriComponent(wikiPage.getTitle())); - for (Map.Entry entry : additionalData.entrySet()) - { - activity.writeValue(entry.getKey(), entry.getValue()); - } - activity.endObject(); - - activityService.postActivity( - "org.alfresco.wiki.page-" + event, - site.getShortName(), - WIKI_SERVICE_ACTIVITY_APP_NAME, - activityJson.toString()); - } - catch (Exception e) - { - // Warn, but carry on - logger.warn("Error adding wiki page " + event + " to activities feed", e); - } - } - - protected NodeRef personForModel(String username) - { - if (username == null || username.isEmpty()) - { - return null; - } - - try - { - // Will turn into a Script Node needed of the person - return personService.getPerson(username); - } - catch(NoSuchPersonException e) - { - // This is normally caused by the person having been deleted - return null; - } - } - - protected Map renderWikiPage(WikiPageInfo page) - { - Map res = new HashMap<>(); - res.put("page", page); - res.put("node", page.getNodeRef()); - res.put("name", page.getSystemName()); - res.put("title", page.getTitle()); - res.put("contents", page.getContents()); - res.put("tags", page.getTags()); - - // Both forms used for dates - res.put("createdOn", page.getCreatedAt()); - res.put("modifiedOn", page.getModifiedAt()); - res.put("created", page.getCreatedAt()); - res.put("modified", page.getModifiedAt()); - - // For most things, we want blank instead of null - for (Map.Entry entry : res.entrySet()) - { - if (entry.getValue() == null) entry.setValue(""); - } - - // FTL needs a script node of the people, or null if unavailable - res.put("createdBy", personForModel(page.getCreator())); - res.put("modifiedBy", personForModel(page.getModifier())); - - // All done - return res; - } - - @Override - protected Map executeImpl(WebScriptRequest req, - Status status, Cache cache) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - if (templateVars == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "No parameters supplied"); - } - - - // Parse the JSON, if supplied - JSONObject json = null; - String contentType = req.getContentType(); - if (contentType != null && contentType.indexOf(';') != -1) - { - contentType = contentType.substring(0, contentType.indexOf(';')); - } - if (MimetypeMap.MIMETYPE_JSON.equals(contentType)) - { - JSONParser parser = new JSONParser(); - try - { - json = (JSONObject)parser.parse(req.getContent().getContent()); - } - catch (IOException | ParseException io) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Invalid JSON: " + io.getMessage()); - } - } - - - // Get the site short name. Try quite hard to do so... - String siteName = templateVars.get("siteId"); - if (siteName == null) - { - siteName = req.getParameter("site"); - } - if (siteName == null && json != null) - { - if (json.containsKey("siteid")) - { - siteName = (String)json.get("siteid"); - } - else if (json.containsKey("siteId")) - { - siteName = (String)json.get("siteId"); - } - else if(json.containsKey("site")) - { - siteName = (String)json.get("site"); - } - } - if (siteName == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "No site given"); - } - - // Grab the requested site - SiteInfo site = siteService.getSite(siteName); - if (site == null) - { - String error = "Could not find site: " + siteName; - throw new WebScriptException(Status.STATUS_NOT_FOUND, error); - } - - String pageTitle = templateVars.get("pageTitle"); - - // Have the real work done - return executeImpl(site, pageTitle, req, json, status, cache); - } - - protected abstract Map executeImpl(SiteInfo site, - String pageTitle, WebScriptRequest req, JSONObject json, - Status status, Cache cache); -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageDelete.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageDelete.java deleted file mode 100644 index c75167ec46..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageDelete.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.json.simple.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; - -/** - * This class is the controller for the wiki page listing page.delete webscript. - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiPageDelete extends AbstractWikiWebScript -{ - @Override - protected Map executeImpl(SiteInfo site, String pageTitle, - WebScriptRequest req, JSONObject json, Status status, Cache cache) - { - Map model = new HashMap(); - - // Try to find the page - WikiPageInfo page = wikiService.getWikiPage(site.getShortName(), pageTitle); - if (page == null) - { - String message = "The Wiki Page could not be found"; - throw new WebScriptException(Status.STATUS_NOT_FOUND, message); - } - - // Have the page deleted - wikiService.deleteWikiPage(page); - - // Generate an activity for this - addActivityEntry("deleted", page, site, req, json); - - // Mark it as gone - status.setCode(Status.STATUS_NO_CONTENT); - return model; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageGet.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageGet.java deleted file mode 100644 index 3c043e74b4..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageGet.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.apache.commons.lang.StringEscapeUtils; -import org.json.simple.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class is the controller for the wiki page fetching page.get webscript. - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiPageGet extends AbstractWikiWebScript -{ - private static final String MSG_NOT_FOUND= "page-not-found"; - - // For matching links. Not the best pattern ever... - private static final Pattern LINK_PATTERN = Pattern.compile("\\[\\[([^\\|#\\]]+)"); - - @Override - protected Map executeImpl(SiteInfo site, String pageTitle, - WebScriptRequest req, JSONObject json, Status status, Cache cache) - { - String strMinWikiData = req.getParameter("minWikiData"); - boolean minWikiData = strMinWikiData != null ? Boolean.parseBoolean(strMinWikiData) : false; - - final ResourceBundle rb = getResources(); - Map model = new HashMap<>(); - - // Try to find the page - WikiPageInfo page = wikiService.getWikiPage(site.getShortName(), pageTitle); - if (page == null) - { - String message = "The Wiki Page could not be found"; - status.setCode(Status.STATUS_NOT_FOUND); - status.setMessage(message); - status.setRedirect(true); - - // MNT-11595 Downgrading permission from Manager to Consumer, user still allowed to create WIKI pages - // Record these - model.put("container", site.getNodeRef()); - model.put("error", rb.getString(MSG_NOT_FOUND)); - - // Bail out - return model; - } - - - // Identify all the internal page links, valid and not - // TODO This may be a candidate for the service in future - List links = new ArrayList<>(); - List pageTitles = new ArrayList<>(); - if (page.getContents() != null) - { - Matcher m = LINK_PATTERN.matcher(page.getContents()); - while (m.find()) - { - String link = m.group(1); - if (! links.contains(link)) - { - links.add(link); - // build the list of available pages - WikiPageInfo wikiPage = wikiService.getWikiPage(site.getShortName(), StringEscapeUtils.unescapeHtml(link)); - if (wikiPage != null) - { - pageTitles.add(wikiPage.getTitle()); - } - } - } - } - - // All done - model.put("page", page); - model.put("node", page.getNodeRef()); - model.put("container", page.getContainerNodeRef()); - model.put("links", links); - model.put("pageList", pageTitles); - model.put("tags", page.getTags()); - model.put("siteId", site.getShortName()); - model.put("site", site); - model.put("minWikiData", minWikiData); - - // Double wrap - Map result = new HashMap<>(); - result.put("result", model); - return result; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageListGet.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageListGet.java deleted file mode 100644 index fee4a2c1c2..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageListGet.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.admin.SysAdminParams; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.wiki.WikiServiceImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.alfresco.util.UrlUtil; -import org.json.simple.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class is the controller for the wiki page listing pagelist.get webscript. - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiPageListGet extends AbstractWikiWebScript -{ - protected static final int RECENT_SEARCH_PERIOD_DAYS = 7; - protected static final long ONE_DAY_MS = 24*60*60*1000; - - // Injected services - private SysAdminParams sysAdminParams; - - public void setSysAdminParams(SysAdminParams sysAdminParams) - { - this.sysAdminParams = sysAdminParams; - } - - @Override - protected Map executeImpl(SiteInfo site, String pageTitle, - WebScriptRequest req, JSONObject json, Status status, Cache cache) - { - // Decide on what kind of request they wanted - String filter = req.getParameter("filter"); - String strPageMetaOnly = req.getParameter("pageMetaOnly"); - boolean pageMetaOnly = strPageMetaOnly != null ? Boolean.parseBoolean(strPageMetaOnly) : false; - - // User? - boolean userFiltering = false; - String user = null; - if ("user".equals(filter) || "myPages".equals(filter)) - { - userFiltering = true; - user = AuthenticationUtil.getFullyAuthenticatedUser(); - } - - // Date? - boolean dateFiltering = false; - boolean dateIsCreated = true; - Date from = null; - Date to = null; - if ("recentlyAdded".equals(filter) || - "recentlyCreated".equals(filter) || - "recentlyModified".equals(filter)) - { - dateFiltering = true; - if ("recentlyModified".equals(filter)) - { - dateIsCreated = false; - } - - int days = RECENT_SEARCH_PERIOD_DAYS; - String daysS = req.getParameter("days"); - if (daysS != null && daysS.length() > 0) - { - days = Integer.parseInt(daysS); - } - - Date now = new Date(); - from = new Date(now.getTime() - days*ONE_DAY_MS); - to = new Date(now.getTime() + ONE_DAY_MS); - } - - - // Get the links for the list - PagingRequest paging = buildPagingRequest(req); - PagingResults pages; - if (userFiltering) - { - pages = wikiService.listWikiPages(site.getShortName(), user, paging); - } - else if (dateFiltering) - { - if (dateIsCreated) - { - pages = wikiService.listWikiPagesByCreated(site.getShortName(), from, to, paging); - } - else - { - pages = wikiService.listWikiPagesByModified(site.getShortName(), from, to, paging); - } - } - else - { - pages = wikiService.listWikiPages(site.getShortName(), paging); - } - - - // For each one in our page, grab details of any ignored instances - List> items = new ArrayList>(); - for (WikiPageInfo page : pages.getPage()) - { - Map result = renderWikiPage(page); - items.add(result); - } - Map data = new HashMap(); - data.put("pages", items); - data.put("pageSize", paging.getMaxItems()); - data.put("startIndex", paging.getSkipCount()); - data.put("itemCount", items.size()); - - int total = items.size(); - if (pages.getTotalResultCount() != null && pages.getTotalResultCount().getFirst() != null) - { - total = pages.getTotalResultCount().getFirst(); - } - data.put("total", total); - - // We need the container node for permissions checking - NodeRef container; - if (pages.getPage().size() > 0) - { - container = pages.getPage().get(0).getContainerNodeRef(); - } - else - { - // Find the container (if it's been created yet) - container = siteService.getContainer( - site.getShortName(), WikiServiceImpl.WIKI_COMPONENT); - - if (container == null) - { - // Brand new site, no write operations on links have happened - // Fudge it for now with the site itself, the first write call - // will have the container created - container = site.getNodeRef(); - } - } - - // All done - Map wiki = new HashMap(); - wiki.put("pages", items); // Old style - wiki.put("container", container); - - if (userFiltering) - { - // We need to get all the wiki pages for "My Pages" filter otherwise - // the links for renamed wiki pages won't be rendered correctly, - // which were created by other users - pages = wikiService.listWikiPages(site.getShortName(), paging); - List pageTitles = new ArrayList(pages.getPage().size()); - for (WikiPageInfo page : pages.getPage()) - { - pageTitles.add(page.getTitle()); - } - wiki.put("pageTitles", pageTitles); - } - - Map model = new HashMap(); - model.put("data", data); // New style - model.put("wiki", wiki); - model.put("siteId", site.getShortName()); - model.put("site", site); - model.put(TemplateService.KEY_SHARE_URL, UrlUtil.getShareUrl(sysAdminParams)); - model.put("pageMetaOnly", pageMetaOnly); - return model; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageMovePost.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageMovePost.java deleted file mode 100644 index 53491cf756..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageMovePost.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.util.HashMap; -import java.util.Map; -import java.util.ResourceBundle; - -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.json.simple.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; - -/** - * This class is the controller for the wiki page renaming move.post webscript. - * - * TODO Track links to pages, so we can avoid creating the "This page has been moved" - * stubs as now, for cases where nothing links to the page being renamed. (ALF-3844) - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiPageMovePost extends AbstractWikiWebScript -{ - private static final String MSG_MOVED = "page-moved"; - private static final String MSG_MOVED_HERE = "page-moved-here"; - private static final String MSG_NOT_FOUND= "page-not-found"; - - // The 'custom0' key here refers to the org.alfresco.wiki.page-renamed {2} in activity-list.get.properties - private static final String OLD_TITLE_KEY = "custom0"; - - @Override - protected Map executeImpl(SiteInfo site, String pageTitle, - WebScriptRequest req, JSONObject json, Status status, Cache cache) - { - final Map model = new HashMap(); - final ResourceBundle rb = getResources(); - - // Try to find the page we're renaming - WikiPageInfo page = wikiService.getWikiPage(site.getShortName(), pageTitle); - if (page == null) - { - String message = "The Wiki Page could not be found"; - status.setCode(Status.STATUS_NOT_FOUND); - status.setMessage(message); - - // Wrap and bail - model.put("error", rb.getString(MSG_NOT_FOUND)); - Map result = new HashMap(); - result.put("result", model); - return result; - } - - - // Grab the new Title - // The "name" in the JSON is actually the title! - String newTitle = (String)json.get("name"); - - - // Have the page re-named, if possible - String oldTitle = page.getTitle().length() == 0 ? pageTitle : page.getTitle(); - try - { - page.setTitle(newTitle); - page = wikiService.updateWikiPage(page); - } - catch (FileExistsException e) - { - throw new WebScriptException(Status.STATUS_CONFLICT, "Duplicate page name"); - } - - - // Create the "This page has been moved" entry for the old page - String movedContent = rb.getString(MSG_MOVED) + " [[" + page.getTitle() + - "|" + rb.getString(MSG_MOVED_HERE) + "]]."; - wikiService.createWikiPage(site.getShortName(), oldTitle, movedContent); - - Map additionalData = new HashMap(); - additionalData.put(OLD_TITLE_KEY, oldTitle); - - // Add an activity entry for the rename - addActivityEntry("renamed", page, site, req, json, additionalData); - - - // All done - model.put("name", page.getSystemName()); - model.put("title", page.getTitle()); - model.put("page", page); - model.put("siteId", site.getShortName()); - model.put("site", site); - - // Double wrap - Map result = new HashMap(); - result.put("result", model); - return result; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPagePut.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPagePut.java deleted file mode 100644 index 3784d18cb2..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPagePut.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.alfresco.service.namespace.QName; -import org.json.simple.JSONArray; -import org.json.simple.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; - -/** - * This class is the controller for the wiki page creating/editing page.put webscript. - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiPagePut extends AbstractWikiWebScript -{ - // Implementation note: the wiki page webscripts do not follow the standard Alfresco convention whereby - // POST = CREATE and PUT = UPDATE. - // In this case, put is used for both create and update. - - private VersionService versionService; - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - @Override - protected Map executeImpl(SiteInfo site, String pageTitle, - WebScriptRequest req, JSONObject json, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Grab the details of the change - // Fetch the contents - String contents = (String)json.get("pagecontent"); - - // Fetch the title, used only when creating - String title; - if (json.containsKey("title")) - { - title = (String)json.get("title"); - } - else - { - title = pageTitle; - } - - // Fetch the versioning details - boolean forceSave = json.containsKey("forceSave"); - String currentVersion = null; - if (json.containsKey("currentVersion")) - { - currentVersion = (String)json.get("currentVersion"); - } - - // Fetch the tags, if given - List tags = null; - if (json.containsKey("tags")) - { - tags = new ArrayList<>(); - if (!json.get("tags").equals("")) - { - // Array of tags - JSONArray tagsA = (JSONArray)json.get("tags"); - for (int i=0; i result = new HashMap<>(); - result.put("result", model); - return result; - } - - private boolean pageVersionMatchesSubmitted(WikiPageInfo page, String currentVersion) - { - // If they didn't give version, it can't be right - if (currentVersion == null) - { - return false; - } - - // Grab the current version - Version version = versionService.getCurrentVersion(page.getNodeRef()); - if (version == null) - { - // It should be versioned already, fix that - makeVersioned(page); - - // Wasn't versioned before, so can't detect conflict - return true; - } - - return version.getVersionLabel().equals(currentVersion); - } - - private void makeVersioned(WikiPageInfo page) - { - Map versionProps = new HashMap<>(); - versionProps.put(ContentModel.PROP_AUTO_VERSION, true); - versionProps.put(ContentModel.PROP_AUTO_VERSION_PROPS, true); - versionService.ensureVersioningEnabled(page.getNodeRef(), versionProps); - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageVersionGet.java b/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageVersionGet.java deleted file mode 100644 index d00faa1602..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/web/scripts/wiki/WikiPageVersionGet.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.AspectMissingException; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionDoesNotExistException; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.json.simple.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; - -/** - * This class is the controller for the wiki page version fetching version.get webscript. - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiPageVersionGet extends AbstractWikiWebScript -{ - // For spotting if a version string is an ID or a Label - private static final Pattern LABEL_PATTERN = Pattern.compile("\\d+\\.\\d+"); - - private static final String PARAM_CONTENT = "content"; - - private ContentService contentService; - private VersionService versionService; - - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected Map executeImpl(SiteInfo site, String pageTitle, - WebScriptRequest req, JSONObject json, Status status, Cache cache) - { - Map model = new HashMap<>(); - - // Grab the version string - Map templateVars = req.getServiceMatch().getTemplateVars(); - String versionId = templateVars.get("versionId"); - if (versionId == null) - { - String error = "No versionId supplied"; - throw new WebScriptException(Status.STATUS_BAD_REQUEST, error); - } - - // Try to find the page - WikiPageInfo page = wikiService.getWikiPage(site.getShortName(), pageTitle); - if (page == null) - { - String message = "The Wiki Page could not be found"; - status.setCode(Status.STATUS_NOT_FOUND); - status.setMessage(message); - - // Return an empty string though - model.put(PARAM_CONTENT, ""); - return model; - } - - - // Fetch the version history for the node - VersionHistory versionHistory = null; - Version version = null; - try - { - versionHistory = versionService.getVersionHistory(page.getNodeRef()); - } - catch (AspectMissingException e) {} - - if (versionHistory == null) - { - // Not been versioned, return an empty string - model.put(PARAM_CONTENT, ""); - return model; - } - - - // Fetch the version by either ID or Label - Matcher m = LABEL_PATTERN.matcher(versionId); - if (m.matches()) - { - // It's a version label like 2.3 - try - { - version = versionHistory.getVersion(versionId); - } - catch (VersionDoesNotExistException e) {} - } - else - { - // It's a version ID like ed00bac1-f0da-4042-8598-45a0d39cb74d - // (The ID is usually part of the NodeRef of the frozen node, but we - // don't assume to be able to just generate the full NodeRef) - for (Version v : versionHistory.getAllVersions()) - { - if (v.getFrozenStateNodeRef().getId().equals(versionId)) - { - version = v; - } - } - } - - - // Did we find the right version in the end? - String contents; - if (version != null) - { - ContentReader reader = contentService.getReader(version.getFrozenStateNodeRef(), ContentModel.PROP_CONTENT); - if (reader != null) - { - contents = reader.getContentString(); - } - else - { - // No content was stored in the version history - contents = ""; - } - } - else - { - // No warning of the missing version, just return an empty string - contents = ""; - } - - // All done - model.put(PARAM_CONTENT, contents); - model.put("page", page); - model.put("site", site); - model.put("siteId", site.getShortName()); - return model; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/wiki/WikiPageInfoImpl.java b/amps/share-services/src/main/java/org/alfresco/repo/wiki/WikiPageInfoImpl.java deleted file mode 100644 index 663ec714e9..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/wiki/WikiPageInfoImpl.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.wiki; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.wiki.WikiPageInfo; - -/** - * An implementation of {@link WikiPageInfo} - * - * @author Nick Burch (based on existing webscript controllers in the REST API) - * @since 4.0 - */ -public class WikiPageInfoImpl implements WikiPageInfo -{ - private NodeRef nodeRef; - private NodeRef containerNodeRef; - private String systemName; - private String title; - private String contents; - private String creator; - private String modifier; - private Date createdAt; - private Date modifiedAt; - private List tags = new ArrayList(); - - /** - * Creates a new, empty WikiPageInfo - */ - public WikiPageInfoImpl() - { - } - - /** - * Create a WikiPageInfo object from an existing node - */ - public WikiPageInfoImpl(NodeRef nodeRef, NodeRef containerNodeRef, String systemName) - { - this.nodeRef = nodeRef; - this.containerNodeRef = containerNodeRef; - this.systemName = systemName; - } - - @Override - public NodeRef getContainerNodeRef() - { - return containerNodeRef; - } - - @Override - public NodeRef getNodeRef() - { - return nodeRef; - } - - @Override - public String getSystemName() - { - return systemName; - } - - @Override - public String getTitle() - { - return title; - } - - @Override - public String getContents() - { - return contents; - } - - @Override - public String getCreator() - { - return creator; - } - - @Override - public String getModifier() - { - return modifier; - } - - @Override - public Date getCreatedAt() - { - return createdAt; - } - - @Override - public Date getModifiedAt() - { - return modifiedAt; - } - - @Override - public List getTags() - { - return tags; - } - - @Override - public void setTitle(String title) - { - this.title = title; - } - - @Override - public void setContents(String contents) - { - this.contents = contents; - } - - public void setCreator(String creator) - { - this.creator = creator; - } - - public void setModifier(String modifier) - { - this.modifier = modifier; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public void setModifiedAt(Date modifiedAt) - { - this.modifiedAt = modifiedAt; - } - - public void setTags(List tags) - { - this.tags = tags; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/repo/wiki/WikiServiceImpl.java b/amps/share-services/src/main/java/org/alfresco/repo/wiki/WikiServiceImpl.java deleted file mode 100644 index b8b0edea69..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/repo/wiki/WikiServiceImpl.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.wiki; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -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.query.CannedQueryFactory; -import org.alfresco.query.CannedQueryResults; -import org.alfresco.query.CannedQuerySortDetails; -import org.alfresco.query.EmptyPagingResults; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.node.getchildren.GetChildrenAuditableCannedQuery; -import org.alfresco.repo.node.getchildren.GetChildrenAuditableCannedQueryFactory; -import org.alfresco.repo.query.NodeBackedEntity; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileNotFoundException; -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.site.SiteService; -import org.alfresco.service.cmr.tagging.TaggingService; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.alfresco.service.cmr.wiki.WikiService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.alfresco.util.registry.NamedObjectRegistry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Nick Burch (based on existing webscript controllers in the REST API) - * @since 4.0 - */ -public class WikiServiceImpl implements WikiService -{ - public static final String WIKI_COMPONENT = "wiki"; - - protected static final String CANNED_QUERY_GET_CHILDREN = "wikiGetChildrenCannedQueryFactory"; - - /** - * The logger - */ - @SuppressWarnings("unused") - private static Log logger = LogFactory.getLog(WikiServiceImpl.class); - - private NodeDAO nodeDAO; - private NodeService nodeService; - private SiteService siteService; - private ContentService contentService; - private TaggingService taggingService; - private FileFolderService fileFolderService; - private TransactionService transactionService; - private NamedObjectRegistry> cannedQueryRegistry; - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - public void setTaggingService(TaggingService taggingService) - { - this.taggingService = taggingService; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Set the registry of {@link CannedQueryFactory canned queries} - */ - public void setCannedQueryRegistry(NamedObjectRegistry> cannedQueryRegistry) - { - this.cannedQueryRegistry = cannedQueryRegistry; - } - - /** - * Fetches the Wiki Container on a site, creating as required if requested. - */ - protected NodeRef getSiteWikiContainer(final String siteShortName, boolean create) - { - return SiteServiceImpl.getSiteContainer( - siteShortName, WIKI_COMPONENT, create, - siteService, transactionService, taggingService); - } - - /** - * Turns a Title into a Page Name. - */ - private static String buildName(String title) - { - // The name is based on the title, but with underscores - String name = title.replace(' ', '_'); - name = name.replaceAll("\"", "%22"); - name = name.replaceAll("[*]", "%2a"); - name = name.replaceAll("<", "%3c"); - name = name.replaceAll(">", "%3e"); - name = name.replaceAll(":", "%3a"); - name = name.replaceAll("([.]?[.]+$)", "%2e"); - return name; - } - - private WikiPageInfo buildPage(NodeRef nodeRef, NodeRef container, String name, String preLoadedContents) - { - WikiPageInfoImpl page = new WikiPageInfoImpl(nodeRef, container, name); - - // Grab all the properties, we need the bulk of them anyway - Map props = nodeService.getProperties(nodeRef); - - // Start with the auditable properties - page.setCreator((String)props.get(ContentModel.PROP_CREATOR)); - page.setModifier((String)props.get(ContentModel.PROP_MODIFIER)); - page.setCreatedAt((Date)props.get(ContentModel.PROP_CREATED)); - page.setModifiedAt((Date)props.get(ContentModel.PROP_MODIFIED)); - - // Now the wiki ones - page.setTitle(((String)props.get(ContentModel.PROP_TITLE)).replaceAll(" ", "_")); - - // Finally, do the content - String contents = preLoadedContents; - if (contents == null) - { - ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - if (reader != null) - { - contents = reader.getContentString(); - } - } - page.setContents(contents); - - // Finally tags - page.setTags(taggingService.getTags(nodeRef)); - - // All done - return page; - } - - - @Override - public WikiPageInfo getWikiPage(String siteShortName, String pageTitle) - { - NodeRef container = getSiteWikiContainer(siteShortName, false); - if (container == null) - { - // No links - return null; - } - - String pageName = buildName(pageTitle); - NodeRef link = nodeService.getChildByName(container, ContentModel.ASSOC_CONTAINS, pageName); - if (link != null) - { - return buildPage(link, container, pageName, null); - } - return null; - } - - @Override - public WikiPageInfo createWikiPage(String siteShortName, String title, - String content) - { - // Grab the location to store in - NodeRef container = getSiteWikiContainer(siteShortName, true); - - // Build the name - String name = buildName(title); - - // Get the properties for the node - Map props = new HashMap(); - props.put(ContentModel.PROP_NAME, name); - props.put(ContentModel.PROP_TITLE, title); - - // Build the node - NodeRef nodeRef = nodeService.createNode( - container, - ContentModel.ASSOC_CONTAINS, - QName.createQName(name), - ContentModel.TYPE_CONTENT, - props - ).getChildRef(); - - // Store the content - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_HTML); - writer.setEncoding("UTF-8"); - writer.putContent(content); - - // Generate the wrapping object for it - // Build it that way, so creator and created date come through - return buildPage(nodeRef, container, name, content); - } - - @Override - public WikiPageInfo updateWikiPage(WikiPageInfo page) - { - // Sanity check what we were given - if (page.getNodeRef() == null) - { - throw new IllegalArgumentException("Can't update a page that was never persisted, call create instead"); - } - - NodeRef nodeRef = page.getNodeRef(); - String nodeName = buildName(page.getTitle()); - - // Handle the rename case - boolean renamed = false; - if (! nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE).equals(page.getTitle())) - { - try - { - fileFolderService.rename(nodeRef, nodeName); - renamed = true; - } - catch (FileNotFoundException e) - { - throw new AlfrescoRuntimeException("Invalid node state - wiki page no longer found"); - } - nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, nodeName); - nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, page.getTitle()); - } - - // Change the content - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_HTML); - writer.setEncoding("UTF-8"); - writer.putContent(page.getContents()); - - // Now do the tags - taggingService.setTags(nodeRef, page.getTags()); - - // If we re-named, re-create the object - if (renamed) - { - page = buildPage(nodeRef, page.getContainerNodeRef(), nodeName, page.getContents()); - } - - // All done - return page; - } - - @Override - public void deleteWikiPage(WikiPageInfo page) - { - if (page.getNodeRef() == null) - { - throw new IllegalArgumentException("Can't delete a wiki page that was never persisted"); - } - - nodeService.deleteNode(page.getNodeRef()); - } - - @Override - public PagingResults listWikiPages(String siteShortName, PagingRequest paging) - { - return listWikiPages(siteShortName, null, paging); - } - - @Override - public PagingResults listWikiPages(String siteShortName, String user, - PagingRequest paging) - { - return listWikiPages(siteShortName, user, null, null, null, null, paging); - } - - @Override - public PagingResults listWikiPagesByCreated(String siteShortName, - Date from, Date to, PagingRequest paging) - { - return listWikiPages(siteShortName, null, from, to, null, null, paging); - } - - @Override - public PagingResults listWikiPagesByModified(String siteShortName, - Date from, Date to, PagingRequest paging) - { - return listWikiPages(siteShortName, null, null, null, from, to, paging); - } - - public PagingResults listWikiPages(String siteShortName, String username, - Date createdFrom, Date createdTo, Date modifiedFrom, Date modifiedTo, PagingRequest paging) - { - NodeRef container = getSiteWikiContainer(siteShortName, false); - if (container == null) - { - // No events - return new EmptyPagingResults(); - } - - // Grab the factory - GetChildrenAuditableCannedQueryFactory getChildrenCannedQueryFactory = - (GetChildrenAuditableCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_GET_CHILDREN); - - // Do the sorting, newest first by created date - CannedQuerySortDetails sorting = getChildrenCannedQueryFactory.createDateDescendingCQSortDetails(); - - // Run the canned query - GetChildrenAuditableCannedQuery cq = (GetChildrenAuditableCannedQuery)getChildrenCannedQueryFactory.getCannedQuery( - container, ContentModel.TYPE_CONTENT, username, createdFrom, createdTo, null, - modifiedFrom, modifiedTo, sorting, paging); - - // Execute the canned query - CannedQueryResults results = cq.execute(); - - // Convert to Link objects - return wrap(results, container); - } - - /** - * Our class to wrap up paged results of NodeBackedEntities as - * WikiPageInfo instances - */ - private PagingResults wrap(final PagingResults results, final NodeRef container) - { - // Pre-load the nodes before we create them - List ids = new ArrayList(); - for (NodeBackedEntity node : results.getPage()) - { - ids.add(node.getId()); - } - nodeDAO.cacheNodesById(ids); - - // Wrap - return new PagingResults() - { - @Override - public String getQueryExecutionId() - { - return results.getQueryExecutionId(); - } - - @Override - public List getPage() - { - List pages = new ArrayList(); - for (NodeBackedEntity node : results.getPage()) - { - NodeRef nodeRef = node.getNodeRef(); - String name = node.getName(); - pages.add(buildPage(nodeRef, container, name, null)); - } - return pages; - } - - @Override - public boolean hasMoreItems() - { - return results.hasMoreItems(); - } - - @Override - public Pair getTotalResultCount() - { - return results.getTotalResultCount(); - } - }; - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/service/cmr/wiki/WikiPageInfo.java b/amps/share-services/src/main/java/org/alfresco/service/cmr/wiki/WikiPageInfo.java deleted file mode 100644 index 982d1364a0..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/service/cmr/wiki/WikiPageInfo.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.service.cmr.wiki; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -import org.alfresco.repo.security.permissions.PermissionCheckValue; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * This class represents a Wiki Paeg in a site - * - * @author Nick Burch - * @since 4.0 - */ -public interface WikiPageInfo extends Serializable, PermissionCheckValue -{ - /** - * @return the NodeRef of the underlying wiki page - */ - NodeRef getNodeRef(); - - /** - * @return the NodeRef of the site container this belongs to - */ - NodeRef getContainerNodeRef(); - - /** - * @return the name of the wiki page - */ - String getSystemName(); - - /** - * @return the Title of the wiki page - */ - String getTitle(); - - /** - * Sets the Title of the wiki page - */ - void setTitle(String title); - - /** - * @return the HTML Content of the wiki page - */ - String getContents(); - - /** - * Sets the (HTML) Content of the wiki page - */ - void setContents(String contentHTML); - - /** - * @return the creator of the wiki page - */ - String getCreator(); - - /** - * @return the modifier of the wiki page - */ - String getModifier(); - - /** - * @return the creation date and time - */ - Date getCreatedAt(); - - /** - * @return the modification date and time - */ - Date getModifiedAt(); - - /** - * @return the Tags associated with the wiki page - */ - List getTags(); -} diff --git a/amps/share-services/src/main/java/org/alfresco/service/cmr/wiki/WikiService.java b/amps/share-services/src/main/java/org/alfresco/service/cmr/wiki/WikiService.java deleted file mode 100644 index 7e624632f1..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/service/cmr/wiki/WikiService.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.service.cmr.wiki; - -import java.util.Date; - -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.service.NotAuditable; - -/** - * The Wiki service. - * - * @author Nick Burch - * @since 4.0 - */ -public interface WikiService -{ - /** - * Creates a new {@link WikiPageInfo} in the given site, with the - * specified contents - * - * @return The newly created {@link WikiPageInfo} - */ - @NotAuditable - WikiPageInfo createWikiPage(String siteShortName, String title, String contents); - - /** - * Updates an existing {@link WikiPageInfo} in the repository. - * - * @return The updated {@link WikiPageInfo} - */ - @NotAuditable - WikiPageInfo updateWikiPage(WikiPageInfo wikiPage); - - /** - * Deletes an existing {@link WikiPageInfo} from the repository - */ - @NotAuditable - void deleteWikiPage(WikiPageInfo wikiPage); - - /** - * Retrieves an existing {@link WikiPageInfo} from the repository - */ - @NotAuditable - WikiPageInfo getWikiPage(String siteShortName, String pageName); - - /** - * Retrieves all {@link WikiPageInfo} instances in the repository - * for the given site. - */ - @NotAuditable - PagingResults listWikiPages(String siteShortName, PagingRequest paging); - - /** - * Retrieves all {@link WikiPageInfo} instances in the repository - * for the given site and the specified user. - */ - @NotAuditable - PagingResults listWikiPages(String siteShortName, String user, PagingRequest paging); - - /** - * Retrieves all {@link WikiPageInfo} instances in the repository - * for the given site, created in the specified date range - */ - @NotAuditable - PagingResults listWikiPagesByCreated(String siteShortName, Date from, Date to, PagingRequest paging); - - /** - * Retrieves all {@link WikiPageInfo} instances in the repository - * for the given site, modified in the specified date range - */ - @NotAuditable - PagingResults listWikiPagesByModified(String siteShortName, Date from, Date to, PagingRequest paging); -} diff --git a/amps/share-services/src/main/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java b/amps/share-services/src/main/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java deleted file mode 100644 index bf4042e72b..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.slingshot.web.scripts; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.admin.NodeBrowserPost; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.LimitBy; -import org.alfresco.service.cmr.search.SearchParameters; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Node browser web script to handle search results, node details and workspaces. - * Extends the NodeBrowserPost script to inherit useful helper classes. - * - * @author dcaruana - * @author wabson - */ -public class NodeBrowserScript extends NodeBrowserPost implements Serializable -{ - private static final long serialVersionUID = 48743409337475896L; - - private Long searchElapsedTime = null; - - /** - * Action to submit search - * - * @return next action - */ - public List submitSearch(final String store, final String query, final String queryLanguage, final int maxResults) throws IOException - { - long start = System.currentTimeMillis(); - final StoreRef storeRef = new StoreRef(store); - RetryingTransactionCallback> searchCallback = new RetryingTransactionCallback>() - { - public List execute() throws Throwable - { - List searchResults = null; - - if (queryLanguage.equals("storeroot")) - { - NodeRef rootNodeRef = getNodeService().getRootNode(storeRef); - searchResults = new ArrayList(1); - searchResults.add(new Node(rootNodeRef)); - return searchResults; - } - else if (queryLanguage.equals("noderef")) - { - // ensure node exists - NodeRef nodeRef = new NodeRef(query); - boolean exists = getNodeService().exists(nodeRef); - if (!exists) - { - throw new WebScriptException(500, "Node " + nodeRef + " does not exist."); - } - searchResults = new ArrayList(1); - searchResults.add(new Node(nodeRef)); - return searchResults; - } - SearchParameters sp = new SearchParameters(); - sp.addStore(storeRef); - sp.setLanguage(queryLanguage); - sp.setQuery(query); - if (maxResults > 0) - { - sp.setLimit(maxResults); - sp.setLimitBy(LimitBy.FINAL_SIZE); - } - - // perform search - List nodeRefs = getSearchService().query(sp).getNodeRefs(); - searchResults = new ArrayList(nodeRefs.size()); - for (NodeRef nodeRef : nodeRefs) { - searchResults.add(new Node(nodeRef)); - } - return searchResults; - } - }; - - try - { - List results = getTransactionService().getRetryingTransactionHelper().doInTransaction(searchCallback, true); - this.searchElapsedTime = System.currentTimeMillis() - start; - return results; - } - catch (Throwable e) - { - throw new IOException(e.getMessage(), e); - } - } - - /** - * @return the searchElapsedTime - */ - protected Long getSearchElapsedTime() - { - return this.searchElapsedTime; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - if (req.getPathInfo().equals("/slingshot/node/search")) - { - List nodes; - Map tmplMap = new HashMap(1); - try - { - if (req.getParameter("store") == null || req.getParameter("store").length() == 0) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST); - status.setMessage("Store name not provided"); - status.setRedirect(true); - return null; - } - if (req.getParameter("q") == null || req.getParameter("q").length() == 0) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST); - status.setMessage("Search query not provided"); - status.setRedirect(true); - return null; - } - if (req.getParameter("lang") == null || req.getParameter("lang").length() == 0) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST); - status.setMessage("Search language not provided"); - status.setRedirect(true); - return null; - } - - int maxResult = 0; - try - { - maxResult = Integer.parseInt(req.getParameter("maxResults")); - } - catch (NumberFormatException ex) - { - } - - nodes = submitSearch(req.getParameter("store"), req.getParameter("q"), req.getParameter("lang"), maxResult); - tmplMap.put("results", nodes); - tmplMap.put("searchElapsedTime", getSearchElapsedTime()); - } - catch (IOException e) - { - status.setCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - status.setMessage(e.getMessage()); - status.setException(e); - status.setRedirect(true); - } - return tmplMap; - } - else if (req.getPathInfo().equals("/slingshot/node/stores")) - { - Map model = new HashMap(); - model.put("stores", getStores()); - return model; - } - else // Assume we are looking for a node - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - if (templateVars.get("protocol") == null || templateVars.get("protocol").length() == 0 || - templateVars.get("store") == null || templateVars.get("store").length() == 0 || - templateVars.get("id") == null || templateVars.get("id").length() == 0) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST); - status.setMessage("Node not provided"); - status.setRedirect(true); - return null; - } - NodeRef nodeRef = new NodeRef(templateVars.get("protocol"), templateVars.get("store"), templateVars.get("id")); - - Map permissionInfo = new HashMap(3); - permissionInfo.put("entries", getPermissions(nodeRef)); - permissionInfo.put("owner", this.getOwnableService().getOwner(nodeRef)); - permissionInfo.put("inherit", this.getInheritPermissions(nodeRef)); - permissionInfo.put("storePermissions", getStorePermissionMasks(nodeRef)); - - Map model = new HashMap(); - model.put("node", new Node(nodeRef)); - model.put("properties", getProperties(nodeRef)); - model.put("aspects", getAspects(nodeRef)); - model.put("children", getChildren(nodeRef)); - model.put("parents", getParents(nodeRef)); - model.put("assocs", getAssocs(nodeRef)); - model.put("sourceAssocs", getSourceAssocs(nodeRef)); - model.put("permissions", permissionInfo); - return model; - } - } -} diff --git a/amps/share-services/src/main/java/org/alfresco/slingshot/web/scripts/SlingshotContentGet.java b/amps/share-services/src/main/java/org/alfresco/slingshot/web/scripts/SlingshotContentGet.java deleted file mode 100644 index 609c906db8..0000000000 --- a/amps/share-services/src/main/java/org/alfresco/slingshot/web/scripts/SlingshotContentGet.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.slingshot.web.scripts; - -import java.io.IOException; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.sync.repo.Client; -import org.alfresco.sync.repo.Client.ClientType; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.content.ContentGet; -import org.alfresco.service.cmr.activities.ActivityPoster; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Share specific ContentGet implementation. - *

- * Checks to see if: - * a) the request is an explicit download (attachment) - * b) the requested NodeRef within the context of a Share Site - *

- * If both tests are true then generates an Activity feed item to record the Download request. - * All other requests and any further processing is performed by the super class. - * - * @author Kevin Roast - */ -public class SlingshotContentGet extends ContentGet -{ - protected SiteService siteService; - private ActivityPoster poster; - private RetryingTransactionHelper transactionHelper; - - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - public void setPoster(ActivityPoster poster) - { - this.poster = poster; - } - - public void setTransactionHelper(RetryingTransactionHelper transactionHelper) - { - this.transactionHelper = transactionHelper; - } - - - @Override - public void execute(final WebScriptRequest req, final WebScriptResponse res) throws IOException - { - // are we downloading content as an attachment? - if (Boolean.valueOf(req.getParameter("a"))) - { - // is this private ActivityPoster poster; node part of a Site context? - 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 - if (storeType != null && storeId != null && nodeId != null) - { - // MNT-16380 - String nodeIdTmp = nodeId; - if (nodeId.contains("/")) - { - nodeIdTmp = nodeId.substring(0, nodeId.indexOf('/')); - } - final NodeRef nodeRef = new NodeRef(storeType, storeId, nodeIdTmp); - SiteInfo site = null; - try - { - site = this.siteService.getSite(nodeRef); - } - catch (AccessDeniedException ade) - { - // We don't have access to the site, don't post any permissions - } - if (site != null) - { - // found a valid parent Site - gather the details to post an Activity - String filename = templateVars.get("filename"); - if (filename == null || filename.length() == 0) - { - filename = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - if (nodeId.contains("/")) - { - filename = nodeId.substring(nodeId.lastIndexOf("/") + 1); - } - } - final String strFilename = filename; - final String siteName = site.getShortName(); - transactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - // post an activity - mirror the mechanism as if from the Share application - poster.postFileFolderActivity(ActivityPoster.DOWNLOADED, null, null, - siteName, null, nodeRef, strFilename, "documentlibrary", Client.asType(ClientType.webclient), null); - return null; - } - }, false, true); - } - } - } - super.execute(req, res); - } -} diff --git a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Contents.acp b/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Contents.acp deleted file mode 100644 index 417cd8296a..0000000000 Binary files a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Contents.acp and /dev/null differ diff --git a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Groups.txt b/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Groups.txt deleted file mode 100644 index 971f4a75e6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Groups.txt +++ /dev/null @@ -1,2 +0,0 @@ -abeecher=GROUP_site_swsdp_SiteCollaborator -mjackson=GROUP_site_swsdp_SiteManager diff --git a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/People.acp b/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/People.acp deleted file mode 100644 index bbe9169e9b..0000000000 Binary files a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/People.acp and /dev/null differ diff --git a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Users.acp b/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Users.acp deleted file mode 100644 index 0ee3915344..0000000000 Binary files a/amps/share-services/src/main/resources/alfresco/bootstrap/team-sample-sites/swsdp/Users.acp and /dev/null differ diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model.properties deleted file mode 100755 index 2d34421b42..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Alfresco Share Data List Model - -dl_datalistmodel.type.dl_dataList.title=Data List folder type -dl_datalistmodel.type.dl_dataList.description=Holds Data List items of the type specified in the dl:dataListItemType property. -dl_datalistmodel.property.dl_dataListItemType.title=Data List Item Type -dl_datalistmodel.property.dl_dataListItemType.description=Determines which subtype of dl:dataListItem will be used when create new items within the Data List. - -dl_datalistmodel.type.dl_dataListItem.title=Data List parent type -dl_datalistmodel.type.dl_dataListItem.description=Parent type from which sample Data List Item types are derived. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=To Do List -dl_datalistmodel.type.dl_todoList.description=A simple to do list with optional assignee. -dl_datalistmodel.property.dl_todoTitle.title=Title -dl_datalistmodel.property.dl_todoDueDate.title=Due Date -dl_datalistmodel.property.dl_todoPriority.title=Priority -dl_datalistmodel.property.dl_todoStatus.title=Status -dl_datalistmodel.property.dl_todoNotes.title=Notes -dl_datalistmodel.association.dl_assignee.title=Assignee -dl_datalistmodel.association.dl_attachments.title=Attachments - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Start Date -dl_datalistmodel.property.dl_ganttEndDate.title=End Date -dl_datalistmodel.property.dl_ganttPercentComplete.title=% Complete - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Task List (Advanced) -dl_datalistmodel.type.dl_task.description=Advanced tasks list including title, description, start and end dates, priority, status, comments, assignees and attachments. -dl_datalistmodel.property.dl_taskPriority.title=Priority -dl_datalistmodel.property.dl_taskStatus.title=Status -dl_datalistmodel.property.dl_taskComments.title=Comments -dl_datalistmodel.association.dl_taskAssignee.title=Assignee - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Task List (Simple) -dl_datalistmodel.type.dl_simpletask.description=Simple tasks list including title, description, due date, priority, status, comments. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Due Date -dl_datalistmodel.property.dl_simpletaskPriority.title=Priority -dl_datalistmodel.property.dl_simpletaskStatus.title=Status -dl_datalistmodel.property.dl_simpletaskComments.title=Comments - -# Contact -dl_datalistmodel.type.dl_contact.title=Contact List -dl_datalistmodel.type.dl_contact.description=Contacts list including first name, last name, full name, email, job title, phone (office), phone (mobile). -dl_datalistmodel.property.dl_contactFirstName.title=First Name -dl_datalistmodel.property.dl_contactLastName.title=Last Name -dl_datalistmodel.property.dl_contactEmail.title=Email -dl_datalistmodel.property.dl_contactCompany.title=Company -dl_datalistmodel.property.dl_contactJobTitle.title=Job Title -dl_datalistmodel.property.dl_contactPhoneOffice.title=Phone (Office) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Phone (Mobile) -dl_datalistmodel.property.dl_contactNotes.title=Notes - -# Issues -dl_datalistmodel.type.dl_issue.title=Issue List -dl_datalistmodel.type.dl_issue.description=Issues list including ID, status, priority, description, due data, comments, assign to, related issues. -dl_datalistmodel.property.dl_issueID.title=Issue ID -dl_datalistmodel.property.dl_issueStatus.title=Status -dl_datalistmodel.property.dl_issuePriority.title=Priority -dl_datalistmodel.property.dl_issueDescription.title=Description -dl_datalistmodel.property.dl_issueDueDate.title=Due Date -dl_datalistmodel.property.dl_issueComments.title=Comments -dl_datalistmodel.association.dl_issueAssignedTo.title=Assigned To -dl_datalistmodel.property.dl_issueRelatedIssues.title=Related Issues - -# Event -dl_datalistmodel.type.dl_event.title=Event List -dl_datalistmodel.type.dl_event.description=Events list including title, description, location, start and end date/time. -dl_datalistmodel.property.dl_eventLocation.title=Location -dl_datalistmodel.property.dl_eventStartDate.title=Start Date -dl_datalistmodel.property.dl_eventEndDate.title=End Date -dl_datalistmodel.property.dl_eventRegistrations.title=Registrations -dl_datalistmodel.property.dl_eventNote.title=Notes - -# Location -dl_datalistmodel.type.dl_location.title=Location List -dl_datalistmodel.type.dl_location.description=Locations/Addresses list -dl_datalistmodel.property.dl_locationAddress1.title=Address Line 1 -dl_datalistmodel.property.dl_locationAddress2.title=Address Line 2 -dl_datalistmodel.property.dl_locationAddress3.title=Address Line 3 -dl_datalistmodel.property.dl_locationZip.title=Zip/Post Code -dl_datalistmodel.property.dl_locationState.title=State/County -dl_datalistmodel.property.dl_locationCountry.title=Country -dl_datalistmodel.property.dl_locationNote.title=Notes - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.description=Manage meeting agenda items including description, owner, allocated time. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Reference -dl_datalistmodel.property.dl_meetingAgendaTime.title=Time (mins) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Owner - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Event Agenda -dl_datalistmodel.type.dl_eventAgenda.description=Manage event agenda items including session names, presenters, start and end times. -dl_datalistmodel.property.dl_eventAgendaRef.title=Reference -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Start Time -dl_datalistmodel.property.dl_eventAgendaEndTime.title=End Time -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Session Name -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Presenter -dl_datalistmodel.property.dl_eventAgendaAudience.title=Audience -dl_datalistmodel.property.dl_eventAgendaNotes.title=Notes - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=Not Started -listconstraint.dl_task_status.In\ Progress=In Progress -listconstraint.dl_task_status.On\ Hold= On Hold -listconstraint.dl_task_status.Complete=Complete -listconstraint.dl_priority_value.High=High -listconstraint.dl_priority_value.Normal=Normal -listconstraint.dl_priority_value.Low=Low - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_de.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_de.properties deleted file mode 100755 index d8d5f75753..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_de.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Alfresco Share Datenlisten-Modell - -dl_datalistmodel.type.dl_dataList.title=Ordnertyp der Datenliste -dl_datalistmodel.type.dl_dataList.description=H\u00e4lt Datenlisten-Elemente des angegebenen Typs in der Eigenschaft dl: dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Elementtyp Datenliste -dl_datalistmodel.property.dl_dataListItemType.description=Legt fest, welcher Subtyp von dl: dataListItem verwendet wird, wenn neue Elemente in der Datenliste erstellt werden. - -dl_datalistmodel.type.dl_dataListItem.title=\u00dcbergeordneter Typ der Datenliste -dl_datalistmodel.type.dl_dataListItem.description=\u00dcbergeordneter Typ, von dem Mustertypen von Elementen der Datenliste abgeleitet werden. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Liste zu erledigender Aufgaben -dl_datalistmodel.type.dl_todoList.description=Einfache Liste zu erledigender Aufgaben mit optionaler zugewiesener Person. -dl_datalistmodel.property.dl_todoTitle.title=Titel -dl_datalistmodel.property.dl_todoDueDate.title=F\u00e4lligkeitsdatum -dl_datalistmodel.property.dl_todoPriority.title=Priorit\u00e4t -dl_datalistmodel.property.dl_todoStatus.title=Status -dl_datalistmodel.property.dl_todoNotes.title=Notizen -dl_datalistmodel.association.dl_assignee.title=Zugewiesene Person -dl_datalistmodel.association.dl_attachments.title=Anh\u00e4nge - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Anfangsdatum -dl_datalistmodel.property.dl_ganttEndDate.title=Enddatum -dl_datalistmodel.property.dl_ganttPercentComplete.title=% Abgeschlossen - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Aufgabenliste (Erweitert) -dl_datalistmodel.type.dl_task.description=Erweiterte Aufgabenliste einschlie\u00dflich Titel, Beschreibung, Anfangs- und Enddatum, Priorit\u00e4t, Status, Bemerkungen, zugewiesenen Personen und Anlagen. -dl_datalistmodel.property.dl_taskPriority.title=Priorit\u00e4t -dl_datalistmodel.property.dl_taskStatus.title=Status -dl_datalistmodel.property.dl_taskComments.title=Kommentare -dl_datalistmodel.association.dl_taskAssignee.title=Zugewiesene Person - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Aufgabenliste (Einfach) -dl_datalistmodel.type.dl_simpletask.description=Einfache Aufgabenliste einschlie\u00dflich Titel, Beschreibung, F\u00e4lligkeitsdatum, Priorit\u00e4t, Status, Kommentaren. -dl_datalistmodel.property.dl_simpletaskDueDate.title=F\u00e4lligkeitsdatum -dl_datalistmodel.property.dl_simpletaskPriority.title=Priorit\u00e4t -dl_datalistmodel.property.dl_simpletaskStatus.title=Status -dl_datalistmodel.property.dl_simpletaskComments.title=Kommentare - -# Contact -dl_datalistmodel.type.dl_contact.title=Liste der Kontakte -dl_datalistmodel.type.dl_contact.description=Liste der Kontakte einschlie\u00dflich Vornamen, Nachnamen, vollst\u00e4ndigem Namen, E-Mail, Jobtitel, Telefon (B\u00fcro), Telefon (Mobil). -dl_datalistmodel.property.dl_contactFirstName.title=Vorname -dl_datalistmodel.property.dl_contactLastName.title=Nachname -dl_datalistmodel.property.dl_contactEmail.title=E-Mail -dl_datalistmodel.property.dl_contactCompany.title=Unternehmen -dl_datalistmodel.property.dl_contactJobTitle.title=Jobtitel -dl_datalistmodel.property.dl_contactPhoneOffice.title=Telefon (B\u00fcro) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Telefon (Mobil) -dl_datalistmodel.property.dl_contactNotes.title=Notizen - -# Issues -dl_datalistmodel.type.dl_issue.title=Themenliste -dl_datalistmodel.type.dl_issue.description=Themenliste, die ID, Status, Priorit\u00e4t, Beschreibung, F\u00e4lligkeitsdatum, zugewiesen zu und verwandte Themen enth\u00e4lt. -dl_datalistmodel.property.dl_issueID.title=Themen ID -dl_datalistmodel.property.dl_issueStatus.title=Status -dl_datalistmodel.property.dl_issuePriority.title=Priorit\u00e4t -dl_datalistmodel.property.dl_issueDescription.title=Beschreibung -dl_datalistmodel.property.dl_issueDueDate.title=F\u00e4lligkeitsdatum -dl_datalistmodel.property.dl_issueComments.title=Kommentare -dl_datalistmodel.association.dl_issueAssignedTo.title=Zugewiesen an -dl_datalistmodel.property.dl_issueRelatedIssues.title=\u00c4hnliche Elemente - -# Event -dl_datalistmodel.type.dl_event.title=Ereignisliste -dl_datalistmodel.type.dl_event.description=Ereignisliste einschlie\u00dflich Titel, Beschreibung, Ort, Anfangs- und Enddatum/-zeit. -dl_datalistmodel.property.dl_eventLocation.title=Speicherort -dl_datalistmodel.property.dl_eventStartDate.title=Anfangsdatum -dl_datalistmodel.property.dl_eventEndDate.title=Enddatum -dl_datalistmodel.property.dl_eventRegistrations.title=Registrierungen -dl_datalistmodel.property.dl_eventNote.title=Notizen - -# Location -dl_datalistmodel.type.dl_location.title=Standortliste -dl_datalistmodel.type.dl_location.description=Liste Liste von Standorten/Adressen -dl_datalistmodel.property.dl_locationAddress1.title=Adresse Zeile 1 -dl_datalistmodel.property.dl_locationAddress2.title=Adresse Zeile 2 -dl_datalistmodel.property.dl_locationAddress3.title=Adresse Zeile 3 -dl_datalistmodel.property.dl_locationZip.title=Postleitzahl -dl_datalistmodel.property.dl_locationState.title=Bundesland -dl_datalistmodel.property.dl_locationCountry.title=Land -dl_datalistmodel.property.dl_locationNote.title=Notizen - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Sitzungskalender -dl_datalistmodel.type.dl_meetingAgenda.description=Verwaltung von Elementen des Sitzungskalenders einschlie\u00dflich Beschreibung, Eigent\u00fcmer, zugewiesene Zeit. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Referenz -dl_datalistmodel.property.dl_meetingAgendaTime.title=Zeit (Minuten) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Eigent\u00fcmer - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Ereigniskalender -dl_datalistmodel.type.dl_eventAgenda.description=Ereigniskalender einschlie\u00dflich Namen der Sitzungen, Pr\u00e4sentatoren, Anfangs- und Endzeit verwalten. -dl_datalistmodel.property.dl_eventAgendaRef.title=Referenz -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Anfangszeit -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Endzeit -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Name der Sitzung -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Pr\u00e4sentator -dl_datalistmodel.property.dl_eventAgendaAudience.title=Publikum -dl_datalistmodel.property.dl_eventAgendaNotes.title=Notizen - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=nicht gestartet -listconstraint.dl_task_status.In\ Progress=in Bearbeitung -listconstraint.dl_task_status.On\ Hold=in Wartestellung -listconstraint.dl_task_status.Complete=Abgeschlossen -listconstraint.dl_priority_value.High=Hoch -listconstraint.dl_priority_value.Normal=Normal -listconstraint.dl_priority_value.Low=Niedrig - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_es.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_es.properties deleted file mode 100755 index 646013d438..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_es.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Modelo de lista de datos de Alfresco Share - -dl_datalistmodel.type.dl_dataList.title=Tipo de carpeta de lista de datos -dl_datalistmodel.type.dl_dataList.description=Contiene elementos de lista de datos del tipo especificado en la propiedad dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Tipo de elemento de lista de datos -dl_datalistmodel.property.dl_dataListItemType.description=Determina qu\u00e9 subtipo de dl:DataListItem se utilizar\u00e1 al crear nuevos elementos en la lista de datos. - -dl_datalistmodel.type.dl_dataListItem.title=Tipo de padre de lista de datos -dl_datalistmodel.type.dl_dataListItem.description=Tipo de padre del que se derivan los tipos de elementos de muestra de listas de datos. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Lista de tareas pendientes -dl_datalistmodel.type.dl_todoList.description=Una lista sencilla de tareas pendientes con usuario opcional a asignar la tarea. -dl_datalistmodel.property.dl_todoTitle.title=T\u00edtulo -dl_datalistmodel.property.dl_todoDueDate.title=Fecha de vencimiento -dl_datalistmodel.property.dl_todoPriority.title=Prioridad -dl_datalistmodel.property.dl_todoStatus.title=Estado -dl_datalistmodel.property.dl_todoNotes.title=Notas -dl_datalistmodel.association.dl_assignee.title=Usuario asignado -dl_datalistmodel.association.dl_attachments.title=Adjuntos - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Fecha de inicio -dl_datalistmodel.property.dl_ganttEndDate.title=Fecha de fin -dl_datalistmodel.property.dl_ganttPercentComplete.title=% Completado - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Lista de tareas (Avanzada) -dl_datalistmodel.type.dl_task.description=Lista de tareas avanzada, incluyendo t\u00edtulo, descripci\u00f3n, fechas de inicio y finalizaci\u00f3n, prioridad, estado, comentarios, usuarios a asignar la tarea y adjuntos. -dl_datalistmodel.property.dl_taskPriority.title=Prioridad -dl_datalistmodel.property.dl_taskStatus.title=Estado -dl_datalistmodel.property.dl_taskComments.title=Comentarios -dl_datalistmodel.association.dl_taskAssignee.title=Usuario asignado - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Lista de tareas (sencillas) -dl_datalistmodel.type.dl_simpletask.description=Lista de tareas sencilla, incluyendo t\u00edtulo, descripci\u00f3n, fecha de vencimiento, prioridad, estado, comentarios. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Fecha de vencimiento -dl_datalistmodel.property.dl_simpletaskPriority.title=Prioridad -dl_datalistmodel.property.dl_simpletaskStatus.title=Estado -dl_datalistmodel.property.dl_simpletaskComments.title=Comentarios - -# Contact -dl_datalistmodel.type.dl_contact.title=Lista de contactos -dl_datalistmodel.type.dl_contact.description=Lista de contactos incluyendo nombre, apellido, nombre completo, email, t\u00edtulo del trabajo, tel\u00e9fono (oficina), tel\u00e9fono (m\u00f3vil). -dl_datalistmodel.property.dl_contactFirstName.title=Nombre -dl_datalistmodel.property.dl_contactLastName.title=Apellidos -dl_datalistmodel.property.dl_contactEmail.title=Correo electr\u00f3nico -dl_datalistmodel.property.dl_contactCompany.title=Empresa -dl_datalistmodel.property.dl_contactJobTitle.title=Cargo -dl_datalistmodel.property.dl_contactPhoneOffice.title=Tel\u00e9fono (Oficina) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Tel\u00e9fono (M\u00f3vil) -dl_datalistmodel.property.dl_contactNotes.title=Notas - -# Issues -dl_datalistmodel.type.dl_issue.title=Lista de temas -dl_datalistmodel.type.dl_issue.description=Lista de temas incluyendo ID, estado, prioridad, descripci\u00f3n, fechas de vencimiento, comentarios, asignar a, temas relacionados. -dl_datalistmodel.property.dl_issueID.title=ID de tema -dl_datalistmodel.property.dl_issueStatus.title=Estado -dl_datalistmodel.property.dl_issuePriority.title=Prioridad -dl_datalistmodel.property.dl_issueDescription.title=Descripci\u00f3n -dl_datalistmodel.property.dl_issueDueDate.title=Fecha de vencimiento -dl_datalistmodel.property.dl_issueComments.title=Comentarios -dl_datalistmodel.association.dl_issueAssignedTo.title=Asignado a -dl_datalistmodel.property.dl_issueRelatedIssues.title=Temas relacionados - -# Event -dl_datalistmodel.type.dl_event.title=Lista de eventos -dl_datalistmodel.type.dl_event.description=Lista de eventos, incluyendo t\u00edtulo, descripci\u00f3n, ubicaci\u00f3n, fecha/hora de inicio y fin. -dl_datalistmodel.property.dl_eventLocation.title=Ubicaci\u00f3n -dl_datalistmodel.property.dl_eventStartDate.title=Fecha de inicio -dl_datalistmodel.property.dl_eventEndDate.title=Fecha de fin -dl_datalistmodel.property.dl_eventRegistrations.title=Inscripciones -dl_datalistmodel.property.dl_eventNote.title=Notas - -# Location -dl_datalistmodel.type.dl_location.title=Lista de ubicaciones -dl_datalistmodel.type.dl_location.description=Lista de ubicaciones/direcciones -dl_datalistmodel.property.dl_locationAddress1.title=Direcci\u00f3n l\u00ednea 1 -dl_datalistmodel.property.dl_locationAddress2.title=Direcci\u00f3n l\u00ednea 2 -dl_datalistmodel.property.dl_locationAddress3.title=Direcci\u00f3n l\u00ednea 3 -dl_datalistmodel.property.dl_locationZip.title=Zip/C\u00f3digo postal -dl_datalistmodel.property.dl_locationState.title=Estado/Condado -dl_datalistmodel.property.dl_locationCountry.title=Pa\u00eds -dl_datalistmodel.property.dl_locationNote.title=Notas - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Agenda de reuni\u00f3n -dl_datalistmodel.type.dl_meetingAgenda.description=Administrar elementos de agenda de reuni\u00f3n, incluyendo descripci\u00f3n, propietario, el tiempo asignado. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Referencia -dl_datalistmodel.property.dl_meetingAgendaTime.title=Tiempo (min) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Propietario - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Agenda de eventos -dl_datalistmodel.type.dl_eventAgenda.description=Administrar agenda de eventos incluyendo nombres de sesi\u00f3n, participantes, horas de inicio y fin. -dl_datalistmodel.property.dl_eventAgendaRef.title=Referencia -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Hora de inicio -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Hora de fin -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Nombre de sesi\u00f3n -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Participante -dl_datalistmodel.property.dl_eventAgendaAudience.title=Audiencia -dl_datalistmodel.property.dl_eventAgendaNotes.title=Notas - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=No iniciada -listconstraint.dl_task_status.In\ Progress=En curso -listconstraint.dl_task_status.On\ Hold=En espera -listconstraint.dl_task_status.Complete=Completa -listconstraint.dl_priority_value.High=Alta -listconstraint.dl_priority_value.Normal=Normal -listconstraint.dl_priority_value.Low=Baja - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_fr.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_fr.properties deleted file mode 100755 index 6a2b40090a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_fr.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Mod\u00e8le de liste de donn\u00e9es Alfresco Share - -dl_datalistmodel.type.dl_dataList.title=Type de dossier de liste de donn\u00e9es -dl_datalistmodel.type.dl_dataList.description=Stocke les \u00e9l\u00e9ments de liste de donn\u00e9es du type sp\u00e9cifi\u00e9 dans la propri\u00e9t\u00e9 dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Type d'\u00e9l\u00e9ment de liste de donn\u00e9es -dl_datalistmodel.property.dl_dataListItemType.description=D\u00e9termine quel sous-type de dl:dataListItem sera utilis\u00e9 quand un nouvel \u00e9l\u00e9ment de la liste de donn\u00e9es sera cr\u00e9\u00e9. - -dl_datalistmodel.type.dl_dataListItem.title=Type parent de liste de donn\u00e9es -dl_datalistmodel.type.dl_dataListItem.description=Type parent \u00e0 partir duquel d\u00e9rivent les types d'\u00e9l\u00e9ment de liste de donn\u00e9es. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Liste de t\u00e2ches -dl_datalistmodel.type.dl_todoList.description=Une liste de t\u00e2ches avec personne assign\u00e9e facultative. -dl_datalistmodel.property.dl_todoTitle.title=Titre -dl_datalistmodel.property.dl_todoDueDate.title=Ech\u00e9ance -dl_datalistmodel.property.dl_todoPriority.title=Priorit\u00e9 -dl_datalistmodel.property.dl_todoStatus.title=Statut -dl_datalistmodel.property.dl_todoNotes.title=Notes -dl_datalistmodel.association.dl_assignee.title=Personne assign\u00e9e -dl_datalistmodel.association.dl_attachments.title=El\u00e9ments attach\u00e9s - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Date de d\u00e9but -dl_datalistmodel.property.dl_ganttEndDate.title=Date de fin -dl_datalistmodel.property.dl_ganttPercentComplete.title=% achev\u00e9 - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Liste de t\u00e2ches (avanc\u00e9es) -dl_datalistmodel.type.dl_task.description=Liste de t\u00e2ches avanc\u00e9es comprenant le titre, la description, les dates de d\u00e9but et de fin, la priorit\u00e9, le statut, les commentaires, les acteurs et les pi\u00e8ces jointes. -dl_datalistmodel.property.dl_taskPriority.title=Priorit\u00e9 -dl_datalistmodel.property.dl_taskStatus.title=Statut -dl_datalistmodel.property.dl_taskComments.title=Commentaires -dl_datalistmodel.association.dl_taskAssignee.title=Personne assign\u00e9e - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Liste de t\u00e2ches (simples) -dl_datalistmodel.type.dl_simpletask.description=Liste de t\u00e2ches simples comprenant le titre, la description, la date d'\u00e9ch\u00e9ance, la priorit\u00e9, le statut et les commentaires. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Ech\u00e9ance -dl_datalistmodel.property.dl_simpletaskPriority.title=Priorit\u00e9 -dl_datalistmodel.property.dl_simpletaskStatus.title=Statut -dl_datalistmodel.property.dl_simpletaskComments.title=Commentaires - -# Contact -dl_datalistmodel.type.dl_contact.title=Liste de contacts -dl_datalistmodel.type.dl_contact.description=Liste de contacts comprenant le pr\u00e9nom, le nom, le nom complet, l'e-mail, l'intitul\u00e9 du poste, le num\u00e9ro de t\u00e9l\u00e9phone (bureau) et le num\u00e9ro de t\u00e9l\u00e9phone (portable). -dl_datalistmodel.property.dl_contactFirstName.title=Pr\u00e9nom -dl_datalistmodel.property.dl_contactLastName.title=Nom -dl_datalistmodel.property.dl_contactEmail.title=E-mail -dl_datalistmodel.property.dl_contactCompany.title=Soci\u00e9t\u00e9 -dl_datalistmodel.property.dl_contactJobTitle.title=Intitul\u00e9 du poste -dl_datalistmodel.property.dl_contactPhoneOffice.title=T\u00e9l\u00e9phone (bureau) -dl_datalistmodel.property.dl_contactPhoneMobile.title=T\u00e9l\u00e9phone (portable) -dl_datalistmodel.property.dl_contactNotes.title=Notes - -# Issues -dl_datalistmodel.type.dl_issue.title=Liste de publications -dl_datalistmodel.type.dl_issue.description=Liste de publications comprenant l'identifiant, le statut, la priorit\u00e9, la description, la date d'\u00e9ch\u00e9ance, les commentaires, l'assignation et les publications apparent\u00e9es. -dl_datalistmodel.property.dl_issueID.title=Identifiant de publication -dl_datalistmodel.property.dl_issueStatus.title=Statut -dl_datalistmodel.property.dl_issuePriority.title=Priorit\u00e9 -dl_datalistmodel.property.dl_issueDescription.title=Description -dl_datalistmodel.property.dl_issueDueDate.title=Ech\u00e9ance -dl_datalistmodel.property.dl_issueComments.title=Commentaires -dl_datalistmodel.association.dl_issueAssignedTo.title=Assign\u00e9 \u00e0 -dl_datalistmodel.property.dl_issueRelatedIssues.title=Publications apparent\u00e9es - -# Event -dl_datalistmodel.type.dl_event.title=Liste d'\u00e9v\u00e9nements -dl_datalistmodel.type.dl_event.description=Liste d'\u00e9v\u00e9nements comprenant le titre, la description, le lieu et les dates/heures de d\u00e9but et de fin. -dl_datalistmodel.property.dl_eventLocation.title=Emplacement -dl_datalistmodel.property.dl_eventStartDate.title=Date de d\u00e9but -dl_datalistmodel.property.dl_eventEndDate.title=Date de fin -dl_datalistmodel.property.dl_eventRegistrations.title=Inscriptions -dl_datalistmodel.property.dl_eventNote.title=Notes - -# Location -dl_datalistmodel.type.dl_location.title=Carnet d'adresses -dl_datalistmodel.type.dl_location.description=Carnet d'adresses -dl_datalistmodel.property.dl_locationAddress1.title=Adresse (ligne 1) -dl_datalistmodel.property.dl_locationAddress2.title=Adresse (ligne 2) -dl_datalistmodel.property.dl_locationAddress3.title=Adresse (ligne 3) -dl_datalistmodel.property.dl_locationZip.title=Code postal -dl_datalistmodel.property.dl_locationState.title=D\u00e9partement -dl_datalistmodel.property.dl_locationCountry.title=Pays -dl_datalistmodel.property.dl_locationNote.title=Notes - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Ordre du jour -dl_datalistmodel.type.dl_meetingAgenda.description=G\u00e9rer un ordre du jour comprenant la description, le propri\u00e9taire et le temps imparti. -dl_datalistmodel.property.dl_meetingAgendaRef.title=R\u00e9f\u00e9rence -dl_datalistmodel.property.dl_meetingAgendaTime.title=Temps (min) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Propri\u00e9taire - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Agenda d'\u00e9v\u00e9nement -dl_datalistmodel.type.dl_eventAgenda.description=G\u00e9rer un agenda d'\u00e9v\u00e9nement comprenant les noms de s\u00e9ances, les intervenants et les heures de d\u00e9but et de fin de s\u00e9ance. -dl_datalistmodel.property.dl_eventAgendaRef.title=R\u00e9f\u00e9rence -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Heure de d\u00e9but -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Heure de fin -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Nom de la s\u00e9ance -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Intervenant -dl_datalistmodel.property.dl_eventAgendaAudience.title=Auditoire -dl_datalistmodel.property.dl_eventAgendaNotes.title=Notes - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=Pas d\u00e9marr\u00e9 -listconstraint.dl_task_status.In\ Progress=En cours -listconstraint.dl_task_status.On\ Hold=Suspendu -listconstraint.dl_task_status.Complete=Achev\u00e9 -listconstraint.dl_priority_value.High=\u00c9lev\u00e9e -listconstraint.dl_priority_value.Normal=Normale -listconstraint.dl_priority_value.Low=Basse - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_it.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_it.properties deleted file mode 100755 index 5b5fc5a9c6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_it.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Modello di elenco dati Alfresco Share - -dl_datalistmodel.type.dl_dataList.title=Tipo di cartella dell'elenco dati -dl_datalistmodel.type.dl_dataList.description=Contiene elementi dell'elenco dati del tipo specificato nella propriet\u00e0 dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Tipo di elemento dell'elenco dati -dl_datalistmodel.property.dl_dataListItemType.description=Determina il sottotipo di dl:dataListItem che verr\u00e0 utilizzato durante la creazione di nuovi elementi nell'elenco dati. - -dl_datalistmodel.type.dl_dataListItem.title=Tipo di genitore dell'elenco dati -dl_datalistmodel.type.dl_dataListItem.description=Tipo di genitore da cui derivano i tipi di elementi dell'elenco dati di esempio. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Elenco Da fare -dl_datalistmodel.type.dl_todoList.description=Semplice elenco di compiti da eseguire con assegnatario opzionale. -dl_datalistmodel.property.dl_todoTitle.title=Titolo -dl_datalistmodel.property.dl_todoDueDate.title=Data di scadenza -dl_datalistmodel.property.dl_todoPriority.title=Priorit\u00e0 -dl_datalistmodel.property.dl_todoStatus.title=Stato -dl_datalistmodel.property.dl_todoNotes.title=Note -dl_datalistmodel.association.dl_assignee.title=Assegnatario -dl_datalistmodel.association.dl_attachments.title=Allegati - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Data di inizio -dl_datalistmodel.property.dl_ganttEndDate.title=Data di fine -dl_datalistmodel.property.dl_ganttPercentComplete.title=Percentuale di completamento - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Elenco di compiti (avanzato) -dl_datalistmodel.type.dl_task.description=Elenco di compiti avanzato contenente il titolo, la descrizione, le date di inizio e di fine, la priorit\u00e0, lo stato, i commenti, gli assegnatari e gli allegati. -dl_datalistmodel.property.dl_taskPriority.title=Priorit\u00e0 -dl_datalistmodel.property.dl_taskStatus.title=Stato -dl_datalistmodel.property.dl_taskComments.title=Commenti -dl_datalistmodel.association.dl_taskAssignee.title=Assegnatario - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Elenco di compiti (semplice) -dl_datalistmodel.type.dl_simpletask.description=Elenco di compiti semplice contenente il titolo, la descrizione, la data di scadenza, la priorit\u00e0, lo stato e i commenti. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Data di scadenza -dl_datalistmodel.property.dl_simpletaskPriority.title=Priorit\u00e0 -dl_datalistmodel.property.dl_simpletaskStatus.title=Stato -dl_datalistmodel.property.dl_simpletaskComments.title=Commenti - -# Contact -dl_datalistmodel.type.dl_contact.title=Elenco di contatti -dl_datalistmodel.type.dl_contact.description=Elenco di contatti contenente il nome, il cognome, il nome completo, l'indirizzo e-mail, la qualifica, il telefono dell'ufficio e il cellulare. -dl_datalistmodel.property.dl_contactFirstName.title=Nome -dl_datalistmodel.property.dl_contactLastName.title=Cognome -dl_datalistmodel.property.dl_contactEmail.title=E-mail -dl_datalistmodel.property.dl_contactCompany.title=Azienda -dl_datalistmodel.property.dl_contactJobTitle.title=Qualifica -dl_datalistmodel.property.dl_contactPhoneOffice.title=Telefono (ufficio) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Cellulare -dl_datalistmodel.property.dl_contactNotes.title=Note - -# Issues -dl_datalistmodel.type.dl_issue.title=Elenco di problemi -dl_datalistmodel.type.dl_issue.description=Elenco di problemi contenente l'ID, lo stato, la priorit\u00e0, la descrizione, la data di scadenza, i commenti, l'assegnatario e i problemi correlati. -dl_datalistmodel.property.dl_issueID.title=ID problema -dl_datalistmodel.property.dl_issueStatus.title=Stato -dl_datalistmodel.property.dl_issuePriority.title=Priorit\u00e0 -dl_datalistmodel.property.dl_issueDescription.title=Descrizione -dl_datalistmodel.property.dl_issueDueDate.title=Data di scadenza -dl_datalistmodel.property.dl_issueComments.title=Commenti -dl_datalistmodel.association.dl_issueAssignedTo.title=Assegnato a -dl_datalistmodel.property.dl_issueRelatedIssues.title=Problemi correlati - -# Event -dl_datalistmodel.type.dl_event.title=Elenco di eventi -dl_datalistmodel.type.dl_event.description=Elenco di eventi contenente il titolo, la descrizione, la localit\u00e0 e la data/ora di inizio e di fine. -dl_datalistmodel.property.dl_eventLocation.title=Localit\u00e0 -dl_datalistmodel.property.dl_eventStartDate.title=Data di inizio -dl_datalistmodel.property.dl_eventEndDate.title=Data di fine -dl_datalistmodel.property.dl_eventRegistrations.title=Registrazioni -dl_datalistmodel.property.dl_eventNote.title=Note - -# Location -dl_datalistmodel.type.dl_location.title=Elenco di localit\u00e0 -dl_datalistmodel.type.dl_location.description=Elenco di localit\u00e0/indirizzi -dl_datalistmodel.property.dl_locationAddress1.title=Riga 1 indirizzo -dl_datalistmodel.property.dl_locationAddress2.title=Riga 2 indirizzo -dl_datalistmodel.property.dl_locationAddress3.title=Riga 3 indirizzo -dl_datalistmodel.property.dl_locationZip.title=CAP/Codice postale -dl_datalistmodel.property.dl_locationState.title=Stato -dl_datalistmodel.property.dl_locationCountry.title=Paese -dl_datalistmodel.property.dl_locationNote.title=Note - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Agenda riunioni -dl_datalistmodel.type.dl_meetingAgenda.description=Consente di gestire le voci dell'agenda delle riunioni, tra cui la descrizione, il proprietario e l'ora di assegnazione. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Riferimento -dl_datalistmodel.property.dl_meetingAgendaTime.title=Ora (minuti) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Proprietario - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Agenda eventi -dl_datalistmodel.type.dl_eventAgenda.description=Consente di gestire le voci dell'agenda degli eventi, tra cui i nomi delle sessioni, i relatori e le ore di inizio e di fine. -dl_datalistmodel.property.dl_eventAgendaRef.title=Riferimento -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Ora di inizio -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Ora di fine -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Nome sessione -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Relatore -dl_datalistmodel.property.dl_eventAgendaAudience.title=Destinatari -dl_datalistmodel.property.dl_eventAgendaNotes.title=Note - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=Non avviato -listconstraint.dl_task_status.In\ Progress=In corso -listconstraint.dl_task_status.On\ Hold=In attesa -listconstraint.dl_task_status.Complete=Completato -listconstraint.dl_priority_value.High=Alta -listconstraint.dl_priority_value.Normal=Normale -listconstraint.dl_priority_value.Low=Bassa - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_ja.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_ja.properties deleted file mode 100755 index a6059888fb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_ja.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Alfresco Share \u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u30e2\u30c7\u30eb - -dl_datalistmodel.type.dl_dataList.title=\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u30d5\u30a9\u30eb\u30c0\u306e\u30bf\u30a4\u30d7 -dl_datalistmodel.type.dl_dataList.description=dl:dataListItemType \u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u6307\u5b9a\u3055\u308c\u305f\u30bf\u30a4\u30d7\u306e\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u30a2\u30a4\u30c6\u30e0\u3092\u4fdd\u6301\u3057\u307e\u3059\u3002 -dl_datalistmodel.property.dl_dataListItemType.title=\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u30a2\u30a4\u30c6\u30e0\u306e\u30bf\u30a4\u30d7 -dl_datalistmodel.property.dl_dataListItemType.description=\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u5185\u3067\u65b0\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u3092\u4f5c\u6210\u3059\u308b\u3068\u304d\u306b\u4f7f\u7528\u3059\u308b dl:dataListItem \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002 - -dl_datalistmodel.type.dl_dataListItem.title=\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u306e\u89aa\u30bf\u30a4\u30d7 -dl_datalistmodel.type.dl_dataListItem.description=\u89aa\u30bf\u30a4\u30d7\u3068\u306f\u3001\u30b5\u30f3\u30d7\u30eb\u306e\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u30a2\u30a4\u30c6\u30e0\u306e\u30bf\u30a4\u30d7\u304c\u5f93\u5c5e\u3059\u308b\u30bf\u30a4\u30d7\u3092\u6307\u3057\u307e\u3059\u3002 - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=\u7528\u4ef6\u30ea\u30b9\u30c8 -dl_datalistmodel.type.dl_todoList.description=\u30b7\u30f3\u30d7\u30eb\u306a\u7528\u4ef6\u30ea\u30b9\u30c8\u3002\u62c5\u5f53\u8005\u3092\u5272\u308a\u5f53\u3066\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 -dl_datalistmodel.property.dl_todoTitle.title=\u30bf\u30a4\u30c8\u30eb -dl_datalistmodel.property.dl_todoDueDate.title=\u671f\u9650 -dl_datalistmodel.property.dl_todoPriority.title=\u512a\u5148\u5ea6 -dl_datalistmodel.property.dl_todoStatus.title=\u30b9\u30c6\u30fc\u30bf\u30b9 -dl_datalistmodel.property.dl_todoNotes.title=\u30e1\u30e2 -dl_datalistmodel.association.dl_assignee.title=\u62c5\u5f53\u8005 -dl_datalistmodel.association.dl_attachments.title=\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=\u958b\u59cb\u65e5 -dl_datalistmodel.property.dl_ganttEndDate.title=\u7d42\u4e86\u65e5 -dl_datalistmodel.property.dl_ganttPercentComplete.title=% \u5b8c\u4e86 - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=\u30bf\u30b9\u30af\u30ea\u30b9\u30c8 (\u8a73\u7d30) -dl_datalistmodel.type.dl_task.description=\u30bf\u30b9\u30af\u306e\u30bf\u30a4\u30c8\u30eb\u3001\u8aac\u660e\u3001\u958b\u59cb\u65e5\u3001\u7d42\u4e86\u65e5\u3001\u512a\u5148\u5ea6\u3001\u30b9\u30c6\u30fc\u30bf\u30b9\u3001\u30b3\u30e1\u30f3\u30c8\u3001\u62c5\u5f53\u8005\u3001\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_taskPriority.title=\u512a\u5148\u5ea6 -dl_datalistmodel.property.dl_taskStatus.title=\u30b9\u30c6\u30fc\u30bf\u30b9 -dl_datalistmodel.property.dl_taskComments.title=\u30b3\u30e1\u30f3\u30c8 -dl_datalistmodel.association.dl_taskAssignee.title=\u62c5\u5f53\u8005 - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=\u30bf\u30b9\u30af\u30ea\u30b9\u30c8 (\u30b7\u30f3\u30d7\u30eb) -dl_datalistmodel.type.dl_simpletask.description=\u30bf\u30b9\u30af\u306e\u30bf\u30a4\u30c8\u30eb\u3001\u8aac\u660e\u3001\u671f\u9650\u3001\u512a\u5148\u5ea6\u3001\u30b9\u30c6\u30fc\u30bf\u30b9\u3001\u30b3\u30e1\u30f3\u30c8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_simpletaskDueDate.title=\u671f\u9650 -dl_datalistmodel.property.dl_simpletaskPriority.title=\u512a\u5148\u5ea6 -dl_datalistmodel.property.dl_simpletaskStatus.title=\u30b9\u30c6\u30fc\u30bf\u30b9 -dl_datalistmodel.property.dl_simpletaskComments.title=\u30b3\u30e1\u30f3\u30c8 - -# Contact -dl_datalistmodel.type.dl_contact.title=\u9023\u7d61\u5148\u30ea\u30b9\u30c8 -dl_datalistmodel.type.dl_contact.description=\u540d\u524d\u3001E \u30e1\u30fc\u30eb\u3001\u5f79\u8077\u3001\u96fb\u8a71 (\u4f1a\u793e)\u3001\u96fb\u8a71 (\u643a\u5e2f) \u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_contactFirstName.title=\u540d -dl_datalistmodel.property.dl_contactLastName.title=\u59d3 -dl_datalistmodel.property.dl_contactEmail.title=E \u30e1\u30fc\u30eb -dl_datalistmodel.property.dl_contactCompany.title=\u4f1a\u793e\u540d -dl_datalistmodel.property.dl_contactJobTitle.title=\u5f79\u8077\u540d -dl_datalistmodel.property.dl_contactPhoneOffice.title=\u96fb\u8a71\uff08\u4f1a\u793e\uff09 -dl_datalistmodel.property.dl_contactPhoneMobile.title=\u96fb\u8a71\uff08\u643a\u5e2f\uff09 -dl_datalistmodel.property.dl_contactNotes.title=\u30e1\u30e2 - -# Issues -dl_datalistmodel.type.dl_issue.title=\u8ab2\u984c\u30ea\u30b9\u30c8 -dl_datalistmodel.type.dl_issue.description=ID\u3001\u30b9\u30c6\u30fc\u30bf\u30b9\u3001\u512a\u5148\u5ea6\u3001\u8aac\u660e\u3001\u671f\u9650\u3001\u30b3\u30e1\u30f3\u30c8\u3001\u62c5\u5f53\u8005\u3001\u95a2\u9023\u8ab2\u984c\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_issueID.title=\u8ab2\u984c ID -dl_datalistmodel.property.dl_issueStatus.title=\u30b9\u30c6\u30fc\u30bf\u30b9 -dl_datalistmodel.property.dl_issuePriority.title=\u512a\u5148\u5ea6 -dl_datalistmodel.property.dl_issueDescription.title=\u8aac\u660e -dl_datalistmodel.property.dl_issueDueDate.title=\u671f\u9650 -dl_datalistmodel.property.dl_issueComments.title=\u30b3\u30e1\u30f3\u30c8 -dl_datalistmodel.association.dl_issueAssignedTo.title=\u62c5\u5f53\u8005 -dl_datalistmodel.property.dl_issueRelatedIssues.title=\u95a2\u9023\u8ab2\u984c - -# Event -dl_datalistmodel.type.dl_event.title=\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30c8 -dl_datalistmodel.type.dl_event.description=\u30a4\u30d9\u30f3\u30c8\u306e\u30bf\u30a4\u30c8\u30eb\u3001\u8aac\u660e\u3001\u5834\u6240\u3001\u512a\u5148\u5ea6\u3001\u958b\u59cb\u65e5\u6642\u3001\u7d42\u4e86\u65e5\u6642\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_eventLocation.title=\u5834\u6240 -dl_datalistmodel.property.dl_eventStartDate.title=\u958b\u59cb\u65e5 -dl_datalistmodel.property.dl_eventEndDate.title=\u7d42\u4e86\u65e5 -dl_datalistmodel.property.dl_eventRegistrations.title=\u767b\u9332\u6570 -dl_datalistmodel.property.dl_eventNote.title=\u30e1\u30e2 - -# Location -dl_datalistmodel.type.dl_location.title=\u4f4f\u6240\u30ea\u30b9\u30c8 -dl_datalistmodel.type.dl_location.description=\u4f4f\u6240\u304c\u8868\u793a\u3055\u308c\u307e\u3059 -dl_datalistmodel.property.dl_locationAddress1.title=\u4f4f\u62401 -dl_datalistmodel.property.dl_locationAddress2.title=\u4f4f\u6240 2 -dl_datalistmodel.property.dl_locationAddress3.title=\u4f4f\u6240 3 -dl_datalistmodel.property.dl_locationZip.title=\u90f5\u4fbf\u756a\u53f7 -dl_datalistmodel.property.dl_locationState.title=\u90fd\u9053\u5e9c\u770c -dl_datalistmodel.property.dl_locationCountry.title=\u56fd -dl_datalistmodel.property.dl_locationNote.title=\u30e1\u30e2 - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=\u4f1a\u8b70\u30a2\u30b8\u30a7\u30f3\u30c0 -dl_datalistmodel.type.dl_meetingAgenda.description=\u4f1a\u8b70\u306e\u30a2\u30b8\u30a7\u30f3\u30c0 (\u8aac\u660e\u3001\u4e3b\u50ac\u8005\u3001\u4e88\u5b9a\u6642\u9593) \u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_meetingAgendaRef.title=\u53c2\u7167 -dl_datalistmodel.property.dl_meetingAgendaTime.title=\u6642\u9593 (\u5206) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=\u6240\u6709\u8005 - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=\u30a4\u30d9\u30f3\u30c8\u30a2\u30b8\u30a7\u30f3\u30c0 -dl_datalistmodel.type.dl_eventAgenda.description=\u30a4\u30d9\u30f3\u30c8\u306e\u30a2\u30b8\u30a7\u30f3\u30c0 (\u30bb\u30c3\u30b7\u30e7\u30f3\u540d\u3001\u767a\u8868\u8005\u3001\u958b\u59cb\u6642\u523b\u3001\u7d42\u4e86\u6642\u523b) \u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 -dl_datalistmodel.property.dl_eventAgendaRef.title=\u53c2\u7167 -dl_datalistmodel.property.dl_eventAgendaStartTime.title=\u958b\u59cb\u6642\u523b -dl_datalistmodel.property.dl_eventAgendaEndTime.title=\u7d42\u4e86\u6642\u523b -dl_datalistmodel.property.dl_eventAgendaSessionName.title=\u30bb\u30c3\u30b7\u30e7\u30f3\u540d -dl_datalistmodel.property.dl_eventAgendaPresenter.title=\u767a\u8868\u8005 -dl_datalistmodel.property.dl_eventAgendaAudience.title=\u53c2\u52a0\u8005 -dl_datalistmodel.property.dl_eventAgendaNotes.title=\u30e1\u30e2 - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=\u958b\u59cb\u524d -listconstraint.dl_task_status.In\ Progress=\u9032\u884c\u4e2d -listconstraint.dl_task_status.On\ Hold=\u4fdd\u7559\u4e2d -listconstraint.dl_task_status.Complete=\u5b8c\u4e86 -listconstraint.dl_priority_value.High=\u9ad8 -listconstraint.dl_priority_value.Normal=\u4e2d -listconstraint.dl_priority_value.Low=\u4f4e - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_nb.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_nb.properties deleted file mode 100755 index e4181c1bd5..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_nb.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Datalistemodell for Alfresco Deling - -dl_datalistmodel.type.dl_dataList.title=Mappetype for dataliste -dl_datalistmodel.type.dl_dataList.description=Holder datalisteelementer av den typen som angis i egenskapen dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Type datalisteelement -dl_datalistmodel.property.dl_dataListItemType.description=Fastsetter hvilken undertype av dl:dataListItem som brukes n\u00e5r nye elementer opprettes innenfor datalisten. - -dl_datalistmodel.type.dl_dataListItem.title=Overordnet type for dataliste -dl_datalistmodel.type.dl_dataListItem.description=Fra hvilken overordnet type som utvalg av datalisteelementtyper hentes fra. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Liste over gj\u00f8rem\u00e5l -dl_datalistmodel.type.dl_todoList.description=En enkel liste over gj\u00f8rem\u00e5l med valgfri tilordnet person. -dl_datalistmodel.property.dl_todoTitle.title=Tittel -dl_datalistmodel.property.dl_todoDueDate.title=Forfallsdato -dl_datalistmodel.property.dl_todoPriority.title=Prioritet -dl_datalistmodel.property.dl_todoStatus.title=Status -dl_datalistmodel.property.dl_todoNotes.title=Merknader -dl_datalistmodel.association.dl_assignee.title=Tilordnet -dl_datalistmodel.association.dl_attachments.title=Vedlegg - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Startdato -dl_datalistmodel.property.dl_ganttEndDate.title=Sluttdato -dl_datalistmodel.property.dl_ganttPercentComplete.title=% fullf\u00f8rt - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Oppgaveliste (avansert) -dl_datalistmodel.type.dl_task.description=Avansert oppgaveliste som inkluderer tittel, beskrivelse, start- og sluttdatoer, prioritet, status, kommentarer, tilordnede og vedlegg. -dl_datalistmodel.property.dl_taskPriority.title=Prioritet -dl_datalistmodel.property.dl_taskStatus.title=Status -dl_datalistmodel.property.dl_taskComments.title=Kommentarer -dl_datalistmodel.association.dl_taskAssignee.title=Tilordnet - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Oppgaveliste (enkel) -dl_datalistmodel.type.dl_simpletask.description=Enkel oppgaveliste som inkluderer tittel, beskrivelse, forfallsdato, prioritet, status og kommentarer. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Forfallsdato -dl_datalistmodel.property.dl_simpletaskPriority.title=Prioritet -dl_datalistmodel.property.dl_simpletaskStatus.title=Status -dl_datalistmodel.property.dl_simpletaskComments.title=Kommentarer - -# Contact -dl_datalistmodel.type.dl_contact.title=Kontaktliste -dl_datalistmodel.type.dl_contact.description=Kontaktliste som inkluderer fornavn, etternavn, fullt navn, jobbtittel, telefon (kontor), telefon (mobil). -dl_datalistmodel.property.dl_contactFirstName.title=Fornavn -dl_datalistmodel.property.dl_contactLastName.title=Etternavn -dl_datalistmodel.property.dl_contactEmail.title=E-post -dl_datalistmodel.property.dl_contactCompany.title=Firma -dl_datalistmodel.property.dl_contactJobTitle.title=Stillingstittel -dl_datalistmodel.property.dl_contactPhoneOffice.title=Telefon (kontor) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Telefon (mobil) -dl_datalistmodel.property.dl_contactNotes.title=Merknader - -# Issues -dl_datalistmodel.type.dl_issue.title=Problemliste -dl_datalistmodel.type.dl_issue.description=Problemliste som inkluderer ID, status, prioritet, beskrivelse, forfallsdato, kommentarer, tilordnet til, relaterte problemer. -dl_datalistmodel.property.dl_issueID.title=Problem-ID -dl_datalistmodel.property.dl_issueStatus.title=Status -dl_datalistmodel.property.dl_issuePriority.title=Prioritet -dl_datalistmodel.property.dl_issueDescription.title=Beskrivelse -dl_datalistmodel.property.dl_issueDueDate.title=Forfallsdato -dl_datalistmodel.property.dl_issueComments.title=Kommentarer -dl_datalistmodel.association.dl_issueAssignedTo.title=Tilordnet til -dl_datalistmodel.property.dl_issueRelatedIssues.title=Relaterte problemer - -# Event -dl_datalistmodel.type.dl_event.title=Hendelsesliste -dl_datalistmodel.type.dl_event.description=Hendelsesliste som inkluderer tittel, beskrivelse, sted, start- og sluttdato/-tid. -dl_datalistmodel.property.dl_eventLocation.title=Sted -dl_datalistmodel.property.dl_eventStartDate.title=Startdato -dl_datalistmodel.property.dl_eventEndDate.title=Sluttdato -dl_datalistmodel.property.dl_eventRegistrations.title=Registreringer -dl_datalistmodel.property.dl_eventNote.title=Merknader - -# Location -dl_datalistmodel.type.dl_location.title=Stedsliste -dl_datalistmodel.type.dl_location.description=Liste over steder/adresser -dl_datalistmodel.property.dl_locationAddress1.title=Adresserad 1 -dl_datalistmodel.property.dl_locationAddress2.title=Adresserad 2 -dl_datalistmodel.property.dl_locationAddress3.title=Adresserad 3 -dl_datalistmodel.property.dl_locationZip.title=Postnummer -dl_datalistmodel.property.dl_locationState.title=Fylke/kommune -dl_datalistmodel.property.dl_locationCountry.title=Land -dl_datalistmodel.property.dl_locationNote.title=Merknader - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Saksliste -dl_datalistmodel.type.dl_meetingAgenda.description=Administrer sakslisteelementer som inkluderer beskrivelse, eier, tildelt tid. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Referanse -dl_datalistmodel.property.dl_meetingAgendaTime.title=Tid (minutter) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Eier - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Hendelsesagenda -dl_datalistmodel.type.dl_eventAgenda.description=Administrer hendelsesagendaelementer som inkluderer \u00f8ktnavn, person som presenterer, start- og sluttider. -dl_datalistmodel.property.dl_eventAgendaRef.title=Referanse -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Starttid -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Sluttid -dl_datalistmodel.property.dl_eventAgendaSessionName.title=\u00d8ktnavn -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Person som presenterer -dl_datalistmodel.property.dl_eventAgendaAudience.title=Publikum -dl_datalistmodel.property.dl_eventAgendaNotes.title=Merknader - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=Ikke startet -listconstraint.dl_task_status.In\ Progress=P\u00e5g\u00e5r -listconstraint.dl_task_status.On\ Hold=P\u00e5 vent -listconstraint.dl_task_status.Complete=Fullf\u00f8r -listconstraint.dl_priority_value.High=H\u00f8y -listconstraint.dl_priority_value.Normal=Normal -listconstraint.dl_priority_value.Low=Lav - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_nl.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_nl.properties deleted file mode 100755 index 94984dbfc8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_nl.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Alfresco Share-gegevenslijstmodel - -dl_datalistmodel.type.dl_dataList.title=Maptype van gegevenslijst -dl_datalistmodel.type.dl_dataList.description=Bevat gegevenslijstobjecten van het type dat is opgegeven in de eigenschap dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Objecttype van gegevenslijst -dl_datalistmodel.property.dl_dataListItemType.description=Bepaalt welk subtype van dl:dataListItem wordt gebruikt bij het maken van nieuwe objecten in de gegevenslijst. - -dl_datalistmodel.type.dl_dataListItem.title=Bovenliggend type van gegevenslijst -dl_datalistmodel.type.dl_dataListItem.description=Bovenliggend type waarvan voorbeeldobjecttypen van de gegevenslijst zijn afgeleid. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Takenlijst -dl_datalistmodel.type.dl_todoList.description=Een eenvoudige takenlijst met een optionele toegewezen persoon. -dl_datalistmodel.property.dl_todoTitle.title=Titel -dl_datalistmodel.property.dl_todoDueDate.title=Vervaldatum -dl_datalistmodel.property.dl_todoPriority.title=Prioriteit -dl_datalistmodel.property.dl_todoStatus.title=Status -dl_datalistmodel.property.dl_todoNotes.title=Opmerkingen -dl_datalistmodel.association.dl_assignee.title=Toegewezen persoon -dl_datalistmodel.association.dl_attachments.title=Bijlagen - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Begindatum -dl_datalistmodel.property.dl_ganttEndDate.title=Einddatum -dl_datalistmodel.property.dl_ganttPercentComplete.title=% voltooid - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Takenlijst (geavanceerd) -dl_datalistmodel.type.dl_task.description=Geavanceerde takenlijst, inclusief titel, beschrijving, begin- en einddatum, prioriteit, status, opmerkingen, toegewezen personen en bijlagen. -dl_datalistmodel.property.dl_taskPriority.title=Prioriteit -dl_datalistmodel.property.dl_taskStatus.title=Status -dl_datalistmodel.property.dl_taskComments.title=Opmerkingen -dl_datalistmodel.association.dl_taskAssignee.title=Toegewezen persoon - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Takenlijst (eenvoudig) -dl_datalistmodel.type.dl_simpletask.description=Eenvoudige takenlijst, inclusief titel, beschrijving, vervaldatum, prioriteit, status en opmerkingen. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Vervaldatum -dl_datalistmodel.property.dl_simpletaskPriority.title=Prioriteit -dl_datalistmodel.property.dl_simpletaskStatus.title=Status -dl_datalistmodel.property.dl_simpletaskComments.title=Opmerkingen - -# Contact -dl_datalistmodel.type.dl_contact.title=Lijst met contactpersonen -dl_datalistmodel.type.dl_contact.description=Lijst met contactpersonen, inclusief voornaam, achternaam, volledige naam, e-mailadres, functie, telefoon (kantoor), telefoon (mobiel). -dl_datalistmodel.property.dl_contactFirstName.title=Voornaam -dl_datalistmodel.property.dl_contactLastName.title=Achternaam -dl_datalistmodel.property.dl_contactEmail.title=E-mailadres -dl_datalistmodel.property.dl_contactCompany.title=Bedrijf -dl_datalistmodel.property.dl_contactJobTitle.title=Functie -dl_datalistmodel.property.dl_contactPhoneOffice.title=Telefoon (kantoor) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Telefoon (mobiel) -dl_datalistmodel.property.dl_contactNotes.title=Opmerkingen - -# Issues -dl_datalistmodel.type.dl_issue.title=Lijst met problemen -dl_datalistmodel.type.dl_issue.description=Lijst met problemen, inclusief id, status, prioriteit, beschrijving, vervaldatums, opmerkingen, toewijzen aan, gerelateerde problemen. -dl_datalistmodel.property.dl_issueID.title=Probleem-id -dl_datalistmodel.property.dl_issueStatus.title=Status -dl_datalistmodel.property.dl_issuePriority.title=Prioriteit -dl_datalistmodel.property.dl_issueDescription.title=Beschrijving -dl_datalistmodel.property.dl_issueDueDate.title=Vervaldatum -dl_datalistmodel.property.dl_issueComments.title=Opmerkingen -dl_datalistmodel.association.dl_issueAssignedTo.title=Toegewezen aan -dl_datalistmodel.property.dl_issueRelatedIssues.title=Gerelateerde problemen - -# Event -dl_datalistmodel.type.dl_event.title=Lijst met gebeurtenissen -dl_datalistmodel.type.dl_event.description=Lijst met gebeurtenissen, inclusief titel, beschrijving, locatie en begin- en einddatum/-tijd. -dl_datalistmodel.property.dl_eventLocation.title=Locatie -dl_datalistmodel.property.dl_eventStartDate.title=Begindatum -dl_datalistmodel.property.dl_eventEndDate.title=Einddatum -dl_datalistmodel.property.dl_eventRegistrations.title=Registraties -dl_datalistmodel.property.dl_eventNote.title=Opmerkingen - -# Location -dl_datalistmodel.type.dl_location.title=Lijst met locaties -dl_datalistmodel.type.dl_location.description=Lijst met locaties/adressen -dl_datalistmodel.property.dl_locationAddress1.title=Adresregel 1 -dl_datalistmodel.property.dl_locationAddress2.title=Adresregel 2 -dl_datalistmodel.property.dl_locationAddress3.title=Adresregel 3 -dl_datalistmodel.property.dl_locationZip.title=Postcode -dl_datalistmodel.property.dl_locationState.title=Staat/provincie -dl_datalistmodel.property.dl_locationCountry.title=Land -dl_datalistmodel.property.dl_locationNote.title=Opmerkingen - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Vergaderagenda -dl_datalistmodel.type.dl_meetingAgenda.description=Beheer vergaderagenda-items zoals beschrijving, eigenaar, toegewezen tijd. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Verwijzing -dl_datalistmodel.property.dl_meetingAgendaTime.title=Tijd (min.) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Eigenaar - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Gebeurtenisagenda -dl_datalistmodel.type.dl_eventAgenda.description=Beheer gebeurtenisagenda-items zoals sessienamen, presentators en begin- en eindtijden. -dl_datalistmodel.property.dl_eventAgendaRef.title=Verwijzing -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Begintijd -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Eindtijd -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Sessienaam -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Presentator -dl_datalistmodel.property.dl_eventAgendaAudience.title=Publiek -dl_datalistmodel.property.dl_eventAgendaNotes.title=Opmerkingen - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=Niet gestart -listconstraint.dl_task_status.In\ Progress=In uitvoering -listconstraint.dl_task_status.On\ Hold=In bewaring -listconstraint.dl_task_status.Complete=Voltooid -listconstraint.dl_priority_value.High=Hoog -listconstraint.dl_priority_value.Normal=Normaal -listconstraint.dl_priority_value.Low=Laag - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_pt_BR.properties deleted file mode 100644 index 96e68fadc4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_pt_BR.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Modelo de lista de dados do Alfresco Share - -dl_datalistmodel.type.dl_dataList.title=Tipo de pasta de lista de dados -dl_datalistmodel.type.dl_dataList.description=Cont\u00e9m itens de lista de dados do tipo especificado na propriedade dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=Tipo de item da lista de dados -dl_datalistmodel.property.dl_dataListItemType.description=Determina qual subtipo de dl:dataListItem ser\u00e1 usado quando criar novos itens na lista de dados. - -dl_datalistmodel.type.dl_dataListItem.title=Tipo prim\u00e1rio da lista de dados -dl_datalistmodel.type.dl_dataListItem.description=Tipo prim\u00e1rio a partir do qual os tipos de item da lista de dados amostrais s\u00e3o derivados. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=Lista de tarefas -dl_datalistmodel.type.dl_todoList.description=Uma lista de tarefas simples com destinat\u00e1rio opcional. -dl_datalistmodel.property.dl_todoTitle.title=T\u00edtulo -dl_datalistmodel.property.dl_todoDueDate.title=Data de vencimento -dl_datalistmodel.property.dl_todoPriority.title=Prioridade -dl_datalistmodel.property.dl_todoStatus.title=Status -dl_datalistmodel.property.dl_todoNotes.title=Notas -dl_datalistmodel.association.dl_assignee.title=Destinat\u00e1rio -dl_datalistmodel.association.dl_attachments.title=Anexos - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=Data de in\u00edcio -dl_datalistmodel.property.dl_ganttEndDate.title=Data de t\u00e9rmino -dl_datalistmodel.property.dl_ganttPercentComplete.title=% Completa - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=Lista de tarefas (avan\u00e7ada) -dl_datalistmodel.type.dl_task.description=Lista de tarefas avan\u00e7ada, incluindo t\u00edtulo, descri\u00e7\u00e3o, datas de in\u00edcio e t\u00e9rmino, prioridade, status, coment\u00e1rios, destinat\u00e1rios e anexos. -dl_datalistmodel.property.dl_taskPriority.title=Prioridade -dl_datalistmodel.property.dl_taskStatus.title=Status -dl_datalistmodel.property.dl_taskComments.title=Coment\u00e1rios -dl_datalistmodel.association.dl_taskAssignee.title=Destinat\u00e1rio - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=Lista de tarefas (simples) -dl_datalistmodel.type.dl_simpletask.description=Lista de tarefas simples, incluindo t\u00edtulo, descri\u00e7\u00e3o, prazo, prioridade, status e coment\u00e1rios. -dl_datalistmodel.property.dl_simpletaskDueDate.title=Data de vencimento -dl_datalistmodel.property.dl_simpletaskPriority.title=Prioridade -dl_datalistmodel.property.dl_simpletaskStatus.title=Status -dl_datalistmodel.property.dl_simpletaskComments.title=Coment\u00e1rios - -# Contact -dl_datalistmodel.type.dl_contact.title=Lista de contatos -dl_datalistmodel.type.dl_contact.description=Lista de contatos, incluindo o nome, sobrenome, nome completo, email, cargo, telefone (escrit\u00f3rio) e telefone (celular). -dl_datalistmodel.property.dl_contactFirstName.title=Nome -dl_datalistmodel.property.dl_contactLastName.title=Sobrenome -dl_datalistmodel.property.dl_contactEmail.title=Email -dl_datalistmodel.property.dl_contactCompany.title=Empresa -dl_datalistmodel.property.dl_contactJobTitle.title=Cargo -dl_datalistmodel.property.dl_contactPhoneOffice.title=Telefone (escrit\u00f3rio) -dl_datalistmodel.property.dl_contactPhoneMobile.title=Telefone (celular) -dl_datalistmodel.property.dl_contactNotes.title=Notas - -# Issues -dl_datalistmodel.type.dl_issue.title=Lista de problemas -dl_datalistmodel.type.dl_issue.description=Lista de problemas, incluindo ID, status, prioridade, descri\u00e7\u00e3o, prazo, coment\u00e1rios, atribuir e problemas relacionados. -dl_datalistmodel.property.dl_issueID.title=ID do problema -dl_datalistmodel.property.dl_issueStatus.title=Status -dl_datalistmodel.property.dl_issuePriority.title=Prioridade -dl_datalistmodel.property.dl_issueDescription.title=Descri\u00e7\u00e3o -dl_datalistmodel.property.dl_issueDueDate.title=Data de vencimento -dl_datalistmodel.property.dl_issueComments.title=Coment\u00e1rios -dl_datalistmodel.association.dl_issueAssignedTo.title=Atribu\u00eddo para -dl_datalistmodel.property.dl_issueRelatedIssues.title=Problemas relacionados - -# Event -dl_datalistmodel.type.dl_event.title=Lista de eventos -dl_datalistmodel.type.dl_event.description=Lista de eventos incluindo t\u00edtulo, descri\u00e7\u00e3o, localiza\u00e7\u00e3o e data/hora de in\u00edcio e t\u00e9rmino. -dl_datalistmodel.property.dl_eventLocation.title=Localiza\u00e7\u00e3o -dl_datalistmodel.property.dl_eventStartDate.title=Data de in\u00edcio -dl_datalistmodel.property.dl_eventEndDate.title=Data de t\u00e9rmino -dl_datalistmodel.property.dl_eventRegistrations.title=Registros -dl_datalistmodel.property.dl_eventNote.title=Notas - -# Location -dl_datalistmodel.type.dl_location.title=Lista de localiza\u00e7\u00e3o -dl_datalistmodel.type.dl_location.description=Lista de localiza\u00e7\u00f5es/endere\u00e7os -dl_datalistmodel.property.dl_locationAddress1.title=Endere\u00e7o, linha 1 -dl_datalistmodel.property.dl_locationAddress2.title=Endere\u00e7o, linha 2 -dl_datalistmodel.property.dl_locationAddress3.title=Endere\u00e7o, linha 3 -dl_datalistmodel.property.dl_locationZip.title=C\u00f3digo postal/CEP -dl_datalistmodel.property.dl_locationState.title=Estado/munic\u00edpio -dl_datalistmodel.property.dl_locationCountry.title=Pa\u00eds -dl_datalistmodel.property.dl_locationNote.title=Notas - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=Agenda de reuni\u00e3o -dl_datalistmodel.type.dl_meetingAgenda.description=Gerencie itens de agenda de reuni\u00e3o, incluindo descri\u00e7\u00e3o, propriet\u00e1rio e tempo alocado. -dl_datalistmodel.property.dl_meetingAgendaRef.title=Refer\u00eancia -dl_datalistmodel.property.dl_meetingAgendaTime.title=Tempo (minutos) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=Propriet\u00e1rio - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=Agenda de evento -dl_datalistmodel.type.dl_eventAgenda.description=Gerencie itens de agenda de evento, incluindo nomes de sess\u00e3o, apresentadores e horas de in\u00edcio e t\u00e9rmino. -dl_datalistmodel.property.dl_eventAgendaRef.title=Refer\u00eancia -dl_datalistmodel.property.dl_eventAgendaStartTime.title=Hora de in\u00edcio -dl_datalistmodel.property.dl_eventAgendaEndTime.title=Hora de t\u00e9rmino -dl_datalistmodel.property.dl_eventAgendaSessionName.title=Nome da sess\u00e3o -dl_datalistmodel.property.dl_eventAgendaPresenter.title=Apresentador -dl_datalistmodel.property.dl_eventAgendaAudience.title=P\u00fablico -dl_datalistmodel.property.dl_eventAgendaNotes.title=Notas - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=N\u00e3o iniciado -listconstraint.dl_task_status.In\ Progress=Em andamento -listconstraint.dl_task_status.On\ Hold=Em espera -listconstraint.dl_task_status.Complete=Conclu\u00eddo -listconstraint.dl_priority_value.High=Alto -listconstraint.dl_priority_value.Normal=Normal -listconstraint.dl_priority_value.Low=Baixo - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_ru.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_ru.properties deleted file mode 100755 index 8769340b4d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_ru.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=\u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Alfresco Share - -dl_datalistmodel.type.dl_dataList.title=\u0422\u0438\u043f \u043f\u0430\u043f\u043a\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 -dl_datalistmodel.type.dl_dataList.description=\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 dl:dataListItemType. -dl_datalistmodel.property.dl_dataListItemType.title=\u0422\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 -dl_datalistmodel.property.dl_dataListItemType.description=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0442\u0438\u043f dl:dataListItem \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. - -dl_datalistmodel.type.dl_dataListItem.title=\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 -dl_datalistmodel.type.dl_dataListItem.description=\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0438\u043f, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0438\u043f\u043e\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=\u0421\u043f\u0438\u0441\u043e\u043a \u0434\u0435\u043b -dl_datalistmodel.type.dl_todoList.description=\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0435\u043b \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f\u043c\u0438. -dl_datalistmodel.property.dl_todoTitle.title=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a -dl_datalistmodel.property.dl_todoDueDate.title=\u0421\u0440\u043e\u043a -dl_datalistmodel.property.dl_todoPriority.title=\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 -dl_datalistmodel.property.dl_todoStatus.title=\u0421\u0442\u0430\u0442\u0443\u0441 -dl_datalistmodel.property.dl_todoNotes.title=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f -dl_datalistmodel.association.dl_assignee.title=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c -dl_datalistmodel.association.dl_attachments.title=\u0412\u043b\u043e\u0436\u0435\u043d\u0438\u044f - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=\u0414\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 -dl_datalistmodel.property.dl_ganttEndDate.title=\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f -dl_datalistmodel.property.dl_ganttPercentComplete.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e % - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=\u0421\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447 (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439) -dl_datalistmodel.type.dl_task.description=\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0434\u0430\u0442\u044b \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043a\u043e\u043d\u0446\u0430, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u0441\u0442\u0430\u0442\u0443\u0441, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u0439 \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u044f. -dl_datalistmodel.property.dl_taskPriority.title=\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 -dl_datalistmodel.property.dl_taskStatus.title=\u0421\u0442\u0430\u0442\u0443\u0441 -dl_datalistmodel.property.dl_taskComments.title=\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 -dl_datalistmodel.association.dl_taskAssignee.title=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=\u0421\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447 (\u043f\u0440\u043e\u0441\u0442\u043e\u0439) -dl_datalistmodel.type.dl_simpletask.description=\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0441\u0440\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u0441\u0442\u0430\u0442\u0443\u0441, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. -dl_datalistmodel.property.dl_simpletaskDueDate.title=\u0421\u0440\u043e\u043a -dl_datalistmodel.property.dl_simpletaskPriority.title=\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 -dl_datalistmodel.property.dl_simpletaskStatus.title=\u0421\u0442\u0430\u0442\u0443\u0441 -dl_datalistmodel.property.dl_simpletaskComments.title=\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 - -# Contact -dl_datalistmodel.type.dl_contact.title=\u0421\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 -dl_datalistmodel.type.dl_contact.description=\u0421\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0438\u043c\u044f, \u0444\u0430\u043c\u0438\u043b\u0438\u044e, \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f, \u0430\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b, \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c, \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (\u043e\u0444\u0438\u0441), \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e). -dl_datalistmodel.property.dl_contactFirstName.title=\u0418\u043c\u044f -dl_datalistmodel.property.dl_contactLastName.title=\u0424\u0430\u043c\u0438\u043b\u0438\u044f -dl_datalistmodel.property.dl_contactEmail.title=\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430 -dl_datalistmodel.property.dl_contactCompany.title=\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f -dl_datalistmodel.property.dl_contactJobTitle.title=\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c -dl_datalistmodel.property.dl_contactPhoneOffice.title=\u041d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (\u043e\u0444\u0438\u0441) -dl_datalistmodel.property.dl_contactPhoneMobile.title=\u041d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (\u043c\u043e\u0431) -dl_datalistmodel.property.dl_contactNotes.title=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f - -# Issues -dl_datalistmodel.type.dl_issue.title=\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 -dl_datalistmodel.type.dl_issue.description=\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0441\u0442\u0430\u0442\u0443\u0441, \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0441\u0440\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. -dl_datalistmodel.property.dl_issueID.title=\u041d\u043e\u043c\u0435\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 -dl_datalistmodel.property.dl_issueStatus.title=\u0421\u0442\u0430\u0442\u0443\u0441 -dl_datalistmodel.property.dl_issuePriority.title=\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 -dl_datalistmodel.property.dl_issueDescription.title=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 -dl_datalistmodel.property.dl_issueDueDate.title=\u0421\u0440\u043e\u043a -dl_datalistmodel.property.dl_issueComments.title=\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 -dl_datalistmodel.association.dl_issueAssignedTo.title=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e -dl_datalistmodel.property.dl_issueRelatedIssues.title=\u0421\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b - -# Event -dl_datalistmodel.type.dl_event.title=\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 -dl_datalistmodel.type.dl_event.description=\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0434\u0430\u0442\u0443/\u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f. -dl_datalistmodel.property.dl_eventLocation.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dl_datalistmodel.property.dl_eventStartDate.title=\u0414\u0430\u0442\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 -dl_datalistmodel.property.dl_eventEndDate.title=\u0414\u0430\u0442\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f -dl_datalistmodel.property.dl_eventRegistrations.title=\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 -dl_datalistmodel.property.dl_eventNote.title=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f - -# Location -dl_datalistmodel.type.dl_location.title=\u0421\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 -dl_datalistmodel.type.dl_location.description=\u0421\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439/\u0430\u0434\u0440\u0435\u0441\u043e\u0432 -dl_datalistmodel.property.dl_locationAddress1.title=\u0410\u0434\u0440\u0435\u0441 (\u0441\u0442\u0440\u043e\u043a\u0430 1) -dl_datalistmodel.property.dl_locationAddress2.title=\u0410\u0434\u0440\u0435\u0441 (\u0441\u0442\u0440\u043e\u043a\u0430 2) -dl_datalistmodel.property.dl_locationAddress3.title=\u0410\u0434\u0440\u0435\u0441 (\u0441\u0442\u0440\u043e\u043a\u0430 3) -dl_datalistmodel.property.dl_locationZip.title=\u041f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 -dl_datalistmodel.property.dl_locationState.title=\u041e\u0431\u043b\u0430\u0441\u0442\u044c -dl_datalistmodel.property.dl_locationCountry.title=\u0421\u0442\u0440\u0430\u043d\u0430 -dl_datalistmodel.property.dl_locationNote.title=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e\u0431\u0440\u0430\u043d\u0438\u044f -dl_datalistmodel.type.dl_meetingAgenda.description=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043e\u0431\u0440\u0430\u043d\u0438\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. -dl_datalistmodel.property.dl_meetingAgendaRef.title=\u0421\u0441\u044b\u043b\u043a\u0430 -dl_datalistmodel.property.dl_meetingAgendaTime.title=\u0412\u0440\u0435\u043c\u044f (\u043c\u0438\u043d.) -dl_datalistmodel.property.dl_meetingAgendaOwner.title=\u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446 - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f -dl_datalistmodel.type.dl_eventAgenda.description=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u0432, \u0438\u043c\u0435\u043d\u0430 \u0434\u043e\u043a\u043b\u0430\u0434\u0447\u0438\u043a\u043e\u0432, \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u0432. -dl_datalistmodel.property.dl_eventAgendaRef.title=\u0421\u0441\u044b\u043b\u043a\u0430 -dl_datalistmodel.property.dl_eventAgendaStartTime.title=\u0412\u0440\u0435\u043c\u044f \u043d\u0430\u0447\u0430\u043b\u0430 -dl_datalistmodel.property.dl_eventAgendaEndTime.title=\u0412\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f -dl_datalistmodel.property.dl_eventAgendaSessionName.title=\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043a\u043b\u0430\u0434\u0430 -dl_datalistmodel.property.dl_eventAgendaPresenter.title=\u0414\u043e\u043a\u043b\u0430\u0434\u0447\u0438\u043a -dl_datalistmodel.property.dl_eventAgendaAudience.title=\u0410\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f -dl_datalistmodel.property.dl_eventAgendaNotes.title=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=\u041d\u0435 \u043d\u0430\u0447\u0430\u0442\u043e -listconstraint.dl_task_status.In\ Progress=\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 -listconstraint.dl_task_status.On\ Hold=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -listconstraint.dl_task_status.Complete=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -listconstraint.dl_priority_value.High=\u0412\u044b\u0441\u043e\u043a\u0438\u0439 -listconstraint.dl_priority_value.Normal=\u0421\u0440\u0435\u0434\u043d\u0438\u0439 -listconstraint.dl_priority_value.Low=\u041d\u0438\u0437\u043a\u0438\u0439 - diff --git a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/messages/data-list-model_zh_CN.properties deleted file mode 100755 index c1ec8260af..0000000000 --- a/amps/share-services/src/main/resources/alfresco/messages/data-list-model_zh_CN.properties +++ /dev/null @@ -1,114 +0,0 @@ -# Display labels for Share Data Lists Model -dl_datalistmodel.description=Alfresco Share \u6570\u636e\u5217\u8868\u6a21\u578b - -dl_datalistmodel.type.dl_dataList.title=\u6570\u636e\u5217\u8868\u6587\u4ef6\u5939\u7c7b\u578b -dl_datalistmodel.type.dl_dataList.description=\u7528\u4e8e\u5b58\u50a8 dl:dataListItemType \u5c5e\u6027\u4e2d\u6307\u5b9a\u7c7b\u578b\u7684\u6570\u636e\u5217\u8868\u9879\u3002 -dl_datalistmodel.property.dl_dataListItemType.title=\u6570\u636e\u5217\u8868\u9879\u7c7b\u578b -dl_datalistmodel.property.dl_dataListItemType.description=\u7528\u4e8e\u786e\u5b9a\u5728\u6570\u636e\u5217\u8868\u5185\u65b0\u5efa\u9879\u65f6\u5c06\u4f7f\u7528\u7684\u54ea\u79cd dl:dataListItem \u7684\u5b50\u7c7b\u578b\u3002 - -dl_datalistmodel.type.dl_dataListItem.title=\u6570\u636e\u5217\u8868\u7236\u7c7b\u578b -dl_datalistmodel.type.dl_dataListItem.description=\u6d3e\u751f\u6837\u672c\u6570\u636e\u5217\u8868\u9879\u7c7b\u578b\u7684\u6765\u6e90\u7236\u7c7b\u578b\u3002 - -## Simple "To do" List -dl_datalistmodel.type.dl_todoList.title=\u4ee3\u529e\u4e8b\u5b9c\u5217\u8868 -dl_datalistmodel.type.dl_todoList.description=\u4e00\u4e2a\u7b80\u5355\u7684\u4ee3\u529e\u4e8b\u5b9c\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u53ef\u9009\u7684\u88ab\u6307\u6d3e\u8005\u3002 -dl_datalistmodel.property.dl_todoTitle.title=\u6807\u9898 -dl_datalistmodel.property.dl_todoDueDate.title=\u622a\u6b62\u65e5\u671f -dl_datalistmodel.property.dl_todoPriority.title=\u4f18\u5148\u7ea7 -dl_datalistmodel.property.dl_todoStatus.title=\u72b6\u6001 -dl_datalistmodel.property.dl_todoNotes.title=\u8bf4\u660e -dl_datalistmodel.association.dl_assignee.title=\u88ab\u6307\u6d3e\u8005 -dl_datalistmodel.association.dl_attachments.title=\u9644\u4ef6 - -# Gantt Aspect -dl_datalistmodel.property.dl_ganttStartDate.title=\u5f00\u59cb\u65e5\u671f -dl_datalistmodel.property.dl_ganttEndDate.title=\u7ed3\u675f\u65e5\u671f -dl_datalistmodel.property.dl_ganttPercentComplete.title=\u5b8c\u6210\u767e\u5206\u6bd4 - -# Task List (Advanced) -dl_datalistmodel.type.dl_task.title=\u4efb\u52a1\u5217\u8868\uff08\u9ad8\u7ea7\uff09 -dl_datalistmodel.type.dl_task.description=\u9ad8\u7ea7\u4efb\u52a1\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u6807\u9898\u3001\u8bf4\u660e\u3001\u5f00\u59cb\u65e5\u671f\u4e0e\u7ed3\u675f\u65e5\u671f\u3001\u4f18\u5148\u7ea7\u3001\u72b6\u6001\u3001\u6ce8\u91ca\u3001\u88ab\u6307\u6d3e\u8005\u4ee5\u53ca\u9644\u4ef6\u3002 -dl_datalistmodel.property.dl_taskPriority.title=\u4f18\u5148\u7ea7 -dl_datalistmodel.property.dl_taskStatus.title=\u72b6\u6001 -dl_datalistmodel.property.dl_taskComments.title=\u8bc4\u8bba -dl_datalistmodel.association.dl_taskAssignee.title=\u88ab\u6307\u6d3e\u8005 - -# Task List (Simple) -dl_datalistmodel.type.dl_simpletask.title=\u4efb\u52a1\u5217\u8868\uff08\u7b80\u5355\uff09 -dl_datalistmodel.type.dl_simpletask.description=\u7b80\u5355\u4efb\u52a1\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u6807\u9898\u3001\u8bf4\u660e\u3001\u622a\u6b62\u65e5\u671f\u3001\u4f18\u5148\u7ea7\u3001\u72b6\u6001\u4ee5\u53ca\u6ce8\u91ca\u3002 -dl_datalistmodel.property.dl_simpletaskDueDate.title=\u622a\u6b62\u65e5\u671f -dl_datalistmodel.property.dl_simpletaskPriority.title=\u4f18\u5148\u7ea7 -dl_datalistmodel.property.dl_simpletaskStatus.title=\u72b6\u6001 -dl_datalistmodel.property.dl_simpletaskComments.title=\u8bc4\u8bba - -# Contact -dl_datalistmodel.type.dl_contact.title=\u8054\u7cfb\u4eba\u5217\u8868 -dl_datalistmodel.type.dl_contact.description=\u8054\u7cfb\u4eba\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u540d\u5b57\u3001\u59d3\u6c0f\u3001\u5168\u540d\u3001\u7535\u5b50\u90ae\u4ef6\u3001\u804c\u4f4d\u3001\u7535\u8bdd\u53f7\u7801\uff08\u529e\u516c\u5ba4\u5ea7\u673a\uff09\u4ee5\u53ca\u7535\u8bdd\u53f7\u7801\uff08\u79fb\u52a8\u7535\u8bdd\uff09\u3002 -dl_datalistmodel.property.dl_contactFirstName.title=\u540d\u5b57 -dl_datalistmodel.property.dl_contactLastName.title=\u59d3\u6c0f -dl_datalistmodel.property.dl_contactEmail.title=\u7535\u5b50\u90ae\u4ef6 -dl_datalistmodel.property.dl_contactCompany.title=\u516c\u53f8 -dl_datalistmodel.property.dl_contactJobTitle.title=\u804c\u4f4d -dl_datalistmodel.property.dl_contactPhoneOffice.title=\u7535\u8bdd\u53f7\u7801\uff08\u529e\u516c\u5ba4\u5ea7\u673a\uff09 -dl_datalistmodel.property.dl_contactPhoneMobile.title=\u7535\u8bdd\u53f7\u7801\uff08\u79fb\u52a8\u7535\u8bdd\uff09 -dl_datalistmodel.property.dl_contactNotes.title=\u8bf4\u660e - -# Issues -dl_datalistmodel.type.dl_issue.title=\u95ee\u9898\u5217\u8868 -dl_datalistmodel.type.dl_issue.description=\u95ee\u9898\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b ID\u3001\u72b6\u6001\u3001\u4f18\u5148\u7ea7\u3001\u8bf4\u660e\u3001\u622a\u6b62\u65e5\u671f\u3001\u6ce8\u91ca\u3001\u6307\u6d3e\u5bf9\u8c61\u4ee5\u53ca\u76f8\u5173\u95ee\u9898\u3002 -dl_datalistmodel.property.dl_issueID.title=\u95ee\u9898 ID -dl_datalistmodel.property.dl_issueStatus.title=\u72b6\u6001 -dl_datalistmodel.property.dl_issuePriority.title=\u4f18\u5148\u7ea7 -dl_datalistmodel.property.dl_issueDescription.title=\u8bf4\u660e -dl_datalistmodel.property.dl_issueDueDate.title=\u622a\u6b62\u65e5\u671f -dl_datalistmodel.property.dl_issueComments.title=\u8bc4\u8bba -dl_datalistmodel.association.dl_issueAssignedTo.title=\u88ab\u6307\u6d3e\u7ed9 -dl_datalistmodel.property.dl_issueRelatedIssues.title=\u76f8\u5173\u95ee\u9898 - -# Event -dl_datalistmodel.type.dl_event.title=\u4e8b\u4ef6\u5217\u8868 -dl_datalistmodel.type.dl_event.description=\u4e8b\u4ef6\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u6807\u9898\u3001\u8bf4\u660e\u3001\u4f4d\u7f6e\uff0c\u4ee5\u53ca\u5f00\u59cb\u548c\u7ed3\u675f\u65e5\u671f/\u65f6\u95f4\u3002 -dl_datalistmodel.property.dl_eventLocation.title=\u4f4d\u7f6e -dl_datalistmodel.property.dl_eventStartDate.title=\u5f00\u59cb\u65e5\u671f -dl_datalistmodel.property.dl_eventEndDate.title=\u7ed3\u675f\u65e5\u671f -dl_datalistmodel.property.dl_eventRegistrations.title=\u6ce8\u518c -dl_datalistmodel.property.dl_eventNote.title=\u8bf4\u660e - -# Location -dl_datalistmodel.type.dl_location.title=\u4f4d\u7f6e\u5217\u8868 -dl_datalistmodel.type.dl_location.description=\u4f4d\u7f6e/\u5730\u5740\u5217\u8868 -dl_datalistmodel.property.dl_locationAddress1.title=\u5730\u5740\u7b2c 1 \u884c -dl_datalistmodel.property.dl_locationAddress2.title=\u5730\u5740\u7b2c 2 \u884c -dl_datalistmodel.property.dl_locationAddress3.title=\u5730\u5740\u7b2c 3 \u884c -dl_datalistmodel.property.dl_locationZip.title=\u90ae\u653f\u7f16\u7801 -dl_datalistmodel.property.dl_locationState.title=\u7701/\u76f4\u8f96\u5e02/\u81ea\u6cbb\u533a -dl_datalistmodel.property.dl_locationCountry.title=\u56fd\u5bb6/\u5730\u533a -dl_datalistmodel.property.dl_locationNote.title=\u8bf4\u660e - -# Meeting Agenda -dl_datalistmodel.type.dl_meetingAgenda.title=\u4f1a\u8bae\u8bae\u7a0b -dl_datalistmodel.type.dl_meetingAgenda.description=\u7ba1\u7406\u4f1a\u8bae\u8bae\u7a0b\u9879\uff0c\u5176\u4e2d\u5305\u62ec\u8bf4\u660e\u3001\u6240\u6709\u8005\uff0c\u4ee5\u53ca\u5206\u914d\u7684\u65f6\u95f4\u3002 -dl_datalistmodel.property.dl_meetingAgendaRef.title=\u5f15\u7528 -dl_datalistmodel.property.dl_meetingAgendaTime.title=\u65f6\u95f4\uff08\u5206\u949f\uff09 -dl_datalistmodel.property.dl_meetingAgendaOwner.title=\u6240\u6709\u8005 - -# Event Agenda -dl_datalistmodel.type.dl_eventAgenda.title=\u4e8b\u4ef6\u65e5\u7a0b -dl_datalistmodel.type.dl_eventAgenda.description=\u7ba1\u7406\u4e8b\u4ef6\u65e5\u7a0b\uff0c\u5305\u62ec\u4f1a\u8bdd\u540d\u79f0\u3001\u6f14\u793a\u8005\uff0c\u4ee5\u53ca\u5f00\u59cb\u548c\u7ed3\u675f\u65f6\u95f4\u3002 -dl_datalistmodel.property.dl_eventAgendaRef.title=\u5f15\u7528 -dl_datalistmodel.property.dl_eventAgendaStartTime.title=\u5f00\u59cb\u65f6\u95f4 -dl_datalistmodel.property.dl_eventAgendaEndTime.title=\u7ed3\u675f\u65f6\u95f4 -dl_datalistmodel.property.dl_eventAgendaSessionName.title=\u4f1a\u8bdd\u540d\u79f0 -dl_datalistmodel.property.dl_eventAgendaPresenter.title=\u6f14\u793a\u8005 -dl_datalistmodel.property.dl_eventAgendaAudience.title=\u89c2\u4f17 -dl_datalistmodel.property.dl_eventAgendaNotes.title=\u8bf4\u660e - -# List constraint display labels -listconstraint.dl_task_status.Not\ Started=\u672a\u5f00\u59cb -listconstraint.dl_task_status.In\ Progress=\u6b63\u5728\u8fdb\u884c -listconstraint.dl_task_status.On\ Hold=\u4fdd\u5b58\u4e2d -listconstraint.dl_task_status.Complete=\u5b8c\u6210 -listconstraint.dl_priority_value.High=\u9ad8 -listconstraint.dl_priority_value.Normal=\u6b63\u5e38 -listconstraint.dl_priority_value.Low=\u4f4e - diff --git a/amps/share-services/src/main/resources/alfresco/model/datalistModel.xml b/amps/share-services/src/main/resources/alfresco/model/datalistModel.xml deleted file mode 100644 index f7a2a8ff7f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/model/datalistModel.xml +++ /dev/null @@ -1,494 +0,0 @@ - - - - - - - - - Alfresco Share Data List Model - Mike Hatfield - 0.1 - - - - - - - - - - - - - - - - - - - - - Not Started - In Progress - Complete - On Hold - - - - - - - High - Normal - Low - - - - - - 0 - - - 100 - - - - - - - - - Data List container type - cm:folder - - - List Item Type - Determines which Data Dictionary type will be used when create new items within the Data List. - d:text - - - - - - - Data List parent type - cm:content - - - - - To Do List - dl:dataListItem - - - Title - d:text - true - - - Due Date - d:datetime - false - - - Priority - d:int - false - - - Status - d:text - Not Started - - - - - - Notes - d:text - false - - - - - Assignee - - false - true - - - cm:person - false - false - - - - Attachments - - false - true - - - cm:cmobject - false - true - - - - - - - - Task List (Simple) - dl:dataListItem - - - Due Date - d:date - false - - - Priority - d:text - Normal - - - - - - Status - d:text - Not Started - - - - - - Comments - d:text - false - - - - cm:titled - - - - - - Task List (Advanced) - dl:dataListItem - - - Priority - d:text - Normal - - - - - - Status - d:text - Not Started - - - - - - Comments - d:text - false - - - - - Assignee - - false - true - - - cm:person - false - true - - - - - cm:titled - cm:attachable - dl:gantt - - - - - - Contacts List - dl:dataListItem - - - First Name - d:text - false - - - Last Name - d:text - false - - - Email Address - d:text - false - - - Company - d:text - false - - - Job Title - d:text - false - - - Phone (Office) - d:text - false - - - Phone (Mobile) - d:text - false - - - Notes - d:text - false - - - - - - - Issues List - dl:dataListItem - - - Issue ID - d:text - - - Status - d:text - Not Started - - - - - - Priority - d:text - Normal - - - - - - Due Date - d:date - false - - - Comments - d:text - false - - - - - Assigned To - - false - true - - - cm:person - false - true - - - - - cm:titled - cm:attachable - - - - - - Event - dl:dataListItem - - - Location - d:text - false - - - Notes - d:text - false - - - Start Date - d:datetime - false - - - End Date - d:datetime - false - - - Registrations - d:text - - - - cm:titled - cm:attachable - - - - - - Location - dl:dataListItem - - - Address 1 - d:text - - - Address 2 - d:text - - - Address 3 - d:text - - - Zip/Post Code - d:text - - - State/County - d:text - - - Country - d:text - - - - cm:titled - cm:attachable - - - - - - Meeting Agenda - dl:dataListItem - - - Reference - d:text - - - Time (Mins) - d:text - - - Owner - d:text - - - - cm:titled - cm:attachable - - - - - - Event Agenda - dl:dataListItem - - - Reference - d:text - - - Start Time - d:text - - - End Timie - d:text - - - Session Name - d:text - - - Presenter - d:text - - - Audience - d:text - - - Notes - d:text - - - - cm:attachable - - - - - - - - - Gantt - - - Start Date - d:date - - - End Date - d:date - - - % Complete - d:int - true - 0 - - - - - - - - - - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.desc.xml deleted file mode 100644 index 44c132bf23..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Tagging Actions - Add and remove tags to nodes - /collaboration/tagActions - - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.html.ftl deleted file mode 100644 index 7ff46f8e78..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.get.html.ftl +++ /dev/null @@ -1,52 +0,0 @@ - - - - Tagging Test UI - - - -

Tagging Test UI

-
- -
- Space nodeRef: -
e.g. "e3741425-35cf-11dc-9762-4b73d0280543"
-
- -
- Tag: - -
- -
- - -
- -
- - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.desc.xml deleted file mode 100644 index 6416523009..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Tagging Actions - Add and remove tags to nodes - /collaboration/tagActions - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.js deleted file mode 100644 index ec5d6d6c40..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.js +++ /dev/null @@ -1,150 +0,0 @@ -model.tagActions = tagActions(args.a, args.n, args.t); - -function tagActions(action, nodeId, tagName) -{ - var resultString = "Action failed"; - var resultCode = false; - var node = null; - var newTag = null; - var newTagNodeRef = ""; - - if ((tagName != "") && (tagName != null)) - { - tagName = tagName.toLowerCase(); - if (action == "add") - { - // Make sure the tag is in the repo - newTag = createTag(tagName); - if (newTag != null) - { - resultString = "Tag added"; - resultCode = true; - newTagNodeRef = newTag.nodeRef.toString(); - } - else - { - resultString = "Tag '" + tagName + "' not indexed"; - } - } - - // Adding/removing the tag to/from a node? - if ((nodeId != "") && (nodeId != null)) - { - var node = search.findNode("workspace://SpacesStore/" + nodeId); - - if (node != null) - { - try - { - var tags; - - if (action == "add") - { - // Must have newTag node - if (newTag != null) - { - resultString = "Already tagged with '" + tagName + "'"; - tags = node.properties["cm:taggable"]; - if (tags == null) - { - tags = new Array(); - } - // Check node doesn't already have this tag - var hasTag = false; - for each (tag in tags) - { - if (tag != null) - { - if (tag.name == tagName) - { - hasTag = true; - break; - } - } - } - if (!hasTag) - { - // Add it to our node - tags.push(newTag); - tagsArray = new Array(); - tagsArray["cm:taggable"] = tags; - node.addAspect("cm:taggable", tagsArray); - - resultString = "Document tagged"; - resultCode = true; - } - } - } - else if (action == "remove") - { - resultString = "Could not remove tag"; - var oldTags = node.properties["cm:taggable"]; - if (oldTags == null) - { - oldTags = new Array(); - } - tags = new Array(); - // Find this tag - for each (tag in oldTags) - { - if (tag != null) - { - if (tag.name != tagName) - { - tags.push(tag); - } - } - } - // Removed tag? - if (oldTags.length > tags.length) - { - tagsArray = new Array(); - tagsArray["cm:taggable"] = tags; - node.addAspect("cm:taggable", tagsArray); - resultString = "Tag removed"; - resultCode = true; - } - else - { - resultString = "Not tagged with '" + tagName + "'"; - } - } - else - { - resultString = "Unknown action"; - } - } - catch(e) - { - resultString = "Action failed due to exception [" + e.toString() + "]"; - } - } - } - } - - var result = - { - "resultString": resultString, - "resultCode": resultCode, - "newTag": newTagNodeRef - }; - return result; -} - -/* - * Create a new tag if the passed-in one doesn't exist - */ -function createTag(tagName) -{ - var existingTags = classification.getRootCategories("cm:taggable"); - for each (existingTag in existingTags) - { - if (existingTag.name == tagName) - { - return existingTag; - } - } - - var tagNode = classification.createRootCategory("cm:taggable", tagName); - return tagNode; -} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.json.ftl deleted file mode 100644 index ff1785e8a2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagActions.post.json.ftl +++ /dev/null @@ -1,7 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "statusString": "${tagActions.resultString}", - "statusCode": ${tagActions.resultCode?string}, - "newTag": "${tagActions.newTag?string}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.desc.xml deleted file mode 100644 index 2ae903bc01..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.desc.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Tagging Query - - The following properties may be updated. -
-
nodeRef
nodeRef to anchor tag query from. Defaults to Company Home
-
maxResults
maximum number of results to return. Defaults to all results (limited by Lucene)
-
sortOrder
sort order for results. Possible values are: "name" (default), "count"
-
- ]]>
- /collaboration/tagQuery?n={nodeRef?}&m={maxResults?}&s={sortOrder?} - argument - user - required - internal -
diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.js deleted file mode 100644 index e3de9a5d40..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.js +++ /dev/null @@ -1,173 +0,0 @@ -function tagQuery() -{ - var rootNode = args.n, - maxResults = args.m, - sortOrder = args.s, - tags = [], - countMin = Number.MAX_VALUE, - countMax = 0; - - /* rootNode input */ - var node = null; - if ((rootNode !== null) && (rootNode !== "")) - { - node = utils.resolveNodeReference(rootNode); - } - if (node === null) - { - node = companyhome; - } - - /* maxResults input */ - if ((maxResults === null) || (maxResults === "")) - { - maxResults = -1; - } - - /* sortOrder input */ - var validSortOrders = - { - "name": true, - "count": true - }; - if (!(sortOrder in validSortOrders)) - { - sortOrder = "name"; - } - - /* Query for tagged node(s) */ - var query = ""; - if (node !== companyhome) - { - query = "PATH:\"" + node.qnamePath; - if (node.isContainer) - { - query += "//*"; - } - query += "\" AND "; - } - query += "ASPECT:\"{http://www.alfresco.org/model/content/1.0}taggable\""; - //MNT-2118 Share inconsistencies when displaying locked files with tags - query += " -ASPECT:\"{http://www.alfresco.org/model/content/1.0}workingcopy\""; - - // MNT-20091 check to prevent cm:taggable with NULL - query += " AND ISNOTNULL:\"{http://www.alfresco.org/model/content/1.0}taggable\""; - - if (search.searchSubsystem.startsWith("solr")) - { - // MNT-11511: use facet search - var queryDef = { - query: query, - language: "lucene", - page: { - // query minimum rows because all usefull info will come with facets - maxItems: 1, - skipCount: 0 - }, - fieldFacets: [ "TAG" ] - }; - var rs = search.queryResultSet(queryDef); - var tagFacets = rs.meta.facets.TAG; - - for(var i=0; i < tagFacets.size(); i++) - { - var tagFacet = tagFacets.get(i); - tag = - { - name: tagFacet.facetValue, - count: tagFacet.hits, - toString: function() - { - return this.name; - } - }; - tags.push(tag); - } - } - else - { - var taggedNodes = search.luceneSearch(query); - - /* Build a hashtable of tags and tag count */ - var tagHash = {}, - count, taggedNode, tag, key; - - for each (taggedNode in taggedNodes) - { - try - { - for each (tag in taggedNode.properties["cm:taggable"]) - { - if (tag !== null) - { - count = tagHash[tag.name]; - tagHash[tag.name] = count ? count+1 : 1; - } - } - } - catch (e) - { - continue; - } - } - - /* Convert the hashtable into an array of objects */ - for (key in tagHash) - { - tag = - { - name: key, - count: tagHash[key], - toString: function() - { - return this.name; - } - }; - tags.push(tag); - } - } - - if (tags.length === 0) - { - countMin = 0; - } - else - { - /* Sort the results by count (descending) */ - tags.sort(sortByCountDesc); - - /* Trim the results to maxResults if specified */ - if (maxResults > -1) - { - tags = tags.slice(0, maxResults); - } - - /* Calculate the min and max tag count values */ - for each (tag in tags) - { - countMin = Math.min(countMin, tag.count); - countMax = Math.max(countMax, tag.count); - } - - if (sortOrder == "name") - { - /* Sort the results by tag name (ascending) */ - tags.sort(); - } - } - - var results = - { - "countMin": countMin, - "countMax": countMax, - "tags": tags - }; - return results; -} - -function sortByCountDesc(a, b) -{ - return (b.count - a.count); -} - -model.tagQuery = tagQuery(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.json.ftl deleted file mode 100644 index 6c946b00fa..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/collaboration/tagQuery.get.json.ftl +++ /dev/null @@ -1,10 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "countMin": ${tagQuery.countMin?c}, - "countMax": ${tagQuery.countMax?c}, - "tags": - [<#list tagQuery.tags as tag> - { "name": "${tag.name}", "count": ${tag.count?c} }<#if tag_has_next>, - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/site/site-share-view-url.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/site/site-share-view-url.get.desc.xml deleted file mode 100644 index b8bde595f0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/site/site-share-view-url.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Get the Share URL to View a Site Node - Gets the appropriate Share URL to view a given Site Node within Share - /api/sites/shareUrl - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/site/site-share-view-url.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/site/site-share-view-url.get.json.ftl deleted file mode 100644 index 2c504ff0b2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/site/site-share-view-url.get.json.ftl +++ /dev/null @@ -1,6 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "site": "${site.getShortName()}", - "url": "${url}" -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.desc.xml deleted file mode 100644 index 0e9abfa46d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Create Activity - Share Generic Component - create activity data webscript - /slingshot/activity/create - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.ftl deleted file mode 100644 index e37684e04d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.ftl +++ /dev/null @@ -1,3 +0,0 @@ -{ - "success": true -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.js deleted file mode 100644 index 005f3ff524..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/activity/create-activity.post.json.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * Share Generic Component: post new activity - */ - -var m_node = null, - m_parentNode = null; - -/* Posts to the activities service after a Share action */ -function postActivity() -{ - var data = {}, - type = null, - siteId = null, - title = null, - appTool = null, - nodeRef = null, - parentNodeRef = null; - - /* - * Activity Type - */ - if (json.has("type")) - { - type = json.get("type"); - } - if (type == null || type.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Activity 'type' parameter missing when posting activity"); - return; - } - - /* - * Site - */ - if (json.has("site")) - { - siteId = json.get("site"); - } - if (siteId == null || siteId.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "'site' parameter missing when posting activity"); - return; - } - // Check site existence - if (siteService.getSite(siteId) == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "'" + siteId + "' is not a valid site"); - return; - } - - /** - * NodeRef & ParentNodeRef properties (must have at least one) - */ - if (json.has("nodeRef")) - { - nodeRef = json.get("nodeRef"); - data.nodeRef = nodeRef; - m_node = search.findNode(nodeRef); - } - if (json.has("parentNodeRef")) - { - parentNodeRef = json.get("parentNodeRef"); - data.parentNodeRef = parentNodeRef; - m_parentNode = search.findNode(parentNodeRef); - } - if (nodeRef == null && parentNodeRef == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "Must specify either 'nodeRef' or 'parentNodeRef' parameter when posting activity"); - return; - } - - /** - * Title property - */ - if (json.has("title")) - { - title = json.get("title"); - data.title = populateTokens(title); - } - if (title == null || title.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Activity 'title' parameter missing when posting activity"); - return; - } - - /** - * AppTool (optional) - */ - if (json.has("appTool")) - { - appTool = json.get("appTool"); - } - - /** - * Page and page params (optional) - */ - if (json.has("page")) - { - data.page = populateTokens(json.get("page")); - } - - try - { - // Log to activity service - activities.postActivity(type, siteId, appTool, jsonUtils.toJSONString(data)); - } - catch(e) - { - if (logger.isLoggingEnabled()) - { - logger.log(e); - } - } -} - -/** - * Property token substution. - * Simplified version of YAHOO.lang.substitute() - * - * @method populateTokens - * @param s {string} String containing zero or more tokens of the form {token} - *
- *    {cm:name} Node's cm:name property
- *    {cm:name parent} Parent node's cm:name property
- * 
- */ -function populateTokens(s) -{ - var i, j, k, key, v, n, meta, saved=[], token, - SPACE = ' ', PARENT = 'parent', LBRACE = '{', RBRACE = '}', - dump, objstr; - - for (;;) - { - i = s.lastIndexOf(LBRACE); - if (i < 0) - { - break; - } - j = s.indexOf(RBRACE, i); - if (i + 1 >= j) - { - break; - } - - // Extract key and meta info - token = s.substring(i + 1, j); - key = token; - meta = null; - k = key.indexOf(SPACE); - if (k > -1) - { - meta = key.substring(k + 1).toLowerCase(); - key = key.substring(0, k); - } - - // Lookup the value - n = meta == PARENT ? m_parentNode : m_node; - v = null; - if (n != null) - { - v = n.properties[key]; - } - - if (v == null) - { - // This {block} has no replace string. Save it for later. - v = "~-" + saved.length + "-~"; - saved[saved.length] = token; - } - - s = s.substring(0, i) + v + s.substring(j + 1); - } - - // restore saved {block}s - for (i = saved.length - 1; i >= 0; i = i - 1) - { - s = s.replace(new RegExp("~-" + i + "-~"), "{" + saved[i] + "}", "g"); - } - - return s; -} - -postActivity(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.config.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.config.xml deleted file mode 100644 index 68f431ff29..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.config.xml +++ /dev/null @@ -1,4 +0,0 @@ - - 350 - 50 - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.desc.xml deleted file mode 100644 index c778c1b467..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Logo Upload - Upload logo file content - - admin - required - /slingshot/application/uploadlogo - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.html.ftl deleted file mode 100644 index 08859a3359..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.html.ftl +++ /dev/null @@ -1,15 +0,0 @@ - - - Upload Logo Success - - -<#if (args.success!"")?matches("^[\\w\\d\\._]+$")> - - - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.html.status.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.html.status.ftl deleted file mode 100644 index 57aea85cd7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.html.status.ftl +++ /dev/null @@ -1,19 +0,0 @@ - - - Upload Logo Failure - - -<#if (args.failure!"")?matches("^[\\w\\d\\._]+$")> - - - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.js deleted file mode 100644 index 43693e4389..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Application Log Upload method - * - * @method POST - * @param filedata {file} - */ - -function main() -{ - try - { - var filename = null; - var content = null; - - // locate file attributes - for each (field in formdata.fields) - { - if (field.name == "filedata" && field.isFile) - { - filename = field.filename; - content = field.content; - break; - } - } - - // ensure all mandatory attributes have been located - if (filename == undefined || content == undefined) - { - status.code = 400; - status.message = msg.get("error.uploadMissing"); - status.redirect = true; - return; - } - - var sitesNode = companyhome.childrenByXPath("st:sites")[0]; - if (sitesNode == null) - { - status.code = 500; - status.message = msg.get("error.sitesFolder"); - status.redirect = true; - return; - } - - var logoConfig = new XML(config.script); - var widthxheight = logoConfig.width + "x" + logoConfig.height; - - var transformationOptions = "-resize " + widthxheight + "> -background none -gravity center"; - - // create the new image node - var nodeName = new Date().getTime() + "_" + filename; - var tmpFolder = sitesNode.createFolder(nodeName + "_tmp"); - logoNode = sitesNode.createNode(nodeName, "cm:content"); - logoNode.properties.content.write(content); - logoNode.properties.content.guessMimetype(filename); - var resizedImage = logoNode.transformImage(logoNode.properties.content.mimetype, transformationOptions, tmpFolder); - logoNode.properties.content.write(resizedImage.properties.content); - // CLOUD-951, no need to delete the resizedImage, as removing the tmpFolder will remove resizedImage too. - tmpFolder.remove(); - logoNode.save(); - - // save ref to be returned - model.logo = logoNode; - model.name = filename; - } - catch (e) - { - var x = e; - status.code = 500; - status.message = msg.get("error.unexpected"); - if (x.message && x.message.indexOf("org.alfresco.service.cmr.usage.ContentQuotaException") == 0) - { - status.code = 413; - status.message = x.message; - } - status.redirect = true; - return; - } -} - -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.json.ftl deleted file mode 100644 index 97e04553c0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.json.ftl +++ /dev/null @@ -1,12 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${logo.nodeRef}", - "fileName": "${name}", - "status": - { - "code": 200, - "name": "OK", - "description" : "File uploaded successfully" - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.properties deleted file mode 100644 index 40b09531f7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Unexpected error occurred during upload of new content. -error.uploadMissing=Uploaded file cannot be located in request. -error.sitesFolder=Failed to locate Sites folder. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_de.properties deleted file mode 100644 index 9b41140af5..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_de.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Unerwarteter Fehler beim Hochladen von neuem Inhalt. -error.uploadMissing=Hochgeladene Datei nicht in Anfrage gefunden. -error.sitesFolder=Sites-Ordner nicht gefunden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_es.properties deleted file mode 100644 index 19246a99f9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_es.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Se ha producido un error inesperado durante la carga de nuevo contenido. -error.uploadMissing=El fichero cargado no puede localizarse en los datos enviados al servidor. -error.sitesFolder=No se pudo localizar la carpeta Sitios. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_fr.properties deleted file mode 100644 index 8cf984804d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_fr.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Une erreur inattendue s'est produite lors de l'importation de nouveau contenu. -error.uploadMissing=Impossible de trouver dans les donn\u00e9es le fichier import\u00e9. -error.sitesFolder=Impossible de situer le dossier Sites. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_it.properties deleted file mode 100644 index f3e4768be9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_it.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Si \u00e8 verificato un errore imprevisto durante il caricamento del nuovo contenuto. -error.uploadMissing=Impossibile trovare il file caricato nei dati inviati al server. -error.sitesFolder=Impossibile individuare la cartella Siti. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_ja.properties deleted file mode 100644 index 64544e9dd0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_ja.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=\u65b0\u3057\u3044\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u4e2d\u306b\u60f3\u5b9a\u5916\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 -error.uploadMissing=\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u30c7\u30fc\u30bf\u306e\u4e2d\u306b\u3042\u308a\u307e\u305b\u3093\u3002 -error.sitesFolder=[\u30b5\u30a4\u30c8] \u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_nb.properties deleted file mode 100644 index a11b585b70..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_nb.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Uventet feil oppstod under opplasting av nytt innhold. -error.uploadMissing=Finner ikke opplastede fil fra foresp\u00f8rselen. -error.sitesFolder=Fant ikke stedsmappe. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_nl.properties deleted file mode 100644 index a2fcb8f615..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_nl.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Er is een onverwachte fout opgetreden bij het uploaden van nieuwe content. -error.uploadMissing=Kan het ge\u00fcploade bestand niet vinden in de aanvraag. -error.sitesFolder=Kan de map Sites niet vinden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_pt_BR.properties deleted file mode 100644 index 1a63e14ca2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_pt_BR.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=Um erro inesperado ocorreu durante o carregamento do novo conte\u00fado. -error.uploadMissing=O arquivo carregado n\u00e3o pode ser localizado no pedido. -error.sitesFolder=Falha na localiza\u00e7\u00e3o da pasta Locais. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_ru.properties deleted file mode 100644 index f2f5ecfc1b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_ru.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=\u0412 \u0445\u043e\u0434\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. -error.uploadMissing=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435. -error.sitesFolder=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442 \u043f\u0430\u043f\u043a\u0443 \u0421\u0430\u0439\u0442\u044b. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_zh_CN.properties deleted file mode 100644 index bd3fb55db8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/application/logo.post_zh_CN.properties +++ /dev/null @@ -1,3 +0,0 @@ -error.unexpected=\u4e0a\u4f20\u65b0\u5185\u5bb9\u671f\u95f4\u53d1\u751f\u610f\u5916\u9519\u8bef\u3002 -error.uploadMissing=\u65e0\u6cd5\u5728\u8bf7\u6c42\u6570\u636e\u4e2d\u627e\u5230\u4e0a\u4f20\u7684\u6587\u4ef6\u3002 -error.sitesFolder=\u65e0\u6cd5\u627e\u5230\u7ad9\u70b9\u6587\u4ef6\u5939\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.desc.xml deleted file mode 100644 index d9a5178bf0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - my-content - Content I'm Editing Dashlet Data Webscript - /slingshot/dashlets/my-contents - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.js deleted file mode 100644 index 1336bd5a9a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.js +++ /dev/null @@ -1,46 +0,0 @@ - - -/** - * Fetches all posts of the given blog - */ -function getDraftBlogPostList() -{ - var q = " +TYPE:\"{http://www.alfresco.org/model/content/1.0}content\"" + - " +PATH:\"/app:company_home/st:sites/*/cm:blog/*\"" + - " -ISNOTNULL:\"{http://www.alfresco.org/model/content/1.0}published\"" + - " +@cm\\:creator:\"" + person.properties.userName + '"'; - - nodes = search.luceneSearch(q, '@cm:modified', false, 3); - - return processResults(nodes, 3); -} - -function getWikiPages() -{ - var q = " +TYPE:\"{http://www.alfresco.org/model/content/1.0}content\"" + - " +PATH:\"/app:company_home/st:sites/*/cm:wiki/*\"" + - " +@cm\\:modifier:\"" + person.properties.userName + '"'; - - nodes = search.luceneSearch(q, '@cm:modified', false, 3); - - return processResults(nodes, 3); -} - -function getDiscussions() -{ - var q = " +TYPE:\"{http://www.alfresco.org/model/forum/1.0}post\"" + - " +PATH:\"/app:company_home/st:sites/*/cm:discussions/*/*\"" + - " +@cm\\:creator:\"" + person.properties.userName + '"'; - - // NOTE: pull back all posts as first reply on each post will also find the root post - // the posts will be discarded until the root post for each topic is found. - nodes = search.luceneSearch(q, '@cm:modified', false); - - return processResults(nodes, 3); -} - -model.data = {}; - -model.data.blogPosts = getDraftBlogPostList(); -model.data.wikiPages = getWikiPages(); -model.data.discussions = getDiscussions(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.json.ftl deleted file mode 100644 index 62463d4db0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-contents.get.json.ftl +++ /dev/null @@ -1,59 +0,0 @@ -<#macro dateFormat date>${xmldate(date)} -<#macro renderItem item> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "name":"${item.name}", - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "displayName": "${item.displayName!''}", - "description": "${item.description!''}", - "createdOn": "<@dateFormat item.createdOn />", - "createdBy": "${item.createdBy!''}", - "createdByUser": "${item.createdByUser!''}", - "modifiedOn": "<@dateFormat item.modifiedOn />", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "size": ${item.size?c}, - "tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,], - <#if item.site??> - "site": - { - "shortName": "${item.site.shortName}", - "title": "${item.site.title}" - }, - "container": "${item.container}" - -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "blogPosts": - { - "items": - [ - <#list data.blogPosts.items as item> - <@renderItem item /><#if item_has_next>, - - ] - }, - "wikiPages": - { - "items": - [ - <#list data.wikiPages.items as item> - <@renderItem item /><#if item_has_next>, - - ] - }, - "forumPosts": - { - "items": - [ - <#list data.discussions.items as item> - <@renderItem item /><#if item_has_next>, - - ] - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.desc.xml deleted file mode 100644 index 2f040e0152..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - my-tasks - My Tasks Dashlet Data Webscript - /slingshot/dashlets/my-tasks?filter={filter?}&date={date?} - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.html.ftl deleted file mode 100644 index 35860a983c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.html.ftl +++ /dev/null @@ -1 +0,0 @@ -<#include "my-tasks.get.json.ftl"> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.js deleted file mode 100644 index 84d89b326e..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.js +++ /dev/null @@ -1,22 +0,0 @@ -var today = new Date(); - -var tomorrow = new Date(); -tomorrow.setDate(today.getDate() + 1); - -var lastSunday = new Date(); -lastSunday.setDate(today.getDate() - today.getDay()); - -var sunday = new Date(); -sunday.setDate(lastSunday.getDate() + 7); - -var nextSunday = new Date(); -nextSunday.setDate(sunday.getDate() + 7); - -var future = new Date(); -future.setYear(9999); - -model.tomorrow = tomorrow; -model.lastSunday = lastSunday; -model.sunday = sunday; -model.nextSunday = nextSunday; -model.future = future; \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.json.ftl deleted file mode 100644 index abaab1f373..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/dashlets/my-tasks.get.json.ftl +++ /dev/null @@ -1,223 +0,0 @@ -<#assign workingCopyLabel = " " + message("coci_service.working_copy_label")> -<#assign inviteWorkflowDefinitionNames = ["jbpm$imwf:invitation-moderated", "jbpm$inwf:invitation-nominated"]> -<#assign filter = args["filter"]!"all"> -<#-- - Resolve site, container and path ---> -<#macro location doc> - <#assign qnamePaths = doc.qnamePath?split("/")> - <#assign displayPaths = doc.displayPath?split("/") + [""]> - <#if ((qnamePaths?size > 5) && (qnamePaths[2] == "st:sites"))> - "site": "${displayPaths[3]}", - "container": "${displayPaths[4]}", - "path": "<#list displayPaths[5..] as path><#if path_has_next>/${path}" - - -<#-- - Render a task ---> -<#macro dateFormat date>${date?datetime?string("yyyy-MM-dd HH:mm:ss 'GMT'Z '('zzz')'")!""} -<#macro taskDetail task> - { - "id": "${task.id}", - "description": "${(task.description!"")?j_string}", - "dueDate": "<#if task.properties["bpm:dueDate"]?exists><@dateFormat task.properties["bpm:dueDate"] /><#else><@dateFormat future />", - "status": "${task.properties["bpm:status"]}", - "priority": "${task.properties["bpm:priority"]}", - "startDate": "<@dateFormat task.startDate />", - "type": "${task.type}", - "completeness": "${task.properties["bpm:percentComplete"]}", - "resources": - [ -<#list task.packageResources as resource> - { - "nodeRef": "${resource.nodeRef}", - "fileName": "${resource.name}", - "displayName": "${resource.name?replace(workingCopyLabel, "")}", - "location": - { - <@location resource /> - }, - "icon": "${resource.icon16}" - }<#if resource_has_next>, - - ], - "transitions": - [ -<#list task.transitions as transition> - { - "id": "${transition.id!""}", - "label": "${transition.label!""}" - }<#if transition_has_next>, - - ] - } - - -<#macro invitationModeratedTaskDetail task> - <#assign theSite = site.getSiteInfo(task.properties["imwf:resourceName"])> - <#assign theUser = people.getPerson(task.properties["imwf:inviteeUserName"])> - { - "id": "${task.id}", - "description": "${(task.description!"")?j_string}", - "dueDate": "<#if task.properties["bpm:dueDate"]?exists><@dateFormat task.properties["bpm:dueDate"] /><#else><@dateFormat future />", - "status": "${task.properties["bpm:status"]}", - "priority": "${task.properties["bpm:priority"]}", - "startDate": "<@dateFormat task.startDate />", - "type": "${task.type}", - "completeness": "${task.properties["bpm:percentComplete"]}", - "invitation": - { - "type": "moderated", - "site": - { - "id": "${theSite.shortName}", - "title": "${theSite.title!""}", - "description": "${theSite.description!""}" - }, - "invitee": - { - "fullName": "${(theUser.properties.firstName!"" + " " + theUser.properties.lastName!"")?trim}", - <#if theUser.assocs["cm:avatar"]??> - "avatarRef": "${theUser.assocs["cm:avatar"][0].nodeRef?string}", - - "userName": "${theUser.properties.userName}" - }, - "inviteeRole": "${task.properties["imwf:inviteeRole"]}" - }, - "transitions": - [ -<#list task.transitions as transition> - { - "id": "${transition.id!""}", - "label": "${transition.label!""}" - }<#if transition_has_next>, - - ] - } - - -<#macro invitationNominatedTaskDetail task> - { - "id": "${task.id}", - "description": "${(task.description!"")?j_string}", - "dueDate": "<#if task.properties["bpm:dueDate"]?exists><@dateFormat task.properties["bpm:dueDate"] /><#else><@dateFormat future />", - "status": "${task.properties["bpm:status"]}", - "priority": "${task.properties["bpm:priority"]}", - "startDate": "<@dateFormat task.startDate />", - "type": "${task.type}", - "completeness": "${task.properties["bpm:percentComplete"]}", - <#if task.properties["inwf:resourceName"]?exists> - <#assign theInviter = people.getPerson(task.properties["inwf:inviterUserName"])> - "invitation": - { - "type": "nominated", - "site": - { - "id": "${task.properties["inwf:resourceName"]!""}", - "title": "${jsonUtils.encodeJSONString(task.properties["inwf:resourceTitle"]!"")}", - "description": "${jsonUtils.encodeJSONString(task.properties["inwf:resourceDescription"]!"")}" - }, - "inviter": - { - "fullName": "${(theInviter.properties.firstName!"" + " " + theInviter.properties.lastName!"")?trim}", - <#if theInviter.assocs["cm:avatar"]??> - "avatarRef": "${theInviter.assocs["cm:avatar"][0].nodeRef?string}", - - "userName": "${theInviter.properties.userName}" - }, - "inviteeRole": "${task.properties["inwf:inviteeRole"]}" - }, - - "transitions": - [ -<#list task.transitions as transition> - { - "id": "${transition.id!""}", - "label": "${transition.label!""}" - }<#if transition_has_next>, - - ] - } - - - -<#-- - Filter task list ---> -<#assign filteredTasks = []> -<#assign unfilteredTasks = workflow.assignedTasks + workflow.pooledTasks> -<#list unfilteredTasks as task> - <#assign hasDate = task.properties["bpm:dueDate"]?exists> - <#assign dueDate><#if task.properties["bpm:dueDate"]?exists>${task.properties["bpm:dueDate"]?date!""}<#else>${future?date} - <#switch filter> - <#case "all"> - <#assign filteredTasks = filteredTasks + [task]> - <#break> - - <#case "today"> - <#if (dateCompare(date?date, dueDate?date, 0, "==") == 1)> - <#assign filteredTasks = filteredTasks + [task]> - - <#break> - - <#case "tomorrow"> - <#if (dateCompare(tomorrow?date, dueDate?date, 0, "==") == 1)> - <#assign filteredTasks = filteredTasks + [task]> - - <#break> - - <#case "this-week"> - <#if ((dateCompare(lastSunday?date, dueDate?date) == 0) && (dateCompare(sunday?date, dueDate?date) == 1))> - <#assign filteredTasks = filteredTasks + [task]> - - <#break> - - <#case "next-week"> - <#if ((dateCompare(sunday?date, dueDate?date) == 0) && (dateCompare(nextSunday?date, dueDate?date) == 1))> - <#assign filteredTasks = filteredTasks + [task]> - - <#break> - - <#case "overdue"> - <#if (dateCompare(date?date, dueDate?date) == 1)> - <#assign filteredTasks = filteredTasks + [task]> - - <#break> - - <#case "no-due-date"> - <#if !hasDate> - <#assign filteredTasks = filteredTasks + [task]> - - <#break> - - <#case "invites"> - <#if task.properties["bpm:package"]??> - <#if inviteWorkflowDefinitionNames?seq_contains(task.properties["bpm:package"].properties["bpm:workflowDefinitionName"])> - <#assign filteredTasks = filteredTasks + [task]> - - - <#break> - - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "tasks": - [ -<#list filteredTasks as task> - <#if task.properties["bpm:package"]??> - <#assign packageNode = task.properties["bpm:package"]> - <#if packageNode.properties["bpm:workflowDefinitionName"] == "jbpm$imwf:invitation-moderated"> - <@invitationModeratedTaskDetail task /> - <#elseif packageNode.properties["bpm:workflowDefinitionName"] == "jbpm$inwf:invitation-nominated"> - <@invitationNominatedTaskDetail task /> - <#else> - <@taskDetail task /> - - - <#if task_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/action.lib.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/action.lib.ftl deleted file mode 100644 index eaa499cdba..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/action.lib.ftl +++ /dev/null @@ -1,25 +0,0 @@ -<#macro resultsJSON results> - <#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalResults": ${results?size?c}, - "overallSuccess": ${overallSuccess?string}, - "successCount": ${successCount?c}, - "failureCount": ${failureCount?c}, - "results": - [ - <#list results as r> - { - <#list r?keys as key> - <#assign value = r[key]> - <#if value?is_number || value?is_boolean> - "${key}": ${value?string}<#if key_has_next>, - <#else> - "${key}": "${value}"<#if key_has_next>, - - - }<#if r_has_next>, - - ] -} - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/action.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/action.lib.js deleted file mode 100644 index ba2c9e2e1c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/action.lib.js +++ /dev/null @@ -1,158 +0,0 @@ - - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Data List Component: action - * - * For a single-asset action, template paramters address the item. - * For multi-item actions, optional template parameters address the source or destination node, - * and a JSON body addresses the items involved in the action. - * - * @param uri {string} node/{store_type}/{store_id}/{id} - */ - -/** - * Main script entry point - * @method main - */ -function main() -{ - var nodeRef = null, - rootNode = null, - params = {}; - - if (url.templateArgs.store_type !== null) - { - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - nodeRef = storeType + "://" + storeId + "/" + id; - rootNode = ParseArgs.resolveNode(nodeRef); - if (rootNode == null) - { - rootNode = search.findNode(nodeRef); - if (rootNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - params.nodeRef = nodeRef; - params.rootNode = rootNode; - } - - // Multiple input files in the JSON body? - var items = getMultipleInputValues("nodeRefs"); - if (typeof items != "string") - { - params.items = items; - } - - // Check runAction function is provided the action's webscript - if (typeof runAction != "function") - { - status.setCode(status.STATUS_BAD_REQUEST, "Action webscript must provide runAction() function."); - return; - } - - // Actually run the action - var results = runAction(params); - if (results) - { - if (typeof results == "string") - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, results); - } - else if (typeof results.status == "object") - { - // Status fields have been manually set - status.redirect = true; - for (var s in results.status) - { - status[s] = results.status[s]; - } - } - else - { - /** - * NOTE: Webscripts run within one transaction only. - * If a single operation fails, the transaction is marked for rollback and all - * previous (successful) operations are also therefore rolled back. - * We therefore need to scan the results for a failed operation and mark the entire - * set of operations as failed. - */ - var overallSuccess = true, - successCount = 0, - failureCount = 0; - - for (var i = 0, j = results.length; i < j; i++) - { - overallSuccess = overallSuccess && results[i].success; - results[i].success ? ++successCount : ++failureCount; - } - model.overallSuccess = overallSuccess; - model.successCount = successCount; - model.failureCount = failureCount; - model.results = results; - } - } -} - -/** - * Get multiple input values - * - * @method getMultipleInputValues - * @return {array|string} Array containing multiple values, or string error - */ -function getMultipleInputValues(param) -{ - var values = [], - error = null; - - try - { - // Was a JSON parameter list supplied? - if (typeof json != "undefined") - { - if (!json.isNull(param)) - { - var jsonValues = json.get(param); - // Convert from JSONArray to JavaScript array - for (var i = 0, j = jsonValues.length(); i < j; i++) - { - values.push(jsonValues.get(i)); - } - } - } - } - catch(e) - { - error = e.toString(); - } - - // Return the values array, or the error string if it was set - return (error !== null ? error : values); -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.desc.xml deleted file mode 100644 index 080eeac44a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - duplicate - Data List Action - Duplicate single or multiple items - /slingshot/datalists/action/duplicate/node/{store_type}/{store_id}/{id} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.json.js deleted file mode 100644 index 811c71e60c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/duplicate.post.json.js +++ /dev/null @@ -1,124 +0,0 @@ - - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Duplicate multiple items action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing items array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - parentNode = p_params.rootNode, - items = p_params.items, - index, itemNode, result, nodeRef; - - // Must have parent node and array of items - if (!parentNode) - { - status.setCode(status.STATUS_BAD_REQUEST, "No parent node supplied on URL."); - return; - } - if (!items || items.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No items supplied in JSON body."); - return; - } - - // Properties to skip when duplicating - var propertiesToSkip = - { - "cm:name": true, - "cm:content": true, - "cm:created": true, - "cm:creator": true, - "cm:modified": true, - "cm:modifier": true - }; - - for (index in items) - { - nodeRef = items[index]; - result = - { - nodeRef: nodeRef, - action: "duplicateItem", - success: false - }; - - try - { - itemNode = search.findNode(nodeRef); - if (itemNode !== null) - { - var duplicateProperties = new Array(), - propNames = itemNode.getPropertyNames(true), - propName; - - // Copy selected properties from the original node - for (var i = 0, ii = propNames.length; i < ii; i++) - { - propName = propNames[i]; - if (propName in propertiesToSkip || propName.indexOf("sys:") == 0) - { - continue; - } - duplicateProperties[propName] = itemNode.properties[propName]; - } - - // Duplicate the node with a new GUID cm:name - var newNode = parentNode.createNode(null, itemNode.type, duplicateProperties); - if (newNode !== null) - { - // Now copy any associations - for (var idxAssoc in itemNode.assocs) - { - var assocs = itemNode.assocs[idxAssoc]; - for (var j = 0, jj = assocs.length; j < jj; j++) - { - newNode.createAssociation(assocs[j], idxAssoc); - } - } - result.nodeRef = newNode.nodeRef.toString(); - result.success = true; - } - } - } - catch (e) - { - result.success = false; - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.desc.xml deleted file mode 100644 index 2aa6054d66..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - files - Data List Action - Delete single or multiple items - /slingshot/datalists/action/items - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.json.js deleted file mode 100644 index c31394199d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/action/items.delete.json.js +++ /dev/null @@ -1,77 +0,0 @@ - - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Delete multiple items action - * @method DELETE - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing items array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - items = p_params.items, - item, result, nodeRef; - - // Must have array of items - if (!items || items.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No items supplied in JSON body."); - return; - } - - for (item in items) - { - nodeRef = items[item]; - result = - { - nodeRef: nodeRef, - action: "deleteItem", - success: false - } - - try - { - itemNode = search.findNode(nodeRef); - if (itemNode != null) - { - result.success = itemNode.remove(); - } - } - catch (e) - { - result.success = false; - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.desc.xml deleted file mode 100644 index 7e7c793dbd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - DataLists - Data retrieval - Data Lists Component - retrieve data within a given list - /slingshot/datalists/data/site/{site}/{container}/{list} - /slingshot/datalists/data/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.json.ftl deleted file mode 100644 index 95d7957faf..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.json.ftl +++ /dev/null @@ -1,36 +0,0 @@ -<#import "item.lib.ftl" as itemLib /> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${data.paging.totalRecords?c}, - "startIndex": ${data.paging.startIndex?c}, - "metadata": - { - "parent": - { - <#if data.parent??> - <#assign parentNode = data.parent.node> - "nodeRef": "${parentNode.nodeRef}", - "permissions": - { - "userAccess": - { - <#list data.parent.userAccess?keys as perm> - <#if data.parent.userAccess[perm]?is_boolean> - "${perm?string}": ${data.parent.userAccess[perm]?string}<#if perm_has_next>, - - - } - } - - } - }, - "items": - [ - <#list data.items as item> - { - <@itemLib.itemJSON item /> - }<#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.json.js deleted file mode 100644 index 6d5cef7664..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/data.post.json.js +++ /dev/null @@ -1,125 +0,0 @@ - - - - -const REQUEST_MAX = 1000; - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Main entry point: Return data list with properties being supplied in POSTed arguments - * - * @method getData - */ -function getData() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - var fields = null; - // Extract fields (if given) - if (json.has("fields")) - { - // Convert the JSONArray object into a native JavaScript array - fields = []; - var jsonFields = json.get("fields"), - numFields = jsonFields.length(); - - for (count = 0; count < numFields; count++) - { - fields.push(jsonFields.get(count).replaceFirst("_", ":")); - } - } - - // Try to find a filter query based on the passed-in arguments - var filter = parsedArgs.filter, - allNodes = [], node, - items = []; - - if (filter == null || filter.filterId == "all") - { - // Use non-query method - var parentNode = parsedArgs.listNode; - if (parentNode != null) - { - var pagedResult = parentNode.childFileFolders(true, false, Filters.IGNORED_TYPES.concat(Filters.IGNORED_ASPECTS), -1, -1, REQUEST_MAX, "cm:name", true, null); - allNodes = pagedResult.page; - } - } - else - { - var filterParams = Filters.getFilterParams(filter, parsedArgs) - query = filterParams.query; - - // Query the nodes - passing in default sort and result limit parameters - if (query !== "") - { - allNodes = search.query( - { - query: query, - language: filterParams.language, - page: - { - maxItems: (filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : 0) - }, - sort: filterParams.sort, - templates: filterParams.templates, - namespace: (filterParams.namespace ? filterParams.namespace : null) - }); - } - } - - if (allNodes.length > 0) - { - for each (node in allNodes) - { - try - { - items.push(Evaluator.run(node, fields)); - } - catch(e) {} - } - } - - return ( - { - fields: fields, - paging: - { - totalRecords: items.length, - startIndex: 0 - }, - parent: - { - node: parsedArgs.listNode, - userAccess: - { - create: parsedArgs.listNode.hasPermission("CreateChildren") - } - }, - items: items - }); -} - -model.data = getData(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/evaluator.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/evaluator.lib.js deleted file mode 100644 index 6747ca4ecd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/evaluator.lib.js +++ /dev/null @@ -1,285 +0,0 @@ -/** - * Copyright (C) 2005-2010 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 . - */ - -var Evaluator = -{ - /** - * Cache for cm:person objects - */ - PeopleObjectCache: {}, - - /** - * Gets / caches a person object - * - * @method getPersonObject - * @param nodeRef {string} NodeRef of a cm:person object - */ - getPersonObject: function Evaluator_getPersonObject(nodeRef) - { - if (nodeRef == null || nodeRef == "") - { - return null; - } - - if (typeof Evaluator.PeopleObjectCache[nodeRef] == "undefined") - { - var person = search.findNode(nodeRef); - Evaluator.PeopleObjectCache[nodeRef] = - { - userName: person.properties.userName, - firstName: person.properties.firstName, - lastName: person.properties.lastName, - displayName: (person.properties.firstName + " " + person.properties.lastName).replace(/^\s+|\s+$/g, "") - }; - if (person.assocs["cm:avatar"] != null) - { - Evaluator.PeopleObjectCache[nodeRef].avatar = person.assocs["cm:avatar"][0]; - } - } - return Evaluator.PeopleObjectCache[nodeRef]; - }, - - /** - * Cache for nodes that are subtypes of cm:cmobject - */ - ContentObjectCache: {}, - - /** - * Gets / caches a content object - * - * @method getContentObject - * @param nodeRef {string} NodeRef - */ - getContentObject: function Evaluator_getContentObject(nodeRef) - { - if (nodeRef == null || nodeRef == "") - { - return null; - } - - if (typeof Evaluator.ContentObjectCache[nodeRef] == "undefined") - { - var node = search.findNode(nodeRef); - try - { - Evaluator.ContentObjectCache[nodeRef] = node; - } - catch(e) - { - // Possibly a stale indexed node - return null; - } - } - return Evaluator.ContentObjectCache[nodeRef]; - }, - - /** - * Generate displayValue and any extra metadata for this field - * - * @method decorateFieldData - * @param objData {object} Object literal containing this field's data - * @param node {ScriptNode} The list item node for this field - * @return {Boolean} false to prevent this field being added to the output stream. - */ - decorateFieldData: function Evaluator_decorateFieldData(objData, node) - { - var value = objData.value, - type = objData.type, - obj; - - if (type == "cm:person") - { - obj = Evaluator.getPersonObject(value); - if (obj == null) - { - return false; - } - objData.displayValue = obj.displayName; - objData.metadata = obj.userName; - } - else if (type == "cm:folder") - { - obj = Evaluator.getContentObject(value); - if (obj == null) - { - return false; - } - objData.displayValue = obj.displayPath.substring(companyhome.name.length() + 1); - objData.metadata = "container"; - } - else if (type == "category") - { - var displayValue = "", - categoryNodeRefs = value.split(","); - for each (nodeRef in categoryNodeRefs) - { - if (displayValue !== "") - { - displayValue += ", " - } - displayValue += Evaluator.getContentObject(nodeRef).properties["cm:name"]; - } - objData.displayValue = displayValue; - } - else if (type.indexOf(":") > 0 && node.isSubType("cm:cmobject")) - { - obj = Evaluator.getContentObject(value); - if (obj == null || !obj.hasPermission("Read")) - { - return false; - } - objData.displayValue = obj.properties["cm:name"]; - objData.metadata = obj.isContainer ? "container" : "document"; - } - return true; - }, - - /** - * Translates a List fieldDefinition - * - * @method translateField - * @param objDef {FieldDefinition} objDef - * @param value {String} default value - */ - translateField: function Evaluator_translateField(objDef, value) - { - if (objDef == null || objDef == "") - { - return null; - } - if (objDef.constraints != null) - { - for ( var i=0, len= objDef.constraints.size(); i 0) - { - values = value.split(","); - nodeData[k] = []; - for each (value in values) - { - var objLoop = - { - type: objData.type, - value: value, - displayValue: value - }; - - if (Evaluator.decorateFieldData(objLoop, node)) - { - nodeData[k].push(objLoop); - } - } - } - } - else - { - objData.value = value; - objData.displayValue = isAssoc ? value : Evaluator.translateField(objDefinitions[k],value); - - if (Evaluator.decorateFieldData(objData, node)) - { - nodeData[k] = objData; - } - } - } - - return( - { - node: node, - nodeData: nodeData, - actionSet: actionSet, - actionPermissions: permissions, - createdBy: createdBy, - modifiedBy: modifiedBy, - tags: node.tags, - actionLabels: actionLabels - }); - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/filters.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/filters.lib.js deleted file mode 100644 index eac9dacba6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/filters.lib.js +++ /dev/null @@ -1,169 +0,0 @@ -/** - * Copyright (C) 2005-2010 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 . - */ - -var Filters = -{ - /** - * Types that we want to suppress from the resultset - */ - IGNORED_TYPES: - [ - "cm:systemfolder", - "fm:forums", - "fm:forum", - "fm:topic", - "fm:post" - ], - - /** - * Aspects that we want to suppress from the resultset - */ - IGNORED_ASPECTS: - [ - "cm:workingcopy" - ], - - /** - * Create filter parameters based on input parameters - * - * @method getFilterParams - * @param filter {string} Required filter - * @param parsedArgs {object} Parsed arguments object literal - * @return {object} Object literal containing parameters to be used in Lucene search - */ - getFilterParams: function Filter_getFilterParams(filter, parsedArgs) - { - var filterParams = - { - query: "+PARENT:\"" + parsedArgs.nodeRef + "\" ", - limitResults: null, - sort: [ - { - column: "@cm:name", - ascending: true - }], - language: "lucene", - templates: null - }; - - // Max returned results specified? - var argMax = args.max; - if ((argMax !== null) && !isNaN(argMax)) - { - filterParams.limitResults = argMax; - } - - // Create query based on passed-in arguments - var filterData = String(filter.filterData || ""), - filterQuery = filterParams.query; - - // Common types and aspects to filter from the UI - var filterQueryDefaults = ' -TYPE:"' + Filters.IGNORED_TYPES.join('" -TYPE:"') + '"' + ' -ASPECT:"' + Filters.IGNORED_ASPECTS.join('" -ASPECT:"') + '"'; - - switch (String(filter.filterId)) - { - case "recentlyAdded": - case "recentlyModified": - case "recentlyCreatedByMe": - case "recentlyModifiedByMe": - var onlySelf = (filter.filterId.indexOf("ByMe")) > 0 ? true : false, - dateField = (filter.filterId.indexOf("Modified") > 0) ? "modified" : "created", - ownerField = (dateField == "created") ? "creator" : "modifier"; - - // Default to 7 days - can be overridden using "days" argument - var dayCount = 7, - argDays = args.days; - if ((argDays !== null) && !isNaN(argDays)) - { - dayCount = argDays; - } - - // Default limit to 50 documents - can be overridden using "max" argument - if (filterParams.limitResults === null) - { - filterParams.limitResults = 50; - } - - var date = new Date(); - var toQuery = date.getFullYear() + "\\-" + (date.getMonth() + 1) + "\\-" + date.getDate(); - date.setDate(date.getDate() - dayCount); - var fromQuery = date.getFullYear() + "\\-" + (date.getMonth() + 1) + "\\-" + date.getDate(); - - filterQuery = "+PARENT:\"" + parsedArgs.nodeRef; - if (parsedArgs.nodeRef == "alfresco://sites/home") - { - // Special case for "Sites home" pseudo-nodeRef - filterQuery += "/*/cm:dataLists"; - } - filterQuery += "\""; - filterQuery += " +@cm\\:" + dateField + ":[" + fromQuery + "T00\\:00\\:00.000 TO " + toQuery + "T23\\:59\\:59.999]"; - if (onlySelf) - { - filterQuery += " +@cm\\:" + ownerField + ":\"" + person.properties.userName + '"'; - } - filterQuery += " -TYPE:\"folder\""; - - filterParams.sort = [ - { - column: "@cm:" + dateField, - ascending: false - }]; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "createdByMe": - // Default limit to 50 documents - can be overridden using "max" argument - if (filterParams.limitResults === null) - { - filterParams.limitResults = 50; - } - - filterQuery = "+PARENT:\"" + parsedArgs.nodeRef; - if (parsedArgs.nodeRef == "alfresco://sites/home") - { - // Special case for "Sites home" pseudo-nodeRef - filterQuery += "/*/cm:dataLists"; - } - filterQuery += "\""; - filterQuery += " +@cm\\:creator:\"" + person.properties.userName + '"'; - filterQuery += " -TYPE:\"folder\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "node": - filterParams.query = "+ID:\"" + parsedArgs.nodeRef + "\""; - break; - - case "tag": - // Remove any trailing "/" character - if (filterData.charAt(filterData.length - 1) == "/") - { - filterData = filterData.slice(0, -1); - } - filterParams.query += "+PATH:\"/cm:taggable/cm:" + search.ISO9075Encode(filterData) + "/member\""; - break; - - default: - filterParams.query = filterQuery + filterQueryDefaults; - break; - } - - return filterParams; - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.lib.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.lib.ftl deleted file mode 100644 index eaecbe4310..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.lib.ftl +++ /dev/null @@ -1,81 +0,0 @@ -<#macro itemJSON item> - <#escape x as jsonUtils.encodeJSONString(x)> - <#assign node = item.node> - <#assign tags><#list item.tags as tag>"${tag}"<#if tag_has_next>, - "nodeRef": "${node.nodeRef}", - "createdOn": "${xmldate(node.properties.created)}", - "createdBy": - { - "value": "${item.createdBy.userName}", - "displayValue": "${item.createdBy.displayName}" - }, - "modifiedOn": "${xmldate(node.properties.modified)}", - "modifiedBy": - { - "value": "${item.modifiedBy.userName}", - "displayValue": "${item.modifiedBy.displayName}" - }, - "actionSet": "${item.actionSet}", - "tags": <#noescape>[${tags}], - "permissions": - { - "userAccess": - { - <#list item.actionPermissions?keys as actionPerm> - <#if item.actionPermissions[actionPerm]?is_boolean> - "${actionPerm?string}": ${item.actionPermissions[actionPerm]?string}<#if actionPerm_has_next>, - - - } - }, - <#if item.custom??>"custom": <#noescape>${item.custom}, - "actionLabels": - { - <#if item.actionLabels??> - <#list item.actionLabels?keys as actionLabel> - "${actionLabel?string}": "${item.actionLabels[actionLabel]}"<#if actionLabel_has_next>, - - - }, - "itemData": - { - <#list item.nodeData?keys as key> - <#assign itemData = item.nodeData[key]> - "${key}": - <#if itemData?is_sequence> - [ - <#list itemData as data> - <@renderData data /><#if data_has_next>, - - ] - <#else> - <@renderData itemData /> - <#if key_has_next>, - - } - - - -<#macro renderData data> - <#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if data.value?is_boolean> - "value": ${data.value?string}, - <#elseif data.value?is_number> - "value": ${data.value?c}, - <#else> - "value": "${data.value}", - - <#if data.metadata??> - "metadata": "${data.metadata}", - - <#if data.displayValue?is_boolean> - "displayValue": ${data.displayValue?string} - <#elseif data.displayValue?is_number> - "displayValue": ${data.displayValue?c} - <#else> - "displayValue": "${data.displayValue}" - -} - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.desc.xml deleted file mode 100644 index 216fee2fb3..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - DataLists - Single item data retrieval - Data Lists Component - retrieve data for a single item by nodeRef - /slingshot/datalists/item/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.json.ftl deleted file mode 100644 index 0ed6ae7c0b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.json.ftl +++ /dev/null @@ -1,30 +0,0 @@ -<#import "item.lib.ftl" as itemLib /> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "metadata": - { - "parent": - { - <#if data.parent??> - <#assign parentNode = data.parent.node> - "nodeRef": "${parentNode.nodeRef}", - "permissions": - { - "userAccess": - { - <#list data.parent.userAccess?keys as perm> - <#if data.parent.userAccess[perm]?is_boolean> - "${perm?string}": ${data.parent.userAccess[perm]?string}<#if perm_has_next>, - - - } - } - - } - }, - "item": - { - <@itemLib.itemJSON data.item /> - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.json.js deleted file mode 100644 index 301dad9458..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/item.post.json.js +++ /dev/null @@ -1,80 +0,0 @@ - - - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Main entry point: Return data list with properties being supplied in POSTed arguments - * - * @method getData - */ -function getData() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - var fields = null; - // Extract fields (if given) - if (json.has("fields")) - { - // Convert the JSONArray object into a native JavaScript array - fields = []; - var jsonFields = json.get("fields"), - numFields = jsonFields.length(); - - for (count = 0; count < numFields; count++) - { - fields.push(jsonFields.get(count).replaceFirst("_", ":")); - } - } - - // Try to find a filter query based on the passed-in arguments - var node = search.findNode(parsedArgs.nodeRef), - items = []; - - if (node != null) - { - try - { - item = Evaluator.run(node, fields); - } - catch(e) {} - } - - return ( - { - fields: fields, - parent: - { - node: parsedArgs.listNode, - userAccess: - { - create: parsedArgs.listNode.hasPermission("CreateChildren") - } - }, - item: item - }); -} - -model.data = getData(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.desc.xml deleted file mode 100644 index 4ac3faf877..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - DataLists - Delete a Data List - Data Lists Component - delete a Data List - /slingshot/datalists/list/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.js deleted file mode 100644 index aba2a7ce73..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.js +++ /dev/null @@ -1,51 +0,0 @@ - - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Main entry point: Delete a Data List - * - * @method deleteList - */ -function deleteList() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - try - { - if (!parsedArgs.rootNode.remove()) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not delete."); - return; - } - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } -} - -deleteList(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.json.ftl deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.delete.json.ftl +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.desc.xml deleted file mode 100644 index 03894a1a8c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.desc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - DataLists - Download a Data List - Data Lists Component - Download a Data List - /slingshot/datalists/list/site/{site}/{container}/{list}/ - /slingshot/datalists/list/site/{site}/{container}/{list} - /slingshot/datalists/list/node/{store_type}/{store_id}/{id} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.xls.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.xls.ftl deleted file mode 100644 index 87cc72dbdb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.xls.ftl +++ /dev/null @@ -1 +0,0 @@ -<#-- Must not have a newline or any other contents! -->${writeExcel.write()} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.xlsx.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.xlsx.ftl deleted file mode 100644 index 87cc72dbdb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.get.xlsx.ftl +++ /dev/null @@ -1 +0,0 @@ -<#-- Must not have a newline or any other contents! -->${writeExcel.write()} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.lib.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.lib.ftl deleted file mode 100644 index 51c2e0b2f2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/list.lib.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<#macro listJSON list> - <#escape x as jsonUtils.encodeJSONString(x)> -{ - "name": "${list.name}", - "title": "${list.properties.title!list.name}", - "description": "${list.properties.description!""}", - "nodeRef": "${list.nodeRef}", - "itemType": "${list.properties["dl:dataListItemType"]!""}", - "permissions": - { - "edit": ${list.hasPermission("Write")?string}, - "delete": ${list.hasPermission("Delete")?string} - } -} - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.desc.xml deleted file mode 100644 index 54adc3ba1c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.desc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - DataLists - Data Lists Component - retrieve data lists within a given site and container, or by container nodeRef - /slingshot/datalists/lists/site/{site}/{container}/ - /slingshot/datalists/lists/site/{site}/{container} - /slingshot/datalists/lists/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.js deleted file mode 100644 index b47295f025..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.js +++ /dev/null @@ -1,43 +0,0 @@ - - -/** - * Copyright (C) 2005-2010 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 . - */ - -/** - * Main entry point: Return list of Data Lists - * - * @method getDataLists - */ -function getDataLists() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - return ( - { - container: parsedArgs.rootNode, - lists: parsedArgs.rootNode.childAssocs["cm:contains"] || [] - }); -} - -model.datalists = getDataLists(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.json.ftl deleted file mode 100644 index 3bdef7ad0a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/lists.get.json.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<#import "list.lib.ftl" as listLib /> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "container": "${datalists.container.nodeRef?string}", - "permissions": - { - "create": ${datalists.container.hasPermission("CreateChildren")?string} - }, - "datalists": - [ - <#list datalists.lists as list> - <@listLib.listJSON list /><#if list_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/parse-args.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/parse-args.lib.js deleted file mode 100644 index 14f9264764..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/datalists/parse-args.lib.js +++ /dev/null @@ -1,234 +0,0 @@ -/** - * Copyright (C) 2005-2010 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 . - */ - -var Common = -{ - /** - * Cache for person objects - */ - PeopleCache: {}, - - /** - * Gets / caches a person object - * - * @method getPerson - * @param username {string} User name - */ - getPerson: function Common_getPerson(username) - { - if (username == null || username == "") - { - return null; - } - - if (typeof Common.PeopleCache[username] != "object") - { - 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: {} - }; - } - } - Common.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, "") - }; - if (person.assocs["cm:avatar"] != null) - { - Common.PeopleCache[username].avatar = person.assocs["cm:avatar"][0]; - } - } - return Common.PeopleCache[username]; - } -}; - -var ParseArgs = -{ - /** - * Get and parse arguments - * - * @method getParsedArgs - * @param containerType {string} Optional: Node Type of container to create if it doesn't exist, defaults to "cm:folder" - * @return {array|null} Array containing the validated input parameters - */ - getParsedArgs: function ParseArgs_getParsedArgs(containerType) - { - var rootNode = null, - nodeRef = null, - listNode = null; - - if (url.templateArgs.store_type !== null) - { - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - nodeRef = storeType + "://" + storeId + "/" + id; - rootNode = ParseArgs.resolveNode(nodeRef); - if (rootNode == null) - { - rootNode = search.findNode(nodeRef); - if (rootNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - listNode = rootNode; - } - else - { - /** - * Site and container input - */ - var siteId = url.templateArgs.site, - containerId = url.templateArgs.container, - listId = url.templateArgs.list, - siteNode = siteService.getSite(siteId); - - if (siteNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Site not found: '" + siteId + "'"); - return null; - } - - rootNode = siteNode.getContainer(containerId); - if (rootNode === null) - { - rootNode = siteNode.createAndSaveContainer(containerId, containerType || "cm:folder", "Data Lists"); - if (rootNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Data Lists container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - } - listNode = rootNode; - - if (listId !== null) - { - listNode = rootNode.childByNamePath(listId); - if (listNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "List not found: '" + listId + "'"); - return null; - } - } - } - - // Filter - var filter = null; - if (args.filter) - { - filter = - { - filterId: args.filter, - filterData: args.filterData - } - } - else if (typeof json !== "undefined" && json.has("filter")) - { - var filterJSON = json.get("filter"); - if (filterJSON != null) - { - filter = - { - filterId: filterJSON.get("filterId"), - filterData: filterJSON.get("filterData") - } - } - else - { - filter = - { - filterId: "all" - } - } - } - - var objRet = - { - rootNode: rootNode, - listNode: listNode, - nodeRef: String(listNode.nodeRef), - filter: filter - }; - - return objRet; - }, - - /** - * Resolve "virtual" nodeRefs into nodes - * - * @method resolveVirtualNodeRef - * @deprecated for ParseArgs.resolveNode - */ - resolveVirtualNodeRef: function ParseArgs_resolveVirtualNodeRef(nodeRef) - { - if (logger.isLoggingEnabled()) - { - logger.log("WARNING: ParseArgs.resolveVirtualNodeRef is deprecated for ParseArgs.resolveNode"); - } - return ParseArgs.resolveNode(nodeRef); - }, - - /** - * Resolve "virtual" nodeRefs, nodeRefs and xpath expressions into nodes - * - * @method resolveNode - * @param reference {string} "virtual" nodeRef, nodeRef or xpath expressions - * @return {ScriptNode|null} Node corresponding to supplied expression. Returns null if node cannot be resolved. - */ - resolveNode: function ParseArgs_resolveNode(reference) - { - return utils.resolveNodeReference(reference); - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.desc.xml deleted file mode 100644 index e0d70c61c8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - doclist-v2 - Document List v2 Component - doclist data webscript - /slingshot/doclib2/doclist/{type}/site/{site}/{container}/{path} - /slingshot/doclib2/doclist/{type}/site/{site}/{container} - /slingshot/doclib2/doclist/{type}/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib2/doclist/{type}/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js deleted file mode 100644 index cdf5d045fe..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.js +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -/** - * Document List Component: doclist - */ -model.doclist = doclist_main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.json.ftl deleted file mode 100644 index 9903a77eec..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.get.json.ftl +++ /dev/null @@ -1,35 +0,0 @@ -<#import "item.lib.ftl" as itemLib /> -<#assign workingCopyLabel = " " + message("coci_service.working_copy_label")> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${doclist.paging.totalRecords?c}, - <#if doclist.paging.totalRecordsUpper??> - "totalRecordsUpper": ${doclist.paging.totalRecordsUpper?c}, - - "startIndex": ${doclist.paging.startIndex?c}, - "metadata": - { - "repositoryId": "${server.id}", - <#if (doclist.container.nodeRef)??>"container": "${doclist.container.nodeRef}", - <#if (doclist.parent.nodeJSON)??>"parent": <#noescape>${doclist.parent.nodeJSON}, - <#if doclist.customJSON??>"custom": <#noescape>${doclist.customJSON}, - "onlineEditing": ${doclist.onlineEditing?string}, - "itemCounts": - { - "folders": ${(doclist.itemCount.folders!0)?c}, - "documents": ${(doclist.itemCount.documents!0)?c} - }, - "workingCopyLabel": "${workingCopyLabel}" - }, - "items": - [ - <#list doclist.items as item> - { - "node": <#noescape>${item.nodeJSON}, - <#if item.parent??>"parent": <#noescape>${item.parent.nodeJSON}, - <@itemLib.itemJSON item=item /> - }<#if item_has_next>, - - ] -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.lib.js deleted file mode 100644 index e23552cd98..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.lib.js +++ /dev/null @@ -1,360 +0,0 @@ -const REQUEST_MAX = 1000; - -/** - * Method that performs the actual loading of the nodes. - * - * Note! - * Will optimize performance by using ScriptNode.childFileFolders for directory listings - * In other words when the "path" filter is used. - * - * @method doclist_getAllNodes - * @param parsedArgs {Object} - * @param filterParams {Object} - * @param query {String} - * @param totalItemCount {int} - * @return {object} Returns the node and corresponding pagination metadata - * { - * allNodes: {Array} - * totalRecords: {int} - * requestTotalCountMax: {int} - * paged: {boolean} - * query: {String} - * } - */ -function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount) -{ - var filter = args.filter, - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - allNodes = []; - if ((filter || "path") == "path") - { - // TODO also add DB filter by "node" (in addition to "path") - var parentNode = parsedArgs.pathNode; - if (parentNode !== null) - { - var skip = -1, - max = -1; - - if (args.size != null) - { - max = args.size; - - if (args.pos > 0) - { - skip = (args.pos - 1) * max; - } - } - - var sortField = (args.sortField == null ? "cm:name" : args.sortField), - sortAsc = (((args.sortAsc == null) || (args.sortAsc == "true")) ? true : false); - - // Get paged set - requestTotalCountMax = skip + REQUEST_MAX; - var pagedResult = parentNode.childFileFolders( - true, true, filterParams.ignoreTypes.concat(filterParams.ignoreAspects), - skip, max, requestTotalCountMax, sortField, sortAsc, ""); - - allNodes = pagedResult.page; - totalRecords = pagedResult.totalResultCountUpper; - paged = true; - } - } - else - { - // Query the nodes - passing in sort and result limit parameters - if (query !== "") - { - allNodes = search.query( - { - query: query, - language: filterParams.language, - page: - { - maxItems: totalItemCount - }, - sort: filterParams.sort, - templates: filterParams.templates, - namespace: (filterParams.namespace ? filterParams.namespace : null) - }); - - totalRecords = allNodes.length; - } - } - return { - allNodes: allNodes, - totalRecords: totalRecords, - requestTotalCountMax: requestTotalCountMax, - paged: paged, - query: query - }; -} - -/** - * Main entry point: Create collection of documents and folders in the given space - * - * @method doclist_main - */ -function doclist_main() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - var filter = args.filter, - items = []; - - // Try to find a filter query based on the passed-in arguments - var allNodes = [], - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - favourites = Common.getFavourites(), - filterParams = Filters.getFilterParams(filter, parsedArgs, - { - favourites: favourites - }), - query = filterParams.query, - allSites = (parsedArgs.nodeRef == "alfresco://sites/home"); - - if (logger.isLoggingEnabled()) - logger.log("doclist.lib.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query); - - var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1; - // For all sites documentLibrary query we pull in all available results and post filter - if (totalItemCount === 0) totalItemCount = -1; - else if (allSites) totalItemCount = (totalItemCount > 0 ? totalItemCount * 10 : 500); - - - var allNodesResult = doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount); - allNodes = allNodesResult.allNodes; - totalRecords = allNodesResult.totalRecords; - requestTotalCountMax = allNodesResult.requestTotalCountMax; - paged = allNodesResult.paged; - query = allNodesResult.query; - - - if (logger.isLoggingEnabled()) - logger.log("doclist.lib.js - query results: " + allNodes.length); - // Generate the qname path match regex required for all sites 'documentLibrary' results match - var pathRegex; - if (allSites) - { - // escape the forward slash characters in the qname path - // TODO: replace with java.lang.String regex match for performance - var pathMatch = new String(parsedArgs.rootNode.qnamePath).replace(/\//g, '\\/') + "\\/.*\\/cm:documentLibrary\\/.*"; - pathRegex = new RegExp(pathMatch, "gi"); - if (logger.isLoggingEnabled()) - logger.log("doclist.lib.js - will match results using regex: " + pathMatch); - } - - // Ensure folders and folderlinks appear at the top of the list - var folderNodes = [], - documentNodes = []; - - for each (node in allNodes) - { - if (totalItemCount !== 0) - { - try - { - if (!allSites || node.qnamePath.match(pathRegex)) - { - totalItemCount--; - if (node.isContainer || node.isLinkToContainer) - { - folderNodes.push(node); - } - else - { - documentNodes.push(node); - } - } - } - catch (e) - { - // Possibly an old indexed node - ignore it - } - } else break; - } - - // Node type counts - var folderNodesCount = folderNodes.length, - documentNodesCount = documentNodes.length, - nodes; - - if (parsedArgs.type === "documents") - { - nodes = documentNodes; - totalRecords -= folderNodesCount; - } - else if (parsedArgs.type === "folders") - { - nodes = folderNodes; - totalRecords -= documentNodesCount; - } - else - { - // TODO: Sorting with folders at end -- swap order of concat() - nodes = folderNodes.concat(documentNodes); - } - - if (logger.isLoggingEnabled()) - logger.log("doclist.lib.js - totalRecords: " + totalRecords); - - // Pagination - var pageSize = args.size || nodes.length, - pagePos = args.pos || "1", - startIndex = (pagePos - 1) * pageSize; - - if (!paged) - { - // Trim the nodes array down to the page size - nodes = nodes.slice(startIndex, pagePos * pageSize); - } - - // Common or variable parent container? - var parent = null; - - if (!filterParams.variablePath) - { - // Parent node permissions (and Site role if applicable) - parent = Evaluator.run(parsedArgs.pathNode, true); - } - - var thumbnail = null, - locationNode, - item; - - // Loop through and evaluate each node in this result set - for each (node in nodes) - { - // Get evaluated properties. - item = Evaluator.run(node); - if (item !== null && (filter!=="editingMe" && filter!=="editingOthers" || node.getIsLocked() || item.workingCopy.isWorkingCopy ) ) - { - item.isFavourite = (favourites[item.node.nodeRef] === true || (item.node.properties["smf:actualNodeRef"] && favourites[item.node.properties["smf:actualNodeRef"]] === true)); - item.likes = Common.getLikes(node); - - // Does this collection of nodes have potentially differering paths? - if (filterParams.variablePath || item.isLink) - { - locationNode = item.isLink ? item.linkedNode : item.node; - if (locationNode.isTargetDeleted) - { - // take location of the link node - location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - sitePreset: parsedArgs.location.sitePreset, - container: parsedArgs.location.container, - containerType: parsedArgs.location.containerType, - path: parsedArgs.location.path, - repoPath: parsedArgs.location.repoPath, - file: "" - }; - } - else - { - // Ensure we have Read permissions on the destination on the link object - if (!locationNode.hasPermission("Read")) - { - --totalRecords; - continue; - } - location = Common.getLocation(locationNode, parsedArgs.libraryRoot); - } - // Parent node - if (node.parent != null && node.parent.isContainer && node.parent.hasPermission("Read")) - { - item.parent = Evaluator.run(node.parent, true); - } - } - else - { - location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - sitePreset: parsedArgs.location.sitePreset, - container: parsedArgs.location.container, - containerType: parsedArgs.location.containerType, - path: parsedArgs.location.path, - repoPath: parsedArgs.location.repoPath, - file: node.name - }; - } - - // Resolved location - item.location = location; - - items.push(item); - } - else - { - --totalRecords; - } - } - - // Array Remove - By John Resig (MIT Licensed) - var fnArrayRemove = function fnArrayRemove(array, from, to) - { - var rest = array.slice((to || from) + 1 || array.length); - array.length = from < 0 ? array.length + from : from; - return array.push.apply(array, rest); - }; - - /** - * De-duplicate orignals for any existing working copies. - * This can't be done in evaluator.lib.js as it has no knowledge of the current filter or UI operation. - * Note: This may result in pages containing less than the configured amount of items (50 by default). - */ - for each (item in items) - { - if (item.workingCopy && item.workingCopy.isWorkingCopy) - { - var workingCopySource = String(item.workingCopy.sourceNodeRef); - for (var i = 0, ii = items.length; i < ii; i++) - { - if (String(items[i].node.nodeRef) == workingCopySource) - { - fnArrayRemove(items, i); - --totalRecords; - break; - } - } - } - } - - var paging = - { - totalRecords: totalRecords, - startIndex: startIndex - }; - - if (paged && (totalRecords == requestTotalCountMax)) - { - paging.totalRecordsUpper = requestTotalCountMax; - } - - return ( - { - luceneQuery: query, - paging: paging, - container: parsedArgs.rootNode, - parent: parent, - onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), - itemCount: - { - folders: folderNodesCount, - documents: documentNodesCount - }, - items: items, - customJSON: slingshotDocLib.getJSON() - }); -} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js deleted file mode 100644 index 2da7db7e87..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js +++ /dev/null @@ -1,137 +0,0 @@ - -var Evaluator = -{ - /** - * Node Type evaluator - */ - getNodeType: function Evaluator_getNodeType(node) - { - var nodeType = "document"; - if (node.isContainer) - { - nodeType = "folder"; - } - else if (node.isLinkToContainer) - { - nodeType = "folderlink"; - } - else if (node.isLinkToDocument) - { - nodeType = "filelink"; - } - return nodeType; - }, - - /** - * Node Evaluator - main entrypoint - */ - run: function Evaluator_run(node, isParent) - { - var nodeType = Evaluator.getNodeType(node), - workingCopy = {}, - activeWorkflows = [], - isLink = false, - linkedNode = null; - - if (!isParent) - { - // Get relevant actions set - switch (nodeType) - { - /** - * SPECIFIC TO: LINK - */ - case "folderlink": - case "filelink": - isLink = true; - - linkedNode = node.properties.destination; - if (linkedNode == null) - { - linkedNode = { isTargetDeleted: true }; - } - break; - - /** - * SPECIFIC TO: DOCUMENTS - */ - case "document": - // Working Copy? - if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy")) - { - var wcLink = node.sourceAssocs["cm:workingcopylink"]; - var isWorkingCopy = wcLink != null; - if (isWorkingCopy) - { - var wcNode = wcLink[0]; - workingCopy["isWorkingCopy"] = true; - workingCopy["sourceNodeRef"] = wcNode.nodeRef; - if (wcNode.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")) - { - workingCopy["workingCopyVersion"] = wcNode.properties["cm:versionLabel"]; - } - } - else - { - logger.error("Node: " + node.nodeRef +" hasn't \"cm:workingcopylink\" association"); - } - } - // Locked? - else if (node.isLocked && !node.hasAspect("trx:transferred") && node.hasAspect("{http://www.alfresco.org/model/content/1.0}checkedOut")) - { - var srcNode = node.assocs["cm:workingcopylink"][0]; - workingCopy["hasWorkingCopy"] = true; - workingCopy["workingCopyNodeRef"] = srcNode.nodeRef; - } - } - - // Part of an active workflow? Guard against stale worklow tasks. - try - { - for each (activeWorkflow in node.activeWorkflows) - { - activeWorkflows.push(activeWorkflow.id); - } - } - catch (e) {} - } - - var nodeJSON = appUtils.toJSON(node, true); - var stripLinkedNodeProperties = (args["stripLinkedNodeProperties"] == "true" ? true : false); - - if (isLink && stripLinkedNodeProperties) { - var nodeJsonObj = jsonUtils.toObject(nodeJSON); - var linkedPropsInclude = ["cm:taggable","cm:categories"]; - var linkedNodePropsCompact = {}; - - for each (var linkedProp in linkedPropsInclude) { - var prop = nodeJsonObj.linkedNode.properties[linkedProp]; - if (prop) { - linkedNodePropsCompact[linkedProp] = prop; - } - } - - nodeJsonObj.linkedNode.properties = linkedNodePropsCompact; - nodeJSON = jsonUtils.toJSONString(nodeJsonObj); - } - - if (node !== null) - { - return( - { - node: node, - nodeJSON: nodeJSON, - type: nodeType, - isLink: isLink, - linkedNode: linkedNode, - activeWorkflows: activeWorkflows, - workingCopy: workingCopy, - workingCopyJSON: jsonUtils.toJSONString(workingCopy) - }); - } - else - { - return null; - } - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js deleted file mode 100644 index 8d1c096d50..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js +++ /dev/null @@ -1,287 +0,0 @@ -var Filters = -{ - /** - * Type map to filter required types. - * NOTE: "documents" filter also returns folders to show UI hint about hidden folders. - */ - TYPE_MAP: - { - "documents": '+(TYPE:"content" OR TYPE:"app:filelink" OR TYPE:"folder")', - "folders": '+(TYPE:"folder" OR TYPE:"app:folderlink")', - "images": '+@cm\\:content.mimetype:image/*' - }, - - /** - * Types that we want to suppress from the resultset - */ - IGNORED_TYPES: - [ - "cm:systemfolder", - "fm:forums", - "fm:forum", - "fm:topic", - "fm:post" - ], - - /** - * Aspects ignored from the canned query based resultset - */ - IGNORED_ASPECTS: - [ - "cm:checkedOut" - ], - - /** - * Encode a path with ISO9075 encoding - * - * @method iso9075EncodePath - * @param path {string} Path to be encoded - * @return {string} Encoded path - */ - iso9075EncodePath: function Filter_iso9075EncodePath(path) - { - var parts = path.split("/"); - for (var i = 1, ii = parts.length; i < ii; i++) - { - parts[i] = "cm:" + search.ISO9075Encode(parts[i]); - } - return parts.join("/"); - }, - - /** - * Create filter parameters based on input parameters - * - * @method getFilterParams - * @param filter {string} Required filter - * @param parsedArgs {object} Parsed arguments object literal - * @param optional {object} Optional arguments depending on filter type - * @return {object} Object literal containing parameters to be used in Lucene search - */ - getFilterParams: function Filter_getFilterParams(filter, parsedArgs, optional) - { - var filterParams = - { - query: "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\"", - limitResults: null, - sort: [ - { - column: "@cm:name", - ascending: true - }], - language: "lucene", - templates: null, - variablePath: true, - ignoreTypes: Filters.IGNORED_TYPES, - ignoreAspects: Filters.IGNORED_ASPECTS - }; - - optional = optional || {}; - - // Sorting parameters specified? - var sortAscending = args.sortAsc, - sortField = args.sortField; - - if (sortAscending == "false") - { - filterParams.sort[0].ascending = false; - } - if (sortField !== null) - { - filterParams.sort[0].column = (sortField.indexOf(":") != -1 ? "@" : "") + sortField; - } - - // Max returned results specified? - var argMax = args.max; - if ((argMax !== null) && !isNaN(argMax)) - { - filterParams.limitResults = argMax; - } - - var favourites = optional.favourites; - if (typeof favourites == "undefined") - { - favourites = []; - } - - // Create query based on passed-in arguments - var filterData = String(args.filterData), - filterQuery = ""; - - // Common types and aspects to filter from the UI - known subtypes of cm:content and cm:folder - var filterQueryDefaults = ' -TYPE:"' + Filters.IGNORED_TYPES.join('" -TYPE:"') + '"'; - - switch (String(filter)) - { - case "all": - filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; - filterQuery += " +TYPE:\"cm:content\""; - filterQuery += " -ASPECT:\"cm:checkedOut\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "recentlyAdded": - case "recentlyModified": - case "recentlyCreatedByMe": - case "recentlyModifiedByMe": - var onlySelf = (filter.indexOf("ByMe")) > 0 ? true : false, - dateField = (filter.indexOf("Modified") > 0) ? "modified" : "created", - ownerField = (dateField == "created") ? "creator" : "modifier"; - - // Default to 7 days - can be overridden using "days" argument - var dayCount = 7, - argDays = args.days; - if ((argDays !== null) && !isNaN(argDays)) - { - dayCount = argDays; - } - - // Default limit to 50 documents - can be overridden using "max" argument - if (filterParams.limitResults === null) - { - filterParams.limitResults = 50; - } - - var date = new Date(); - var toQuery = date.getFullYear() + "\\-" + (date.getMonth() + 1) + "\\-" + date.getDate(); - date.setDate(date.getDate() - dayCount); - var fromQuery = date.getFullYear() + "\\-" + (date.getMonth() + 1) + "\\-" + date.getDate(); - - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +@cm\\:" + dateField + ":[" + fromQuery + "T00\\:00\\:00.000 TO " + toQuery + "T23\\:59\\:59.999]"; - if (onlySelf) - { - filterQuery += " +@cm\\:" + ownerField + ":\"" + person.properties.userName + '"'; - } - filterQuery += " +TYPE:\"cm:content\""; - - filterParams.sort = [ - { - column: "@cm:" + dateField, - ascending: false - }]; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "editingMe": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +((+@cm\\:workingCopyOwner:\"" + person.properties.userName + '")'; - filterQuery += " OR (+@cm\\:lockOwner:\"" + person.properties.userName + '"'; - filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))"; - filterParams.query = filterQuery; - break; - - case "editingOthers": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +((+ASPECT:\"workingcopy\""; - filterQuery += " -@cm\\:workingCopyOwner:\"" + person.properties.userName + '")'; - filterQuery += " OR (-@cm\\:lockOwner:\"" + person.properties.userName + '"'; - filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))"; - filterParams.query = filterQuery; - break; - - case "favourites": - for (var favourite in favourites) - { - if (filterQuery) - { - filterQuery += " OR "; - } - filterQuery += "ID:\"" + favourite + "\""; - } - - if (filterQuery.length !== 0) - { - filterQuery = "+(" + filterQuery + ")"; - // no need to specify path here for all sites - IDs are exact matches - if (parsedArgs.nodeRef != "alfresco://sites/home" && parsedArgs.nodeRef != "alfresco://company/home") - { - filterQuery += ' +PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; - } - } - else - { - // empty favourites query - filterQuery = "+ID:\"\""; - } - - filterParams.query = filterQuery; - break; - - case "synced": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +ASPECT:\"sync:syncSetMemberNode\""; - filterParams.query = filterQuery; - break; - - case "syncedErrors": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +ASPECT:\"sync:failed\""; - filterParams.query = filterQuery; - break; - - case "node": - filterParams.variablePath = false; - filterParams.query = "+ID:\"" + parsedArgs.nodeRef + "\""; - break; - - case "tag": - // Remove any trailing "/" character - if (filterData.charAt(filterData.length - 1) == "/") - { - filterData = filterData.slice(0, -1); - } - filterQuery = this.constructPathQuery(parsedArgs); - filterParams.query = filterQuery + " +PATH:\"/cm:taggable/cm:" + search.ISO9075Encode(filterData) + "/member\""; - break; - - case "category": - // Remove any trailing "/" character - if (filterData.charAt(filterData.length - 1) == "/") - { - filterData = filterData.slice(0, -1); - } - filterQuery = this.constructPathQuery(parsedArgs); - filterParams.query = filterQuery + " +PATH:\"/cm:generalclassifiable" + Filters.iso9075EncodePath(filterData) + "/member\""; - break; - - case "aspect": - filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; - filterQuery += "+ASPECT:\"" + args.filterData + "\""; - filterParams.query = filterQuery; - break; - - default: // "path" - filterParams.variablePath = false; - filterQuery = "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - } - - // Specialise by passed-in type - if (filterParams.query !== "") - { - filterParams.query += " " + (Filters.TYPE_MAP[parsedArgs.type] || ""); - } - - return filterParams; - }, - - constructPathQuery: function constructPathQuery(parsedArgs) - { - var pathQuery = ""; - if (parsedArgs.libraryRoot != companyhome || parsedArgs.nodeRef != "alfresco://company/home") - { - if (parsedArgs.nodeRef == "alfresco://sites/home") - { - // all sites query - better with //cm:* - pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"'; - } - else - { - // site specific query - better with //* - pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; - } - } - return pathQuery; - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/item.lib.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/item.lib.ftl deleted file mode 100644 index bb7daf55a7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/item.lib.ftl +++ /dev/null @@ -1,46 +0,0 @@ -<#macro itemJSON item> - <#local node = item.node> - <#local version = "1.0"> - <#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")><#local version = node.properties["cm:versionLabel"]!""> - <#escape x as jsonUtils.encodeJSONString(x)> - "version": "${version}", - "webdavUrl": "${node.webdavUrl}", - <#if item.activeWorkflows?? && (item.activeWorkflows?size > 0)>"activeWorkflows": ${item.activeWorkflows?size?c}, - <#if item.isFavourite??>"isFavourite": ${item.isFavourite?string}, - <#if (item.workingCopyJSON?length > 2)>"workingCopy": <#noescape>${item.workingCopyJSON}, - <#if item.likes??>"likes": - { - "isLiked": ${item.likes.isLiked?string}, - "totalLikes": ${item.likes.totalLikes?c} - }, - "location": - { - "repositoryId": "${(node.properties["trx:repositoryId"])!(server.id)}", - <#if item.location.site??> - "site": - { - "name": "${(item.location.site)!""}", - "title": "${(item.location.siteTitle)!""}", - "preset": "${(item.location.sitePreset)!""}" - }, - - <#if item.location.container??> - "container": - { - "name": "${(item.location.container)!""}", - "type": "${(item.location.containerType)!""}", - "nodeRef": "${(item.location.containerNode.nodeRef)!""}" - }, - - "path": "${(item.location.path)!""}", - "repoPath": "${(item.location.repoPath)!""}", - "file": "${(item.location.file)!""}", - "parent": - { - <#if (item.location.parent.nodeRef)??> - "nodeRef": "${item.location.parent.nodeRef}" - - } - } - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.desc.xml deleted file mode 100644 index 3c570f0cac..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.desc.xml +++ /dev/null @@ -1,23 +0,0 @@ - - Create Folder Paths - - Example: -
-      {  
-         "destination": "workspace://SpacesStore/1234567890",
-         "paths": [
-            "/My folder path/here/x/y/z",
-            "/Another folder path/here/a/b",
-            "/Another folder path/here/a/c"
-         ]
-      }
-      
- ]]>
- /slingshot/doclib2/mkdir - argument - user - required - internal -
\ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.json.ftl deleted file mode 100644 index 66caadd556..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.json.ftl +++ /dev/null @@ -1,7 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRefs": [ - <#list nodeRefs as r>"${r}"<#if r_has_next>, - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.json.js deleted file mode 100644 index 979cdbb05e..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/mkdir.post.json.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Create folder paths under a node, ignoring existing folders and creating as needed - * Emulating the functionality provided by "mkdir -p" unix command. - * - * @param destination (string) - NodeRef destination for the paths i.e. parent node for all paths - * @param paths (Array) - List of path Strings to be created under the given parent node - * @since 5.2 - */ - -function main() -{ - // get params and check destination nodeRef exists - if (json.has("destination")) - { - var destination = json.get("destination"); - } - if (json.has("paths")) - { - var paths = json.get("paths"); - } - if (!destination || !paths) - { - status.setCode(status.STATUS_BAD_REQUEST, "Required parameters are missing"); - return; - } - var destNode = search.findNode(destination); - if (destNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Cannot find specified destination node"); - } - - // process each path and create the folder, store created noderefs - var nodeRefs = []; - - for (var i=0, path; i - node-v2 - Document List v2 Component - node data webscript - /slingshot/doclib2/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/node.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/node.get.js deleted file mode 100644 index f87f650899..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/node.get.js +++ /dev/null @@ -1,76 +0,0 @@ - - - -/** - * Main entry point: Return single document or folder given it's nodeRef - * - * @method getDoclist - */ -function getDoclist() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - parsedArgs.pathNode = ParseArgs.resolveNode(parsedArgs.nodeRef); - parsedArgs.location = Common.getLocation(parsedArgs.pathNode, parsedArgs.libraryRoot); - - var favourites = Common.getFavourites(), - node = parsedArgs.pathNode; - - var thumbnail = null, - item = Evaluator.run(node); - - item.isFavourite = (favourites[node.nodeRef] === true); - item.likes = Common.getLikes(node); - item.location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - sitePreset: parsedArgs.location.sitePreset, - container: parsedArgs.location.container, - containerType: parsedArgs.location.containerType, - path: parsedArgs.location.path, - repoPath: parsedArgs.location.repoPath, - file: node.name - }; - - item.parent = null; - if (node.parent != null && node.parent.isContainer && node.parent.hasPermission("Read")) - { - item.parent = Evaluator.run(node.parent, true); - } - - // Special case for container and libraryRoot nodes - if ((parsedArgs.location.containerNode && String(parsedArgs.location.containerNode.nodeRef) == String(node.nodeRef)) || - (parsedArgs.libraryRoot && String(parsedArgs.libraryRoot.nodeRef) == String(node.nodeRef))) - { - item.location.file = ""; - } - - var returnObject = { - container: parsedArgs.rootNode, - onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), - item: item, - customJSON: slingshotDocLib.getJSON() - }; - - // Additionally include the content if requested by request parameter... - if (args["includeContent"] == "true") - { - returnObject.content = item.node.content - } - if (args["includeThumbnails"] == "true") - { - returnObject.thumbnailDefinitions = item.node.thumbnailDefinitions - } - return (returnObject); -} - -/** - * Document List Component: doclist - */ -model.doclist = getDoclist(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/node.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/node.get.json.ftl deleted file mode 100644 index 7326e90fde..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/node.get.json.ftl +++ /dev/null @@ -1,27 +0,0 @@ -<#import "item.lib.ftl" as itemLib /> -<#assign workingCopyLabel = " " + message("coci_service.working_copy_label")> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "metadata": - { - "repositoryId": "${server.id}", - <#if doclist.parent?? && doclist.parent.nodeJSON??>"parent": <#noescape>${doclist.parent.nodeJSON}, - <#if doclist.customJSON??>"custom": <#noescape>${doclist.customJSON}, - "onlineEditing": ${doclist.onlineEditing?string}, - "workingCopyLabel": "${workingCopyLabel}", - "shareURL": "${site.getShareUrl()}", - "serverURL": "${url.server}" - }, - <#if doclist.content??>"itemContent": "${doclist.content}", - "item": - { - <#if doclist.thumbnailDefinitions??>"thumbnailDefinitions": [<#list doclist.thumbnailDefinitions as thumbnail>"${thumbnail}"<#if thumbnail_has_next>,], - <#if doclist.item??> - <#assign item = doclist.item> - "node": <#noescape>${item.nodeJSON}, - <#if item.parent?? && item.parent.nodeJSON??>"parent": <#noescape>${item.parent.nodeJSON}, - <@itemLib.itemJSON item=item /> - - } -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js deleted file mode 100644 index 8cb9c613c7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js +++ /dev/null @@ -1,421 +0,0 @@ -const THUMBNAIL_NAME = "doclib", - TYPE_SITES = "st:sites", - PREF_DOCUMENT_FAVOURITES = "org.alfresco.share.documents.favourites", - PREF_FOLDER_FAVOURITES = "org.alfresco.share.folders.favourites", - LIKES_SCHEME = "likesRatingScheme"; - -var Common = -{ - /** - * Cache for site objects - */ - SiteCache: {}, - - /** - * Gets / caches a site object - * - * @method getSite - * @param siteId {string} Site ID - */ - getSite: function Common_getSite(siteId) - { - if (typeof Common.SiteCache[siteId] != "object") - { - Common.SiteCache[siteId] = siteService.getSite(siteId); - } - return Common.SiteCache[siteId]; - }, - - /** - * Get the user's favourite docs and folders from our slightly eccentric Preferences Service - * - * @method getFavourites - */ - getFavourites: function Common_getFavourites() - { - var prefs = preferenceService.getPreferences(person.properties.userName, PREF_DOCUMENT_FAVOURITES), - favourites = {}, - arrFavs = [], - strFavs, f, ff; - try - { - /** - * Fasten seatbelts... - * An "eval" could be used here, but the Rhino debugger will complain if throws an exception, which gets old very quickly. - * e.g. var strFavs = eval('try{(prefs.' + PREF_DOCUMENT_FAVOURITES + ')}catch(e){}'); - */ - if (prefs && prefs.org && prefs.org.alfresco && prefs.org.alfresco.share && prefs.org.alfresco.share.documents) - { - strFavs = prefs.org.alfresco.share.documents.favourites; - if (typeof strFavs == "string") - { - arrFavs = strFavs.split(","); - for (f = 0, ff = arrFavs.length; f < ff; f++) - { - favourites[arrFavs[f]] = true; - } - } - } - // Same thing but for folders - prefs = preferenceService.getPreferences(person.properties.userName, PREF_FOLDER_FAVOURITES); - if (prefs && prefs.org && prefs.org.alfresco && prefs.org.alfresco.share && prefs.org.alfresco.share.folders) - { - strFavs = prefs.org.alfresco.share.folders.favourites; - if (typeof strFavs == "string") - { - arrFavs = strFavs.split(","); - for (f = 0, ff = arrFavs.length; f < ff; f++) - { - favourites[arrFavs[f]] = true; - } - } - } - } - catch (e) - { - } - - return favourites; - }, - - /** - * Generates a location object literal for a given node. - * Location is Site-relative unless a libraryRoot node is passed in. - * - * @method getLocation - * @param node {ScriptNode} Node to generate location for - * @param libraryRoot {ScriptNode} Optional node to work out relative location from. - * @param parent {ScriptNode} Optional parent to use instead of assuming primary parent path - * @return {object} Location object literal. - */ - getLocation: function Common_getLocation(node, libraryRoot, parent) - { - try - { - var location = null, - siteId = null, - qnamePaths, - displayPaths; - - if (parent) - { - qnamePaths = (parent.qnamePath + "/_").split("/"); - displayPaths = (parent.displayPath + "/" + parent.name).split("/"); - } - else - { - qnamePaths = node.qnamePath.split("/"), - displayPaths = node.displayPath.split("/"); - } - - if (libraryRoot == undefined && qnamePaths[2] != TYPE_SITES) - { - libraryRoot = companyhome; - } - - if (libraryRoot) - { - // Generate the path from the supplied library root - location = - { - site: null, - container: null, - path: "/" + displayPaths.slice(libraryRoot.displayPath.split("/").length + 1, displayPaths.length).join("/"), - file: node.name - }; - } - else if ((qnamePaths.length > 4) && (qnamePaths[2] == TYPE_SITES)) - { - siteId = displayPaths[3]; - var siteNode = siteService.getSiteInfo(siteId), - containerId = qnamePaths[4].substr(3); - - if (siteNode != null) - { - var containerNode = siteNode.getContainer(containerId); - if (containerNode != null) - { - location = - { - site: siteId, - siteNode: siteNode, - siteTitle: siteNode.title, - sitePreset: siteNode.sitePreset, - container: containerId, - containerNode: containerNode, - containerType: containerNode.typeShort, - path: "/" + displayPaths.slice(5, displayPaths.length).join("/"), - file: node.name - }; - } - } - } - - if (location == null) - { - location = - { - site: siteId, - container: null, - path: "/" + displayPaths.slice(2, displayPaths.length).join("/"), - file: node.name - }; - } - // add repository path to response - location.repoPath = "/" + displayPaths.slice(2, displayPaths.length).join("/"); - - return location; - } - catch(e) - { - return null; - } - }, - - /** - * Returns an object literal representing the current "likes" rating for a node - * - * @method getLikes - * @param node {ScriptNode} Node to query - * @return {object} Likes object literal. - */ - getLikes: function Common_getLikes(node) - { - var isLiked = false, - totalLikes = 0; - - try - { - totalLikes = ratingService.getRatingsCount(node, LIKES_SCHEME); - isLiked = totalLikes === 0 ? false : ratingService.getRating(node, LIKES_SCHEME) !== -1; - } - catch (e) {} - - return ( - { - isLiked: isLiked, - totalLikes: totalLikes - }); - } -}; - -var ParseArgs = -{ - /** - * Get and parse arguments - * - * @method getParsedArgs - * @return {array|null} Array containing the validated input parameters - */ - getParsedArgs: function ParseArgs_getParsedArgs(containerType) - { - var type = url.templateArgs.type, - libraryRoot = args.libraryRoot, - rootNode = null, - pathNode = null, - nodeRef = null, - path = "", - location = null; - - // Is this library rooted from a non-site nodeRef? - if (libraryRoot !== null) - { - libraryRoot = ParseArgs.resolveNode(libraryRoot); - } - - if (url.templateArgs.store_type !== null) - { - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - nodeRef = storeType + "://" + storeId + "/" + id; - rootNode = libraryRoot || ParseArgs.resolveNode(nodeRef); - if (rootNode == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - // Special case: make sure filter picks up correct mode - if (type == null && args.filter == null) - { - args.filter = "node"; - } - } - else - { - /** - * Site and container input - */ - var siteId = url.templateArgs.site, - containerId = url.templateArgs.container, - siteNode = siteService.getSiteInfo(siteId); - - if (siteNode === null) - { - status.setCode(status.STATUS_GONE, "Site not found: '" + siteId + "'"); - return null; - } - - rootNode = siteNode.getContainer(containerId); - if (rootNode === null) - { - rootNode = siteNode.aquireContainer(containerId, containerType || "cm:folder", {"cm:description": "Document Library"}); - if (rootNode === null) - { - status.setCode(status.STATUS_GONE, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - } - } - - // Path input? - path = url.templateArgs.path || ""; - pathNode = path.length > 0 ? rootNode.childByNamePath(path) : (pathNode || rootNode); - if (pathNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Path not found: '" + path + "'"); - return null; - } - - // Parent location parameter adjustment - var parentNode = null; - if (path.length > 0) - { - var p = path.split("/"); - p.pop(); - parentNode = rootNode.childByNamePath(p.join("/")); - } - location = Common.getLocation(pathNode, libraryRoot, parentNode); - if (location === null) - { - status.setCode(status.STATUS_GONE, "Location is 'null'. (No permission?)"); - return null; - } - // ACE-565 fix. Commenting current line causes the incorrect folder navigation into Document Library - if (path !== "") - { - location.path = ParseArgs.combinePaths(location.path, location.file); - } - if (location.repoPath) - { - location.repoPath = ParseArgs.combinePaths(location.repoPath, location.file); - } - if (args.filter !== "node" && !pathNode.isContainer) - { - location.file = ""; - } - - var objRet = - { - rootNode: rootNode, - pathNode: pathNode, - libraryRoot: libraryRoot, - location: location, - path: path, - nodeRef: nodeRef, - type: type - }; - - // Multiple input files in the JSON body? - var files = ParseArgs.getMultipleInputValues("nodeRefs"); - if (typeof files != "string") - { - objRet.files = files; - } - - return objRet; - }, - - /** - * Resolve "virtual" nodeRefs into nodes - * - * @method resolveVirtualNodeRef - * @deprecated for ParseArgs.resolveNode - */ - resolveVirtualNodeRef: function ParseArgs_resolveVirtualNodeRef(nodeRef) - { - if (logger.isLoggingEnabled()) - { - logger.log("WARNING: ParseArgs.resolveVirtualNodeRef is deprecated for ParseArgs.resolveNode"); - } - return ParseArgs.resolveNode(nodeRef); - }, - - /** - * Resolve "virtual" nodeRefs, nodeRefs and xpath expressions into nodes - * - * @method resolveNode - * @param reference {string} "virtual" nodeRef, nodeRef or xpath expressions - * @return {ScriptNode|null} Node corresponding to supplied expression. Returns null if node cannot be resolved. - */ - resolveNode: function ParseArgs_resolveNode(reference) - { - return utils.resolveNodeReference(reference); - }, - - /** - * Get multiple input files - * - * @method getMultipleInputValues - * @param param {string} Property name containing the files array - * @return {array|string} Array containing the files, or string error - */ - getMultipleInputValues: function ParseArgs_getMultipleInputValues(param) - { - var values = [], - error = null; - - try - { - // Was a JSON parameter list supplied? - if (typeof json == "object") - { - if (!json.isNull(param)) - { - var jsonValues = json.get(param); - // Convert from JSONArray to JavaScript array - for (var i = 0, j = jsonValues.length(); i < j; i++) - { - values.push(jsonValues.get(i)); - } - } - } - } - catch(e) - { - error = e.toString(); - } - - // Return the values array, or the error string if it was set - return (error !== null ? error : values); - }, - - /** - * Append multiple parts of a path, ensuring duplicate path separators are removed. - * - * @method combinePaths - * @param path1 {string} First path - * @param path2 {string} Second path - * @param ... - * @param pathN {string} Nth path - * @return {string} A string containing the combined paths - */ - combinePaths: function ParseArgs_combinePaths() - { - var path = "", i, ii; - for (i = 0, ii = arguments.length; i < ii; i++) - { - if (arguments[i] !== null) - { - path += arguments[i] + (arguments[i] !== "/" ? "/" : ""); - } - } - - return path.replace(/\/{2,}/g, "/").replace(/(.)\/$/g, "$1"); - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.ftl deleted file mode 100644 index eaa499cdba..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.ftl +++ /dev/null @@ -1,25 +0,0 @@ -<#macro resultsJSON results> - <#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalResults": ${results?size?c}, - "overallSuccess": ${overallSuccess?string}, - "successCount": ${successCount?c}, - "failureCount": ${failureCount?c}, - "results": - [ - <#list results as r> - { - <#list r?keys as key> - <#assign value = r[key]> - <#if value?is_number || value?is_boolean> - "${key}": ${value?string}<#if key_has_next>, - <#else> - "${key}": "${value}"<#if key_has_next>, - - - }<#if r_has_next>, - - ] -} - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js deleted file mode 100644 index 3689ec58c4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js +++ /dev/null @@ -1,351 +0,0 @@ - - -/** - * Document List Component: action - * - * For a single-asset action, template paramters address the asset. - * For multi-asset actions, template parameters address the source or destination node, - * and a JSON body addresses the assets involved in the action. - * (note: HTTP DELETE methods must use URI) - * - * @param uri {string} site/{siteId}/{containerId} - * @param uri {string} site/{siteId}/{containerId}/{filepath} - * @param uri {string} node/{store_type}/{store_id}/{id} - * @param uri {string} node/{store_type}/{store_id}/{id}/{filepath} - */ - -/** - * Main script entry point - * @method main - */ -function main() -{ - // Params object contains commonly-used arguments - var params = {}, - files, rootNode; - - if (url.templateArgs.store_type != undefined) - { - params = getNodeRefInputParams(); - } - else if (url.templateArgs.site != undefined) - { - params = getSiteInputParams(); - } - if (typeof params == "string") - { - status.setCode(status.STATUS_BAD_REQUEST, params); - return; - } - - // Resolve parent if available - var parent = getInputParam("parentId"); - if (parent !== null) - { - params.parent = parent; - } - - // Resolve path if available - var path = url.templateArgs.path || ""; - // Fix-up parent path to have no leading or trailing slashes - if (path.length > 0) - { - var aPaths = path.split("/"); - while (aPaths[0] === "") - { - aPaths.shift(); - } - while (aPaths[aPaths.length-1] === "") - { - aPaths.pop(); - } - path = aPaths.join("/"); - } - params.path = path; - params.destNode = getAssetNode(params.rootNode, path); - - // Must have destNode by this point - if (typeof params.destNode == "string") - { - status.setCode(status.STATUS_NOT_FOUND, "Not found: " + url.extension); - return; - } - - // Multiple input files in the JSON body? - files = getMultipleInputValues("nodeRefs"); - if (typeof files != "string") - { - params.files = files; - } - - // Check runAction function is provided the action's webscript - if (typeof runAction != "function") - { - status.setCode(status.STATUS_BAD_REQUEST, "Action webscript must provide runAction() function."); - return; - } - - // Actually run the action - var results = runAction(params); - if ((results !== null) && (results !== undefined)) - { - if (typeof results == "string") - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, results); - } - else if (typeof results.status == "object") - { - // Status fields have been manually set - status.redirect = true; - for (var s in results.status) - { - status[s] = results.status[s]; - } - } - else - { - /** - * NOTE: Webscripts run within one transaction only. - * If a single operation fails, the transaction is marked for rollback and all - * previous (successful) operations are also therefore rolled back. - * We therefore need to scan the results for a failed operation and mark the entire - * set of operations as failed. - */ - var overallSuccess = true, - successCount = 0, - failureCount = 0; - for (var i = 0, j = results.length; i < j; i++) - { - overallSuccess = overallSuccess && results[i].success; - results[i].success ? ++successCount : ++failureCount; - } - model.overallSuccess = overallSuccess; - model.successCount = successCount; - model.failureCount = failureCount; - model.results = results; - } - } -} - - -/** - * Get and check existence of mandatory input parameters (Site-based) - * - * @method getSiteInputParams - * @return {object|string} object literal containing parameters value or string error - */ -function getSiteInputParams() -{ - var params = {}, - error = null, - template = url.template; - - try - { - var siteId, containerId, siteNode, rootNode; - - // Try to get the parameters from the URI - siteId = url.templateArgs.site; - containerId = url.templateArgs.container; - - // SiteId - if (template.indexOf("{site}") != -1) - { - if ((siteId === null) || (siteId.length === 0)) - { - return "'site' parameter is missing."; - } - - // Find the site - siteNode = siteService.getSite(siteId); - if (siteNode === null) - { - return "Site '" + siteId + "' not found."; - } - - // ContainerId - if (template.indexOf("{container}") != -1) - { - if ((containerId === null) || (containerId.length === 0)) - { - return "'container' parameter is missing."; - } - - // Find the component container - var rootNode = siteNode.getContainer(containerId); - if (rootNode === null) - { - rootNode = siteNode.aquireContainer(containerId); - if (rootNode === null) - { - return "Component container '" + containerId + "' not found in '" + siteId + "'."; - } - } - } - - // Populate the return object - params = - { - siteId: siteId, - containerId: containerId, - siteNode: siteNode, - rootNode: rootNode - } - } - } - catch(e) - { - error = e.toString(); - } - - // Return the params object, or the error string if it was set - return (error !== null ? error : params); -} - -/** - * Get and check existence of mandatory input parameters (nodeRef-based) - * - * @method getNodeRefInputParams - * @return {object|string} object literal containing parameters value or string error - */ -function getNodeRefInputParams() -{ - var params = {}, - error = null; - - try - { - // First try to get the parameters from the URI - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - var nodeRef = storeType + "://" + storeId + (id == null ? "" : ("/" + id)), - rootNode = ParseArgs.resolveNode(nodeRef); - - if (rootNode === null) - { - return "'" + nodeRef + "' is not a valid nodeRef."; - } - - var rootNodeRef = String(rootNode.nodeRef); - if (rootNodeRef != nodeRef) - { - nodeRef = rootNodeRef; - } - - // Populate the return object - params = - { - nodeRef: nodeRef, - rootNode: rootNode - }; - } - catch(e) - { - error = e.toString(); - } - - // Return the params object, or the error string if it was set - return (error !== null ? error : params); -} - -/** - * Get multiple input values - * - * @method getMultipleInputValues - * @return {array|string} Array containing multiple values, or string error - */ -function getMultipleInputValues(param) -{ - var values = []; - var error = null; - - try - { - // Was a JSON parameter list supplied? - if (typeof json == "object") - { - if (!json.isNull(param)) - { - var jsonValues = json.get(param); - // Convert from JSONArray to JavaScript array - for (var i = 0, j = jsonValues.length(); i < j; i++) - { - values.push(jsonValues.get(i)); - } - } - } - } - catch(e) - { - error = e.toString(); - } - - // Return the values array, or the error string if it was set - return (error !== null ? error : values); -} - -function getInputParam(param) -{ - var value = null; - - try - { - if (typeof json == "object") - { - if (!json.isNull(param)) - { - var value = json.get(param); - } - } - } - catch(e) - { - } - - // Return the values array, or the error string if it was set - return value; -} - - -/** - * Obtain the asset node for the given rootNode and filepath - * - * @method getAssetNode - * @param p_rootNode {object} valid repository node - * @param p_assetPath {string} rootNode-relative path to asset - * @return {object|string} valid repository node or string error - */ -function getAssetNode(p_rootNode, p_assetPath) -{ - var assetNode = p_rootNode, - error = null; - - try - { - // make sure asset path is a string - p_assetPath = String(p_assetPath); - - if (p_assetPath && (p_assetPath.length > 0)) - { - assetNode = assetNode.childByNamePath(p_assetPath); - } - else - { - assetNode = p_rootNode; - } - - if (assetNode === null) - { - return "Asset '" + p_assetPath + " not found."; - } - } - catch(e) - { - error = e.toString(); - } - - // Return the node object, or the error string if it was set - return (error !== null ? error : assetNode); -} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.desc.xml deleted file mode 100644 index 6cf9a0feec..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - add-child - Document List Action - Add multiple files as children - /slingshot/doclib/action/add-child/site/{site}/{container}/{path} - /slingshot/doclib/action/add-child/site/{site}/{container} - /slingshot/doclib/action/add-child/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/add-child/node/{store_type}/{store_id}/{id} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.json.js deleted file mode 100644 index db1f101a2c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/add-child.post.json.js +++ /dev/null @@ -1,70 +0,0 @@ - - -/** - * Add multiple files as children action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - file, fileNode, result, nodeRef; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "addChild", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode === null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - else - { - result.id = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - destNode.addNode(fileNode); - result.success = true; - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.desc.xml deleted file mode 100644 index 1c6d03608b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - aspects - Document List Component - aspects submit - /slingshot/doclib/action/aspects/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.json.js deleted file mode 100644 index e888b62ff1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/aspects.post.json.js +++ /dev/null @@ -1,93 +0,0 @@ - - -/** - * Add / Remove Aspects action - * @method POST - */ - -function jsonToArray(p_name) -{ - var array = []; - - if (json.has(p_name)) - { - var jsonArray = json.get(p_name); - for (var i = 0, ii = jsonArray.length(); i < ii; i++) - { - array.push(jsonArray.get(i)); - } - } - - return array; -} - - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var result, - assetNode = p_params.destNode; - - try - { - result = - { - nodeRef: assetNode.nodeRef.toString(), - action: "manageAspects", - success: false - } - - result.id = assetNode.name; - result.type = assetNode.isContainer ? "folder" : "document"; - - var added = jsonToArray("added"), - removed = jsonToArray("removed"), - isTaggable = false, - i, ii; - - // Aspects to be removed - for (i = 0, ii = removed.length; i < ii; i++) - { - if (assetNode.hasAspect(removed[i])) - { - assetNode.removeAspect(removed[i]); - isTaggable = isTaggable || (removed[i] == "cm:taggable"); - } - } - - // Aspects to be added - for (i = 0, ii = added.length; i < ii; i++) - { - if (!assetNode.hasAspect(added[i])) - { - assetNode.addAspect(added[i]); - isTaggable = isTaggable || (added[i] == "cm:taggable"); - } - } - - // Update the tag scope? This would be nice, but will be quite slow & synchronous. - // We'll send back the flag anyway and the client can fire off a REST API call to do it. - if (isTaggable) - { - // assetNode.tagScope.refresh(); - result.tagScope = true; - } - - result.success = true; - } - catch (e) - { - result.success = false; - } - - return [result]; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.desc.xml deleted file mode 100644 index fdd56e6354..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - cancel-checkout - Document List Action - Cancel check-out for file - /slingshot/doclib/action/cancel-checkout/site/{site}/{container}/{path} - /slingshot/doclib/action/cancel-checkout/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.json.js deleted file mode 100644 index e78f7a740f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/cancel-checkout.post.json.js +++ /dev/null @@ -1,95 +0,0 @@ - - -/** - * Cancel checkout file action - * @method POST - * @param uri {string} /{siteId}/{containerId}/{filepath} - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path - * @return {object|null} object representation of action result - */ -function runAction(p_params) -{ - var results, resultId, resultNodeRef; - - try - { - // Initialise to the destNode (will be updated to the original if a working copy)... - var originalDoc = p_params.destNode; - resultId = originalDoc.name; - resultNodeRef = originalDoc.nodeRef.toString(); - - if (p_params.destNode.hasAspect("cm:workingcopy")) - { - // If the node is a working copy then cancel the checkout and set the original... - var checkedoutNode = p_params.destNode.getCheckedOut(); - if (checkedoutNode === null) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not find original node: " + url.extension); - return; - } - - if (checkedoutNode.hasAspect("cm:cmisCreatedCheckedOut")) - { - var parent = checkedoutNode.parent; - resultId = parent.name; - resultNodeRef = parent.nodeRef.toString(); - } - else - { - resultId = checkedoutNode.name; - resultNodeRef = checkedoutNode.nodeRef.toString(); - } - - originalDoc = p_params.destNode.cancelCheckout(); - if (originalDoc === null) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not cancel checkout: " + url.extension); - return; - } - } - else if (p_params.destNode.isLocked && !p_params.destNode.hasAspect("trx:transferred")) - { - var assocs = p_params.destNode.getAssocs(); - if (assocs["{http://www.alfresco.org/model/content/1.0}workingcopylink"] !==null && assocs["{http://www.alfresco.org/model/content/1.0}workingcopylink"][0]) - { - // original document: edit offline case - originalDoc = assocs["{http://www.alfresco.org/model/content/1.0}workingcopylink"][0].cancelCheckout(); - - resultId = originalDoc.name; - resultNodeRef = originalDoc.nodeRef.toString(); - } - else - { - // original document: edit online case - // ...or, if the node is locked then just unlock it... - p_params.destNode.unlock(); - } - } - - // Construct the result object - results = [ - { - id: resultId, - nodeRef: resultNodeRef, - action: "cancelCheckoutAsset", - success: true - }]; - } - catch(e) - { - e.code = status.STATUS_INTERNAL_SERVER_ERROR; - e.message = e.toString(); - throw e; - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.desc.xml deleted file mode 100644 index 3337af4246..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - checkin - Document List Action - Check-in file - /slingshot/doclib/action/checkin/site/{site}/{container}/{path} - /slingshot/doclib/action/checkin/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.json.js deleted file mode 100644 index 57409a25b6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkin.post.json.js +++ /dev/null @@ -1,53 +0,0 @@ - - -/** - * Checkin file action - * @method POST - * @param uri {string} /{siteId}/{containerId}/{filepath} - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path - * @return {object|null} object representation of action result - */ -function runAction(p_params) -{ - var results; - - try - { - var assetNode = p_params.destNode, - originalDoc = assetNode.checkin(); - if (originalDoc === null) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not checkin: " + p_params.path); - return; - } - - var resultId = originalDoc.name, - resultNodeRef = originalDoc.nodeRef.toString(); - - // Construct the result object - results = [ - { - id: resultId, - nodeRef: resultNodeRef, - action: "checkinAsset", - success: true - }]; - } - catch(e) - { - e.code = status.STATUS_INTERNAL_SERVER_ERROR; - e.message = e.toString(); - throw e; - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.desc.xml deleted file mode 100644 index fca4f3a5ba..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - checkout - Document List Action - Check-out file - /slingshot/doclib/action/checkout/site/{site}/{container}/{path} - /slingshot/doclib/action/checkout/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js deleted file mode 100644 index d3d32f40cc..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/checkout.post.json.js +++ /dev/null @@ -1,66 +0,0 @@ - - -/** - * Checkout file action - * @method POST - * @param uri {string} /{siteId}/{containerId}/{filepath} - * @param json.destination {string} Optional path to checkout to - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path - * @return {object|null} object representation of action result - */ -function runAction(p_params) -{ - var results; - - try - { - var assetNode = p_params.destNode; - - // Ensure the file is versionable (autoVersion = true, autoVersionProps = false) - assetNode.ensureVersioningEnabled(true, false); - - // Checkout the asset - var workingCopy = assetNode.checkout(); - if (workingCopy === null) - { - status.setCode(status.STATUS_FORBIDDEN, "Could not checkout: " + p_params.path); - return; - } - - // Extra property to allow the full series of actions via the Explorer client - utils.disableRules(); - workingCopy.properties["cm:workingCopyMode"] = "offlineEditing"; - workingCopy.save(); - utils.enableRules(); - - var resultId = assetNode.name, - resultNodeRef = workingCopy.nodeRef.toString(); - - // Construct the result object - results = [ - { - id: resultId, - nodeRef: resultNodeRef, - downloadUrl: "api/node/content/" + resultNodeRef.replace(":/", "") + "/" + encodeURIComponent(workingCopy.name) + "?a=true", - action: "checkoutAsset", - success: true - }]; - } - catch(e) - { - e.code = status.STATUS_INTERNAL_SERVER_ERROR; - e.message = e.toString(); - throw e; - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.desc.xml deleted file mode 100644 index 1d487818ff..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - copy-to - Document List Action - Copy multiple files - /slingshot/doclib/action/copy-to/site/{site}/{container}/{path} - /slingshot/doclib/action/copy-to/site/{site}/{container} - /slingshot/doclib/action/copy-to/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/copy-to/node/{store_type}/{store_id}/{id} - /slingshot/doclib/action/copy-to/node/{store_type}/{store_id} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js deleted file mode 100644 index a91cae1f7a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/copy-to.post.json.js +++ /dev/null @@ -1,94 +0,0 @@ - - -/** - * Copy multiple files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - file, fileNode, result, nodeRef, - fromSite, copiedNode; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "copyFile", - success: false - }; - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - else - { - result.type = fileNode.isContainer ? "folder" : "document" - - // Retain the name of the site the node is currently in. Null if it's not in a site. - fromSite = fileNode.siteShortName; - - // copy the node (deep copy for containers) - if (fileNode.isContainer) - { - copiedNode = fileNode.copy(destNode, true); - } - else - { - copiedNode = fileNode.copy(destNode); - } - - result.id = copiedNode.name; - result.nodeRef = copiedNode.nodeRef.toString(); - result.success = (result.nodeRef != null); - - if (result.success) - { - // If this was an inter-site copy, we'll need to clean up the permissions on the node - if ((fromSite) && (String(fromSite) != String(copiedNode.siteShortName))) - { - siteService.cleanSitePermissions(copiedNode); - } - } - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.desc.xml deleted file mode 100644 index 345b3a412a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - file - Document List Action - Delete file - /slingshot/doclib/action/file/site/{site}/{container}/{path} - /slingshot/doclib/action/folder/site/{site}/{container}/{path} - /slingshot/doclib/action/file/node/{store_type}/{store_id}/{id} - /slingshot/doclib/action/folder/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.js deleted file mode 100644 index 8a27c60eb8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.js +++ /dev/null @@ -1,52 +0,0 @@ - - -/** - * Delete file action - * @method DELETE - * @param uri {string} /{siteId}/{containerId}/{filepath} - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path - * @return {object|null} object representation of action result - */ -function runAction(p_params) -{ - var results; - - try - { - var assetNode = p_params.destNode, - resultId = assetNode.name, - resultNodeRef = assetNode.nodeRef.toString(); - - // Delete the asset - if (!assetNode.remove()) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not delete."); - return; - } - - // Construct the result object - results = [ - { - id: resultId, - nodeRef: resultNodeRef, - action: "deleteFile", - success: true - }]; - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/file.delete.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.desc.xml deleted file mode 100644 index f154ddb921..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - files - Document List Action - Delete multiple files - /slingshot/doclib/action/files - /slingshot/doclib/action/folders - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.json.js deleted file mode 100644 index 947d23a8c4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/files.delete.json.js +++ /dev/null @@ -1,94 +0,0 @@ - - -/** - * Delete multiple files action - * @method DELETE - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - files = p_params.files, - linkNodes = [], - nodes = [], - file, nodeRef, node; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - // Loop through nodes, check the existence of each node and create an array of valid ScriptNodes ready for deletion - for (file in files) - { - try - { - nodeRef = files[file]; - node = search.findNode(nodeRef); - - // Check if the node actually exists, before deleting it - // If it doesn't exist mark the deletion of it as failed - if (node === null) - { - results.push( - { - id: file, - nodeRef: nodeRef, - action: "deleteFile", - success: false - } - ); - continue; - } - else if (node.isLinkToDocument || node.isLinkToContainer) - { - linkNodes.push(node); - } - else - { - nodes.push(node); - } - } - catch (e) - { - results.push( - { - id: file, - nodeRef: nodeRef, - action: "deleteFile", - success: false - } - ); - } - } - - nodes = linkNodes.concat(nodes); - - // Loop through ScriptNodes and delete them, one by one - for (var i = 0; i < nodes.length; i++) - { - results.push( - { - id: nodes[i].name, - nodeRef: nodes[i].nodeRef.toString(), - action: "deleteFile", - type: nodes[i].isContainer ? "folder" : "document", - success: nodes[i].remove(true) - } - ); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.desc.xml deleted file mode 100644 index 37fcbc3fd0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - move-to - Document List Action - Move multiple files - /slingshot/doclib/action/move-to/site/{site}/{container}/{path} - /slingshot/doclib/action/move-to/site/{site}/{container} - /slingshot/doclib/action/move-to/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/move-to/node/{store_type}/{store_id}/{id} - /slingshot/doclib/action/move-to/node/{store_type}/{store_id} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js deleted file mode 100644 index 0e824c8449..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/move-to.post.json.js +++ /dev/null @@ -1,98 +0,0 @@ - - -/** - * Move multiple files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - parent = null, - file, fileNode, result, nodeRef, - fromSite; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "moveFile", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - else - { - if (p_params.parent && p_params.parent != null) - { - parent = search.findNode(p_params.parent); - } - result.id = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - - // Retain the name of the site the node is currently in. Null if it's not in a site. - fromSite = fileNode.siteShortName; - - // move the node - result.success = fileNode.move(parent, destNode); - - if (result.success) - { - // If this was an inter-site move, we'll need to clean up the permissions on the node - if ((fromSite) && (String(fromSite) !== String(fileNode.siteShortName))) - { - siteService.cleanSitePermissions(fileNode); - } - } - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - - //MNT-7514 Uninformational error message on move when file name conflicts - result.fileExist = false; - - error = e.toString(); - if (error.indexOf("FileExistsException") != -1) - { - result.fileExist = true; - } - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.desc.xml deleted file mode 100644 index 8d6178a712..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - permissions - Document List Action - set permissions - /slingshot/doclib/action/permissions/{operation}/site/{site} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.json.js deleted file mode 100644 index 43077f1ab8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/permissions.post.json.js +++ /dev/null @@ -1,121 +0,0 @@ - - -const VALID_OPERATIONS = -{ - "set": true, - "reset-all": true -}; - -/** - * Set Permissions on single/multiple files - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - files = p_params.files, - i, j, file, fileNode, nodeRef; - - // Must have array of files - if (!files || (files.length == 0)) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - // Which permissions operation? - var operation = url.templateArgs.operation; - if (!operation || !(operation in VALID_OPERATIONS)) - { - status.setCode(status.STATUS_BAD_REQUEST, "Invalid or missing operation ('" + operation + "')."); - return; - } - - // Permissions to set - var jsonPermissions = getMultipleInputValues("permissions"); - - // We need the site node to perform some of the operations - var site = p_params.siteNode; - - // Set permissions on each file - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: operation, - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode === null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - else - { - result.id = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - - // Execute the operation - switch (operation) - { - case "set": - if (typeof jsonPermissions == "string") - { - status.setCode(status.STATUS_BAD_REQUEST, "Invalid or missing permissions set."); - return; - } - // Convert permissions from JSONArray - var permissions = []; - for (var i = 0, j = jsonPermissions.length; i < j; i++) - { - permissions[jsonPermissions[i].get("group")] = String(jsonPermissions[i].get("role")); - - // It is not allowed for a user to increase access for "All Other Users" on a non-public site. - // This is because the site cannot be accessed until the user has been invited to join the site - if (jsonPermissions[i].get("group") == "GROUP_EVERYONE" && !site.isPublic) - { - result.success = false; - status.setCode(status.STATUS_BAD_REQUEST, "Cannot give permissions to all other users on non-public site"); - return; - } - } - site.setPermissions(fileNode, permissions); - break; - - case "reset-all": - site.resetAllPermissions(fileNode); - break; - } - result.success = true; - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml deleted file mode 100644 index 0104d5f375..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - cancel-checkout - Document List Action - Unlock document - /slingshot/doclib/action/unlock-document/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js deleted file mode 100644 index c5e909d740..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js +++ /dev/null @@ -1,51 +0,0 @@ - - -/** - * Cancel checkout file action - * @method POST - * @param uri {string} /{siteId}/{containerId}/{filepath} - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path - * @return {object|null} object representation of action result - */ -function runAction(p_params) -{ - var results; - - try - { - var originalDoc = p_params.destNode; - if (p_params.destNode.hasAspect("cm:lockable") && !p_params.destNode.hasAspect("trx:transferred")) - { - p_params.destNode.unlock(); - } - - var resultId = originalDoc.name, - resultNodeRef = originalDoc.nodeRef.toString(); - - // Construct the result object - results = [ - { - id: resultId, - nodeRef: resultNodeRef, - action: "unlockDocumentAsset", - success: true - }]; - } - catch(e) - { - e.code = status.STATUS_INTERNAL_SERVER_ERROR; - e.message = e.toString(); - throw e; - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.desc.xml deleted file mode 100644 index 1a14f67c3a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.desc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - unzip-to - Document List Action - Unzip - /slingshot/doclib/action/unzip-to/site/{site}/{container}/{path} - /slingshot/doclib/action/unzip-to/site/{site}/{container} - /slingshot/doclib/action/unzip-to/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/action/unzip-to/node/{store_type}/{store_id}/{id} - /slingshot/doclib/action/unzip-to/node/{store_type}/{store_id} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.json.ftl deleted file mode 100644 index e2f0e9da9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.json.ftl +++ /dev/null @@ -1,2 +0,0 @@ -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.json.js deleted file mode 100644 index ca0a33a309..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unzip-to.post.json.js +++ /dev/null @@ -1,92 +0,0 @@ - - -/** - * Unzip files action - * @method POST - */ - -/** - * Entrypoint required by action.lib.js - * - * @method runAction - * @param p_params {object} Object literal containing files array - * @return {object|null} object representation of action results - */ -function runAction(p_params) -{ - var results = [], - destNode = p_params.destNode, - files = p_params.files, - parent = null, - file, fileNode, result, nodeRef, - fromSite; - - // Must have array of files - if (!files || files.length == 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "No files."); - return; - } - - for (file in files) - { - nodeRef = files[file]; - result = - { - nodeRef: nodeRef, - action: "unzipFile", - success: false - } - - try - { - fileNode = search.findNode(nodeRef); - if (fileNode == null) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - } - else - { - if (p_params.parent && p_params.parent != null) - { - parent = search.findNode(p_params.parent); - } - result.id = fileNode.name; - result.type = fileNode.isContainer ? "folder" : "document"; - - // Retain the name of the site the node is currently in. Null if it's not in a site. - fromSite = fileNode.siteShortName; - - // unzip the node - var unzipAction = actions.create("import"); - unzipAction.parameters.destination = destNode; - unzipAction.execute(fileNode); - result.success = true; - } - } - catch (e) - { - result.id = file; - result.nodeRef = nodeRef; - result.success = false; - - //MNT-7514 Uninformational error message on move when file name conflicts - result.fileExist = false; - - error = e.toString(); - if (error.indexOf("FileExistsException") != -1) - { - result.fileExist = true; - } - } - - results.push(result); - } - - return results; -} - -/* Bootstrap action script */ -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.desc.xml deleted file mode 100644 index 11f770fc20..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - activity - Document List Component - activity data webscript - /slingshot/doclib/activity - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.ftl deleted file mode 100644 index e37684e04d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.ftl +++ /dev/null @@ -1,3 +0,0 @@ -{ - "success": true -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.js deleted file mode 100644 index e2b6b87d00..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/activity.post.json.js +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Document List Component: activity - */ -var _regexNodeRef = new RegExp(/^[^\:^ ]+\:\/\/[^\:^ ]+\/[^ ]+$/); - -postActivity(); - -function isNodeRef(value) -{ - var result = false; - try - { - result = _regexNodeRef.test(String(value)); - } - catch (e) - { - } - return result; -} - -/* Posts to the activities service after a Document Library action */ -function postActivity() -{ - var data = {}; - - /* - * Activity Type - */ - var type = json.get("type"); - if (type == null || type.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Activity 'type' parameter missing when posting activity"); - return; - } - - /* - * Site - */ - var siteId = json.get("site"); - if (siteId == null || siteId.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "'site' parameter missing when posting activity"); - return; - } - var site = siteService.getSite(siteId); - if (site == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "'" + siteId + "' is not a valid site"); - return; - } - - /* - * Check for known nodeRef values - */ - var nodeRef = null, - parentNodeRef = null; - - if (json.has("nodeRef")) - { - nodeRef = json.get("nodeRef"); - if (!isNodeRef(nodeRef)) - { - status.setCode(status.STATUS_BAD_REQUEST, "'" + nodeRef + "' is not a valid NodeRef"); - return; - } - } - if (json.has("parentNodeRef")) - { - parentNodeRef = json.get("parentNodeRef"); - if (!isNodeRef(parentNodeRef)) - { - status.setCode(status.STATUS_BAD_REQUEST, "'" + parentNodeRef + "' is not a valid parent NodeRef"); - return; - } - } - - var strParams = ""; - - switch (String(type).toLowerCase()) - { - case "file-created": - case "file-added": - case "file-updated": - case "file-liked": - case "file-previewed": - case "file-downloaded": - case "folder-liked": - case "inline-edit": - data.title = json.get("fileName"); - data.nodeRef = nodeRef; - strParams = "?nodeRef=" + nodeRef; - break; - - case "files-added": - case "files-deleted": - case "files-updated": - case "folders-deleted": - data.title = json.get("fileCount"); - strParams = "?path=" + json.get("path"); - if (parentNodeRef != null) - { - data.parentNodeRef = parentNodeRef; - } - break; - - case "file-deleted": - case "folder-added": - case "folder-deleted": - data.title = json.get("fileName"); - data.nodeRef = nodeRef; - strParams = "?path=" + json.get("path"); - if (parentNodeRef != null) - { - data.parentNodeRef = parentNodeRef; - } - break; - - default: - status.setCode(status.STATUS_BAD_REQUEST, "'" + type + "' is not a valid activity type"); - return; - } - - try - { - // Log to activity service - data.page = json.get("page") + strParams; - activities.postActivity("org.alfresco.documentlibrary." + type, siteId, "documentlibrary", jsonUtils.toJSONString(data)); - } - catch(e) - { - if (logger.isLoggingEnabled()) - { - logger.log(e); - } - } - -} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.desc.xml deleted file mode 100644 index 998402f0b8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - aspects - Document List Component - aspects query - /slingshot/doclib/aspects/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.js deleted file mode 100644 index e0a80f4b95..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.js +++ /dev/null @@ -1,30 +0,0 @@ -function main() -{ - // nodeRef input - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id; - - var node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - var current = [], - currentSet = node.aspectsSet.toArray(); - - for (index in currentSet) - { - current.push(currentSet[index].toString()); - } - - return ( - { - current: current - }); -} - -model.aspects = main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.json.ftl deleted file mode 100644 index 7727922c56..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/aspects.get.json.ftl +++ /dev/null @@ -1,5 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "current": [<#list aspects.current as a>"${shortQName(a)}"<#if a_has_next>,] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.desc.xml deleted file mode 100644 index 2bd6b47e79..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - category node - Document List Component - category node data webscript - /slingshot/doclib/categorynode/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/categorynode/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.html.ftl deleted file mode 100644 index b8bb640289..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.html.ftl +++ /dev/null @@ -1 +0,0 @@ -<#include "categorynode.get.json.ftl"> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.js deleted file mode 100644 index 30a5b4eca9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Document List Component: category node - */ -model.categorynode = getCategoryNode(); - -/* Create collection of categories for the given path */ -function getCategoryNode() -{ - try - { - var items = new Array(), - hasSubfolders = true, - evalChildFolders = args["children"] !== "false"; - - var catAspect = (args["aspect"] != null) ? args["aspect"] : "cm:generalclassifiable", - nodeRef = url.templateArgs.store_type + "://" + url.templateArgs.store_id + "/" + url.templateArgs.id, - path = url.templateArgs.path, - categoryResults; - - if (path == null) - { - categoryResults = classification.getRootCategories(catAspect); - } - else - { - var queryPath = "/" + catAspect + "/" + encodePath(path); - categoryResults = search.luceneSearch("+PATH:\"" + queryPath + "/*\" -PATH:\"" + queryPath + "/member\""); - } - - // make each result an object and indicate it is selectable in the UI - for each (item in categoryResults) - { - if (evalChildFolders) - { - hasSubfolders = item.children.length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders - }); - } - - items.sort(sortByName); - - return ( - { - items: items - }); - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } -} - -/* Get the path as an ISO9075 encoded path */ -function encodePath(path) -{ - var parts = path.split("/"); - for (var i = 0, ii = parts.length; i < ii; i++) - { - parts[i] = "cm:" + search.ISO9075Encode(parts[i]); - } - return parts.join("/"); -} - -/* Sort the results by case-insensitive name */ -function sortByName(a, b) -{ - return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.json.ftl deleted file mode 100644 index 6a802d4d9b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/categorynode.get.json.ftl +++ /dev/null @@ -1,23 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalResults": ${categorynode.items?size?c}, - "items": - [ - <#list categorynode.items as item> - <#assign c = item.node> - { - "nodeRef": "${c.nodeRef}", - "name": "${c.name}", - "description": "${(c.properties.description!"")}", - "hasChildren": ${item.hasSubfolders?string}, - "userAccess": - { - "create": ${c.hasPermission("CreateChildren")?string}, - "edit": ${c.hasPermission("Write")?string}, - "delete": ${c.hasPermission("Delete")?string} - } - }<#if item_has_next>, - - ] -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.desc.xml deleted file mode 100644 index 12a540235b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - container - Document List Component - container query - /slingshot/doclib/container/{site}/{container} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.js deleted file mode 100644 index 2834ad9b29..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.js +++ /dev/null @@ -1,36 +0,0 @@ -function main() -{ - // site, component container input - var siteId = url.templateArgs.site, - containerId = url.templateArgs.container, - containerType = args.type; - - siteNode = siteService.getSite(siteId); - if (siteNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Site not found: '" + siteId + "'"); - return null; - } - - containerNode = siteNode.getContainer(containerId); - if (containerNode === null) - { - if (containerType != null && containerType != "") - { - containerNode = siteNode.createContainer(containerId, containerType); - } - else - { - containerNode = siteNode.createContainer(containerId); - } - if (containerNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - } - - model.container = containerNode; -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.json.ftl deleted file mode 100644 index 478ea41211..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/container.get.json.ftl +++ /dev/null @@ -1,9 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "container": - { - "nodeRef": "${container.nodeRef}", - "type": "${container.typeShort}" - } -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.desc.xml deleted file mode 100644 index 6fa87c4e4f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - containers - Document List Component - Site Containers query - /slingshot/doclib/containers/{site} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.js deleted file mode 100644 index bc77ca2cd9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * TODO: This webscript should get all the site's containers and return the Document Library ones. - * Unfortunately, there's no way to distinguish them, so we can only return the one called "documentLibrary". - */ -function main() -{ - // site input - var siteId = url.templateArgs.site; - - siteNode = siteService.getSite(siteId); - if (siteNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Site not found: '" + siteId + "'"); - return null; - } - - var containerId = "documentLibrary", - containerNode = siteNode.getContainer(containerId); - if (containerNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - - model.containers = [containerNode]; -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.json.ftl deleted file mode 100644 index 10e2278bc4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/containers.get.json.ftl +++ /dev/null @@ -1,15 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "containers": - [ - <#list containers as container> - { - "name": "${container.name}", - "description": "${container.properties.description!"Document Library"}", - "nodeRef": "${container.nodeRef}", - "type": "${container.typeShort}" - }<#if container_has_next>, - - ] -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.desc.xml deleted file mode 100644 index 443e28baae..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - doclist - Document List Component - doclist data webscript - /slingshot/doclib/doclist/{type}/site/{site}/{container}/{path} - /slingshot/doclib/doclist/{type}/site/{site}/{container} - /slingshot/doclib/doclist/{type}/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/doclist/{type}/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.html.ftl deleted file mode 100644 index b01870225f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.html.ftl +++ /dev/null @@ -1,2 +0,0 @@ -

${doclist.luceneQuery}

-<#include "doclist.get.json.ftl"> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.js deleted file mode 100644 index d7269dd3dc..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.js +++ /dev/null @@ -1,308 +0,0 @@ - - - - -const REQUEST_MAX = 1000; -const SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; - -/** - * Main entry point: Create collection of documents and folders in the given space - * - * @method getDoclist - */ -function getDoclist() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - var filter = args.filter, - items = []; - - // Try to find a filter query based on the passed-in arguments - var allNodes = [], - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - favourites = Common.getFavourites(), - filterParams = Filters.getFilterParams(filter, parsedArgs, - { - favourites: favourites - }), - query = filterParams.query, - allSites = (parsedArgs.nodeRef == "alfresco://sites/home"); - - if (logger.isLoggingEnabled()) - logger.log("doclist.get.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query); - - var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1; - // For all sites documentLibrary query we pull in all available results and post filter - if (totalItemCount === 0) totalItemCount = -1; - else if (allSites) totalItemCount = (totalItemCount > 0 ? totalItemCount * 10 : 500); - - if ((filter || "path") == "path") - { - // TODO also add DB filter by "node" (in addition to "path") - var parentNode = parsedArgs.pathNode; - if (parentNode !== null) - { - var ignoreTypes = Filters.IGNORED_TYPES; - skip = -1, - max = -1; - - if (args.size != null) - { - max = args.size; - - if (args.pos > 0) - { - skip = (args.pos - 1) * max; - } - } - - var sortField = (args.sortField == null ? "cm:name" : args.sortField), - sortAsc = (((args.sortAsc == null) || (args.sortAsc == "true")) ? true : false); - - // Get paged set - requestTotalCountMax = skip + REQUEST_MAX; - var pagedResult = parentNode.childFileFolders(true, true, ignoreTypes, skip, max, requestTotalCountMax, sortField, sortAsc, "TODO"); - - allNodes = pagedResult.page; - totalRecords = pagedResult.totalResultCountUpper; - paged = true; - } - } - else - { - // Query the nodes - passing in sort and result limit parameters - if (query !== "") - { - allNodes = search.query( - { - query: query, - language: filterParams.language, - page: - { - maxItems: totalItemCount - }, - sort: filterParams.sort, - templates: filterParams.templates, - namespace: (filterParams.namespace ? filterParams.namespace : null) - }); - - totalRecords = allNodes.length; - } - } - if (logger.isLoggingEnabled()) - logger.log("doclist.get.js - query results: " + allNodes.length); - - // TODO: replace with java.lang.String regex match for performance - var pathMatch; - if (allSites) - { - // Generate a qname path match regex required for all sites 'documentLibrary' results match - pathMatch = new String(parsedArgs.rootNode.qnamePath).replace(/\//g, '\\/') + "\\/.*\\/cm:documentLibrary\\/.*"; - if (logger.isLoggingEnabled()) - logger.log("doclist.get.js - will match results using regex: " + pathMatch); - } - else if (query) - { - // Generate a qname path match regex required for queries where entire repo has been searched - but don't want results - // from sites which are not documents - i.e. filter wiki, blog etc. from results - pathMatch = new String(SITES_SPACE_QNAME_PATH).replace(/\//g, '\\/') + ".*\\/cm:documentLibrary\\/.*"; - } - var pathRegex = new RegExp(pathMatch, "gi"); - - // Ensure folders and folderlinks appear at the top of the list - var folderNodes = [], - documentNodes = [], - qnamepath; - - for each (node in allNodes) - { - if (totalItemCount !== 0) - { - try - { - var qnamePath = node.qnamePath; - if (!query || (allSites && qnamePath.match(pathRegex)) || qnamePath.indexOf(SITES_SPACE_QNAME_PATH) !== 0 || qnamePath.match(pathRegex)) - { - totalItemCount--; - if (node.isContainer || node.isLinkToContainer) - { - folderNodes.push(node); - } - else - { - documentNodes.push(node); - } - } - } - catch (e) - { - // Possibly an old indexed node - ignore it - } - } else break; - } - - // Node type counts - var folderNodesCount = folderNodes.length, - documentNodesCount = documentNodes.length, - nodes; - - if (parsedArgs.type === "documents") - { - nodes = documentNodes; - totalRecords -= folderNodesCount; - } - else - { - // TODO: Sorting with folders at end -- swap order of concat() - nodes = folderNodes.concat(documentNodes); - } - - if (logger.isLoggingEnabled()) - logger.log("doclist.get.js - totalRecords: " + totalRecords); - - // Pagination - var pageSize = args.size || nodes.length, - pagePos = args.pos || "1", - startIndex = (pagePos - 1) * pageSize; - - if (!paged) - { - // Trim the nodes array down to the page size - nodes = nodes.slice(startIndex, pagePos * pageSize); - } - - // Common or variable parent container? - var parent = null; - - if (!filterParams.variablePath) - { - // Parent node permissions (and Site role if applicable) - parent = - { - node: parsedArgs.pathNode, - userAccess: Evaluator.run(parsedArgs.pathNode, true).actionPermissions - }; - } - - var thumbnail = null, - locationNode, - item; - - // Loop through and evaluate each node in this result set - for each (node in nodes) - { - // Get evaluated properties. - item = Evaluator.run(node); - if (item !== null) - { - item.isFavourite = (favourites[item.node.nodeRef] === true || (item.node.properties["smf:actualNodeRef"] && favourites[item.node.properties["smf:actualNodeRef"]] === true)); - item.likes = Common.getLikes(node); - - // Does this collection of nodes have potentially differering paths? - if (filterParams.variablePath || item.isLink) - { - locationNode = item.isLink ? item.linkedNode : item.node; - // Ensure we have Read permissions on the destination on the link object - if (!locationNode.hasPermission("Read")) - { - --totalRecords; - continue; - } - location = Common.getLocation(locationNode, parsedArgs.libraryRoot); - } - else - { - location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - container: parsedArgs.location.container, - path: parsedArgs.location.path, - file: node.name - }; - } - location.parent = {}; - if (node.parent != null && node.parent.isContainer && node.parent.hasPermission("Read")) - { - location.parent.nodeRef = String(node.parent.nodeRef.toString()); - } - - // Resolved location - item.location = location; - - items.push(item); - } - else - { - --totalRecords; - } - } - - // Array Remove - By John Resig (MIT Licensed) - var fnArrayRemove = function fnArrayRemove(array, from, to) - { - var rest = array.slice((to || from) + 1 || array.length); - array.length = from < 0 ? array.length + from : from; - return array.push.apply(array, rest); - }; - - /** - * De-duplicate orignals for any existing working copies. - * This can't be done in evaluator.lib.js as it has no knowledge of the current filter or UI operation. - * Note: This may result in pages containing less than the configured amount of items (50 by default). - */ - for each (item in items) - { - if (item.customObj && item.customObj.isWorkingCopy) - { - var workingCopyOriginal = String(item.customObj.workingCopyOriginal); - for (var i = 0, ii = items.length; i < ii; i++) - { - if (String(items[i].node.nodeRef) == workingCopyOriginal) - { - fnArrayRemove(items, i); - --totalRecords; - break; - } - } - } - } - - var paging = - { - totalRecords: totalRecords, - startIndex: startIndex - }; - - if (paged && (totalRecords == requestTotalCountMax)) - { - paging.totalRecordsUpper = requestTotalCountMax; - } - - return ( - { - luceneQuery: query, - paging: paging, - container: parsedArgs.rootNode, - parent: parent, - onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), - itemCount: - { - folders: folderNodesCount, - documents: documentNodesCount - }, - items: items - }); -} - -/** - * Document List Component: doclist - */ -model.doclist = getDoclist(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.json.ftl deleted file mode 100644 index 101de008c3..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.json.ftl +++ /dev/null @@ -1,47 +0,0 @@ -<#import "item.lib.ftl" as itemLib /> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${doclist.paging.totalRecords?c}, - <#if doclist.paging.totalRecordsUpper??> - "totalRecordsUpper": ${doclist.paging.totalRecordsUpper?c}, - - "startIndex": ${doclist.paging.startIndex?c}, - "metadata": - { - "repositoryId": "${server.id}", - <#if doclist.container??>"container": "${doclist.container.nodeRef}", - "parent": - { - <#if doclist.parent??> - <#assign parentNode = doclist.parent.node> - "nodeRef": "${parentNode.nodeRef}", - "permissions": - { - "userAccess": - { - <#list doclist.parent.userAccess?keys as perm> - <#if doclist.parent.userAccess[perm]?is_boolean> - "${perm?string}": ${doclist.parent.userAccess[perm]?string}<#if perm_has_next>, - - - } - } - - }, - "onlineEditing": ${doclist.onlineEditing?string}, - "itemCounts": - { - "folders": ${(doclist.itemCount.folders!0)?c}, - "documents": ${(doclist.itemCount.documents!0)?c} - } - }, - "items": - [ - <#list doclist.items as item> - { - <@itemLib.itemJSON item=item /> - }<#if item_has_next>, - - ] -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/evaluator.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/evaluator.lib.js deleted file mode 100644 index 2721aa1c28..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/evaluator.lib.js +++ /dev/null @@ -1,258 +0,0 @@ - -var Evaluator = -{ - /** - * Node Type evaluator - */ - getNodeType: function Evaluator_getNodeType(node) - { - var nodeType = ""; - if (node.isContainer) - { - nodeType = "folder"; - } - else if (node.typeShort == "app:folderlink") - { - nodeType = "folderlink"; - } - else if (node.typeShort == "app:filelink") - { - nodeType = "filelink"; - } - else - { - nodeType = "document"; - } - return nodeType; - }, - - /** - * Parent container evaluators - */ - parentContainer: function Evaluator_parentContainer(node, permissions) - { - }, - - /** - * Document and Folder common evaluators - */ - documentAndFolder: function Evaluator_documentAndFolder(node, permissions, status, actionLabels) - { - /* Simple Workflow */ - if (node.hasAspect("app:simpleworkflow")) - { - status["simple-workflow"] = true; - if (node.properties["app:approveStep"] != null) - { - permissions["simple-approve"] = true; - actionLabels["onActionSimpleApprove"] = node.properties["app:approveStep"]; - } - if (node.properties["app:rejectStep"] != null) - { - permissions["simple-reject"] = true; - actionLabels["onActionSimpleReject"] = node.properties["app:rejectStep"]; - } - } - }, - - /** - * Node Evaluator - main entrypoint - */ - run: function Evaluator_run(node, isParent) - { - var nodeType = Evaluator.getNodeType(node), - actions = {}, - actionSet = "empty", - permissions = {}, - status = {}, - custom = {}, - actionLabels = {}, - activeWorkflows = [], - createdBy = Common.getPerson(node.properties["cm:creator"]), - modifiedBy = Common.getPerson(node.properties["cm:modifier"]), - isLink = false, - linkedNode = null, - lockedBy = null, - lockOwnerUser = ""; - - /** - * COMMON TO ALL - */ - permissions = - { - "create": node.hasPermission("CreateChildren"), - "edit": node.hasPermission("Write"), - "delete": node.hasPermission("Delete"), - "permissions": node.hasPermission("ChangePermissions"), - "cancel-checkout": node.hasPermission("CancelCheckOut") - }; - - // When evaluating parent container - if (isParent) - { - Evaluator.parentContainer(node, permissions); - } - - // Get relevant actions set - switch (nodeType) - { - /** - * SPECIFIC TO: LINK - */ - case "folderlink": - case "filelink": - actionSet = "link"; - isLink = true; - - /** - * NOTE: After this point, the "node" object will be changed to a link's destination node - * if the original node was a filelink type. - */ - linkedNode = node.properties.destination; - if (linkedNode == null) - { - return null; - } - // Re-evaluate the nodeType based on the link's destination node - nodeType = Evaluator.getNodeType(linkedNode); - break; - - /** - * SPECIFIC TO: FOLDER - */ - case "folder": - actionSet = "folder"; - - /* Document Folder common evaluator */ - Evaluator.documentAndFolder(node, permissions, status, actionLabels); - - /* Rules applied? */ - if (node.hasAspect("rule:rules")) - { - status["rules"] = true; - } - - /* Transferred Nodes */ - if (node.hasAspect("trx:transferred")) - { - status["transferred-node"] = true; - permissions["view-source-repository"] = true; - actionSet = "transferredFolder"; - } - break; - - /** - * SPECIFIC TO: DOCUMENTS - */ - case "document": - actionSet = "document"; - - /* Document Folder common evaluator */ - Evaluator.documentAndFolder(node, permissions, status, actionLabels); - - // Working Copy? - if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy")) - { - var wcStatus = ""; - lockedBy = Common.getPerson(node.properties["cm:workingCopyOwner"]); - lockOwnerUser = lockedBy.userName; - if (lockOwnerUser == person.properties.userName) - { - wcStatus = "editing"; - actionSet = "workingCopyOwner"; - } - else - { - wcStatus = "locked " + lockedBy.displayName + "|" + lockedBy.userName; - actionSet = "locked"; - } - var wcNode = node.assocs["cm:original"][0]; - custom["isWorkingCopy"] = true; - custom["workingCopyOriginal"] = wcNode.nodeRef; - if (wcNode.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")) - { - custom["workingCopyVersion"] = wcNode.properties["cm:versionLabel"]; - } - permissions["view-original"] = true; - - status[wcStatus] = true; - } - // Locked? - else if (node.isLocked && !node.hasAspect("trx:transferred")) - { - var lockStatus = ""; - lockedBy = Common.getPerson(node.properties["{http://www.alfresco.org/model/content/1.0}lockOwner"]); - lockOwnerUser = lockedBy.userName; - if (lockOwnerUser == person.properties.userName) - { - lockStatus = "lock-owner"; - actionSet = "lockOwner"; - } - else - { - lockStatus = "locked " + lockedBy.displayName + "|" + lockedBy.userName; - actionSet = "locked"; - } - if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}checkedOut")) - { - var srcNode = node.assocs["cm:workingcopylink"][0]; - custom["hasWorkingCopy"] = true; - custom["workingCopyNode"] = srcNode.nodeRef; - permissions["view-working-copy"] = true; - } - status[lockStatus] = true; - } - - // Inline editable aspect? - if (node.hasAspect("app:inlineeditable")) - { - permissions["inline-edit"] = true; - } - - /* Transferred Nodes */ - if (node.hasAspect("trx:transferred")) - { - status["transferred-node"] = true; - permissions["view-source-repository"] = true; - actionSet = "transferredDocument"; - } - break; - } - - if (node !== null) - { - // Part of an active workflow? Guard against stale worklow tasks. - try - { - for each (activeWorkflow in node.activeWorkflows) - { - activeWorkflows.push(activeWorkflow.id); - } - } - catch (e) {} - - return( - { - node: node, - type: nodeType, - isLink: isLink, - linkedNode: linkedNode, - status: status, - actionSet: actionSet, - actionPermissions: permissions, - createdBy: createdBy, - modifiedBy: modifiedBy, - lockedBy: lockedBy, - tags: node.tags, - activeWorkflows: activeWorkflows, - custom: jsonUtils.toJSONString(custom), - customObj: custom, - actionLabels: actionLabels - }); - } - else - { - return null; - } - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js deleted file mode 100644 index feb46270f6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js +++ /dev/null @@ -1,270 +0,0 @@ -var Filters = -{ - /** - * Type map to filter required types. - * NOTE: "documents" filter also returns folders to show UI hint about hidden folders. - */ - TYPE_MAP: - { - "documents": '+(TYPE:"content" OR TYPE:"app:filelink" OR TYPE:"folder")', - "folders": '+(TYPE:"folder" OR TYPE:"app:folderlink")', - "images": '+@cm\\:content.mimetype:image/*' - }, - - /** - * Types that we want to suppress from the resultset - */ - IGNORED_TYPES: - [ - "cm:systemfolder", - "fm:forums", - "fm:forum", - "fm:topic", - "fm:post" - ], - - /** - * Encode a path with ISO9075 encoding - * - * @method iso9075EncodePath - * @param path {string} Path to be encoded - * @return {string} Encoded path - */ - iso9075EncodePath: function Filter_iso9075EncodePath(path) - { - var parts = path.split("/"); - for (var i = 1, ii = parts.length; i < ii; i++) - { - parts[i] = "cm:" + search.ISO9075Encode(parts[i]); - } - return parts.join("/"); - }, - - /** - * Create filter parameters based on input parameters - * - * @method getFilterParams - * @param filter {string} Required filter - * @param parsedArgs {object} Parsed arguments object literal - * @param optional {object} Optional arguments depending on filter type - * @return {object} Object literal containing parameters to be used in Lucene search - */ - getFilterParams: function Filter_getFilterParams(filter, parsedArgs, optional) - { - var filterParams = - { - query: "", - limitResults: null, - sort: [ - { - column: "@cm:name", - ascending: true - }], - language: "lucene", - templates: null, - variablePath: true - }; - - optional = optional || {}; - - // Sorting parameters specified? - var sortAscending = args.sortAsc, - sortField = args.sortField; - - if (sortAscending == "false") - { - filterParams.sort[0].ascending = false; - } - if (sortField !== null) - { - filterParams.sort[0].column = (sortField.indexOf(":") != -1 ? "@" : "") + sortField; - } - - // Max returned results specified? - var argMax = args.max; - if ((argMax !== null) && !isNaN(argMax)) - { - filterParams.limitResults = argMax; - } - - var favourites = optional.favourites; - if (typeof favourites == "undefined") - { - favourites = []; - } - - // Create query based on passed-in arguments - var filterData = String(args.filterData), - filterQuery = ""; - - // Common types and aspects to filter from the UI - known subtypes of cm:content and cm:folder - var filterQueryDefaults = ' -TYPE:"' + Filters.IGNORED_TYPES.join('" -TYPE:"') + '"'; - - switch (String(filter)) - { - case "all": - filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; - filterQuery += " +TYPE:\"cm:content\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "recentlyAdded": - case "recentlyModified": - case "recentlyCreatedByMe": - case "recentlyModifiedByMe": - var onlySelf = (filter.indexOf("ByMe")) > 0 ? true : false, - dateField = (filter.indexOf("Modified") > 0) ? "modified" : "created", - ownerField = (dateField == "created") ? "creator" : "modifier"; - - // Default to 7 days - can be overridden using "days" argument - var dayCount = 7, - argDays = args.days; - if ((argDays !== null) && !isNaN(argDays)) - { - dayCount = argDays; - } - - // Default limit to 50 documents - can be overridden using "max" argument - if (filterParams.limitResults === null) - { - filterParams.limitResults = 50; - } - - var date = new Date(); - var toQuery = date.getFullYear() + "\\-" + (date.getMonth() + 1) + "\\-" + date.getDate(); - date.setDate(date.getDate() - dayCount); - var fromQuery = date.getFullYear() + "\\-" + (date.getMonth() + 1) + "\\-" + date.getDate(); - - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +@cm\\:" + dateField + ":[" + fromQuery + "T00\\:00\\:00.000 TO " + toQuery + "T23\\:59\\:59.999]"; - if (onlySelf) - { - filterQuery += " +@cm\\:" + ownerField + ":\"" + person.properties.userName + '"'; - } - filterQuery += " +TYPE:\"cm:content\""; - - filterParams.sort = [ - { - column: "@cm:" + dateField, - ascending: false - }]; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "editingMe": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +((+@cm\\:workingCopyOwner:\"" + person.properties.userName + '")'; - filterQuery += " OR (+@cm\\:lockOwner:\"" + person.properties.userName + '"'; - filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))"; - filterParams.query = filterQuery; - break; - - case "editingOthers": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +ASPECT:\"workingcopy\""; - filterQuery += " +((-@cm\\:workingCopyOwner:\"" + person.properties.userName + '")'; - filterQuery += " OR (-@cm\\:lockOwner:\"" + person.properties.userName + '"'; - filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))"; - filterParams.query = filterQuery; - break; - - case "favourites": - for (var favourite in favourites) - { - if (filterQuery) - { - filterQuery += " OR "; - } - filterQuery += "ID:\"" + favourite + "\""; - } - - if (filterQuery.length !== 0) - { - filterQuery = "+(" + filterQuery + ")"; - // no need to specify path here for all sites - IDs are exact matches - if (parsedArgs.nodeRef != "alfresco://sites/home" && parsedArgs.nodeRef != "alfresco://company/home") - { - filterQuery += ' +PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; - } - } - else - { - // empty favourites query - filterQuery = "+ID:\"\""; - } - - filterParams.query = filterQuery; - break; - - case "synced": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +ASPECT:\"sync:syncSetMemberNode\""; - filterParams.query = filterQuery; - break; - - case "syncedErrors": - filterQuery = this.constructPathQuery(parsedArgs); - filterQuery += " +ASPECT:\"sync:failed\""; - filterParams.query = filterQuery; - break; - - case "node": - filterParams.variablePath = false; - filterParams.query = "+ID:\"" + parsedArgs.nodeRef + "\""; - break; - - case "tag": - // Remove any trailing "/" character - if (filterData.charAt(filterData.length - 1) == "/") - { - filterData = filterData.slice(0, -1); - } - filterQuery = this.constructPathQuery(parsedArgs); - filterParams.query = filterQuery + " +PATH:\"/cm:taggable/cm:" + search.ISO9075Encode(filterData) + "/member\""; - break; - - case "category": - // Remove any trailing "/" character - if (filterData.charAt(filterData.length - 1) == "/") - { - filterData = filterData.slice(0, -1); - } - filterQuery = this.constructPathQuery(parsedArgs); - filterParams.query = filterQuery + " +PATH:\"/cm:generalclassifiable" + Filters.iso9075EncodePath(filterData) + "/member\""; - break; - - default: // "path" - filterParams.variablePath = false; - filterQuery = "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - } - - // Specialise by passed-in type - if (filterParams.query !== "") - { - filterParams.query += " " + (Filters.TYPE_MAP[parsedArgs.type] || ""); - } - - return filterParams; - }, - - constructPathQuery: function constructPathQuery(parsedArgs) - { - var pathQuery = ""; - if (parsedArgs.nodeRef != "alfresco://company/home") - { - if (parsedArgs.nodeRef == "alfresco://sites/home") - { - // all sites query - better with //cm:* - pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"'; - } - else - { - // site specific query - better with //* - pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; - } - } - return pathQuery; - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.desc.xml deleted file mode 100644 index 5733aa7cbe..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Create Fodler Templates - Document List Component - Create Folder Templates GET data webscript - /slingshot/doclib/folder-templates - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.js deleted file mode 100644 index db1e8b9801..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Document List Component: Create New Node - get list of available node templates in the Data Dictionary - */ -function main() -{ - var nodes = search.selectNodes('/app:company_home/app:dictionary/app:space_templates/*[subtypeOf("cm:folder")]'); - return nodes; -} - -model.nodes = main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.json.ftl deleted file mode 100644 index 4923d97c59..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.get.json.ftl +++ /dev/null @@ -1,15 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - [ - <#list nodes as node> - { - "nodeRef": "${node.nodeRef}", - "name": "${node.name}", - "title": "${node.properties.title!""}", - "description": "${node.properties.description!""}" - }<#if node_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.desc.xml deleted file mode 100644 index e1ac598df1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Create Folder Templates - Document List Component - Create Folder Templates POST data webscript - /slingshot/doclib/folder-templates - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.json.ftl deleted file mode 100644 index 618584f2f2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.json.ftl +++ /dev/null @@ -1,7 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": true, - "persistedObject": "${persistedObject}", - "name": "${name}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.json.js deleted file mode 100644 index 808d19a3cb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/folder-templates.post.json.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Document List Component: Create New Node - create copy of node template in the Data Dictionary - */ -function main() -{ - // get the arguments - expecting the "sourceNodeRef" and "parentNodeRef" of the source node to copy - // and the parent node to contain the new copy of the source. - var sourceNodeRef = json.get("sourceNodeRef"); - if (sourceNodeRef == null || sourceNodeRef.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Mandatory 'sourceNodeRef' parameter missing."); - return; - } - var parentNodeRef = json.get("parentNodeRef"); - if (parentNodeRef == null || parentNodeRef.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Mandatory 'parentNodeRef' parameter missing."); - return; - } - - // get the nodes and perform the copy - permission failures etc. will produce a status code response - var sourceNode = search.findNode(sourceNodeRef), - parentNode = search.findNode(parentNodeRef); - if (sourceNode == null || parentNode == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Source or destination node is missing for copy operation."); - } - var copy = sourceNode.copy(parentNode, true); - copy.setName(json.get("prop_cm_name").toString()); - copy.properties["cm:description"] = json.get("prop_cm_description").toString(); - copy.properties["cm:title"] = json.get("prop_cm_title").toString(); - copy.save(); - model.persistedObject = copy.getNodeRef().toString(); - model.name = json.get("prop_cm_name").toString(); -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.desc.xml deleted file mode 100644 index 4de3a7d984..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - images - Images List Component - images data webscript - /slingshot/doclib/images/site/{site}/{container}/{path} - /slingshot/doclib/images/site/{site}/{container} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.html.ftl deleted file mode 100644 index a6ef0db7bd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.html.ftl +++ /dev/null @@ -1,2 +0,0 @@ -

${images.luceneQuery}

-<#include "images.get.json.ftl"> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.js deleted file mode 100644 index 1563ed1703..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.js +++ /dev/null @@ -1,55 +0,0 @@ - - - -/** - * Main entry point: Create collection of images in the given space (and its subspaces) - * @method main - */ -function main() -{ - var items = [], - assets, - filterParams, - query; - - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - // Build the query specific to image/* mimetypes - filterParams = Filters.getFilterParams("all", parsedArgs); - if (parsedArgs.pathNode === null) - { - query = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\" "; - } - else - { - query = "+PATH:\"" + parsedArgs.pathNode.qnamePath + "//*\" "; - } - query += "+TYPE:\"cm:content\" +@cm\\:content.mimetype:image/*"; - - // Sort the list before trimming to page chunks - assets = search.query( - { - query: query, - page: - { - maxItems: (filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : 0) - }, - sort: filterParams.sort - }); - - return ( - { - luceneQuery: query, - items: assets - }); -} - -/** - * Images List Component: images - */ -model.images = main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.json.ftl deleted file mode 100644 index 8dfc6addfa..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/images.get.json.ftl +++ /dev/null @@ -1,17 +0,0 @@ -<#macro dateFormat date>${xmldate(date)} -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list images.items as item> - { - "name": "${(item.properties.name)}", - "title": "${(item.properties.title!item.name)}", - "modifier": "${(item.properties.modifier)}", - "modifiedOn": "<@dateFormat item.properties.modified />", - "nodeRef": "${item.nodeRef}" - }<#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/item.lib.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/item.lib.ftl deleted file mode 100644 index 3843b4477c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/item.lib.ftl +++ /dev/null @@ -1,168 +0,0 @@ -<#assign workingCopyLabel = " " + message("coci_service.working_copy_label")> - -<#-- This function is used below to detect numerical property values of Infinity, -Infinity and NaN --> -<#macro renderNumber value=0> -<#if value?is_number> - <#if value?c == '\xfffd' || value?c == '\x221e' || value?c == '-\x221e'>0 - <#else>${value?c} - - - - -<#macro dateFormat date=""><#if date?is_date>${xmldate(date)} - -<#macro itemJSON item> - <#escape x as jsonUtils.encodeJSONString(x)> - <#local node = item.node> - <#local version = "1.0"> - <#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")><#local version = node.properties["cm:versionLabel"]!""> - <#if item.createdBy??> - <#local createdBy = item.createdBy.displayName> - <#local createdByUser = item.createdBy.userName> - <#else> - <#local createdBy="" createdByUser=""> - - <#if item.modifiedBy??> - <#local modifiedBy = item.modifiedBy.displayName> - <#local modifiedByUser = item.modifiedBy.userName> - <#else> - <#local modifiedBy="" modifiedByUser=""> - - <#if item.lockedBy??> - <#local lockedBy = item.lockedBy.displayName> - <#local lockedByUser = item.lockedBy.userName> - <#else> - <#local lockedBy="" lockedByUser=""> - - <#local tags><#list item.tags as tag>"${tag}"<#if tag_has_next>, - "nodeRef": "${node.nodeRef}", - "nodeType": "${shortQName(node.type)}", - "type": "${item.type}", - "mimetype": "${node.mimetype!""}", - "isFolder": <#if item.linkedNode??>${item.linkedNode.isContainer?string}<#else>${node.isContainer?string}, - "isLink": ${(item.isLink!false)?string}, -<#if item.linkedNode??> - "linkedNodeRef": "${item.linkedNode.nodeRef?string}", - - "fileName": "<#if item.linkedNode??>${item.linkedNode.name}<#else>${node.name}", - "displayName": "<#if item.linkedNode??>${item.linkedNode.name}<#elseif node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy")>${node.name?replace(workingCopyLabel, "")}<#else>${node.name}", - "status": "<#list item.status?keys as s><#if item.status[s]?is_boolean && item.status[s] == true>${s}<#if s_has_next>,", - "title": "${node.properties.title!""}", - "description": "${node.properties.description!""}", - "author": "${node.properties.author!""}", - "createdOn": "<@dateFormat node.properties.created />", - "createdBy": "${createdBy}", - "createdByUser": "${createdByUser}", - "modifiedOn": "<@dateFormat node.properties.modified />", - "modifiedBy": "${modifiedBy}", - "modifiedByUser": "${modifiedByUser}", - <#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}thumbnailModification")> - <#if node.properties.lastThumbnailModification??> - <#list node.properties.lastThumbnailModification as thumbnailMod> - <#if thumbnailMod?contains("doclib")> - "lastThumbnailModification": "${thumbnailMod}", - - - - - "lockedBy": "${lockedBy}", - "lockedByUser": "${lockedByUser}", - "size": "${node.size?c}", - "version": "${version}", - "contentUrl": "api/node/content/${node.storeType}/${node.storeId}/${node.id}/${node.name?url}", - "webdavUrl": "${node.webdavUrl}", - "actionSet": "${item.actionSet}", - "tags": <#noescape>[${tags}], - <#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}generalclassifiable")> - "categories": [<#list node.properties.categories![] as c>["${c.name}", "${c.displayPath?replace("/categories/General","")}"]<#if c_has_next>,], - - <#if item.activeWorkflows??>"activeWorkflows": "<#list item.activeWorkflows as aw>${aw}<#if aw_has_next>,", - <#if item.isFavourite??>"isFavourite": ${item.isFavourite?string}, - "likes":<#if item.likes??> - { - "isLiked": ${item.likes.isLiked?string}, - "totalLikes": ${item.likes.totalLikes?c} - }<#else>null, - "location": - { - "repositoryId": "${(node.properties["trx:repositoryId"])!(server.id)}", - "site": "${item.location.site!""}", - "siteTitle": "${item.location.siteTitle!""}", - "container": "${item.location.container!""}", - "path": "${item.location.path!""}", - "file": "${item.location.file!""}", - "parent": - { - <#if item.location.parent??> - <#if item.location.parent.nodeRef??> - "nodeRef": "${item.location.parent.nodeRef!""}" - - - } - }, - <#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}geographic")>"geolocation": - { - "latitude": <@renderNumber node.properties["cm:latitude"] />, - "longitude": <@renderNumber node.properties["cm:longitude"] /> - }, - <#if node.hasAspect("{http://www.alfresco.org/model/audio/1.0}audio")>"audio": - { - "album": "${node.properties["audio:album"]!""}", - "artist": "${node.properties["audio:artist"]!""}", - "composer": "${node.properties["audio:composer"]!""}", - "engineer": "${node.properties["audio:engineer"]!""}", - "genre": "${node.properties["audio:genre"]!""}", - "trackNumber": <@renderNumber node.properties["audio:trackNumber"] />, - "releaseDate": "<@dateFormat node.properties["audio:releaseDate"] />", - "sampleRate": <@renderNumber node.properties["audio:sampleRate"] />, - "sampleType": "${node.properties["audio:sampleType"]!""}", - "channelType": "${node.properties["audio:channelType"]!""}", - "compressor": "${node.properties["audio:compressor"]!""}" - }, - <#if node.hasAspect("{http://www.alfresco.org/model/exif/1.0}exif")>"exif": - { - "dateTimeOriginal": "<@dateFormat node.properties["exif:dateTimeOriginal"] />", - "pixelXDimension": <@renderNumber node.properties["exif:pixelXDimension"] />, - "pixelYDimension": <@renderNumber node.properties["exif:pixelYDimension"] />, - "exposureTime": <@renderNumber node.properties["exif:exposureTime"] />, - "fNumber": <@renderNumber node.properties["exif:fNumber"] />, - "flash": ${(node.properties["exif:flash"]!false)?string}, - "focalLength": <@renderNumber node.properties["exif:focalLength"] />, - "isoSpeedRatings": "${node.properties["exif:isoSpeedRatings"]!""}", - "manufacturer": "${node.properties["exif:manufacturer"]!""}", - "model": "${node.properties["exif:model"]!""}", - "software": "${node.properties["exif:software"]!""}", - "orientation": <@renderNumber node.properties["exif:orientation"] />, - "xResolution": <@renderNumber node.properties["exif:xResolution"] />, - "yResolution": <@renderNumber node.properties["exif:yResolution"] />, - "resolutionUnit": "${node.properties["exif:resolutionUnit"]!""}" - }, - "permissions": - { - "inherited": ${node.inheritsPermissions?string}, - "roles": - [ - <#list node.fullPermissions as permission> - "${permission?string}"<#if permission_has_next>, - - ], - "userAccess": - { - <#list item.actionPermissions?keys as actionPerm> - <#if item.actionPermissions[actionPerm]?is_boolean> - "${actionPerm?string}": ${item.actionPermissions[actionPerm]?string}<#if actionPerm_has_next>, - - - } - }, - <#if item.custom??>"custom": <#noescape>${item.custom}, - "actionLabels": - { -<#if item.actionLabels??> - <#list item.actionLabels?keys as actionLabel> - "${actionLabel?string}": "${item.actionLabels[actionLabel]}"<#if actionLabel_has_next>, - - - } - - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.desc.xml deleted file mode 100644 index 5cc5522d42..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - path - Document List Component - path resolver - /slingshot/doclib/node/{store_type}/{store_id}/{id}/location - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.js deleted file mode 100644 index 795f7e2bab..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.js +++ /dev/null @@ -1,49 +0,0 @@ - - - -/** - * Main entry point: Return scope of nodeRef - * - * @method resolvePath - */ -function resolveLocations() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - var libraryRoot = parsedArgs.libraryRoot ? parsedArgs.libraryRoot : companyhome, - repoLocation = Common.getLocation(parsedArgs.rootNode, libraryRoot), - siteLocation = Common.getLocation(parsedArgs.rootNode, null), - fileName = parsedArgs.rootNode.properties["name"]; - - var locations = - { - repo: - { - path: repoLocation.path, - file: fileName ? fileName : null - } - }; - - if (siteLocation.site) - { - locations.site = - { - path: siteLocation.path, - file: fileName ? fileName : null, - site: siteLocation.site, - siteTitle: siteLocation.siteTitle, - container: siteLocation.container - }; - } - - return locations; -} - -/** - * - */ -model.locations = resolveLocations(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.json.ftl deleted file mode 100644 index cc6dce2ad9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/location.get.json.ftl +++ /dev/null @@ -1,19 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if (locations.site??)> - <#assign site = locations.site> - "site": - { - "site": "${site.site!""}", - "siteTitle": "${site.siteTitle!""}", - "container": "${site.container!""}", - "path": "${site.path!""}", - "file": "${site.file!""}" - }, - "repo": - { - "path": "${locations.repo.path!""}", - "file": "${locations.repo.file!""}" - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.desc.xml deleted file mode 100644 index 0a126a030c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Create Node Templates - Document List Component - Create Node Templates GET data webscript - /slingshot/doclib/node-templates - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.js deleted file mode 100644 index 52502562fd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Document List Component: Create New Node - get list of available node templates in the Data Dictionary - */ -function main() -{ - var nodes = search.selectNodes('/app:company_home/app:dictionary/app:node_templates/*[subtypeOf("cm:content")]'); - return nodes; -} - -model.nodes = main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.json.ftl deleted file mode 100644 index 4923d97c59..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.get.json.ftl +++ /dev/null @@ -1,15 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - [ - <#list nodes as node> - { - "nodeRef": "${node.nodeRef}", - "name": "${node.name}", - "title": "${node.properties.title!""}", - "description": "${node.properties.description!""}" - }<#if node_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.desc.xml deleted file mode 100644 index 04991abaf6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Create Node Templates - Document List Component - Create Node Templates POST data webscript - /slingshot/doclib/node-templates - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.ftl deleted file mode 100644 index 82e22e050d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.ftl +++ /dev/null @@ -1,7 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": true, - "name": "${result.name}", - "nodeRef": "${result.nodeRef}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.js deleted file mode 100644 index d08ce460f5..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node-templates.post.json.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Document List Component: Create New Node - create copy of node template in the Data Dictionary - */ -function main() -{ - // get the arguments - expecting the "sourceNodeRef" and "parentNodeRef" of the source node to copy - // and the parent node to contain the new copy of the source. - var sourceNodeRef = json.get("sourceNodeRef"); - if (sourceNodeRef == null || sourceNodeRef.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Mandatory 'sourceNodeRef' parameter missing."); - return; - } - var parentNodeRef = json.get("parentNodeRef"); - if (parentNodeRef == null || parentNodeRef.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Mandatory 'parentNodeRef' parameter missing."); - return; - } - - // get the nodes and perform the copy - permission failures etc. will produce a status code response - var sourceNode = search.findNode(sourceNodeRef), - parentNode = search.findNode(parentNodeRef); - if (sourceNode == null || parentNode == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Source or destination node is missing for copy operation."); - } - model.result = sourceNode.copy(parentNode); -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.desc.xml deleted file mode 100644 index 9675060892..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - node - Document List Component - node data webscript - /slingshot/doclib/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.js deleted file mode 100644 index d0be6879fd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.js +++ /dev/null @@ -1,73 +0,0 @@ - - - - -/** - * Main entry point: Return single document or folder given it's nodeRef - * - * @method getDoclist - */ -function getDoclist() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - parsedArgs.pathNode = ParseArgs.resolveNode(parsedArgs.nodeRef); - parsedArgs.location = Common.getLocation(parsedArgs.pathNode, parsedArgs.libraryRoot); - - var filter = args.filter, - items = []; - - var favourites = Common.getFavourites(), - node = parsedArgs.pathNode, - parent = null; - - var thumbnail = null, - item = Evaluator.run(node); - - item.isFavourite = (favourites[node.nodeRef] === true); - item.likes = Common.getLikes(node); - - item.location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - container: parsedArgs.location.container, - path: parsedArgs.location.path, - file: node.name - }; - - item.location.parent = {}; - if (node.parent != null && node.parent.isContainer && node.parent.hasPermission("Read")) - { - parent = - { - node: node.parent, - userAccess: Evaluator.run(node.parent, true).actionPermissions - }; - item.location.parent.nodeRef = String(node.parent.nodeRef.toString()); - } - - // Special case for container and libraryRoot nodes - if ((parsedArgs.location.containerNode && String(parsedArgs.location.containerNode.nodeRef) == String(node.nodeRef)) || - (parsedArgs.libraryRoot && String(parsedArgs.libraryRoot.nodeRef) == String(node.nodeRef))) - { - item.location.file = ""; - } - - return ( - { - parent: parent, - onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), - items: [item] - }); -} - -/** - * Document List Component: doclist - */ -model.doclist = getDoclist(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.json.ftl deleted file mode 100644 index 82b75b30c0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/node.get.json.ftl +++ /dev/null @@ -1,31 +0,0 @@ -<#import "item.lib.ftl" as itemLib /> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "metadata": - { - "parent": - { - <#if doclist.parent??> - <#assign parentNode = doclist.parent.node> - "nodeRef": "${parentNode.nodeRef}", - "permissions": - { - "userAccess": - { - <#list doclist.parent.userAccess?keys as perm> - <#if doclist.parent.userAccess[perm]?is_boolean> - "${perm?string}": ${doclist.parent.userAccess[perm]?string}<#if perm_has_next>, - - - } - } - - }, - "onlineEditing": ${doclist.onlineEditing?string} - }, - "item": - { - <#if doclist.items??><@itemLib.itemJSON item=doclist.items[0] /> - } -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js deleted file mode 100644 index e4357048b6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js +++ /dev/null @@ -1,520 +0,0 @@ -const THUMBNAIL_NAME = "doclib", - TYPE_SITES = "st:sites", - PREF_DOCUMENT_FAVOURITES = "org.alfresco.share.documents.favourites", - PREF_FOLDER_FAVOURITES = "org.alfresco.share.folders.favourites", - LIKES_SCHEME = "likesRatingScheme"; - -var Common = -{ - /** - * Cache for person objects - */ - PeopleCache: {}, - - /** - * Gets / caches a person object - * - * @method getPerson - * @param username {string} User name - */ - getPerson: function Common_getPerson(username) - { - if (username == null || username == "") - { - return null; - } - - if (typeof Common.PeopleCache[username] != "object") - { - 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: {} - }; - } - } - Common.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, "") - }; - if (person.assocs["cm:avatar"] != null) - { - Common.PeopleCache[username].avatar = person.assocs["cm:avatar"][0]; - } - } - return Common.PeopleCache[username]; - }, - - /** - * Cache for group objects - */ - GroupCache: {}, - - /** - * Gets / caches a group object - * - * @method getGroup - * @param groupname {string} Group name - */ - getGroup: function Common_getGroup(groupname) - { - if (groupname == null || groupname == "") - { - return null; - } - - if (typeof Common.GroupCache[groupname] != "object") - { - var group = groups.getGroupForFullAuthorityName(groupname); - if (group == null && groupname == "GROUP_EVERYONE") - { - group = - { - fullName: groupname, - shortName: "EVERYONE", - displayName: "EVERYONE" - }; - } - Common.GroupCache[groupname] = group; - } - return Common.GroupCache[groupname]; - }, - - /** - * Cache for site objects - */ - SiteCache: {}, - - /** - * Gets / caches a site object - * - * @method getSite - * @param siteId {string} Site ID - */ - getSite: function Common_getSite(siteId) - { - if (typeof Common.SiteCache[siteId] != "object") - { - Common.SiteCache[siteId] = siteService.getSite(siteId); - } - return Common.SiteCache[siteId]; - }, - - /** - * Get the user's favourite docs and folders from our slightly eccentric Preferences Service - * - * @method getFavourites - */ - getFavourites: function Common_getFavourites() - { - var prefs = preferenceService.getPreferences(person.properties.userName, PREF_DOCUMENT_FAVOURITES), - favourites = {}, - arrFavs = [], - strFavs, f, ff; - try - { - /** - * Fasten seatbelts... - * An "eval" could be used here, but the Rhino debugger will complain if throws an exception, which gets old very quickly. - * e.g. var strFavs = eval('try{(prefs.' + PREF_DOCUMENT_FAVOURITES + ')}catch(e){}'); - */ - if (prefs && prefs.org && prefs.org.alfresco && prefs.org.alfresco.share && prefs.org.alfresco.share.documents) - { - strFavs = prefs.org.alfresco.share.documents.favourites; - if (typeof strFavs == "string") - { - arrFavs = strFavs.split(","); - for (f = 0, ff = arrFavs.length; f < ff; f++) - { - favourites[arrFavs[f]] = true; - } - } - } - // Same thing but for folders - prefs = preferenceService.getPreferences(person.properties.userName, PREF_FOLDER_FAVOURITES); - if (prefs && prefs.org && prefs.org.alfresco && prefs.org.alfresco.share && prefs.org.alfresco.share.folders) - { - strFavs = prefs.org.alfresco.share.folders.favourites; - if (typeof strFavs == "string") - { - arrFavs = strFavs.split(","); - for (f = 0, ff = arrFavs.length; f < ff; f++) - { - favourites[arrFavs[f]] = true; - } - } - } - } - catch (e) - { - } - - return favourites; - }, - - /** - * Returns the number of nested levels at which two paths match. This is used when there are two - * parents to a node and is used to determine the correct one. - * - * @param count - * @param firstNode An array of Strings that are the elements in a path to a node. - * @param secondNode An array of Strings that are the elements in a path to a different node. - */ - getDeepOfPath: function Common_getDeepOfPath(count, firstNode, secondNode) - { - var i = 0; - for (var i = 0; i < count; i++) - { - if (!firstNode[i].equals(secondNode[i])) - { - break; - } - } - return i; - }, - - /** - * Generates a location object literal for a given node. - * Location is Site-relative unless a libraryRoot node is passed in. - * - * @method getLocation - * @param node {ScriptNode} Node to generate location for - * @param libraryRoot {ScriptNode} Optional node to work out relative location from. - * @return {object} Location object literal. - */ - getLocation: function Common_getLocation(node, libraryRoot) - { - var location = null, - qnamePaths = node.qnamePath.split("/"), - displayPaths = node.displayPath.split("/"); - - if (libraryRoot == undefined && qnamePaths[2] != TYPE_SITES) - { - libraryRoot = companyhome; - } - - if (libraryRoot) - { - var libraryRootDisplayPath = libraryRoot.displayPath.split("/"); - var deepLibraryRoot = libraryRootDisplayPath.length; - var deepNode = displayPaths.length; - - var count = (deepNode > deepLibraryRoot) ? Common.getDeepOfPath(deepNode, displayPaths, libraryRootDisplayPath): Common.getDeepOfPath(deepLibraryRoot, libraryRootDisplayPath, displayPaths); - - if (node.qnamePath.contains(libraryRoot.qnamePath)) - { - count++; - } - - // Generate the path from the supplied library root - location = - { - site: null, - siteTitle: null, - container: null, - path: "/" + displayPaths.slice(count, deepNode).join("/"), - file: node.name - }; - } - else if ((qnamePaths.length > 4) && (qnamePaths[2] == TYPE_SITES)) - { - var siteId = displayPaths[3], - siteNode = Common.getSite(siteId), - containerId = qnamePaths[4].substr(3); - - if (siteNode != null) - { - location = - { - site: siteId, - siteNode: siteNode, - siteTitle: siteNode.title, - container: containerId, - containerNode: siteNode.getContainer(containerId), - path: "/" + displayPaths.slice(5, displayPaths.length).join("/"), - file: node.name - }; - } - } - - if (location == null) - { - location = - { - site: null, - siteTitle: null, - container: null, - path: "/" + displayPaths.slice(2, displayPaths.length).join("/"), - file: node.name - }; - } - - return location; - }, - - /** - * Returns an object literal representing the current "likes" rating for a node - * - * @method getLikes - * @param node {ScriptNode} Node to query - * @return {object} Likes object literal. - */ - getLikes: function Common_getLikes(node) - { - var isLiked = false, - totalLikes = 0; - - try - { - totalLikes = ratingService.getRatingsCount(node, LIKES_SCHEME); - isLiked = totalLikes === 0 ? false : ratingService.getRating(node, LIKES_SCHEME) !== -1; - } - catch (e) {} - - return ( - { - isLiked: isLiked, - totalLikes: totalLikes - }); - } -}; - -var ParseArgs = -{ - /** - * Get and parse arguments - * - * @method getParsedArgs - * @return {array|null} Array containing the validated input parameters - */ - getParsedArgs: function ParseArgs_getParsedArgs(containerType) - { - var type = url.templateArgs.type, - libraryRoot = args.libraryRoot, - rootNode = null, - pathNode = null, - nodeRef = null, - path = "", - location = null; - - // Is this library rooted from a non-site nodeRef? - if (libraryRoot !== null) - { - libraryRoot = ParseArgs.resolveNode(libraryRoot); - } - - - if (url.templateArgs.store_type !== null) - { - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - nodeRef = storeType + "://" + storeId + "/" + id; - if (url.templateArgs.store_type == "workspace") - { - rootNode = ParseArgs.resolveNode(nodeRef); - } - else - { - rootNode = libraryRoot || ParseArgs.resolveNode(nodeRef); - } - if (rootNode == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - // Special case: make sure filter picks up correct mode - if (type == null && args.filter == null) - { - args.filter = "node"; - } - } - else - { - /** - * Site and container input - */ - var siteId = url.templateArgs.site, - containerId = url.templateArgs.container, - siteNode = siteService.getSite(siteId); - - if (siteNode === null) - { - status.setCode(status.STATUS_GONE, "Site not found: '" + siteId + "'"); - return null; - } - - rootNode = siteNode.getContainer(containerId); - if (rootNode === null) - { - rootNode = siteNode.aquireContainer(containerId, containerType || "cm:folder", {"cm:description": "Document Library"}); - if (rootNode === null) - { - status.setCode(status.STATUS_GONE, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - } - } - - // Path input? - path = url.templateArgs.path || ""; - pathNode = path.length > 0 ? rootNode.childByNamePath(path) : (pathNode || rootNode); - if (pathNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Path not found: '" + path + "'"); - return null; - } - - // Parent location parameter adjustment - location = Common.getLocation(pathNode, libraryRoot); - if (path !== "") - { - location.path = ParseArgs.combinePaths(location.path, location.file); - } - if (args.filter !== "node" && !pathNode.isContainer) - { - location.file = ""; - } - - var objRet = - { - rootNode: rootNode, - pathNode: pathNode, - libraryRoot: libraryRoot, - location: location, - path: path, - nodeRef: nodeRef, - type: type - }; - - // Multiple input files in the JSON body? - var files = ParseArgs.getMultipleInputValues("nodeRefs"); - if (typeof files != "string") - { - objRet.files = files; - } - - return objRet; - }, - - /** - * Resolve "virtual" nodeRefs into nodes - * - * @method resolveVirtualNodeRef - * @deprecated for ParseArgs.resolveNode - */ - resolveVirtualNodeRef: function ParseArgs_resolveVirtualNodeRef(nodeRef) - { - if (logger.isLoggingEnabled()) - { - logger.log("WARNING: ParseArgs.resolveVirtualNodeRef is deprecated for ParseArgs.resolveNode"); - } - return ParseArgs.resolveNode(nodeRef); - }, - - /** - * Resolve "virtual" nodeRefs, nodeRefs and xpath expressions into nodes - * - * @method resolveNode - * @param reference {string} "virtual" nodeRef, nodeRef or xpath expressions - * @return {ScriptNode|null} Node corresponding to supplied expression. Returns null if node cannot be resolved. - */ - resolveNode: function ParseArgs_resolveNode(reference) - { - return utils.resolveNodeReference(reference); - }, - - /** - * Get multiple input files - * - * @method getMultipleInputValues - * @param param {string} Property name containing the files array - * @return {array|string} Array containing the files, or string error - */ - getMultipleInputValues: function ParseArgs_getMultipleInputValues(param) - { - var values = [], - error = null; - - try - { - // Was a JSON parameter list supplied? - if (typeof json == "object") - { - if (!json.isNull(param)) - { - var jsonValues = json.get(param); - // Convert from JSONArray to JavaScript array - for (var i = 0, j = jsonValues.length(); i < j; i++) - { - values.push(jsonValues.get(i)); - } - } - } - } - catch(e) - { - error = e.toString(); - } - - // Return the values array, or the error string if it was set - return (error !== null ? error : values); - }, - - /** - * Append multiple parts of a path, ensuring duplicate path separators are removed. - * - * @method combinePaths - * @param path1 {string} First path - * @param path2 {string} Second path - * @param ... - * @param pathN {string} Nth path - * @return {string} A string containing the combined paths - */ - combinePaths: function ParseArgs_combinePaths() - { - var path = "", i, ii; - for (i = 0, ii = arguments.length; i < ii; i++) - { - if (arguments[i] !== null) - { - path += arguments[i] + (arguments[i] !== "/" ? "/" : ""); - } - } - - return path.replace(/\/{2,}/g, "/").replace(/(.)\/$/g, "$1"); - } -}; diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.desc.xml deleted file mode 100644 index ec232e5f7a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - permissions - Document List Component - permissions data webscript - /slingshot/doclib/permissions/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js deleted file mode 100644 index 5e6512861b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.js +++ /dev/null @@ -1,134 +0,0 @@ - - -/** - * Main entry point: Retrieve permissions and associated metadata for given node - * - * @method getPermissions - */ -function getPermissions() -{ - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id, - node = ParseArgs.resolveNode(nodeRef); - - if (node == null) - { - node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - // Get array of settable permissions - var settable, location = Common.getLocation(node); - - // MNT-12761 - // If this node lives within a Site, then append only the Site-specific roles, else Repository-specific - if (location.siteNode != null) - { - settable = location.siteNode.getNode().getSettablePermissions(); - } - else - { - settable = node.getSettablePermissions(); - } - - // Get full permission set, including inherited - // [ALLOWED|DENIED];[USERNAME|GROUPNAME|ROLE];PERMISSION;[INHERITED|DIRECT] - var isInherited = node.inheritsPermissions(), - nodePermissions = parsePermissions(node.getDirectPermissions(), settable), - inheritedPermissions = [], - canReadInherited = true; - - if (node.parent.hasPermission("ReadPermissions")) - { - inheritedPermissions = parsePermissions(node.parent.getPermissions(), settable); - } - else - { - canReadInherited = false; - } - - return ( - { - inherited: inheritedPermissions, - isInherited: isInherited, - canReadInherited: canReadInherited, - direct: nodePermissions, - settable: settable - }); -} - -function parsePermissions(p_permissions, p_settable) -{ - var results = [], - settable = {}, - tokens, authority, authorityId, role, i, ii; - - // Settable array into object for "x in y" style operations - for (i = 0, ii = p_settable.length; i < ii; i++) - { - if (p_settable[i] !== undefined) - { - settable[p_settable[i]] = true; - } - } - - for (i = 0, ii = p_permissions.length; i < ii; i++) - { - tokens = p_permissions[i].split(";"); - authorityId = tokens[1]; - role = tokens[2]; - - // Only return ALLOWED permissions - if (tokens[0] == "ALLOWED") - { - // Resolve to group or user as appropriate - if (authorityId.indexOf("GROUP_") === 0) - { - authority = Common.getGroup(authorityId); - } - else if (authorityId.indexOf("ROLE_") === 0) - { - authority = - { - avatar: null, - name: authorityId, - displayName: null - }; - nameProperty = "name"; - } - else - { - authority = Common.getPerson(authorityId); - } - - if (authority != null) - { - results.push( - { - authority: - { - avatar: authority.avatar || null, - name: authorityId, - displayName: authority["displayName"] - }, - role: role - }); - } - } - } - return results; -} - -/** - * Document List Component: permissions - */ -model.data = getPermissions(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.json.ftl deleted file mode 100644 index 3608d62538..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.get.json.ftl +++ /dev/null @@ -1,32 +0,0 @@ -<#macro permissionsJSON permissions> - <#escape x as jsonUtils.encodeJSONString(x)> -[ - <#list permissions as perm> - { - "authority": - { - <#if perm.authority.avatar??> - "avatar": "${"api/node/" + perm.authority.avatar.nodeRef?string?replace('://','/') + "/content/thumbnails/avatar"}", - - "name": "${perm.authority.name}", - "displayName": "${perm.authority.displayName!perm.authority.name}" - }, - "role": "${perm.role}" - }<#if perm_has_next>, - -] - - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "inherited": <@permissionsJSON data.inherited />, - "isInherited": ${data.isInherited?string}, - "canReadInherited": ${data.canReadInherited?string}, - "direct": <@permissionsJSON data.direct />, - "settable": - [ - <#list data.settable as settable>"${settable}"<#if settable_has_next>, - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.desc.xml deleted file mode 100644 index c5d8fdc1fd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - set-permissions - Document List Component - set permissions data webscript - /slingshot/doclib/permissions/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.json.ftl deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.json.ftl +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.json.js deleted file mode 100644 index 54e36ff786..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/permissions.post.json.js +++ /dev/null @@ -1,104 +0,0 @@ - - -/** - * Entry point for rmpermissions POST data webscript. - * Applies supplied permissions to a node. - * - * @method main - */ -function main() -{ - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id, - node = ParseArgs.resolveNode(nodeRef); - - if (node == null) - { - node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - var location = Common.getLocation (node); - var siteManagerAuthority = "GROUP_site_" + location.site + "_SiteManager"; - - if (json.has("permissions") == false) - { - status.setCode(status.STATUS_BAD_REQUEST, "Permissions value missing from request."); - } - - // Inherited permissions flag - // First set inherit and then modify permissions - // See MNT-11725 - if (json.has("isInherited")) - { - var isInherited = json.getBoolean("isInherited"); - if (location.site != null) - { - if (isInherited == false) - { - // Insure Site Managers can still manage content. - node.setPermission("SiteManager", siteManagerAuthority); - } - } - node.setInheritsPermissions(isInherited); - } - - var permissions = json.getJSONArray("permissions"); - var isInherited = json.getBoolean("isInherited"); - for (var i = 0; i < permissions.length(); i++) - { - var perm = permissions.getJSONObject(i); - - // collect values for the permission setting - var authority = perm.getString("authority"); - - var role = perm.getString("role"); - var remove = false; - if (perm.has("remove")) - { - remove = perm.getBoolean("remove"); - } - - // Apply or remove permission - if (remove) - { - // Prevent the removal of the SiteManager group authority - if (!(role == "SiteManager" && authority == siteManagerAuthority && !isInherited)) - { - node.removePermission(role, authority); - } - } - else - { - var isSpecialAuthority = false; - switch ("" + authority) - { - case "GROUP_EVERYONE": - case "ROLE_ADMINISTRATOR": - case "ROLE_GUEST": - case "ROLE_OWNER": - isSpecialAuthority = true; - break; - } - - if (!isSpecialAuthority && people.getGroup(authority) == null && people.getPerson(authority) == null) - { - // ACE-3280: silently not add non-existent users - return; - } - - node.setPermission(role, authority); - } - } -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.desc.xml deleted file mode 100644 index a9d3f79aa7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.desc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - treenode - Document List Component - treenode data webscript - /slingshot/doclib/treenode/site/{site}/{container}/{path} - /slingshot/doclib/treenode/site/{site}/{container} - /slingshot/doclib/treenode/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/treenode/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.html.ftl deleted file mode 100644 index 00df6880d2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.html.ftl +++ /dev/null @@ -1 +0,0 @@ -<#include "treenode.get.json.ftl"> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.js deleted file mode 100644 index 3f62a2c723..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.js +++ /dev/null @@ -1,82 +0,0 @@ - - -/** - * Document List Component: treenode - */ -model.treenode = getTreeNode(); - -/* Create collection of folders in the given space */ -function getTreeNode() -{ - try - { - if (url.templateArgs.site != undefined) - { - var siteId = url.templateArgs.site; - var site = siteService.getSite(siteId); - if (site && site.visibility != "PUBLIC" && !site.isMember(person.properties.userName) && !people.isAdmin(person)) - { - status.setCode(status.STATUS_FORBIDDEN, "User is not a member of the " + siteId + " site"); - return null; - } - } - var items = new Array(), - hasSubfolders = true, - ignoredTypes = ['fm:forum','fm:topic'], - evalChildFolders = args["children"] !== "false", - resultsTrimmed = false, - argMax = parseInt(args["max"], 10), - maxItems = isNaN(argMax) ? -1 : argMax, - maxNumChildren = 100; - - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - // Look for folders in the pathNode - sort by ascending name - var pagedResult = parsedArgs.pathNode.childFileFolders(false, true, ignoredTypes, 0, maxItems, 0, "cm:name", true, "TODO"); - - if (pagedResult.hasMoreItems() == true) - { - resultsTrimmed = true; - } - - var numChildren = 1; - - for each (item in pagedResult.page) - { - numChildren++; - if (numChildren == maxNumChildren) - { - evalChildFolders = false; - } - - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, ignoredTypes, 1).page.length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders, - aspects: item.aspectsShort - }); - } - - return ( - { - parent: parsedArgs.pathNode, - resultsTrimmed: resultsTrimmed, - items: items - }); - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.json.ftl deleted file mode 100644 index 67e7d0fa65..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/treenode.get.json.ftl +++ /dev/null @@ -1,41 +0,0 @@ -<#assign p = treenode.parent> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalResults": ${treenode.items?size?c}, - "resultsTrimmed": ${treenode.resultsTrimmed?string}, - "parent": - { - "nodeRef": "${p.nodeRef}", - "userAccess": - { - "create": ${p.hasPermission("CreateChildren")?string}, - "edit": ${p.hasPermission("Write")?string}, - "delete": ${p.hasPermission("Delete")?string} - } - }, - "items": - [ - <#list treenode.items as item> - <#assign t = item.node> - { - "nodeRef": "${t.nodeRef}", - "name": "${t.name}", - "description": "${(t.properties.description!"")}", - "hasChildren": ${item.hasSubfolders?string}, - "userAccess": - { - "create": ${t.hasPermission("CreateChildren")?string}, - "edit": ${t.hasPermission("Write")?string}, - "delete": ${t.hasPermission("Delete")?string} - }, - "aspects": - [ - <#list item.aspects as aspect> - "${aspect}"<#if aspect_has_next>, - - ] - }<#if item_has_next>, - - ] -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.desc.xml deleted file mode 100644 index 321a1099d7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - type - Document List Component - type submit - /slingshot/doclib/type/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.json.ftl deleted file mode 100644 index efdd8b6641..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.json.ftl +++ /dev/null @@ -1,5 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "current": "${currentType}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.json.js deleted file mode 100644 index de45ed720d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/type.post.json.js +++ /dev/null @@ -1,33 +0,0 @@ -function main() -{ - // nodeRef input - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id; - - var node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - if (!json.has("type")) - { - status.setCode(status.STATUS_BAD_REQUEST, "'type' parameter not supplied"); - return null; - } - - var type = json.get("type"); - - if (!node.specializeType(type)) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not change type of nodeRef '" + nodeRef + "' to '" + type + "'"); - return null; - } - - model.currentType = type; -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/download.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/download.get.desc.xml deleted file mode 100644 index bdac35686c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/download.get.desc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - DownloadContent - Slingshot download content webscript - posts an activity for Site content download then delegates to standard ContentGet implementation - /slingshot/node/content{property}/{store_type}/{store_id}/{id}?a={attach?} - /slingshot/node/{store_type}/{store_id}/{id}/content{property}?a={attach?} - /slingshot/node/{store_type}/{store_id}/{id}/content{property}/{filename}?a={attach?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.desc.xml deleted file mode 100644 index 8333dacbe9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - contnode-typeainer - Edit Metadata Manager Component - node type - /slingshot/edit-metadata/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.js deleted file mode 100644 index fc2aaebd5c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.js +++ /dev/null @@ -1,30 +0,0 @@ -function main() -{ - if (url.templateArgs.store_type === null) - { - status.setCode(status.STATUS_BAD_REQUEST, "NodeRef missing"); - return; - } - - // nodeRef input - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id, - node = search.findNode(nodeRef); - - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - model.node = node; - - if (node.parent !== null && node.parent.hasPermission("ReadProperties")) - { - model.parent = node.parent; - } -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.json.ftl deleted file mode 100644 index 3c40abf083..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/edit-metadata/node-type.get.json.ftl +++ /dev/null @@ -1,15 +0,0 @@ -<#macro nodeInfo node name> -<#escape x as jsonUtils.encodeJSONString(x)> - "${name}": - { - "nodeRef": "${node.nodeRef}", - "type": "${node.typeShort}", - "isContainer": ${node.isContainer?string}, - "fileName": "${node.name}" - } - - -{ - <#if parent??><@nodeInfo parent "parent" />, - <@nodeInfo node "node" /> -} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/node-browser/node-browser.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/node-browser/node-browser.get.desc.xml deleted file mode 100644 index 8de44e800c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/node-browser/node-browser.get.desc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - Node Browser Repository support - Execute searches, return information on a node or return a list of stores - /slingshot/node/{protocol}/{store}/{id} - /slingshot/node/search - /slingshot/node/stores - argument - admin - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/node-browser/node-browser.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/node-browser/node-browser.get.json.ftl deleted file mode 100644 index 46b2343f69..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/node-browser/node-browser.get.json.ftl +++ /dev/null @@ -1,209 +0,0 @@ -<#macro dateFormat date>${date?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")} -<#escape x as jsonUtils.encodeJSONString(x)> -<#macro printPropertyValue p> - <#if p.value??> - <#if p.value?is_date> - "<@dateFormat p.value />" - <#elseif p.value?is_boolean> - ${p.value?string} - <#elseif p.value?is_number> - ${p.value?c} - <#elseif p.value?is_string> - "${p.value}" - <#elseif p.value?is_hash> - <#assign result = "{"/> - <#assign first = true /> - <#list p.value?keys as key> - <#if first = false> - <#assign result = result + ", "/> - - <#assign result = result + "${key} = ${p.value[key]}" /> - <#assign first = false/> - - <#assign result = result + "}"/> - <#-- output the result --> - "${result}" - - <#else> - null - - -{ - <#if node??> - "nodeRef": "${node.nodeRef}", - "qnamePath": { - "name": "${node.qnamePath}", - "prefixedName": "${node.prefixedQNamePath}" - }, - "name": { - "name": "${node.name}", - "prefixedName": "${node.prefixedName}" - }, - "parentNodeRef": "<#if node.parentNodeRef?exists>${node.parentNodeRef}", - "type": { - "name": "${node.type.name}", - "prefixedName": "${node.type.prefixedName}" - }, - "id": "${node.id}", - "nodeRef": "${node.nodeRef}", - "aspects": [ - <#list aspects as aspect> - { - "name": "${aspect.name}", - "prefixedName": "${aspect.prefixedName}" - } - <#if aspect_has_next>, - - ], - "properties": [ - <#list properties as p> - { - "name": { - "name": "${p.name.name}", - "prefixedName": "${p.name.prefixedName}" - }, - "values": [ - <#list p.values as val> - { - "dataType": "${val.dataType!""}", - "value": <@printPropertyValue val />, - "isContent": ${val.content?string}, - "isNodeRef": ${val.nodeRef?string}, - "isNullValue": ${val.nullValue?string} - }<#if val_has_next>, - - ], - "type": { - "name": "<#if p.typeName??>${p.typeName.name}", - "prefixedName": "<#if p.typeName??>${p.typeName.prefixedName}" - }, - "multiple": ${p.collection?string}, - "residual": ${p.residual?string} - }<#if p_has_next>, - - ], - "children": [ - <#list children as child> - { - "name": { - "name": "${child.name.name}", - "prefixedName": "${child.name.prefixedName}" - }, - "nodeRef": "${child.childRef}", - "type": { - "name": "${child.childTypeName.name}", - "prefixedName": "${child.childTypeName.prefixedName}" - }, - "assocType": { - "name": "${child.typeName.name}", - "prefixedName": "${child.typeName.prefixedName}" - }, - "primary": ${child.primary?string}, - "index": ${child_index?c} - }<#if child_has_next>, - - ], - "parents": [ - <#list parents as p> - { - "name": { - "name": "${p.name.name}", - "prefixedName": "${p.name.prefixedName}" - }, - "nodeRef": "${p.parentRef}", - "type": { - "name": "${p.parentTypeName.name}", - "prefixedName": "${p.parentTypeName.prefixedName}" - }, - "assocType": { - "name": "${p.typeName.name}", - "prefixedName": "${p.typeName.prefixedName}" - }, - "primary": ${p.primary?string} - }<#if p_has_next>, - - ], - "assocs": [ - <#list assocs as assoc> - { - "type": { - "name": "${assoc.targetTypeName.name}", - "prefixedName": "${assoc.targetTypeName.prefixedName}" - }, - "sourceRef": "${assoc.sourceRef}", - "targetRef": "${assoc.targetRef}", - "assocType": { - "name": "${assoc.typeName.name}", - "prefixedName": "${assoc.typeName.prefixedName}" - } - }<#if assoc_has_next>, - - ], - "sourceAssocs": [ - <#if sourceAssocs??> - <#list sourceAssocs as assoc> - { - "type": { - "name": "${assoc.sourceTypeName.name}", - "prefixedName": "${assoc.sourceTypeName.prefixedName}" - }, - "sourceRef": "${assoc.sourceRef}", - "targetRef": "${assoc.targetRef}", - "assocType": { - "name": "${assoc.typeName.name}", - "prefixedName": "${assoc.typeName.prefixedName}" - } - }<#if assoc_has_next>, - - - ], - "permissions": { - "entries": [ - <#list permissions.entries as p> - { - "permission": "${p.permission}", - "authority": "${p.authority}", - "rel": "${p.accessStatus}" - }<#if p_has_next>, - - ], - "masks": [ - <#list permissions.storePermissions as p> - { - "permission": "${p.permission}", - "authority": "${p.authority}", - "rel": "${p.accessStatus}" - }<#if p_has_next>, - - ], - "inherit": ${permissions.inherit?string}, - "owner": "<#if permissions.owner?exists>${permissions.owner}" - } - <#elseif results??> - "numResults": ${results?size?c}, - "results": [ - <#list results as result> - <#assign qnamePath=result.qnamePath /> - { - "nodeRef": "${result.nodeRef}", - "qnamePath": { - "name": "${result.qnamePath}", - "prefixedName": "${result.prefixedQNamePath}" - }, - "name": { - "name": "${result.name}", - "prefixedName": "${result.prefixedName}" - }, - "parentNodeRef": "<#if result.parent??>${result.parent.nodeRef}" - }<#if result_has_next>, - - ], - "searchElapsedTime": ${(searchElapsedTime!0)?c} - <#elseif stores??> - "stores": [ - <#list stores as store>"${store}"<#if store_has_next>, - - ] - -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/avatar.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/avatar.get.desc.xml deleted file mode 100644 index e20c0bc1bf..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/avatar.get.desc.xml +++ /dev/null @@ -1,16 +0,0 @@ - - Avatar - - Returns a user avatar image in the format specified by the thumbnailname, or the "avatar" preset if omitted. - - /slingshot/profile/avatar/avatar - /slingshot/profile/avatar/avatar/thumbnail/{thumbnailname} - /slingshot/profile/avatar/{store_type}/{store_id}/{id}/thumbnail/{thumbnailname} - /slingshot/profile/avatar/{store_type}/{store_id}/{id} - /slingshot/profile/avatar/{username}/thumbnail/{thumbnailname} - /slingshot/profile/avatar/{username} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/avatar.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/avatar.get.js deleted file mode 100644 index f4b278a1aa..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/avatar.get.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * User Profile - User avatar GET method - * - * Returns a user avatar image in the format specified by the thumbnailname, or the "avatar" preset if omitted. - * - * @method GET - */ - -function getPlaceholder(thumbnailName) -{ - // Try and get the place holder resource for a png avatar. - var phPath = thumbnailService.getMimeAwarePlaceHolderResourcePath(thumbnailName, "images/png"); - if (phPath == null) - { - // 404 since no thumbnail was found - status.setCode(status.STATUS_NOT_FOUND, "Thumbnail was not found and no place holder resource set for '" + thumbnailName + "'"); - return; - } - - return phPath; -} - -function main() -{ - var userName = url.templateArgs.username, - thumbnailName = url.templateArgs.thumbnailname || "avatar", - avatarNode; - - // If there is no store type, store id or id on the request then this WebScript has most likely been requested - // for a user with no avatar image so we will just return the placeholder image. - if (userName == null && url.templateArgs.store_type == null && url.templateArgs.store_id == null && url.templateArgs.id == null) - { - // If there is no userName or nodeRef data then we want to return the browser cacheable placeholder... - model.contentPath = getPlaceholder(thumbnailName); - model.allowBrowserToCache = "true"; - return; - } - else if (url.templateArgs.store_type == null && url.templateArgs.store_id == null && url.templateArgs.id == null) - { - // There is no nodeRef data but there is a username... this should return the user image that needs revalidation - var person = people.getPerson(userName); - if (person == null) - { - // Stream the placeholder image - model.contentPath = getPlaceholder(thumbnailName); - return; - } - else - { - // Retrieve the avatar NodeRef for this person, if there is one. - var avatarAssoc = person.assocs["cm:avatar"]; - if (avatarAssoc != null) - { - avatarNode = avatarAssoc[0]; - } - } - } - else if (userName == null) - { - // There is no user name but there is nodeREf data... this should return the image that CAN be cached by the browser - model.allowBrowserToCache = "true"; - avatarNode = search.findNode(url.templateArgs.store_type + "://" + url.templateArgs.store_id + "/" + url.templateArgs.id); - if (avatarNode == null) - { - // Stream the placeholder image if the avatar node cannot be found. - model.contentPath = getPlaceholder(thumbnailName); - return; - } - } - - // Get the thumbnail for the avatar... - if (avatarNode != null) - { - // Get the thumbnail - var thumbnail = avatarNode.getThumbnail(thumbnailName); - if (thumbnail == null || thumbnail.size == 0) - { - // Remove broken thumbnail - if (thumbnail != null) - { - thumbnail.remove(); - } - - // Force the creation of the thumbnail - thumbnail = avatarNode.createThumbnail(thumbnailName, false); - if (thumbnail != null) - { - model.contentNode = thumbnail; - return; - } - } - else - { - // Place the details of the thumbnail into the model, this will be used to stream the content to the client - model.contentNode = thumbnail; - return; - } - } - - // Stream the placeholder image - model.contentPath = getPlaceholder(thumbnailName); -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.desc.xml deleted file mode 100644 index ce0d21af7a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Reset Avatar image - User Profile - Reset Avatar image for a user - argument - user - required - /slingshot/profile/resetavatar/{userName} - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.json.ftl deleted file mode 100644 index c85c20f2b4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.json.ftl +++ /dev/null @@ -1,3 +0,0 @@ -{ - "success": ${success?string} -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.json.js deleted file mode 100644 index 865b3fd075..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.json.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * User Profile - Reset user avatar REST method - * - * Current user can only modify their own settings or an admin can reset all. - * - * @method PUT - */ - -function main() -{ - // Get the person details and ensure they exist for update - var userName = url.extension; - var user = people.getPerson(userName); - if (user == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Person " + userName + " does not exist"); - return; - } - - // ensure we found a valid user and that it is the current user or we are an admin - if (user == null || - (people.isAdmin(person) == false && user.properties.userName != person.properties.userName)) - { - status.code = 500; - status.message = msg.get("error.failed"); - status.redirect = true; - return; - } - - // remove old image child node if we have one - var assocs = user.childAssocs["cm:preferenceImage"]; - if (assocs != null && assocs.length == 1) - { - assocs[0].remove(); - } - // remove 'cm:avatar' target association - backward compatible with JSF web-client avatar - assocs = user.associations["cm:avatar"]; - if (assocs != null && assocs.length == 1) - { - user.removeAssociation(assocs[0], "cm:avatar"); - } - - model.success = true; -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.properties deleted file mode 100644 index ac208d39b4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Failed to locate user to modify or permission denied. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_de.properties deleted file mode 100644 index 3da6c6f179..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_de.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Zu bearbeitender Benutzer nicht gefunden oder Zugriff verweigert. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_es.properties deleted file mode 100644 index 9c67ce983f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_es.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=No se pudo localizar al usuario a modificar o permiso denegado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_fr.properties deleted file mode 100644 index 18246faca4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_fr.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Impossible de situer l'utilisateur \u00e0 modifier ou permission refus\u00e9e. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_it.properties deleted file mode 100644 index 13365a9176..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_it.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Impossibile individuare l'utente da modificare o permesso negato. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_ja.properties deleted file mode 100644 index 12aaa6d939..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_ja.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=\u5909\u66f4\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u304b\u3001\u6a29\u9650\u304c\u62d2\u5426\u3055\u308c\u307e\u3057\u305f\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_nb.properties deleted file mode 100644 index 55649277a8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_nb.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Fant ikke bruker som skulle endres eller tillatelse ikke gitt. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_nl.properties deleted file mode 100644 index b931e99a32..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_nl.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Kan de gebruiker die moet worden bijgewerkt niet vinden of toestemming is geweigerd. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_pt_BR.properties deleted file mode 100644 index 526edc39ab..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_pt_BR.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=Falha ao localizar o usu\u00e1rio para modifica\u00e7\u00e3o ou permiss\u00e3o negada. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_ru.properties deleted file mode 100644 index a898d5ef11..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_ru.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_zh_CN.properties deleted file mode 100644 index bab2eb1aeb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/resetavatar.put_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -error.failed=\u65e0\u6cd5\u627e\u5230\u8981\u4fee\u6539\u7684\u7528\u6237\u6216\u6743\u9650\u88ab\u62d2\u7edd\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.desc.xml deleted file mode 100644 index d6a0280f72..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Avatar Upload - Upload avatar file content and apply to person preferences - - user - required - /slingshot/profile/uploadavatar - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.html.ftl deleted file mode 100644 index 91cac6770a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.html.ftl +++ /dev/null @@ -1,15 +0,0 @@ - - - Upload Avatar Success - - -<#if (args.success!"")?matches("^[\\w\\d\\._]+$")> - - - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.html.status.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.html.status.ftl deleted file mode 100644 index 41659be481..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.html.status.ftl +++ /dev/null @@ -1,19 +0,0 @@ - - - Upload Avatar Failure - - -<#if (args.failure!"")?matches("^[\\w\\d\\._]+$")> - - - - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.js deleted file mode 100644 index 7ab9363bb8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * User Profile Avatar Upload method - * - * @method POST - * @param username {string} - * filedata {file} - */ - -function main() -{ - try - { - var filename = null; - var content = null; - var username = null; - - // locate file attributes - for each (field in formdata.fields) - { - if (field.name == "filedata" && field.isFile) - { - filename = field.filename; - content = field.content; - } - else if (field.name == "username") - { - username = field.value; - } - } - - // ensure all mandatory attributes have been located - if (filename == undefined || content == undefined) - { - status.code = 400; - status.message = msg.get("error.noFile"); - status.redirect = true; - return; - } - if (username == null || username.length == 0) - { - status.code = 500; - status.message = msg.get("error.noUsername"); - status.redirect = true; - return; - } - - var user = people.getPerson(username); - // ensure we found a valid user and that it is the current user or we are an admin - if (user == null || - (people.isAdmin(person) == false && user.properties.userName != person.properties.userName)) - { - status.code = 500; - status.message = msg.get("error.user"); - status.redirect = true; - return; - } - - // ensure cm:person has 'cm:preferences' aspect applied - as we want to add the avatar as - // the child node of the 'cm:preferenceImage' association - if (!user.hasAspect("cm:preferences")) - { - user.addAspect("cm:preferences"); - } - - // remove old image child node if we already have one - var assocs = user.childAssocs["cm:preferenceImage"]; - if (assocs != null && assocs.length == 1) - { - assocs[0].remove(); - } - - // create the new image node - var image = user.createNode(filename, "cm:content", "cm:preferenceImage"); - image.properties.content.write(content); - image.properties.content.guessMimetype(filename); - - if (image.properties.content.getMimetype().indexOf("image/") != 0) - { - user.removeNode(image); - status.code = 500; - status.message = msg.get("error.notImage"); - status.redirect = true; - return; - } - - image.properties.content.encoding = "UTF-8"; - image.save(); - - // wire up 'cm:avatar' target association - backward compatible with JSF web-client avatar - assocs = user.associations["cm:avatar"]; - if (assocs != null && assocs.length == 1) - { - user.removeAssociation(assocs[0], "cm:avatar"); - } - user.createAssociation(image, "cm:avatar"); - - // save ref to be returned - model.image = image; - } - catch (e) - { - var x = e; - status.code = 500; - status.message = msg.get("error.unexpected"); - if(x.message && x.message.indexOf("org.alfresco.service.cmr.usage.ContentQuotaException") == 0) - { - status.code = 413; - status.message = x.message; - } - status.redirect = true; - return; - } -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.json.ftl deleted file mode 100644 index c12892eb08..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.json.ftl +++ /dev/null @@ -1,12 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${image.nodeRef}", - "fileName": "${image.name}", - "status": - { - "code": 200, - "name": "OK", - "description" : "File uploaded successfully" - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.properties deleted file mode 100644 index 79a62d98ea..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Username parameter not supplied. -error.user=Failed to locate user to modify or permission denied. -error.notImage=Only image files are allowed for user avatar. -error.unexpected=Unexpected error occurred during upload of new content. -error.noFile=Uploaded file cannot be located in request. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_de.properties deleted file mode 100644 index df035d05b3..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_de.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Benutzername-Parameter nicht angegeben. -error.user=Zu bearbeitender Benutzer nicht gefunden oder Zugriff verweigert. -error.notImage=Als Benutzeravatar sind nur Bilddateien zul\u00e4ssig. -error.unexpected=Unerwarteter Fehler beim Hochladen von neuem Inhalt. -error.noFile=Hochgeladene Datei nicht in Anfrage gefunden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_es.properties deleted file mode 100644 index 14fd5f035e..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_es.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Par\u00e1metro de usuario no suministrado. -error.user=No se pudo localizar al usuario a modificar o permiso denegado. -error.notImage=Solo se permiten ficheros de im\u00e1genes para el avatar de usuario. -error.unexpected=Se ha producido un error inesperado durante la carga de nuevo contenido. -error.noFile=El fichero cargado no puede localizarse en los datos enviados al servidor. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_fr.properties deleted file mode 100644 index 83d2fb7bac..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_fr.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Le param\u00e8tre de nom d'utilisateur n'a pas \u00e9t\u00e9 fourni. -error.user=Impossible de situer l'utilisateur \u00e0 modifier ou permission refus\u00e9e. -error.notImage=Seuls les fichiers image sont autoris\u00e9s pour l'avatar de l'utilisateur. -error.unexpected=Une erreur inattendue s'est produite lors de l'importation de nouveau contenu. -error.noFile=Impossible de trouver dans les donn\u00e9es le fichier import\u00e9. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_it.properties deleted file mode 100644 index 6c63970583..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_it.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Parametro nome utente non specificato. -error.user=Impossibile individuare l'utente da modificare o permesso negato. -error.notImage=Sono ammessi solo file di immagine per l'avatar utente. -error.unexpected=Si \u00e8 verificato un errore imprevisto durante il caricamento del nuovo contenuto. -error.noFile=Impossibile trovare il file caricato nei dati inviati al server. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_ja.properties deleted file mode 100644 index a346bf6f4b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_ja.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=\u30e6\u30fc\u30b6\u30fc\u540d\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 -error.user=\u5909\u66f4\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u304b\u3001\u6a29\u9650\u304c\u62d2\u5426\u3055\u308c\u307e\u3057\u305f\u3002 -error.notImage=\u30e6\u30fc\u30b6\u30fc\u306e\u30a2\u30d0\u30bf\u30fc\u306b\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3067\u3059\u3002 -error.unexpected=\u65b0\u3057\u3044\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u4e2d\u306b\u60f3\u5b9a\u5916\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 -error.noFile=\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u30c7\u30fc\u30bf\u306e\u4e2d\u306b\u3042\u308a\u307e\u305b\u3093\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_nb.properties deleted file mode 100644 index bf5389c288..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_nb.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Brukernavnparameter ikke oppgitt. -error.user=Fant ikke bruker som skulle endres eller tillatelse ikke gitt. -error.notImage=Kun bildefiler tillates til bruker-avatar. -error.unexpected=Uventet feil oppstod under opplasting av nytt innhold. -error.noFile=Finner ikke opplastede fil fra foresp\u00f8rselen. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_nl.properties deleted file mode 100644 index e7448b271b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_nl.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Parameter gebruikersnaam is niet opgegeven. -error.user=Kan de gebruiker die moet worden bijgewerkt niet vinden of toestemming is geweigerd. -error.notImage=Alleen afbeeldingsbestanden zijn toegestaan voor de avatar van de gebruiker. -error.unexpected=Er is een onverwachte fout opgetreden bij het uploaden van nieuwe content. -error.noFile=Kan het ge\u00fcploade bestand niet vinden in de aanvraag. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_pt_BR.properties deleted file mode 100644 index c02963597a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_pt_BR.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=Par\u00e2metro do nome de usu\u00e1rio n\u00e3o fornecido. -error.user=Falha ao localizar o usu\u00e1rio para modifica\u00e7\u00e3o ou permiss\u00e3o negada. -error.notImage=Apenas arquivos de imagem s\u00e3o permitidos para o avatar do usu\u00e1rio. -error.unexpected=Um erro inesperado ocorreu durante o carregamento do novo conte\u00fado. -error.noFile=O arquivo carregado n\u00e3o pode ser localizado no pedido. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_ru.properties deleted file mode 100644 index 3cd2680f02..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_ru.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=\u041d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. -error.user=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d. -error.notImage=\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0432\u0430\u0442\u0430\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. -error.unexpected=\u0412 \u0445\u043e\u0434\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. -error.noFile=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_zh_CN.properties deleted file mode 100644 index 088d0b9463..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/uploadavatar.post_zh_CN.properties +++ /dev/null @@ -1,5 +0,0 @@ -error.noUsername=\u672a\u63d0\u4f9b\u7528\u6237\u540d\u53c2\u6570\u3002 -error.user=\u65e0\u6cd5\u627e\u5230\u8981\u4fee\u6539\u7684\u7528\u6237\u6216\u6743\u9650\u88ab\u62d2\u7edd\u3002 -error.notImage=\u4ec5\u56fe\u50cf\u6587\u4ef6\u53ef\u7528\u4f5c\u7528\u6237\u6807\u8bc6\u56fe\u3002 -error.unexpected=\u4e0a\u4f20\u65b0\u5185\u5bb9\u671f\u95f4\u53d1\u751f\u610f\u5916\u9519\u8bef\u3002 -error.noFile=\u65e0\u6cd5\u5728\u8bf7\u6c42\u6570\u636e\u4e2d\u627e\u5230\u4e0a\u4f20\u7684\u6587\u4ef6\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.desc.xml deleted file mode 100644 index a807ece184..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Last edited user contents - Last edited user contents - - guest - /slingshot/profile/usercontents - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js deleted file mode 100644 index a491873c6b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.js +++ /dev/null @@ -1,90 +0,0 @@ - - -var maxResults = (args.maxResults !== undefined) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS; - -function padZeros(number) -{ - return (number < 10) ? '0' + number : number; -} - -function getContents(user, type) -{ - // set range to within last 28 days - var date = new Date(); - var toQuery = date.getFullYear() + "-" + padZeros((date.getMonth()+1)) + "-" + padZeros(date.getDate()); - date.setDate(date.getDate() - 28); - var fromQuery = date.getFullYear() + "-" + padZeros((date.getMonth()+1)) + "-" + padZeros(date.getDate()); - - var userProperty = (type == 'created') ? 'creator' : 'modifier'; - - var getBlogPostsQuery = function getBlogPosts() - { - return 'PATH:"/app:company_home/st:sites/*/cm:blog/*" ' + - 'AND +TYPE:"cm:content" ' + - 'AND +@cm:' + userProperty + ':"' + user + '" ' + - 'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]'; - }; - - var getWikiPagesQuery = function getWikiPagesQuery() - { - return 'PATH:"/app:company_home/st:sites/*/cm:wiki/*" ' + - 'AND +TYPE:"cm:content" ' + - 'AND +@cm:' + userProperty + ':"' + user + '" ' + - 'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]'; - }; - - var getDiscussionsQuery = function getDiscussionsQuery() - { - return 'PATH:"/app:company_home/st:sites/*/cm:discussions//*" ' + - 'AND +TYPE:"fm:post" ' + - 'AND +@cm:' + userProperty + ':"' + user + '" ' + - 'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"]'; - }; - - var getDocumentsQuery = function getDocumentsQuery() - { - return 'TYPE:"cm:content" ' + - 'AND +@cm:' + userProperty + ':"' + user + '" ' + - 'AND +@cm:' + type + ':["' + fromQuery + '" TO "' + toQuery + '"] AND -QNAME:comment\\-*'; - }; - - var sortColumns = []; - sortColumns.push( - { - column: "@" + utils.longQName("cm:" + type), - ascending: false - }); - - var queryDef = { - query: "", - language: "fts-alfresco", - page: {maxItems: maxResults}, - onerror: "no-results", - sort: sortColumns - }; - - // perform fts-alfresco language queries - var results; - queryDef.query = getBlogPostsQuery(); - results = search.query(queryDef); - queryDef.query = getWikiPagesQuery(); - results = results.concat(search.query(queryDef)); - queryDef.query = getDiscussionsQuery(); - results = results.concat(search.query(queryDef)); - queryDef.query = getDocumentsQuery(); - results = results.concat(search.query(queryDef)); - - results.sort(function(a, b) - { - var date1 = a.properties[type].getTime(), - date2 = b.properties[type].getTime(); - return (date1 < date2) ? 1 : (date1 > date2) ? -1 : 0; - } - ); - - return processResults(results, maxResults); -} - -model.data = []; -model.data['created'] = getContents(args.user, 'created', maxResults); -model.data['modified'] = getContents(args.user, 'modified', maxResults); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.json.ftl deleted file mode 100644 index 5919dfb4ca..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/usercontents.get.json.ftl +++ /dev/null @@ -1,37 +0,0 @@ -<#macro dateFormat date>${date?string("yyyy-MM-dd'T'HH:mm:ss.SSSZ")} -<#macro formatDataItems data> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list data.items as item> - { - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "name": "${item.name!''}", - "displayName": "${item.displayName!''}", - "description": "${item.description!''}", - "createdOn": "<@dateFormat item.createdOn />", - "createdBy": "${item.createdBy!''}", - "createdByUser": "${item.createdByUser!''}", - "modifiedOn": "<@dateFormat item.modifiedOn />", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "size": ${item.size?c}, - <#if item.site??>"site": - { - "shortName": "${item.site.shortName}", - "title": "${item.site.title}" - }, - "container": "${item.container!""}", - "tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,] - }<#if item_has_next>, - - ] -} - - -{ - "created": <@formatDataItems data['created'] />, - "modified": <@formatDataItems data['modified'] /> -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.desc.xml deleted file mode 100644 index 9380df58ec..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - User Profile - User Profile POST for update - - user - required - /slingshot/profile/userprofile - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.json.ftl deleted file mode 100644 index c85c20f2b4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.json.ftl +++ /dev/null @@ -1,3 +0,0 @@ -{ - "success": ${success?string} -} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.json.js deleted file mode 100644 index 3fc220a1f2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userprofile.post.json.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * User Profile REST Update method - * - * @method POST - * @param json {string} - * { - * username: "username", - * properties: - * { - * "cm:propname": "value" - * ... - * }, - * content: - * { - * "cm:contentpropname": "contentstringvalue" - * ... - * } - * } - */ - -function main() -{ - model.success = false; - var username = json.get("username"); - if (username == null) - { - status.code = 400; - status.message = msg.get("error.noUsername"); - status.redirect = true; - return; - } - - var user = people.getPerson(username); - // ensure we found a valid user and that it is the current user or we are an admin - if (user == null || - (people.isAdmin(person) == false && user.properties.userName != person.properties.userName)) - { - status.code = 500; - status.message = msg.get("error.user"); - status.redirect = true; - return; - } - - var immutableProperties = people.getImmutableProperties(username); - if (json.has("properties")) - { - var props = json.get("properties"); - if (props != null) - { - var names = props.names(); - for (var i=0; i - User Status - User Status POST for update - - user - required - /slingshot/profile/userstatus - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userstatus.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userstatus.post.json.ftl deleted file mode 100644 index 9d91c6a79d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userstatus.post.json.ftl +++ /dev/null @@ -1,9 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ -<#if success> - "userStatus": "${userStatus}", - "userStatusTime": { "iso8601": "${xmldate(userStatusTime)}"}, - - "success": ${success?string} -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userstatus.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userstatus.post.json.js deleted file mode 100644 index 4786d850bc..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/profile/userstatus.post.json.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * User Status REST Update method - * - * @method POST - * @param json {string} - * { - * status: "value" - * } - */ - -function main() -{ - model.success = false; - - if (json.has("status")) - { - var newStatus = json.get("status"); - if (newStatus != null) - { - var statusTime = new Date(); - person.properties["cm:userStatus"] = newStatus; - person.properties["cm:userStatusTime"] = statusTime; - person.save(); - - model.success = true; - model.userStatus = newStatus; - model.userStatusTime = statusTime; - - if (newStatus.trim() != "") - { - var activity = {}; - activity.status = newStatus; - activities.postActivity("org.alfresco.profile.status-changed", null, "profile", jsonUtils.toJSONString(activity)); - } - } - } -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.desc.xml deleted file mode 100644 index 545be00a01..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Create a Content Application Instance - Creates a new Content Application Instance - Content Applications - /remote-share/content-app-instance - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.js deleted file mode 100644 index 3e2669a9fe..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.js +++ /dev/null @@ -1,100 +0,0 @@ -function main() { - - // This query should find the Share Resources folder - var alfQuery = 'PATH:"/app:company_home/cm:ContentApps"'; - - var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] - }; - - var shareResources, - nodes = search.query(queryDef); - if (nodes.length > 0) - { - shareResources = nodes[0]; - - // Get the page name and JSON definition from the request parameters... - var valid = true; - var name = args.name; - if (name == null || name == "") - { - status.code = 500; - model.errorMessage = "appType.create.error.noNameProvided"; - return false; - } - - // Check to see if the page name is already in use... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}applicationInstance"' + - ' AND PATH:"/app:company_home/cm:ContentApps//*"' + - ' AND @cm\:name:"' + name + '"'; - queryDef.query = alfQuery; - var existingAppTypes = search.query(queryDef); - if (existingAppTypes.length == 1) - { - status.code = 500; - model.errorMessage = "appType.create.error.nameAlreadyUsed"; - model.errorMessageArg = name; - return false; - } - - var targetAppType = null; - var applicationType = args.applicationType; - if (applicationType == null || applicationType == "") - { - status.code = 500; - model.errorMessage = "appType.create.error.noAppTypeProvided"; - return false; - } - else - { - // Check that the requested application type exists... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}applicationType"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + applicationType + '"'; - queryDef.query = alfQuery; - var existingAppTypes = search.query(queryDef); - if (existingAppTypes.length == 0) - { - status.code = 500; - model.errorMessage = "appType.create.error.appTypeDoesNotExist"; - return false; - } - else - { - targetAppType = existingAppTypes[0]; - } - } - - // Get the page name and it's content... - var doc = shareResources.createNode(name, "surf:applicationInstance"); - if (doc == null) - { - status.code = 500; - model.errorMessage = "appType.create.error.couldNotCreate"; - return false; - } - else - { - doc.createAssociation(targetAppType, "surf:applicationType"); - model.nodeRef = doc.nodeRef.toString(); - return true; - } - } - else - { - // The Data Dictionary location for pages hasn't been set up... - status.code = 500; - model.errorMessage = "appType.create.error.noTargetLocation"; - return false; - } - - // Shouldn't get to here - there should be a return at every code path... - model.errorMessage = "appType.create.error.unexpected"; - status.code = 500; - return false; -} - -model.success = main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.json.ftl deleted file mode 100644 index 02989c8d03..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.json.ftl +++ /dev/null @@ -1,11 +0,0 @@ -<#if success!false == true> -{ - "success": "true", - "nodeRef": "${nodeRef!""}" -} -<#else> -{ - "success": "false", - "error": "${msg(errorMessage!"", errorMessageArg!"")?html}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.properties deleted file mode 100644 index 217954ac59..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=The name "{0}" has already been used -appType.create.error.noNameProvided=No name was provided for the application type -appType.create.error.noAppTypeProvided=No application type was provided for the application -appType.create.error.appTypeDoesNotExist=Requested application type does not exist -appType.create.error.invalidJson=The application definition was not valid JSON: {0} -appType.create.error.noTargetLocation=The target location for application "ShareResources/ApplicationTypes" has not been created in the Data Dictionary -appType.create.error.couldNotCreate=It was not possible to create the application type. -appType.create.error.unexpected=An unexpected error occurred. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_de.properties deleted file mode 100644 index 5fc391c46a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_de.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=Der Name ''{0}'' wurde bereits verwendet -appType.create.error.noNameProvided=Es wurde kein Name f\u00fcr den Anwendungstyp angegeben -appType.create.error.noAppTypeProvided=Es wurde kein Anwendungstyp f\u00fcr die Anwendung angegeben -appType.create.error.appTypeDoesNotExist=Der angeforderte Anwendungstyp existiert nicht -appType.create.error.invalidJson=Die Anwendungs-Definition war eine ung\u00fcltige JSON: {0} -appType.create.error.noTargetLocation=Der Zielort f\u00fcr die Anwendung ("ShareResources/ApplicationTypes") wurde nicht im Datenverzeichnis erstellt -appType.create.error.couldNotCreate=Der Anwendungstyp konnte nicht erstellt werden. -appType.create.error.unexpected=Es ist ein unerwarteter Fehler aufgetreten. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_es.properties deleted file mode 100644 index e659052b49..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_es.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=El nombre ''{0}'' ya se ha utilizado -appType.create.error.noNameProvided=No se ha proporcionado un nombre para el tipo de aplicaci\u00f3n -appType.create.error.noAppTypeProvided=No se ha proporcionado un tipo de aplicaci\u00f3n para la aplicaci\u00f3n -appType.create.error.appTypeDoesNotExist=El tipo de aplicaci\u00f3n solicitado no existe -appType.create.error.invalidJson=La definici\u00f3n de la aplicaci\u00f3n era un JSON no v\u00e1lido: {0} -appType.create.error.noTargetLocation=La ubicaci\u00f3n de destino para la aplicaci\u00f3n "ShareResources/ApplicationTypes" no se ha creado en el diccionario de datos -appType.create.error.couldNotCreate=No se ha podido crear el tipo de aplicaci\u00f3n. -appType.create.error.unexpected=Se ha producido un error inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_fr.properties deleted file mode 100644 index 648766e7ad..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_fr.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=Le nom ''{0}'' est d\u00e9j\u00e0 utilis\u00e9 -appType.create.error.noNameProvided=Aucun nom fourni pour le type d'application -appType.create.error.noAppTypeProvided=Aucun type d'application fourni pour l'application -appType.create.error.appTypeDoesNotExist=Le type d'application requis n'existe pas -appType.create.error.invalidJson=D\u00e9finition d''application non valide JSON : {0} -appType.create.error.noTargetLocation=L'emplacement de la cible pour l'application "ShareResources/ApplicationTypes" n'a pas \u00e9t\u00e9 cr\u00e9\u00e9 dans le Dictionnaire de donn\u00e9es -appType.create.error.couldNotCreate=Impossible de cr\u00e9er le type d'application. -appType.create.error.unexpected=Une erreur inattendue s'est produite. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_it.properties deleted file mode 100644 index 134354fa93..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_it.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=Il nome ''{0}'' \u00e8 gi\u00e0 in uso -appType.create.error.noNameProvided=Non \u00e8 stato fornito alcun nome per il tipo di applicazione -appType.create.error.noAppTypeProvided=Non \u00e8 stato fornito alcun tipo per l'applicazione -appType.create.error.appTypeDoesNotExist=Il tipo di applicazione richiesto non esiste -appType.create.error.invalidJson=La definizione di applicazione non \u00e8 un file JSON valido: {0} -appType.create.error.noTargetLocation=La posizione di destinazione per l'applicazione "ShareResources/ApplicationTypes" non \u00e8 stata creata nel dizionario dati -appType.create.error.couldNotCreate=Non \u00e8 stato possibile creare il tipo di applicazione. -appType.create.error.unexpected=Si \u00e8 verificato un errore imprevisto. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_ja.properties deleted file mode 100644 index 98fa55b9f1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_ja.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=\u540d\u524d "{0}" \u306f\u65e2\u306b\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059 -appType.create.error.noNameProvided=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u306e\u540d\u524d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.noAppTypeProvided=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.appTypeDoesNotExist=\u6307\u5b9a\u3055\u308c\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u306f\u5b58\u5728\u3057\u307e\u305b\u3093 -appType.create.error.invalidJson=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5b9a\u7fa9\u306e JSON \u304c\u7121\u52b9\u3067\u3059: {0} -appType.create.error.noTargetLocation=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 "ShareResources/ApplicationTypes" \u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u5834\u6240\u304c\u30c7\u30fc\u30bf\u30c7\u30a3\u30af\u30b7\u30e7\u30ca\u30ea\u5185\u306b\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.couldNotCreate=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -appType.create.error.unexpected=\u60f3\u5b9a\u5916\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_nb.properties deleted file mode 100644 index e5e7369d40..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_nb.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=Navnet ''{0}'' er allerede brukt -appType.create.error.noNameProvided=Ingen navn oppgitt for programtypen -appType.create.error.noAppTypeProvided=Ingen programtype oppgitt for programmet -appType.create.error.appTypeDoesNotExist=Programtypen det ble bedt om, finnes ikke -appType.create.error.invalidJson=Programdefinisjonen ikke gyldig JSON: {0} -appType.create.error.noTargetLocation=M\u00e5lstedet for applikasjonen "ShareResources/ApplicationTypes" (Del ressurser / Programtyper) er ikke opprettet i dataordlisten -appType.create.error.couldNotCreate=Det var ikke mulig \u00e5 opprette programtypen. -appType.create.error.unexpected=Det oppstod en uventet feil. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_nl.properties deleted file mode 100644 index be1477e322..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_nl.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=De naam ''{0}'' is al gebruikt -appType.create.error.noNameProvided=Er is geen naam opgegeven voor het toepassingstype -appType.create.error.noAppTypeProvided=Er is geen toepassingstype opgegeven voor de toepassing -appType.create.error.appTypeDoesNotExist=Het aangevraagde toepassingstype bestaat niet -appType.create.error.invalidJson=De toepassingsdefinitie is niet geldig (JSON): {0} -appType.create.error.noTargetLocation=De doellocatie voor de toepassing "Resources/toegangstypes delen" is niet gemaakt in de data dictionary -appType.create.error.couldNotCreate=Het toepassingstype kon niet worden gemaakt. -appType.create.error.unexpected=Er is een onverwachte fout opgetreden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_pt_BR.properties deleted file mode 100644 index 9212ce21c2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_pt_BR.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=O nome ''{0}'' j\u00e1 foi usado -appType.create.error.noNameProvided=Nenhum nome foi fornecido para o tipo de aplicativo -appType.create.error.noAppTypeProvided=Nenhum tipo de aplicativo foi fornecido para o aplicativo -appType.create.error.appTypeDoesNotExist=Tipo de aplicativo solicitado n\u00e3o existe -appType.create.error.invalidJson=A defini\u00e7\u00e3o do aplicativo n\u00e3o era um JSON v\u00e1lido: {0} -appType.create.error.noTargetLocation=A localiza\u00e7\u00e3o de destino para aplicativo "ShareResources/ApplicationTypes" n\u00e3o foi criada no Dicion\u00e1rio de dados -appType.create.error.couldNotCreate=N\u00e3o foi poss\u00edvel criar o tipo de aplicativo. -appType.create.error.unexpected=Ocorreu um erro inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_ru.properties deleted file mode 100644 index 14527c4f9d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_ru.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=\u0418\u043c\u044f ''{0}'' \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e -appType.create.error.noNameProvided=\u0414\u043b\u044f \u0442\u0438\u043f\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0438\u043c\u044f -appType.create.error.noAppTypeProvided=\u0414\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0442\u0438\u043f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -appType.create.error.appTypeDoesNotExist=\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 -appType.create.error.invalidJson=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c JSON: {0} -appType.create.error.noTargetLocation=\u0412 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f "ShareResources/ApplicationTypes" -appType.create.error.couldNotCreate=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0438\u043f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. -appType.create.error.unexpected=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_zh_CN.properties deleted file mode 100644 index 7defb57f81..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instance.post_zh_CN.properties +++ /dev/null @@ -1,8 +0,0 @@ -appType.create.error.nameAlreadyUsed=\u540d\u79f0 "{0}" \u5df2\u4f7f\u7528 -appType.create.error.noNameProvided=\u6ca1\u6709\u4e3a\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u63d0\u4f9b\u540d\u79f0 -appType.create.error.noAppTypeProvided=\u6ca1\u6709\u4e3a\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b -appType.create.error.appTypeDoesNotExist=\u8bf7\u6c42\u7684\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u4e0d\u5b58\u5728 -appType.create.error.invalidJson=\u5e94\u7528\u7a0b\u5e8f\u5b9a\u4e49\u65e0\u6548 JSON\uff1a''{0}'' -appType.create.error.noTargetLocation=\u672a\u5728\u6570\u636e\u5b57\u5178\u4e2d\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f "ShareResources/ApplicationTypes" \u7684\u76ee\u6807\u4f4d\u7f6e -appType.create.error.couldNotCreate=\u65e0\u6cd5\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u3002 -appType.create.error.unexpected=\u53d1\u751f\u4e86\u610f\u5916\u9519\u8bef\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.desc.xml deleted file mode 100644 index 244b509475..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Application Instances - Returns available Application Instances - Content Applications - /remote-share/content-app-instances - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.js deleted file mode 100644 index d4932e3a91..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.js +++ /dev/null @@ -1,35 +0,0 @@ - -var alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}applicationInstance"' + - ' AND PATH:"/app:company_home/cm:ContentApps//*"'; - -// if (url.templateArgs.pagename != null) -// { -// alfQuery = alfQuery + ' AND @cm\:name:"' + url.templateArgs.pagename + '"'; -// } - -var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] -}; - -// Get article nodes -var pages = [], - item, - nodes = search.query(queryDef); - -for (var i = 0, j = nodes.length; i < j; i++) -{ - // Create core object - node = nodes[i]; - item = - { - nodeRef: node.nodeRef.toString(), - name: node.name - }; - pages.push(item); -} - - -model.data = pages; \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.json.ftl deleted file mode 100644 index 5e344992a1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-instances.get.json.ftl +++ /dev/null @@ -1,19 +0,0 @@ -<#macro renderItem item> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${item.nodeRef}", - "name": "${item.name!''}", - "content": "${item.content!''}" -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list data as item> - <@renderItem item /><#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.desc.xml deleted file mode 100644 index 0b3c92158a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Create a Content Application Type - Creates a new Content Application Type - Content Applications - /remote-share/content-app-type - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.js deleted file mode 100644 index 83473c921a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.js +++ /dev/null @@ -1,101 +0,0 @@ -function main() { - - // This query should find the Share Resources folder - var alfQuery = 'PATH:"/app:company_home/app:dictionary/cm:ShareResources/cm:ApplicationTypes"'; - - var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] - }; - - var shareResources, - nodes = search.query(queryDef); - if (nodes.length > 0) - { - shareResources = nodes[0]; - - // Get the page name and JSON definition from the request parameters... - var valid = true; - var name = args.name; - if (name == null || name == "") - { - status.code = 500; - model.errorMessage = "appType.create.error.noNameProvided"; - return false; - } - - var rootPage = args.rootPage; - if (rootPage == null || rootPage == "") - { - status.code = 500; - model.errorMessage = "appType.create.error.noRootPageProvided"; - return false; - } - else - { - // Check that the requested root page exists... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}amdpage"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + rootPage + '"'; - queryDef.query = alfQuery; - var existingPages = search.query(queryDef); - if (existingPages.length == 0) - { - status.code = 500; - model.errorMessage = "appType.create.error.rootPageDoesNotExist"; - return false; - } - } - - // Check to see if the page name is already in use... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}applicationType"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + name + '"'; - queryDef.query = alfQuery; - var existingAppTypes = search.query(queryDef); - if (existingAppTypes.length == 1) - { - status.code = 500; - model.errorMessage = "appType.create.error.nameAlreadyUsed"; - model.errorMessageArg = name; - return false; - } - - // Create the application type... - var properties = new Array(); - properties["surf:rootRage"] = rootPage; - - if (args.groups != null) - { - properties["surf:groupVisibility"] = args.groups; - } - var doc = shareResources.createNode(name, "surf:applicationType", properties); - if (doc == null) - { - status.code = 500; - model.errorMessage = "appType.create.error.couldNotCreate"; - return false; - } - else - { - model.nodeRef = doc.nodeRef.toString(); - return true; - } - } - else - { - // The Data Dictionary location for pages hasn't been set up... - status.code = 500; - model.errorMessage = "appType.create.error.noTargetLocation"; - return false; - } - - // Shouldn't get to here - there should be a return at every code path... - model.errorMessage = "appType.create.error.unexpected"; - status.code = 500; - return false; -} - -model.success = main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.json.ftl deleted file mode 100644 index 02989c8d03..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.json.ftl +++ /dev/null @@ -1,11 +0,0 @@ -<#if success!false == true> -{ - "success": "true", - "nodeRef": "${nodeRef!""}" -} -<#else> -{ - "success": "false", - "error": "${msg(errorMessage!"", errorMessageArg!"")?html}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.json.js deleted file mode 100644 index ea77ded9da..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.json.js +++ /dev/null @@ -1,95 +0,0 @@ -function main() { - - // This query should find the Share Resources folder - var alfQuery = 'PATH:"/app:company_home/app:dictionary/cm:ShareResources/cm:ApplicationTypes"'; - - var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] - }; - - var shareResources, - nodes = search.query(queryDef); - if (nodes.length > 0) - { - shareResources = nodes[0]; - - // Get the page name and JSON definition from the request parameters... - var valid = true; - var name = json.get("name"); - if (name == null || name == "") - { - status.code = 500; - model.errorMessage = "appType.create.error.noNameProvided"; - return false; - } - - var rootPage = json.get("rootPage"); - if (rootPage == null || rootPage == "") - { - status.code = 500; - model.errorMessage = "appType.create.error.noRootPageProvided"; - return false; - } - else - { - // Check that the requested root page exists... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}amdpage"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + rootPage + '"'; - queryDef.query = alfQuery; - var existingPages = search.query(queryDef); - if (existingPages.length == 0) - { - status.code = 500; - model.errorMessage = "appType.create.error.rootPageDoesNotExist"; - return false; - } - } - - // Check to see if the page name is already in use... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}applicationType"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + name + '"'; - queryDef.query = alfQuery; - var existingAppTypes = search.query(queryDef); - if (existingAppTypes.length == 1) - { - status.code = 500; - model.errorMessage = "appType.create.error.nameAlreadyUsed"; - model.errorMessageArg = name; - return false; - } - - // Create the application type... - var doc = shareResources.createNode(name, "surf:applicationType"); - if (doc == null) - { - status.code = 500; - model.errorMessage = "appType.create.error.couldNotCreate"; - return false; - } - else - { - doc.properties["surf:rootRage"] = rootPage; - model.nodeRef = doc.nodeRef.toString(); - return true; - } - } - else - { - // The Data Dictionary location for pages hasn't been set up... - status.code = 500; - model.errorMessage = "appType.create.error.noTargetLocation"; - return false; - } - - // Shouldn't get to here - there should be a return at every code path... - model.errorMessage = "appType.create.error.unexpected"; - status.code = 500; - return false; -} - -model.success = main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.properties deleted file mode 100644 index 94766c1c85..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=The name "{0}" has already been used -appType.create.error.noNameProvided=No name was provided for the application type -appType.create.error.noRootPageProvided=No root page was provided for the application type -appType.create.error.rootPageDoesNotExist=Requested root page does not exist -appType.create.error.groupDoesNotExist=Requested group does not exist -appType.create.error.noDefProvided=No application definition was provided for the application -appType.create.error.invalidJson=The application definition was not valid JSON: {0} -appType.create.error.noTargetLocation=The target location for application "ShareResources/ApplicationTypes" has not been created in the Data Dictionary -appType.create.error.couldNotCreate=It was not possible to create the application type. -appType.create.error.unexpected=An unexpected error occurred. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_de.properties deleted file mode 100644 index 5bfc212bbd..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_de.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=Der Name ''{0}'' wurde bereits verwendet -appType.create.error.noNameProvided=Es wurde kein Name f\u00fcr den Anwendungstyp angegeben -appType.create.error.noRootPageProvided=Es wurde keine Root-Seite f\u00fcr den Anwendungstyp angegeben -appType.create.error.rootPageDoesNotExist=Die angeforderte Root-Seite existiert nicht -appType.create.error.groupDoesNotExist=Die angeforderte Gruppe existiert nicht -appType.create.error.noDefProvided=Es wurde keine Anwendungs-Definition f\u00fcr die Anwendung angegeben -appType.create.error.invalidJson=Die Anwendungs-Definition war eine ung\u00fcltige JSON: {0} -appType.create.error.noTargetLocation=Der Zielort f\u00fcr die Anwendung ("ShareResources/ApplicationTypes") wurde nicht im Datenverzeichnis erstellt -appType.create.error.couldNotCreate=Der Anwendungstyp konnte nicht erstellt werden. -appType.create.error.unexpected=Es ist ein unerwarteter Fehler aufgetreten. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_es.properties deleted file mode 100644 index 994a7c05d2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_es.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=El nombre ''{0}'' ya se ha utilizado -appType.create.error.noNameProvided=No se ha proporcionado un nombre para el tipo de aplicaci\u00f3n -appType.create.error.noRootPageProvided=No se ha proporcionado una p\u00e1gina ra\u00edz para el tipo de aplicaci\u00f3n -appType.create.error.rootPageDoesNotExist=La p\u00e1gina ra\u00edz solicitada no existe -appType.create.error.groupDoesNotExist=El grupo solicitado no existe -appType.create.error.noDefProvided=No se ha proporcionado una definici\u00f3n de aplicaci\u00f3n para la aplicaci\u00f3n -appType.create.error.invalidJson=La definici\u00f3n de la aplicaci\u00f3n era un JSON no v\u00e1lido: {0} -appType.create.error.noTargetLocation=La ubicaci\u00f3n de destino para la aplicaci\u00f3n "ShareResources/ApplicationTypes" no se ha creado en el diccionario de datos -appType.create.error.couldNotCreate=No se ha podido crear el tipo de aplicaci\u00f3n. -appType.create.error.unexpected=Se ha producido un error inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_fr.properties deleted file mode 100644 index 4fa891d8ce..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_fr.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=Le nom ''{0}'' est d\u00e9j\u00e0 utilis\u00e9 -appType.create.error.noNameProvided=Aucun nom fourni pour le type d'application -appType.create.error.noRootPageProvided=Aucune page racine fournie pour le type d'application -appType.create.error.rootPageDoesNotExist=La page racine requise n'existe pas -appType.create.error.groupDoesNotExist=Le groupe requis n'existe pas -appType.create.error.noDefProvided=Aucune d\u00e9finition d'application fournie pour l'application -appType.create.error.invalidJson=D\u00e9finition d''application non valide JSON : {0} -appType.create.error.noTargetLocation=L'emplacement de la cible pour l'application "ShareResources/ApplicationTypes" n'a pas \u00e9t\u00e9 cr\u00e9\u00e9 dans le Dictionnaire de donn\u00e9es -appType.create.error.couldNotCreate=Impossible de cr\u00e9er le type d'application. -appType.create.error.unexpected=Une erreur inattendue s'est produite. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_it.properties deleted file mode 100644 index 354b6ddc06..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_it.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=Il nome ''{0}'' \u00e8 gi\u00e0 in uso -appType.create.error.noNameProvided=Non \u00e8 stato fornito alcun nome per il tipo di applicazione -appType.create.error.noRootPageProvided=Non \u00e8 stata fornita alcuna pagina d'apertura per il tipo di applicazione -appType.create.error.rootPageDoesNotExist=La pagina d'apertura richiesta non esiste -appType.create.error.groupDoesNotExist=Il gruppo richiesto non esiste -appType.create.error.noDefProvided=Non \u00e8 stata fornita alcuna definizione per l'applicazione -appType.create.error.invalidJson=La definizione di applicazione non \u00e8 un file JSON valido: {0} -appType.create.error.noTargetLocation=La posizione di destinazione per l'applicazione "ShareResources/ApplicationTypes" non \u00e8 stata creata nel dizionario dati -appType.create.error.couldNotCreate=Non \u00e8 stato possibile creare il tipo di applicazione. -appType.create.error.unexpected=Si \u00e8 verificato un errore imprevisto. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_ja.properties deleted file mode 100644 index 08e173c4e2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_ja.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=\u540d\u524d "{0}" \u306f\u65e2\u306b\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059 -appType.create.error.noNameProvided=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u306e\u540d\u524d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.noRootPageProvided=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u306e\u30eb\u30fc\u30c8\u30da\u30fc\u30b8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.rootPageDoesNotExist=\u6307\u5b9a\u3057\u305f\u30eb\u30fc\u30c8\u30da\u30fc\u30b8\u306f\u5b58\u5728\u3057\u307e\u305b\u3093 -appType.create.error.groupDoesNotExist=\u6307\u5b9a\u3057\u305f\u30b0\u30eb\u30fc\u30d7\u306f\u5b58\u5728\u3057\u307e\u305b\u3093 -appType.create.error.noDefProvided=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5b9a\u7fa9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.invalidJson=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5b9a\u7fa9\u306e JSON \u304c\u7121\u52b9\u3067\u3059: {0} -appType.create.error.noTargetLocation=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 "ShareResources/ApplicationTypes" \u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u5834\u6240\u304c\u30c7\u30fc\u30bf\u30c7\u30a3\u30af\u30b7\u30e7\u30ca\u30ea\u5185\u306b\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -appType.create.error.couldNotCreate=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u7a2e\u985e\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -appType.create.error.unexpected=\u60f3\u5b9a\u5916\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_nb.properties deleted file mode 100644 index 66051e1103..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_nb.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=Navnet ''{0}'' er allerede brukt -appType.create.error.noNameProvided=Ingen navn oppgitt for programtypen -appType.create.error.noRootPageProvided=Ingen rotside oppgitt for programtypen -appType.create.error.rootPageDoesNotExist=Rotsiden det ble bedt om, finnes ikke -appType.create.error.groupDoesNotExist=Gruppen det ble bedt om, finnes ikke -appType.create.error.noDefProvided=Ingen programdefinisjon oppgitt for applikasjonen -appType.create.error.invalidJson=Programdefinisjonen ikke gyldig JSON: {0} -appType.create.error.noTargetLocation=M\u00e5lstedet for applikasjonen "ShareResources/ApplicationTypes" (Del ressurser / Programtyper) er ikke opprettet i dataordlisten -appType.create.error.couldNotCreate=Det var ikke mulig \u00e5 opprette programtypen. -appType.create.error.unexpected=Det oppstod en uventet feil. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_nl.properties deleted file mode 100644 index c5f119b696..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_nl.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=De naam ''{0}'' is al gebruikt -appType.create.error.noNameProvided=Er is geen naam opgegeven voor het toepassingstype -appType.create.error.noRootPageProvided=Er is geen hoofdpagina opgegeven voor het toepassingstype -appType.create.error.rootPageDoesNotExist=De aangevraagde hoofdpagina bestaat niet -appType.create.error.groupDoesNotExist=De aangevraagde groep bestaat niet -appType.create.error.noDefProvided=Er is geen toepassingsdefinitie opgegeven voor de toepassing -appType.create.error.invalidJson=De toepassingsdefinitie is niet geldig (JSON): {0} -appType.create.error.noTargetLocation=De doellocatie voor de toepassing "Resources/toegangstypes delen" is niet gemaakt in de data dictionary -appType.create.error.couldNotCreate=Het toepassingstype kon niet worden gemaakt. -appType.create.error.unexpected=Er is een onverwachte fout opgetreden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_pt_BR.properties deleted file mode 100644 index 77f6a3c448..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_pt_BR.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=O nome ''{0}'' j\u00e1 foi usado -appType.create.error.noNameProvided=Nenhum nome foi fornecido para o tipo de aplicativo -appType.create.error.noRootPageProvided=Nenhua p\u00e1gina raiz foi fornecida para o tipo de aplicativo -appType.create.error.rootPageDoesNotExist=P\u00e1gina raiz solicitada n\u00e3o existe -appType.create.error.groupDoesNotExist=Grupo solicitado n\u00e3o existe -appType.create.error.noDefProvided=Nenhuma defini\u00e7\u00e3o de aplicativo foi fornecida para o aplicativo -appType.create.error.invalidJson=A defini\u00e7\u00e3o do aplicativo n\u00e3o era um JSON v\u00e1lido: {0} -appType.create.error.noTargetLocation=A localiza\u00e7\u00e3o de destino para aplicativo "ShareResources/ApplicationTypes" n\u00e3o foi criada no Dicion\u00e1rio de dados -appType.create.error.couldNotCreate=N\u00e3o foi poss\u00edvel criar o tipo de aplicativo. -appType.create.error.unexpected=Ocorreu um erro inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_ru.properties deleted file mode 100644 index 55c08754c6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_ru.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=\u0418\u043c\u044f ''{0}'' \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e -appType.create.error.noNameProvided=\u0414\u043b\u044f \u0442\u0438\u043f\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0438\u043c\u044f -appType.create.error.noRootPageProvided=\u0414\u043b\u044f \u0442\u0438\u043f\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 -appType.create.error.rootPageDoesNotExist=\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 -appType.create.error.groupDoesNotExist=\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 -appType.create.error.noDefProvided=\u0414\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -appType.create.error.invalidJson=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c JSON: {0} -appType.create.error.noTargetLocation=\u0412 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f "ShareResources/ApplicationTypes" -appType.create.error.couldNotCreate=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0438\u043f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. -appType.create.error.unexpected=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_zh_CN.properties deleted file mode 100644 index 83459418e2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-type.post_zh_CN.properties +++ /dev/null @@ -1,10 +0,0 @@ -appType.create.error.nameAlreadyUsed=\u540d\u79f0 "{0}" \u5df2\u4f7f\u7528 -appType.create.error.noNameProvided=\u6ca1\u6709\u4e3a\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u63d0\u4f9b\u540d\u79f0 -appType.create.error.noRootPageProvided=\u6ca1\u6709\u4e3a\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u63d0\u4f9b\u6839\u9875\u9762 -appType.create.error.rootPageDoesNotExist=\u8bf7\u6c42\u7684\u6839\u9875\u9762\u4e0d\u5b58\u5728 -appType.create.error.groupDoesNotExist=\u8bf7\u6c42\u7684\u7ec4\u4e0d\u5b58\u5728 -appType.create.error.noDefProvided=\u6ca1\u6709\u4e3a\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u5e94\u7528\u7a0b\u5e8f\u5b9a\u4e49 -appType.create.error.invalidJson=\u5e94\u7528\u7a0b\u5e8f\u5b9a\u4e49\u65e0\u6548 JSON\uff1a''{0}'' -appType.create.error.noTargetLocation=\u672a\u5728\u6570\u636e\u5b57\u5178\u4e2d\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f "ShareResources/ApplicationTypes" \u7684\u76ee\u6807\u4f4d\u7f6e -appType.create.error.couldNotCreate=\u65e0\u6cd5\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u3002 -appType.create.error.unexpected=\u53d1\u751f\u4e86\u610f\u5916\u9519\u8bef\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.desc.xml deleted file mode 100644 index 21b4f21590..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Application Types - Returns available Application Types - Content Applications - /remote-share/content-app-types - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.js deleted file mode 100644 index a3417fb8b1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.js +++ /dev/null @@ -1,40 +0,0 @@ - -var alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}applicationType"' + - ' AND PATH:"/app:company_home/app:dictionary//*"'; - -// if (url.templateArgs.pagename != null) -// { -// alfQuery = alfQuery + ' AND @cm\:name:"' + url.templateArgs.pagename + '"'; -// } - -var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] -}; - -// Get article nodes -var pages = [], - item, - nodes = search.query(queryDef); - -var includeContent = (nodes.length == 1); -for (var i = 0, j = nodes.length; i < j; i++) -{ - // Create core object - node = nodes[i]; - item = - { - nodeRef: node.nodeRef.toString(), - name: node.name - }; - if (includeContent) - { - item.content = node.content; - } - pages.push(item); -} - - -model.data = pages; \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.json.ftl deleted file mode 100644 index 5e344992a1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/content-apps/application-types.get.json.ftl +++ /dev/null @@ -1,19 +0,0 @@ -<#macro renderItem item> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${item.nodeRef}", - "name": "${item.name!''}", - "content": "${item.content!''}" -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list data as item> - <@renderItem item /><#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.desc.xml deleted file mode 100644 index 13434176de..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Create a Page Definition - Creates a Page definition - Remote Share - /remote-share/page-definition - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.json.ftl deleted file mode 100644 index 02989c8d03..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.json.ftl +++ /dev/null @@ -1,11 +0,0 @@ -<#if success!false == true> -{ - "success": "true", - "nodeRef": "${nodeRef!""}" -} -<#else> -{ - "success": "false", - "error": "${msg(errorMessage!"", errorMessageArg!"")?html}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.json.js deleted file mode 100644 index cdb4836de7..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.json.js +++ /dev/null @@ -1,96 +0,0 @@ -function main() { - - // This query should find the Share Resources folder - var alfQuery = 'PATH:"/app:company_home/app:dictionary/cm:ShareResources/cm:Pages"'; - - var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] - }; - - var shareResources, - nodes = search.query(queryDef); - if (nodes.length > 0) - { - shareResources = nodes[0]; - - // Get the page name and JSON definition from the request parameters... - var valid = true; - var name = json.get("name"); - var def = json.get("json"); - if (name == null || name == "") - { - status.code = 500; - model.errorMessage = "page.create.error.noNameProvided"; - return false; - } - - // Check to see if the page name is already in use... - alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}amdpage"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + name + '"'; - queryDef.query = alfQuery; - var existingPages = search.query(queryDef); - if (existingPages.length == 1) - { - status.code = 500; - model.errorMessage = "page.create.error.nameAlreadyUsed"; - model.errorMessageArg = name; - return false; - } - - if (def == null || def == "") - { - status.code = 500; - model.errorMessage = "page.create.error.noDefProvided" - model.errorMessageArg = def; - return false; - } - - try - { - pageDetails = jsonUtils.toObject(def); - } - catch(e) - { - status.code = 500; - model.errorMessage = "page.create.error.invalidJson"; - model.errorMessageArg = def; - return false; - } - - // Get the page name and it's content... - var pageDefinitionName = name; - var pageDefinitionJSON = def; - var doc = shareResources.createNode(pageDefinitionName, "surf:amdpage"); - if (doc == null) - { - status.code = 500; - model.errorMessage = "page.create.error.couldNotCreate"; - return false; - } - else - { - doc.content = pageDefinitionJSON; - doc.mimetype = "application/json"; - model.nodeRef = doc.nodeRef.toString(); - return true; - } - } - else - { - // The Data Dictionary location for pages hasn't been set up... - status.code = 500; - model.errorMessage = "page.create.error.noTargetLocation"; - return false; - } - - // Shouldn't get to here - there should be a return at every code path... - model.errorMessage = "page.create.error.unexpected"; - status.code = 500; - return false; -} - -model.success = main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.properties deleted file mode 100644 index c180d75750..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=The name "{0}" has already been used -page.create.error.noNameProvided=No name was provided for the page -page.create.error.noDefProvided=No page definition was provided for the page -page.create.error.invalidJson=The page definition was not valid JSON: {0} -page.create.error.noTargetLocation=The target location for pages "ShareResources/pages" has not been created in the Data Dictionary -page.create.error.couldNotCreate=It was not possible to create the page. -page.create.error.unexpected=An unexpected error occurred. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_de.properties deleted file mode 100644 index 57c5c43102..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_de.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=Der Name ''{0}'' wurde bereits verwendet -page.create.error.noNameProvided=Es wurde kein Name f\u00fcr die Seite angegeben -page.create.error.noDefProvided=Es wurde keine Seitendefinition f\u00fcr die Seite angegeben -page.create.error.invalidJson=Die Seitendefinition war eine ung\u00fcltige JSON: {0} -page.create.error.noTargetLocation=Der Zielort f\u00fcr Seiten ("ShareResources/pages") wurde nicht im Datenverzeichnis erstellt -page.create.error.couldNotCreate=Die Seite konnte nicht erstellt werden. -page.create.error.unexpected=Es ist ein unerwarteter Fehler aufgetreten. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_es.properties deleted file mode 100644 index 487f9479fb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_es.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=El nombre ''{0}'' ya se ha utilizado -page.create.error.noNameProvided=No se ha proporcionado un nombre para la p\u00e1gina -page.create.error.noDefProvided=No se ha proporcionado una definici\u00f3n de p\u00e1gina para la p\u00e1gina -page.create.error.invalidJson=La definici\u00f3n de p\u00e1gina era un JSON no v\u00e1lido: {0} -page.create.error.noTargetLocation=La ubicaci\u00f3n de destino para las p\u00e1ginas "ShareResources/pages" no se ha creado en el diccionario de datos -page.create.error.couldNotCreate=No se ha podido crear la p\u00e1gina. -page.create.error.unexpected=Se ha producido un error inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_fr.properties deleted file mode 100644 index 0707de0296..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_fr.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=Le nom ''{0}'' est d\u00e9j\u00e0 utilis\u00e9 -page.create.error.noNameProvided=Aucun nom fourni pour la page -page.create.error.noDefProvided=Aucune d\u00e9finition de page n'a \u00e9t\u00e9 fournie pour la page -page.create.error.invalidJson=D\u00e9finition de page non valide JSON : {0} -page.create.error.noTargetLocation=L'emplacement de la cible pour les pages "ShareResources/pages" n'a pas \u00e9t\u00e9 cr\u00e9\u00e9 dans le Dictionnaire de donn\u00e9es -page.create.error.couldNotCreate=Impossible de cr\u00e9er la page. -page.create.error.unexpected=Une erreur inattendue s'est produite. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_it.properties deleted file mode 100644 index efb6c02f73..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_it.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=Il nome ''{0}'' \u00e8 gi\u00e0 in uso -page.create.error.noNameProvided=Non \u00e8 stato fornito alcun nome per la pagina -page.create.error.noDefProvided=Non \u00e8 stata fornita alcuna definizione di pagina per la pagina -page.create.error.invalidJson=La definizione di pagina non \u00e8 un file JSON valido: {0} -page.create.error.noTargetLocation=La posizione di destinazione per le pagine "ShareResources/pages" non \u00e8 stata creata nel dizionario dati -page.create.error.couldNotCreate=Non \u00e8 stato possibile creare la pagina. -page.create.error.unexpected=Si \u00e8 verificato un errore imprevisto. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_ja.properties deleted file mode 100644 index 854f4989e0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_ja.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=\u540d\u524d "{0}" \u306f\u65e2\u306b\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059 -page.create.error.noNameProvided=\u30da\u30fc\u30b8\u306e\u540d\u524d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -page.create.error.noDefProvided=\u30da\u30fc\u30b8\u306e\u30da\u30fc\u30b8\u5b9a\u7fa9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -page.create.error.invalidJson=\u30da\u30fc\u30b8\u5b9a\u7fa9\u306e JSON \u304c\u7121\u52b9\u3067\u3059: {0} -page.create.error.noTargetLocation=\u30da\u30fc\u30b8 "ShareResources/pages" \u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u5834\u6240\u304c\u30c7\u30fc\u30bf\u30c7\u30a3\u30af\u30b7\u30e7\u30ca\u30ea\u5185\u306b\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -page.create.error.couldNotCreate=\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -page.create.error.unexpected=\u60f3\u5b9a\u5916\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_nb.properties deleted file mode 100644 index aa047e2f4d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_nb.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=Navnet ''{0}'' er allerede brukt -page.create.error.noNameProvided=Intet navn oppgitt for siden -page.create.error.noDefProvided=Ingen sidedefinisjon oppgitt for siden -page.create.error.invalidJson=Sidedefinisjonen ikke gyldig JSON: {0} -page.create.error.noTargetLocation=M\u00e5lstedet for sidene "ShareResources/sider" ikke opprettet i datamappen -page.create.error.couldNotCreate=Det var ikke mulig \u00e5 opprette siden. -page.create.error.unexpected=Det oppstod en uventet feil. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_nl.properties deleted file mode 100644 index 74a8b02383..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_nl.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=De naam ''{0}'' is al gebruikt -page.create.error.noNameProvided=Er is geen naam opgegeven voor de pagina -page.create.error.noDefProvided=Er is geen paginadefinitie opgegeven voor de pagina -page.create.error.invalidJson=De paginadefinitie is niet geldig (JSON): {0} -page.create.error.noTargetLocation=De doellocatie voor de pagina's "Resources/pagina's delen" is niet gemaakt in de data dictionary -page.create.error.couldNotCreate=De pagina kon niet worden gemaakt. -page.create.error.unexpected=Er is een onverwachte fout opgetreden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_pt_BR.properties deleted file mode 100644 index 4578027edf..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_pt_BR.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=O nome ''{0}'' j\u00e1 foi usado -page.create.error.noNameProvided=N\u00e3o foi fornecido um nome para a p\u00e1gina -page.create.error.noDefProvided=N\u00e3o foi fornecida uma defini\u00e7\u00e3o para a p\u00e1gina -page.create.error.invalidJson=A defini\u00e7\u00e3o da p\u00e1gina n\u00e3o era um JSON v\u00e1lido: {0} -page.create.error.noTargetLocation=A localiza\u00e7\u00e3o de destino para p\u00e1ginas "ShareResources/pages" n\u00e3o foi criada no Dicion\u00e1rio de dados -page.create.error.couldNotCreate=N\u00e3o foi poss\u00edvel criar a p\u00e1gina. -page.create.error.unexpected=Ocorreu um erro inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_ru.properties deleted file mode 100644 index 326ebb1a88..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_ru.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=\u0418\u043c\u044f ''{0}'' \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e -page.create.error.noNameProvided=\u0414\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043c\u044f -page.create.error.noDefProvided=\u0414\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 -page.create.error.invalidJson=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c JSON: {0} -page.create.error.noTargetLocation=\u0412 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 "ShareResources/pages" -page.create.error.couldNotCreate=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. -page.create.error.unexpected=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_zh_CN.properties deleted file mode 100644 index f8157c9379..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.post_zh_CN.properties +++ /dev/null @@ -1,7 +0,0 @@ -page.create.error.nameAlreadyUsed=\u540d\u79f0 "{0}" \u5df2\u4f7f\u7528 -page.create.error.noNameProvided=\u6ca1\u6709\u4e3a\u9875\u9762\u6307\u5b9a\u540d\u79f0 -page.create.error.noDefProvided=\u6ca1\u6709\u63d0\u4f9b\u9875\u9762\u5b9a\u4e49 -page.create.error.invalidJson=\u9875\u9762\u5b9a\u4e49\u65e0\u6548 JSON\uff1a{0} -page.create.error.noTargetLocation=\u672a\u5728\u6570\u636e\u5b57\u5178\u4e2d\u521b\u5efa\u9875\u9762"ShareResources/pages"\u7684\u76ee\u6807\u4f4d\u7f6e -page.create.error.couldNotCreate=\u65e0\u6cd5\u521b\u5efa\u9875\u9762\u3002 -page.create.error.unexpected=\u53d1\u751f\u4e86\u610f\u5916\u9519\u8bef\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.desc.xml deleted file mode 100644 index 12bb975f31..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Update a Page Definition - Updates an existing Page definition - Remote Share - /remote-share/page-definition/{pagename} - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.json.ftl deleted file mode 100644 index 02989c8d03..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.json.ftl +++ /dev/null @@ -1,11 +0,0 @@ -<#if success!false == true> -{ - "success": "true", - "nodeRef": "${nodeRef!""}" -} -<#else> -{ - "success": "false", - "error": "${msg(errorMessage!"", errorMessageArg!"")?html}" -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.json.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.json.js deleted file mode 100644 index 3331f00b23..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.json.js +++ /dev/null @@ -1,66 +0,0 @@ -function main() { - - if (url.templateArgs.pagename != null) - { - var alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}amdpage"' + - ' AND PATH:"/app:company_home/app:dictionary//*"' + - ' AND @cm\:name:"' + url.templateArgs.pagename + '"';; - var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] - }; - - var pages = [], - targetPage, - nodes = search.query(queryDef); - if (nodes.length > 0) - { - targetPage = nodes[0]; - var def = json.get("json"); - if (def == null || def == "") - { - status.code = 500; - model.errorMessage = "page.update.error.noDefProvided" - model.errorMessageArg = def; - return false; - } - - try - { - pageDetails = jsonUtils.toObject(def); - } - catch(e) - { - status.code = 500; - model.errorMessage = "page.update.error.invalidJson"; - model.errorMessageArg = def; - return false; - } - - targetPage.addAspect("cm:versionable"); - var workingCopy = targetPage.checkout(); - var pageDefinitionJSON = def; - workingCopy.content = pageDefinitionJSON; - targetPage = workingCopy.checkin(); - return true; - } - - } - else - { - // Not provided with anything to update - model.errorMessage = "page.update.error.doesNotExist"; - status.code = 500; - return false; - } - - - // Shouldn't get to here - there should be a return at every code path... - model.errorMessage = "page.update.error.unexpected"; - status.code = 500; - return false; -} - -model.success = main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.properties deleted file mode 100644 index da1af0386d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=The name "{0}" has already been used -page.update.error.noNameProvided=No name was provided for the page -page.update.error.noDefProvided=No page definition was provided for the page -page.update.error.invalidJson=The page definition was not valid JSON: {0} -page.update.error.noTargetLocation=The target location for pages "ShareResources/pages" has not been created in the Data Dictionary -page.update.error.couldNotCreate=It was not possible to create the page. -page.update.error.doesNotExist=The requested page to update does not exist -page.update.error.unexpected=An unexpected error occurred. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_de.properties deleted file mode 100644 index d8cb058a06..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_de.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=Der Name ''{0}'' wurde bereits verwendet -page.update.error.noNameProvided=Es wurde kein Name f\u00fcr die Seite angegeben -page.update.error.noDefProvided=Es wurde keine Seitendefinition f\u00fcr die Seite angegeben -page.update.error.invalidJson=Die Seitendefinition war eine ung\u00fcltige JSON: {0} -page.update.error.noTargetLocation=Der Zielort f\u00fcr Seiten ("ShareResources/pages") wurde nicht im Datenverzeichnis erstellt -page.update.error.couldNotCreate=Die Seite konnte nicht erstellt werden. -page.update.error.doesNotExist=Die zum Aktualisieren angeforderte Seite gibt es nicht -page.update.error.unexpected=Es ist ein unerwarteter Fehler aufgetreten. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_es.properties deleted file mode 100644 index bf2995eff5..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_es.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=El nombre ''{0}'' ya se ha utilizado -page.update.error.noNameProvided=No se ha proporcionado un nombre para la p\u00e1gina -page.update.error.noDefProvided=No se ha proporcionado una definici\u00f3n de p\u00e1gina para la p\u00e1gina -page.update.error.invalidJson=La definici\u00f3n de p\u00e1gina era un JSON no v\u00e1lido: {0} -page.update.error.noTargetLocation=La ubicaci\u00f3n de destino para las p\u00e1ginas "ShareResources/pages" no se ha creado en el diccionario de datos -page.update.error.couldNotCreate=No se ha podido crear la p\u00e1gina. -page.update.error.doesNotExist=La p\u00e1gina solicitada para actualizaci\u00f3n no existe -page.update.error.unexpected=Se ha producido un error inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_fr.properties deleted file mode 100644 index 852cad403e..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_fr.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=Le nom ''{0}'' est d\u00e9j\u00e0 utilis\u00e9 -page.update.error.noNameProvided=Aucun nom fourni pour la page -page.update.error.noDefProvided=Aucune d\u00e9finition de page n'a \u00e9t\u00e9 fournie pour la page -page.update.error.invalidJson=D\u00e9finition de page non valide JSON : {0} -page.update.error.noTargetLocation=L'emplacement de la cible pour les pages "ShareResources/pages" n'a pas \u00e9t\u00e9 cr\u00e9\u00e9 dans le Dictionnaire de donn\u00e9es -page.update.error.couldNotCreate=Impossible de cr\u00e9er la page. -page.update.error.doesNotExist=La page \u00e0 mettre \u00e0 jour n'existe pas -page.update.error.unexpected=Une erreur inattendue s'est produite. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_it.properties deleted file mode 100644 index f1944842bc..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_it.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=Il nome ''{0}'' \u00e8 gi\u00e0 in uso -page.update.error.noNameProvided=Non \u00e8 stato fornito alcun nome per la pagina -page.update.error.noDefProvided=Non \u00e8 stata fornita alcuna definizione di pagina per la pagina -page.update.error.invalidJson=La definizione di pagina non \u00e8 un file JSON valido: {0} -page.update.error.noTargetLocation=La posizione di destinazione per le pagine "ShareResources/pages" non \u00e8 stata creata nel dizionario dati -page.update.error.couldNotCreate=Non \u00e8 stato possibile creare la pagina. -page.update.error.doesNotExist=La pagina richiesta da aggiornare non esiste -page.update.error.unexpected=Si \u00e8 verificato un errore imprevisto. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_ja.properties deleted file mode 100644 index 7fbd9c0eb3..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_ja.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=\u540d\u524d "{0}" \u306f\u65e2\u306b\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059 -page.update.error.noNameProvided=\u30da\u30fc\u30b8\u306e\u540d\u524d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -page.update.error.noDefProvided=\u30da\u30fc\u30b8\u306e\u30da\u30fc\u30b8\u5b9a\u7fa9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -page.update.error.invalidJson=\u30da\u30fc\u30b8\u5b9a\u7fa9\u306e JSON \u304c\u7121\u52b9\u3067\u3059: {0} -page.update.error.noTargetLocation=\u30da\u30fc\u30b8 "ShareResources/pages" \u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u5834\u6240\u304c\u30c7\u30fc\u30bf\u30c7\u30a3\u30af\u30b7\u30e7\u30ca\u30ea\u5185\u306b\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u305b\u3093 -page.update.error.couldNotCreate=\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -page.update.error.doesNotExist=\u66f4\u65b0\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u30da\u30fc\u30b8\u306f\u5b58\u5728\u3057\u307e\u305b\u3093 -page.update.error.unexpected=\u60f3\u5b9a\u5916\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_nb.properties deleted file mode 100644 index adb2dd1277..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_nb.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=Navnet ''{0}'' er allerede brukt -page.update.error.noNameProvided=Intet navn oppgitt for siden -page.update.error.noDefProvided=Ingen sidedefinisjon oppgitt for siden -page.update.error.invalidJson=Sidedefinisjonen ikke gyldig JSON: {0} -page.update.error.noTargetLocation=M\u00e5lstedet for sidene "ShareResources/sider" ikke opprettet i datamappen -page.update.error.couldNotCreate=Det var ikke mulig \u00e5 opprette siden. -page.update.error.doesNotExist=Forespurt side som skal oppdateres eksisterer ikke -page.update.error.unexpected=Det oppstod en uventet feil. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_nl.properties deleted file mode 100644 index 8aafc38bd4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_nl.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=De naam ''{0}'' is al gebruikt -page.update.error.noNameProvided=Er is geen naam opgegeven voor de pagina -page.update.error.noDefProvided=Er is geen paginadefinitie opgegeven voor de pagina -page.update.error.invalidJson=De paginadefinitie is niet geldig (JSON): {0} -page.update.error.noTargetLocation=De doellocatie voor de pagina's "Resources/pagina's delen" is niet gemaakt in de data dictionary -page.update.error.couldNotCreate=De pagina kon niet worden gemaakt. -page.update.error.doesNotExist=De opgevraagde pagina die moet worden bijgewerkt bestaat niet -page.update.error.unexpected=Er is een onverwachte fout opgetreden. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_pt_BR.properties deleted file mode 100644 index d853a27a5b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_pt_BR.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=O nome ''{0}'' j\u00e1 foi usado -page.update.error.noNameProvided=N\u00e3o foi fornecido um nome para a p\u00e1gina -page.update.error.noDefProvided=N\u00e3o foi fornecida uma defini\u00e7\u00e3o para a p\u00e1gina -page.update.error.invalidJson=A defini\u00e7\u00e3o da p\u00e1gina n\u00e3o era um JSON v\u00e1lido: {0} -page.update.error.noTargetLocation=A localiza\u00e7\u00e3o de destino para p\u00e1ginas "ShareResources/pages" n\u00e3o foi criada no Dicion\u00e1rio de dados -page.update.error.couldNotCreate=N\u00e3o foi poss\u00edvel criar a p\u00e1gina. -page.update.error.doesNotExist=A p\u00e1gina solicitada para atualizar n\u00e3o existe -page.update.error.unexpected=Ocorreu um erro inesperado. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_ru.properties deleted file mode 100644 index 3857942078..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_ru.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=\u0418\u043c\u044f ''{0}'' \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e -page.update.error.noNameProvided=\u0414\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043c\u044f -page.update.error.noDefProvided=\u0414\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 -page.update.error.invalidJson=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c JSON: {0} -page.update.error.noTargetLocation=\u0412 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 "ShareResources/pages" -page.update.error.couldNotCreate=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. -page.update.error.doesNotExist=\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435, \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 -page.update.error.unexpected=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_zh_CN.properties deleted file mode 100644 index d2873564a2..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/page-definition.put_zh_CN.properties +++ /dev/null @@ -1,8 +0,0 @@ -page.update.error.nameAlreadyUsed=\u540d\u79f0 "{0}" \u5df2\u4f7f\u7528 -page.update.error.noNameProvided=\u6ca1\u6709\u4e3a\u9875\u9762\u6307\u5b9a\u540d\u79f0 -page.update.error.noDefProvided=\u6ca1\u6709\u63d0\u4f9b\u9875\u9762\u5b9a\u4e49 -page.update.error.invalidJson=\u9875\u9762\u5b9a\u4e49\u65e0\u6548 JSON\uff1a{0} -page.update.error.noTargetLocation=\u672a\u5728\u6570\u636e\u5b57\u5178\u4e2d\u521b\u5efa\u9875\u9762"ShareResources/pages"\u7684\u76ee\u6807\u4f4d\u7f6e -page.update.error.couldNotCreate=\u65e0\u6cd5\u521b\u5efa\u9875\u9762\u3002 -page.update.error.doesNotExist=\u8bf7\u6c42\u66f4\u65b0\u7684\u9875\u9762\u4e0d\u5b58\u5728 -page.update.error.unexpected=\u53d1\u751f\u4e86\u610f\u5916\u9519\u8bef\u3002 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.desc.xml deleted file mode 100644 index 5717a5424a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.desc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - Remote Pages - Returns available page definitions - Remote Share - /remote-share/pages - /remote-share/pages/name/{pagename} - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.js deleted file mode 100644 index 42484dd8d1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.js +++ /dev/null @@ -1,40 +0,0 @@ - -var alfQuery = 'TYPE:"{http://www.alfresco.org/model/surf/1.0}amdpage"' + - ' AND PATH:"/app:company_home/app:dictionary//*"'; - -if (url.templateArgs.pagename != null) -{ - alfQuery = alfQuery + ' AND @cm\:name:"' + url.templateArgs.pagename + '"'; -} - -var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] -}; - -// Get article nodes -var pages = [], - item, - nodes = search.query(queryDef); - -var includeContent = (nodes.length == 1); -for (var i = 0, j = nodes.length; i < j; i++) -{ - // Create core object - node = nodes[i]; - item = - { - nodeRef: node.nodeRef.toString(), - name: node.name - }; - if (includeContent) - { - item.content = node.content; - } - pages.push(item); -} - - -model.data = pages; \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.json.ftl deleted file mode 100644 index 5e344992a1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/pages.get.json.ftl +++ /dev/null @@ -1,19 +0,0 @@ -<#macro renderItem item> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${item.nodeRef}", - "name": "${item.name!''}", - "content": "${item.content!''}" -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list data as item> - <@renderItem item /><#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.desc.xml deleted file mode 100644 index 39d6756930..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Remote Services - Returns available services - Remote Share - /remote-share/services - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.js deleted file mode 100644 index d24fff7653..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.js +++ /dev/null @@ -1,31 +0,0 @@ - -var alfQuery = 'ASPECT:"{http://www.alfresco.org/model/surf/1.0}service"' + - ' AND PATH:"/app:company_home/app:dictionary//*"'; - -var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] -}; - -// Get article nodes -var services = [], - item, - nodes = search.query(queryDef); - -for (var i = 0, j = nodes.length; i < j; i++) -{ - // Create core object - node = nodes[i]; - item = - { - nodeRef: node.nodeRef.toString(), - mid: node.properties["surf:mid"], - label: node.properties["surf:label"] - }; - services.push(item); -} - - -model.data = services; \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.json.ftl deleted file mode 100644 index 50826455d3..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/services.get.json.ftl +++ /dev/null @@ -1,19 +0,0 @@ -<#macro renderItem item> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${item.nodeRef}", - "mid": "${item.mid!''}", - "label": "${item.label!''}" -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "services": - [ - <#list data as item> - <@renderItem item /><#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.desc.xml deleted file mode 100644 index 12922bc20d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Remote Widgets - Returns available widgets - Remote Share - /remote-share/widgets - - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.js deleted file mode 100644 index 7cd9acedff..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.js +++ /dev/null @@ -1,32 +0,0 @@ - -var alfQuery = 'ASPECT:"{http://www.alfresco.org/model/surf/1.0}widget"' + - ' AND PATH:"/app:company_home/app:dictionary//*"'; - -var queryDef = { - query: alfQuery, - language: "fts-alfresco", - page: {maxItems: 50}, - templates: [] -}; - -// Get article nodes -var widgets = [], - item, - nodes = search.query(queryDef); - -for (var i = 0, j = nodes.length; i < j; i++) -{ - // Create core object - node = nodes[i]; - item = - { - nodeRef: node.nodeRef.toString(), - widgetType: node.properties["surf:widgetType"], - mid: node.properties["surf:mid"], - label: node.properties["surf:label"] - }; - widgets.push(item); -} - - -model.data = widgets; \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.json.ftl deleted file mode 100644 index 00597afa5b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/remote-content/widgets.get.json.ftl +++ /dev/null @@ -1,20 +0,0 @@ -<#macro renderItem item> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "nodeRef": "${item.nodeRef}", - "widgetType": "${item.widgetType!''}", - "mid": "${item.mid!''}", - "label": "${item.label!''}" -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "widgets": - [ - <#list data as item> - <@renderItem item /><#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/auto-suggest-search.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/auto-suggest-search.get.desc.xml deleted file mode 100644 index b14f641c3c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/auto-suggest-search.get.desc.xml +++ /dev/null @@ -1,35 +0,0 @@ - - Share Auto Suggest - - :/alfresco/service/slingshot/auto-suggest?t={term}&limit={limit?} - - Example response from this web script for the term "tes": - - { - "suggestions" : - [ - { - "weight" : 5, - "term" : "test" - }, - { - "weight" : 1, - "term" : "test call" - }, - { - "weight" : 1, - "term" : "test plan" - } - ] - } - ]]> - - /slingshot/auto-suggest?t={term}&limit={limit?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/auto-suggest-search.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/auto-suggest-search.get.json.ftl deleted file mode 100644 index b1d813cec8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/auto-suggest-search.get.json.ftl +++ /dev/null @@ -1,13 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "suggestions" : - [ - <#list suggestions as suggestion> - { - "weight" : ${suggestion.weight?c}, - "term" : "${suggestion.term}" - }<#if suggestion_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.config.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.config.xml deleted file mode 100644 index 0dce806754..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.config.xml +++ /dev/null @@ -1,4 +0,0 @@ - - AND - %(cm:name cm:title cm:description TEXT TAG) - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.desc.xml deleted file mode 100644 index 1738f43e80..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Share Live Search - Documents - Share Live Search Component Data Webscript - /slingshot/live-search-docs?t={term} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.js deleted file mode 100644 index a6e9c14a41..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.js +++ /dev/null @@ -1,24 +0,0 @@ - - -function main() -{ - if (args.t === null || args.t.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Query terms must be provided"); - return; - } - - var params = - { - type: "documents", - term: args.t, - siteId: args.s, - rootNode: (args.rootNode !== null) ? args.rootNode : null, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0 - }; - - model.data = liveSearch(params); -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.json.ftl deleted file mode 100644 index 63775207a9..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-docs.get.json.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${data.totalRecords?c}, - "startIndex": ${data.startIndex?c}, - "hasMoreRecords": ${data.hasMoreRecords?string}, - "items": - [ - <#list data.items as item> - { - "nodeRef": "${item.nodeRef}", - "name": "${item.name!''}", - "title": "${item.title!''}", - "description": "${item.description!''}", - "modifiedOn": "${xmldate(item.modifiedOn)}", - "modifiedBy": "${item.modifiedBy}", - <#if item.site??> - "site": - { - "shortName": "${item.site.shortName}", - "title": "${item.site.title}" - }, - "container": "${item.container}", - - <#if item.lastThumbnailModification??> - "lastThumbnailModification": "${item.lastThumbnailModification}", - - "size": ${item.size?c}, - "mimetype": "${item.mimetype!''}" - }<#if item_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.desc.xml deleted file mode 100644 index f722a3b508..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Share Live Search - People - Share Live Search Component Data Webscript - /slingshot/live-search-people?t={term} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.js deleted file mode 100644 index 2762cfc6f1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.js +++ /dev/null @@ -1,22 +0,0 @@ - - -function main() -{ - if (args.t === null || args.t.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Query terms must be provided"); - return; - } - - var params = - { - type: "people", - term: args.t, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0 - }; - - model.data = liveSearch(params); -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.json.ftl deleted file mode 100644 index 8c8a564e13..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-people.get.json.ftl +++ /dev/null @@ -1,26 +0,0 @@ -<#macro personSummaryJSON person> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "url": "${url.serviceContext + "/api/people/" + person.properties.userName}", - "userName": "${person.properties.userName}", - "firstName": "${person.properties.firstName!""}", - "lastName": "${person.properties.lastName!""}", - "jobtitle": "${person.properties.jobtitle!""}", - "location": "${person.properties.location!""}", - "email": "${person.properties.email!""}", - "organization": "${person.properties.organization!""}" -} - - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${data.totalRecords?c}, - "startIndex": ${data.startIndex?c}, - "items": - [ - <#list data.items as person> - <@personSummaryJSON person=person/><#if person_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.desc.xml deleted file mode 100644 index b29563dccb..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Share Live Search - Sites - Share Live Search Component Data Webscript - /slingshot/live-search-sites?t={term} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.js deleted file mode 100644 index 2ddc859df0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.js +++ /dev/null @@ -1,22 +0,0 @@ - - -function main() -{ - if (args.t === null || args.t.length === 0) - { - status.setCode(status.STATUS_BAD_REQUEST, "Query terms must be provided"); - return; - } - - var params = - { - type: "sites", - term: args.t, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0 - }; - - model.data = liveSearch(params); -} - -main(); \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.json.ftl deleted file mode 100644 index 986081f134..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search-sites.get.json.ftl +++ /dev/null @@ -1,13 +0,0 @@ -<#import "../../repository/site/site.lib.ftl" as siteLib/> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${data.totalRecords?c}, - "startIndex": ${data.startIndex?c}, - "items": - [ - <#list data.items as site> - <@siteLib.siteJSONManagers site=site roles="none"/><#if site_has_next>, - - ] -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search.lib.js deleted file mode 100644 index 49ee71c51f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/live-search.lib.js +++ /dev/null @@ -1,291 +0,0 @@ -/** - * Live Search Component - * - * Takes the following object as Input: - * params - * { - * type: search mode type - one of "documents|sites|people" - * term: search terms - * maxResults: maximum results to return - * }; - * - * Outputs: - * items - Array of objects containing the search results - */ - -const DEFAULT_MAX_RESULTS = 5; -const SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; -const SURF_CONFIG_QNAMEPATH = "/cm:surf-config/"; - -/** - * Returns site information data structure. - * { shortName: siteId, title: title } - * - * Caches the data to avoid repeatedly querying the repository. - */ -var siteDataCache = {}; -function getSiteData(siteId) -{ - if (typeof siteDataCache[siteId] === "object") - { - return siteDataCache[siteId]; - } - var site = siteService.getSite(siteId); - var data = - { - shortName : siteId, - title : (site !== null ? site.title : "unknown") - }; - siteDataCache[siteId] = data; - return data; -} - -/** - * Return the fts-alfresco query template to use. - * The default searches name, title, descripton, calendar, link, full text and tag fields. - * It is configurable via the .config.xml attached to this webscript. - */ -function getQueryTemplate() -{ - var t = - [{ - field: "keywords", - template: "%(cm:name cm:title cm:description TEXT TAG)" - }], - qt = new XML(config.script)["default-query-template"]; - if (qt != null && qt.length() != 0) - { - t[0].template = qt.toString(); - } - return t; -} - -/** - * Process and return a document item node - */ -function getDocumentItem(container, node) -{ - // check whether this is a valid folder or a file - var item = null; - if (node.qnamePath.indexOf(SURF_CONFIG_QNAMEPATH) === -1) - { - if (node.isDocument) - { - item = - { - nodeRef: node.nodeRef.toString(), - name: node.name, - title: node.properties["cm:title"], - description: node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedBy: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdBy: node.properties["cm:creator"], - mimetype: node.mimetype, - size: node.size - }; - if (container.siteId !== null) - { - item.site = getSiteData(container.siteId); - item.container = container.containerId; - } - if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}thumbnailModification")) - { - var dates = node.properties["lastThumbnailModification"]; - for (var i=0; i= 1) - { - var siteQName = Packages.org.alfresco.util.ISO9075.decode(tmp.split("/")[0]); - siteId = siteQName.substring(siteQName.indexOf(":") + 1); - tmp = tmp.substring(pos + 1); - pos = tmp.indexOf('/'); - if (pos >= 1) - { - // strip container id from the path - var containerId = tmp.substring(0, pos); - containerId = containerId.substring(containerId.indexOf(":") + 1); - - container.siteId = siteId; - container.containerId = containerId; - } - } - } - - return container; -} - -/** - * Dispatch a live search to the appropriate search method for the requested result type. - */ -function liveSearch(params) -{ - switch (params.type) - { - case "documents": - return getDocResults(params); - break; - case "sites": - return getSiteResults(params); - break; - case "people": - return getPeopleResults(params); - break; - } -} - -/** - * Return Document Search results with the given search terms. - * - * "AND" is the default operator unless configured otherwise, OR, AND and NOT are also supported - - * as is any other valid fts-alfresco elements such as "quoted terms" and (bracket terms) and also - * propname:propvalue syntax. - * - * @param params Object containing search parameters - see API description above - */ -function getDocResults(params) -{ - // ensure a TYPE is specified - var ftsQuery = params.term + ' AND +TYPE:"cm:content"'; - - // site constraint - if (params.siteId !== null) - { - // use SITE syntax to restrict to specific site - ftsQuery += ' AND SITE:"' + params.siteId + '"'; - } - - // root node - generally used for overridden Repository root in Share - if (params.rootNode !== null) - { - ftsQuery = 'PATH:"' + rootNode.qnamePath + '//*" AND (' + ftsQuery + ')'; - } - - // main query construction - ftsQuery = '(' + ftsQuery + ') AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"fm:post" AND -ASPECT:"sys:hidden" AND -cm:creator:System'; - - if (logger.isLoggingEnabled()) - logger.log("LiveQuery:\r\n" + ftsQuery); - - // get default fts operator from the config - // - // TODO: common search lib - for both live and standard e.g. to get values like this... - // - var operator = "AND"; - var cf = new XML(config.script)["default-operator"]; - if (cf != null && cf.length != 0) - { - operator = cf.toString(); - } - - // perform fts-alfresco language query - var queryDef = { - query: ftsQuery, - language: "fts-alfresco", - templates: getQueryTemplate(), - defaultField: "keywords", - defaultOperator: operator, - onerror: "no-results", - page: { - maxItems: params.maxResults, - skipCount: params.startIndex - } - }; - var rs = search.queryResultSet(queryDef); - nodes = rs.nodes, - results = []; - - if (logger.isLoggingEnabled()) - logger.log("Processing resultset of length: " + nodes.length); - - for (var i=0, item; i - AND - %(cm:name cm:title cm:description ia:whatEvent ia:descriptionEvent lnk:title lnk:description TEXT TAG) - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.desc.xml deleted file mode 100644 index dbd125e39c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Share Search - Share Search Component Data Webscript - /slingshot/search?term={term?}&tag={tag?}&site={site?}&container={container?}&sort={sort?}&query={query?}&repo={repo?} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.html.ftl deleted file mode 100644 index db07bf09a0..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.html.ftl +++ /dev/null @@ -1 +0,0 @@ -<#include "search.get.json.ftl"> \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js deleted file mode 100644 index aebd5ac93b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.js +++ /dev/null @@ -1,43 +0,0 @@ - -function main() -{ - var params = - { - siteId: args.site, - containerId: args.container, - repo: (args.repo !== null) ? (args.repo == "true") : false, - term: args.term, - tag: args.tag, - query: args.query, - rootNode: args.rootNode, - sort: args.sort, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, - facetFields: args.facetFields, - filters: args.filters, - encodedFilters: args.encodedFilters, - spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false - }; - - if (args.highlightFields) - { - // Data for search term highlighting... - params.highlightFields = args.highlightFields; - params.highlightPrefix = (args.highlightPrefix !== null) ? args.highlightPrefix : DEFAULT_HIGHLIGHT_POSTFIX; - params.highlightPostfix = (args.highlightPostfix !== null) ? args.highlightPostfix : DEFAULT_HIGHLIGHT_POSTFIX; - params.highlightSnippetCount = (args.highlightSnippetCount !== null) ? parseInt(args.highlightSnippetCount, 10) : DEFAULT_HIGHLIGHT_SNIPPET_COUNT; - params.highlightFragmentSize = (args.highlightFragmentSize !== null) ? parseInt(args.highlightFragmentSize, 10) : DEFAULT_HIGHLIGHT_FRAGMENT_SIZE; - params.highlightUsePhraseHighlighter = (args.highlightUsePhraseHighlighter !== null) ? args.highlightUsePhraseHighlighter.toUpperCase() === "TRUE" : DEFAULT_HIGHLIGHT_USE_PHRASE_HIGHLIGHTER; - params.highlightMergeContiguous = (args.highlightMergeContiguous !== null) ? args.highlightMergeContiguous.toUpperCase() === "TRUE" : DEFAULT_HIGHLIGHT_MERGE_CONTIGUOUS; - - if (args.highlightMaxAnalyzedChars !== null) - { - params.highlightMaxAnalyzedChars = parseInt(args.highlightMaxAnalyzedChars, 10) - } - } - - model.data = getSearchResults(params); -} - -main(); diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.json.ftl deleted file mode 100644 index 598c244790..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.get.json.ftl +++ /dev/null @@ -1,104 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalRecords": ${data.paging.totalRecords?c}, - "totalRecordsUpper": ${data.paging.totalRecordsUpper?c}, - "startIndex": ${data.paging.startIndex?c}, - "numberFound": ${(data.paging.numberFound!-1)?c}, - "facets": - { - <#if data.facets??><#list data.facets?keys as field> - "${field}": - [ - <#assign facets=data.facets[field]><#list facets as f> - { - "label": "${f.facetLabel}", - "value": "${f.facetValue}", - "hits": ${f.hits?c}, - "index": ${f.facetLabelIndex?c} - }<#if f_has_next>, - - ]<#if field_has_next>, - - }, - "highlighting": - { - <#if data.highlighting??><#list data.highlighting?keys as nodeRef> - "${nodeRef}": - { - <#assign fields=data.highlighting[nodeRef]><#list fields?keys as property> - "${property}": "${fields[property][0]}" - <#if property_has_next>, - - }<#if nodeRef_has_next>, - - }, - "items": - [ - <#list data.items as item> - { - "node": <#noescape>${item.nodeJSON}, - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "name": "${item.name!''}", - "displayName": "${item.displayName!''}", - <#if item.title??> - "title": "${item.title}", - - "description": "${item.description!''}", - "modifiedOn": "${xmldate(item.modifiedOn)}", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "fromDate": "${xmldate(item.fromDate)}", - "size": ${item.size?c}, - "mimetype": "${item.mimetype!''}", - <#if item.site??> - "site": - { - "shortName": "${item.site.shortName}", - "title": "${item.site.title}" - }, - "container": "${item.container}", - - <#if item.path??> - "path": "${item.path}", - - "lastThumbnailModification": - [ - <#if item.lastThumbnailModification??> - <#list item.lastThumbnailModification as lastThumbnailMod> - "${lastThumbnailMod}" - <#if lastThumbnailMod_has_next>, - - - ], - "tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,], - "highlighting": - { - <#list item.highlighting?keys as property> - "${property}": "${item.highlighting[property][0]}" - <#if property_has_next>, - - } - }<#if item_has_next>, - - ], - "spellcheck": - { - <#if data.spellcheck?? && data.spellcheck.spellCheckExist> - "searchRequest": "${data.spellcheck.originalSearchTerm}", - <#if data.spellcheck.searchedFor> - <#list data.spellcheck.results as collationQueryStr> - "searchedFor": "${collationQueryStr?string}" - <#break> - - <#else> - "searchSuggestions": [ - <#list data.spellcheck.results as suggestion> - "${suggestion?string}"<#if suggestion_has_next>, - - ] - - - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js deleted file mode 100644 index 14328b4c0f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js +++ /dev/null @@ -1,1438 +0,0 @@ -/** - * Search Component - * - * Takes the following object as Input: - * params - * { - * siteId: the site identifier to search into, null for all sites - * containerId: the component the search in, null for all components in the site - * term: search terms - * tag: search tag - * query: advanced search query json - * sort: sort parameter - * maxResults: maximum results to return - * }; - * - * Outputs: - * items - Array of objects containing the search results - */ - -const DEFAULT_MAX_RESULTS = 250; -const DEFAULT_PAGE_SIZE = 50; -const SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; - -const DEFAULT_HIGHLIGHT_FIELDS = "cm:name,cm:description,cm:title,content,ia:descriptionEvent,ia:whatEvent,lnk:title"; -const DEFAULT_HIGHLIGHT_PREFIX = "\u0000"; -const DEFAULT_HIGHLIGHT_POSTFIX = "\u0003"; -const DEFAULT_HIGHLIGHT_SNIPPET_COUNT = 255; -const DEFAULT_HIGHLIGHT_FRAGMENT_SIZE = 100; -const DEFAULT_HIGHLIGHT_USE_PHRASE_HIGHLIGHTER = true; -const DEFAULT_HIGHLIGHT_MERGE_CONTIGUOUS = true; - -/** - * Returns site information data structure. - * { shortName: siteId, title: title } - * - * Caches the data to avoid repeatedly querying the repository. - */ -var siteDataCache = {}; -function getSiteData(siteId) -{ - if (typeof siteDataCache[siteId] === "object") - { - return siteDataCache[siteId]; - } - var site = siteService.getSite(siteId); - var data = - { - shortName : siteId, - title : (site !== null ? site.title : "unknown") - }; - siteDataCache[siteId] = data; - return data; -} - -/** - * Returns person display name string as returned to the user. - * - * Caches the person full name to avoid repeatedly querying the repository. - */ -var personDataCache = {}; -function getPersonDisplayName(userId) -{ - if (typeof personDataCache[userId] === "object") - { - return personDataCache[userId]; - } - - var displayName = people.getPersonFullName(userId); - if (displayName == null) - { - displayName = ""; - } - personDataCache[userId] = displayName; - return displayName; -} - -/** - * Cache to not display twice the same element (e.g. if two comments of the - * same blog post match the search criteria - */ -var processedCache; -function checkProcessedCache(key) -{ - var found = processedCache.hasOwnProperty(key); - if (!found) - { - processedCache[key] = true; - } - else if (found && logger.isLoggingEnabled()) - logger.log("...already processed item with key: " + key); - return found; -} - -/** - * Returns an item outside of a site in the main repository. - */ -function getRepositoryItem(folderPath, node, populate, highlighting) -{ - // check whether we already processed this document - if (checkProcessedCache("" + node.nodeRef.toString())) - { - return null; - } - - // check whether this is a valid folder or a file - var item = t = null; - if (node.isContainer || node.isDocument) - { - if (!populate) return {}; - item = - { - nodeRef: node.nodeRef.toString(), - tags: ((t = node.tags) !== null) ? t : [], - name: node.name, - displayName: highlighting["cm:name"] ? highlighting["cm:name"].get(0) : node.name, - title: highlighting["cm:title"] ? highlighting["cm:title"].get(0) : node.properties["cm:title"], - description:highlighting["cm:description"] ? highlighting["cm:description"].get(0) : node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - lastThumbnailModification: node.properties["cm:lastThumbnailModification"], - mimetype: node.mimetype, - path: folderPath.join("/"), - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - } - if (node.isContainer) - { - item.type = "folder"; - item.size = -1; - } - else if (node.isDocument) - { - item.type = "document"; - item.size = node.size; - } - - return item; -} - -/** - * Returns an item of the document library component. - */ -function getDocumentItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - // PENDING: how to handle comments? the document should - // be returned instead - - // check whether we already processed this document - if (checkProcessedCache("" + node.nodeRef.toString())) - { - return null; - } - - // check whether this is a valid folder or a file - var item = t = null; - if (node.isContainer || node.isDocument) - { - if (!populate) return {}; - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: node.nodeRef.toString(), - tags: ((t = node.tags) !== null) ? t : [], - name: node.name, - displayName: highlighting["cm:name"] ? highlighting["cm:name"].get(0) : node.name, - title: highlighting["cm:title"] ? highlighting["cm:title"].get(0) : node.properties["cm:title"], - description: highlighting["cm:description"] ? highlighting["cm:description"].get(0) : node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - lastThumbnailModification: node.properties["cm:lastThumbnailModification"], - mimetype: node.mimetype, - path: pathParts.join("/"), - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - } - if (node.isContainer) - { - item.type = "folder"; - item.size = -1; - } - else if (node.isDocument) - { - item.type = "document"; - item.size = node.size; - } - - return item; -} - -function getBlogPostItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - /** - * Investigate the rest of the path. the first item is the blog post, ignore everything that follows - * are replies or folders - */ - var site = siteService.getSite(siteId); - if (site === null) - { - return null; - } - var container = site.getContainer(containerId); - - /** - * Find the direct child of the container - * Note: this only works for post which are direct children of the blog container - */ - var child = node; - var parent = child.parent; - while ((parent !== null) && (!parent.nodeRef.equals(container.nodeRef))) - { - child = parent; - parent = parent.parent; - } - - // check whether we found the container - if (parent === null) - { - return null; - } - - // check whether we already added this blog post - if (checkProcessedCache("" + child.nodeRef.toString())) - { - return null; - } - - // child is our blog post - if (!populate) return {}; - var item, t = null; - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: child.nodeRef.toString(), - type: "blogpost", - tags: ((t = child.tags) !== null) ? t : [], - name: child.name, - modifiedOn: child.properties["cm:modified"], - modifiedByUser: child.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - size: child.size, - displayName: highlighting["cm:title"] ? highlighting["cm:title"].get(0) : child.properties["cm:title"], - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - - return item; -} - -function getForumPostItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - // try to find the first fm:topic node, that's what we return as search result - var topicNode = node; - while ((topicNode !== null) && (topicNode.type != "{http://www.alfresco.org/model/forum/1.0}topic")) - { - topicNode = topicNode.parent; - } - if (topicNode === null) - { - return null; - } - - // make sure we haven't already added the post - if (checkProcessedCache("" + topicNode.nodeRef.toString())) - { - return null; - } - - // find the first post, which contains the post title - // PENDING: error prone - var title =""; - var postNode; - try - { - var postNode = topicNode.childAssocs["cm:contains"].get(0); - title = postNode.properties["cm:title"]; - } - catch(e1) - { - try - { - postNode = topicNode.childAssocs["cm:contains"][0]; - title = postNode.properties["cm:title"]; - } - catch(e2) {} - } - - // child is our forum post - if (!populate) return {}; - var item = t = null; - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: topicNode.nodeRef.toString(), - type: "forumpost", - tags: ((t = topicNode.tags) !== null) ? t : [], - name: topicNode.name, - description: highlighting["cm:description"] ? highlighting["cm:description"].get(0) : topicNode.properties["cm:description"], - modifiedOn: topicNode.properties["cm:modified"], - modifiedByUser: topicNode.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - size: topicNode.size, - displayName: highlighting["cm:title"] ? highlighting["cm:title"].get(0) : title, - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - - return item; -} - -function getCalendarItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - // only process nodes of the correct type - if (node.type != "{http://www.alfresco.org/model/calendar}calendarEvent") - { - return null; - } - - // make sure we haven't already added the event - if (checkProcessedCache("" + node.nodeRef.toString())) - { - return null; - } - - if (!populate) return {}; - var item, t = null; - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: node.nodeRef.toString(), - type: "calendarevent", - tags: ((t = node.tags) !== null) ? t : [], - name: node.name, - description: highlighting["ia:descriptionEvent"] ? highlighting["ia:descriptionEvent"].get(0) : node.properties["ia:descriptionEvent"], - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - fromDate: node.properties["ia:fromDate"], - size: -1, - displayName: highlighting["ia:whatEvent"] ? highlighting["ia:whatEvent"].get(0) : node.properties["ia:whatEvent"], - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - - return item; -} - -function getWikiItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - // only process documents - if (!node.isDocument) - { - return null; - } - - // make sure we haven't already added the page - if (checkProcessedCache("" + node.nodeRef.toString())) - { - return null; - } - - if (!populate) return {}; - var item, t = null; - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: node.nodeRef.toString(), - type: "wikipage", - tags: ((t = node.tags) !== null) ? t : [], - name: node.name, - description: highlighting["cm:description"] ? highlighting["cm:description"].get(0) : node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - size: node.size, - displayName: highlighting["cm:name"] ? highlighting["cm:name"].get(0) : ("" + node.name).replace(/_/g, " "), - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - - return item; -} - -function getLinkItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - // only process documents - if (!node.isDocument) - { - return null; - } - - // make sure we haven't already added this link - if (checkProcessedCache("" + node.nodeRef.toString())) - { - return null; - } - - var item = t = null; - if (!populate) return {}; - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: node.nodeRef.toString(), - type: "link", - tags: ((t = node.tags) !== null) ? t : [], - name: node.name, - description: highlighting["cm:description"] ? highlighting["cm:description"].get(0) : node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - size: -1, - displayName: highlighting["lnk:title"] ? highlighting["lnk:title"].get(0) : node.properties["lnk:title"], - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - - return item; -} - -function getDataItem(siteId, containerId, pathParts, node, populate, highlighting) -{ - // make sure we haven't already added this item - if (checkProcessedCache("" + node.nodeRef.toString())) - { - return null; - } - - var item = null; - - // data item can be either ba containing dl:dataList or any dl:dataListItem subtype - if (node.type == "{http://www.alfresco.org/model/datalist/1.0}dataList") - { - if (!populate) return {}; - // found a data list - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: node.nodeRef.toString(), - type: "datalist", - tags: [], - name: node.name, - description: highlighting["cm:description"] ? highlighting["cm:description"].get(0) : node.properties["cm:description"], - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - size: -1, - displayName: highlighting["cm:title"] ? highlighting["cm:title"].get(0) : node.properties["cm:title"], - nodeJSON: appUtils.toJSON(node, true) - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - } - else if (node.isSubType("{http://www.alfresco.org/model/datalist/1.0}dataListItem")) - { - if (!populate) return {}; - // found a data list item - item = - { - site: getSiteData(siteId), - container: containerId, - nodeRef: node.nodeRef.toString(), - type: "datalistitem", - tags: [], - name: node.parent.name, // used to generate link to parent datalist - not ideal - modifiedOn: node.properties["cm:modified"], - modifiedByUser: node.properties["cm:modifier"], - createdOn: node.properties["cm:created"], - createdByUser: node.properties["cm:creator"], - size: -1, - nodeJSON: appUtils.toJSON(node, true), - displayName: highlighting["cm:name"] ? highlighting["cm:name"].get(0) : node.name // unfortunately does not have a common display name property - }; - item.modifiedBy = getPersonDisplayName(item.modifiedByUser); - item.createdBy = getPersonDisplayName(item.createdByUser); - } - - return item; -} - -/** - * Delegates the extraction to the correct extraction function - * depending on containerId. - */ -function getItem(siteId, containerId, pathParts, node, populate, meta) -{ - var highlighting = {}; - if (meta && meta.highlighting && node && node.nodeRef) - { - highlighting = meta.highlighting[node.nodeRef.toString()] || {}; - } - - var item = null; - if (siteId == null) - { - item = getRepositoryItem(pathParts, node, populate, highlighting); - } - else - { - switch ("" + containerId.toLowerCase()) - { - case "documentlibrary": - item = getDocumentItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - case "blog": - item = getBlogPostItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - case "discussions": - item = getForumPostItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - case "calendar": - item = getCalendarItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - case "wiki": - item = getWikiItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - case "links": - item = getLinkItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - case "datalists": - item = getDataItem(siteId, containerId, pathParts, node, populate, highlighting); - break; - } - } - - if (meta && meta.highlighting) - { - item.highlighting = highlighting; - } - - return item; -} - -/** - * Splits the qname path to a node to extract Site information and display path parts. - * The display path will be truncated to match the overridden root node if present. - * - * Returns an array with: - * [0] = site or null - * [1] = container or null - * [2] = remaining part of the cm:name based path to the object - as an array - */ -function splitQNamePath(node, rootNodeDisplayPath, rootNodeQNamePath, qnameOnly) -{ - var path = node.qnamePath, - displayPath = qnameOnly ? null : utils.displayPath(node).split("/"), - siteId = null, - containerId = null; - - if (path.match("^"+SITES_SPACE_QNAME_PATH) == SITES_SPACE_QNAME_PATH) - { - // this item is contained within a Site - - // ensure we have not matched a Site folder directly or some node created under the st:sites folder that is not a Site - var qpathUnderSitesFolder = path.substring(SITES_SPACE_QNAME_PATH.length), - positionContainer = qpathUnderSitesFolder.indexOf("/"); - if (positionContainer !== -1) - { - // Decode the Site ID from the qname path using the util method - as we may not have displayPath - // the displayPath will look something like this: ["", "Company Home", "Sites", "MySite", "documentLibrary", "MyFolder"] - var siteQName = Packages.org.alfresco.util.ISO9075.decode(qpathUnderSitesFolder.substring(0, positionContainer)); - siteId = siteQName.substring(siteQName.indexOf(":") + 1); - var qpathContainer = qpathUnderSitesFolder.substring(positionContainer + 1); - var positionUnderContainer = qpathContainer.indexOf("/"); - if (positionUnderContainer !== -1) - { - // extract container id from the qname path - strip off namespace - containerId = qpathContainer.substring(0, positionUnderContainer); - containerId = containerId.substring(containerId.indexOf(":") + 1); - - // construct remaining part of the cm:name based display path to the object - // by removing everything up to the path of the item under the container folder - if (!qnameOnly) displayPath = displayPath.slice(5, displayPath.length); - } - } - } - else - { - // check if we have an overridden root node and the node is under that path - if (!qnameOnly && rootNodeDisplayPath !== null && path.indexOf(rootNodeQNamePath) === 0) - { - // restructure the display path of the node - displayPath = displayPath.splice(rootNodeDisplayPath.length); - // empty element is required at the start of the repository paths - we want to show it as the repo root later - displayPath.unshift(""); - } - } - - return [ siteId, containerId, displayPath ]; -} - -/** - * Processes the search results, extracting the given page of results from the startIndex up to the maxPageResults - * from the total list of nodes passed in. Filters out unnecessary nodes - * - * @return the final search results object - */ -function processResults(nodes, maxPageResults, startIndex, rootNode, meta) -{ - // empty cache state - processedCache = {}; - var results = [], - added = processed = failed = 0, - parts, - item, - rootNodeDisplayPath = rootNode ? utils.displayPath(rootNode).split("/") : null, - rootNodeQNamePath = rootNode ? rootNode.qnamePath : null; - - if (logger.isLoggingEnabled()) - logger.log("Processing resultset of length: " + nodes.length); - - startIndex = startIndex ? startIndex : 0; - for (var i = 0, j = nodes.length; i < j; i++) - { - // For each node we extract the site/container qname path and then - // let the per-container helper function decide what to do. - try - { - // We only want to populate node return structures if we are going to add the items to the results, - // so we skip (process, but don't populate or add to results) until we have reached the startIndex - // then we populate and add items up to the maxPageResults - after that we still need to process - // (but don't populate or add to results) each item to correctly calculate the totalRecordsUpper. - var populate = (processed >= startIndex && added < maxPageResults); - parts = splitQNamePath(nodes[i], rootNodeDisplayPath, rootNodeQNamePath, !populate); - item = getItem(parts[0], parts[1], parts[2], nodes[i], populate, meta); - if (item !== null) - { - processed++; - if (populate) - { - results.push(item); - added++; - } - } - else - { - failed++; - } - } - catch (e) - { - // THOR-833 - if (logger.isWarnLoggingEnabled() == true) - { - logger.warn("search.lib.js: Skipping node due to exception when processing query result: " + e); - logger.warn("..." + nodes[i].nodeRef); - } - - failed++; - } - } - - if (logger.isLoggingEnabled()) - logger.log("Filtered resultset to length: " + results.length + ". Discarded item count: " + failed); - - return ( - { - paging: - { - totalRecords: results.length, - totalRecordsUpper: nodes.length - failed, - startIndex: startIndex, - numberFound: meta ? meta.numberFound : -1 - }, - facets: meta ? meta.facets : null, - highlighting: meta ? meta.highlighting : null, - items: results, - spellcheck: meta ? meta.spellcheck : null - }); -} - -/** - * Processes the search results for a single page. Filters out unnecessary nodes - * - * @return the final search results object - */ -function processResultsSinglePage(nodes, startIndex, rootNode, meta) -{ - // empty cache state - processedCache = {}; - var results = [], - failed = 0, - parts, - item, - rootNodeDisplayPath = rootNode ? utils.displayPath(rootNode).split("/") : null, - rootNodeQNamePath = rootNode ? rootNode.qnamePath : null; - - if (logger.isLoggingEnabled()) - logger.log("Processing resultset of length: " + nodes.length); - - for (var i = 0, j = nodes.length; i < j; i++) - { - // For each node we extract the site/container qname path and then - // let the per-container helper function decide what to do. - try - { - parts = splitQNamePath(nodes[i], rootNodeDisplayPath, rootNodeQNamePath, false); - item = getItem(parts[0], parts[1], parts[2], nodes[i], true, meta); - if (item !== null) - { - results.push(item); - } - else - { - failed++; - } - } - catch (e) - { - // THOR-833 - if (logger.isWarnLoggingEnabled() == true) - { - logger.warn("search.lib.js: Skipping node due to exception when processing query result: " + e); - logger.warn("..." + nodes[i].nodeRef); - } - failed++; - } - } - - if (logger.isLoggingEnabled()) - logger.log("Filtered resultset to length: " + results.length + ". Discarded item count: " + failed); - - return ( - { - paging: - { - totalRecords: results.length, - totalRecordsUpper: -1, - startIndex: startIndex, - numberFound: meta ? meta.numberFound : -1 - }, - facets: meta ? meta.facets : null, - highlighting: meta ? meta.highlighting : null, - items: results, - spellcheck: meta ? meta.spellcheck : null - }); -} - -/** - * Helper to escape the QName string so it is valid inside an fts-alfresco query. - * The language supports the SQL92 identifier standard. - * - * @param qname The QName string to escape - * @return escaped string - */ -function escapeQName(qname) -{ - var separator = qname.indexOf(':'), - namespace = qname.substring(0, separator), - localname = qname.substring(separator + 1); - - return escapeString(namespace) + ':' + escapeString(localname); -} - -function escapeString(value) -{ - var result = ""; - - for (var i=0,c; i= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_')) - { - result += '\\'; - } - } - else - { - if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c == '#')) - { - result += '\\'; - } - } - result += c; - } - return result; -} - -/** - * Helper method used to determine whether the property value is multi-valued. - * - * @param propValue the property value to test - * @param modePropValue the logical operand that should be used for multi-value property - * @return true if it is multi-valued, false otherwise - */ -function isMultiValueProperty(propValue, modePropValue) -{ - return modePropValue != null && propValue.indexOf(",") !== -1; -} - -/** - * Helper method used to construct lucene query fragment for a multi-valued property. - * - * @param propName property name - * @param propValue property value (comma separated) - * @param operand logical operand that should be used - * @param pseudo is it a pseudo property - * @return lucene query with multi-valued property - */ -function processMultiValue(propName, propValue, operand, pseudo) -{ - var multiValue = propValue.split(","), - formQuery = ""; - for (var i = 0; i < multiValue.length; i++) - { - if (i > 0) - { - formQuery += ' ' + operand + ' '; - } - - if (pseudo) - { - formQuery += '(cm:content.' + propName + ':"' + multiValue[i] + '")'; - } - else - { - formQuery += '(' + escapeQName(propName) + ':"' + multiValue[i] + '")'; - } - } - - return formQuery; -} - -/** - * Resolve a root node reference to use as the Repository root for a search. - * - * NOTE: see ParseArgs.resolveNode() - * - * @method resolveRootNode - * @param reference {string} "virtual" nodeRef, nodeRef or xpath expressions - * @return {ScriptNode|null} Node corresponding to supplied expression. Returns null if node cannot be resolved. - */ -function resolveRootNode(reference) -{ - try - { - var node = utils.resolveNodeReference(reference); - if (node === null) - { - logger.warn("Unable to resolve specified root node reference: " + reference); - } - else if (companyhome.nodeRef === node.nodeRef) - { - // default root node - no special handling required - return null; - } - return node; - } - catch (e) - { - logger.warn("Unable to resolve specified root node reference: " + reference); - return null; - } -} - -/** - * Return Search results with the given search terms. - * - * "or" is the default operator, AND and NOT are also supported - as is any other valid fts-alfresco - * elements such as "quoted terms" and (bracket terms) and also propname:propvalue syntax. - * - * @param params Object containing search parameters - see API description above - */ -function getSearchResults(params) -{ - var nodes, - ftsQuery = "", - term = params.term, - tag = params.tag, - formData = params.query, - rootNode = params.rootNode ? resolveRootNode(params.rootNode) : null; - - // Simple keyword search and tag specific search - if (term !== null && term.length !== 0) - { - // TAG is now part of the default search macro - ftsQuery = term + " "; - } - else if (tag !== null && tag.length !== 0) - { - // Just look for tag - ftsQuery = "TAG:" + tag +" "; - } - - // Advanced search form data search. - // Supplied as json in the standard Alfresco Forms data structure: - // prop_:value|assoc_:value - // name = namespace_propertyname|pseudopropertyname - // value = string value - comma separated for multi-value, no escaping yet! - // - underscore represents colon character in name - // - pseudo property is one of any cm:content url property: mimetype|encoding|size - // - always string values - interogate DD for type data - // - an additional "-mode" suffixed parameter for a value is allowed to specify - // either an AND or OR join condition for multi-value property searches - if (formData !== null && formData.length !== 0) - { - var formQuery = "", - formJson = jsonUtils.toObject(formData); - - // extract form data and generate search query - var first = true; - var useSubCats = false; - for (var p in formJson) - { - // retrieve value and check there is someting to search for - // currently all values are returned as strings - var propValue = formJson[p], modePropValue = formJson[p + "-mode"]; - if (propValue.length !== 0) - { - if (p.indexOf("prop_") === 0 && p.match("-mode$") != "-mode") - { - // found a property - is it namespace_propertyname or pseudo property format? - var propName = p.substr(5); - if (propName.indexOf("_") !== -1) - { - // property name - convert to DD property name format - propName = propName.replace("_", ":"); - - // special case for range packed properties - if (propName.match("-range$") == "-range") - { - // currently support text based ranges (usually numbers) or date ranges - // range value is packed with a | character separator - - // if neither value is specified then there is no need to add the term - if (propValue.length > 1) - { - var from, to, sepindex = propValue.indexOf("|"); - if (propName.match("-date-range$") == "-date-range") - { - // date range found - propName = propName.substr(0, propName.length - "-date-range".length) - - // work out if "from" and/or "to" are specified - use MIN and MAX otherwise; - // we only want the "YYYY-MM-DD" part of the ISO date value - so crop the strings - from = (sepindex === 0 ? "MIN" : propValue.substr(0, 10)); - to = (sepindex === propValue.length - 1 ? "MAX" : propValue.substr(sepindex + 1, 10)); - } - else - { - // simple range found - propName = propName.substr(0, propName.length - "-range".length); - - // work out if "min" and/or "max" are specified - use MIN and MAX otherwise - from = (sepindex === 0 ? "MIN" : propValue.substr(0, sepindex)); - to = (sepindex === propValue.length - 1 ? "MAX" : propValue.substr(sepindex + 1)); - } - formQuery += (first ? '' : ' AND ') + escapeQName(propName) + ':"' + from + '".."' + to + '"'; - first = false; - } - } - else if (isCategoryProperty(formJson, p)) - { - // If there's no suffix it means this property holds the value for categories - if (propName.indexOf("usesubcats") == -1 && propName.indexOf("isCategory") == -1) - { - // Determines if the checkbox use sub categories was clicked - if (formJson[p + "_usesubcats"] == "true") - { - useSubCats = true; - } - - // Build list of category terms to search for - var catQuery = ""; - var cats = propValue.split(','); - if (propName.indexOf("cm:categories") != -1) - { - catQuery = processDefaultCategoryProperty(cats, useSubCats); - } - else - { - catQuery = processCustomCategoryProperty(propName, cats, useSubCats); - } - - if (catQuery.length !== 0) - { - // surround category terms with brackets if appropriate - formQuery += (first ? '' : ' AND ') + "(" + catQuery + ")"; - first = false; - } - } - } - else if (isMultiValueProperty(propValue, modePropValue) || isListProperty(formJson, p)) - { - if(propName.indexOf('isListProperty') === -1) - { - formQuery += (first ? '(' : ' AND ('); - formQuery += processMultiValue(propName, propValue, modePropValue, false); - formQuery += ')'; - first = false; - } - } - else - { - if (propValue.charAt(0) === '"' && propValue.charAt(propValue.length-1) === '"') - { - formQuery += (first ? '' : ' AND ') + escapeQName(propName) + ':' + propValue; - } - else - { - var index = propValue.lastIndexOf(" "); - formQuery += (first ? '' : ' AND ') + escapeQName(propName); - if (index > 0 && index < propValue.length - 1) - { - formQuery += ':(' + propValue + ')'; - } - else - { - formQuery += ':"' + propValue + '"'; - } - } - first = false; - } - } - else - { - if (isMultiValueProperty(propValue, modePropValue)) - { - // multi-valued pseudo cm:content property - e.g. mimetype, size or encoding - formQuery += (first ? '(' : ' AND ('); - formQuery += processMultiValue(propName, propValue, modePropValue, true); - formQuery += ')'; - } - else - { - // single pseudo cm:content property - e.g. mimetype, size or encoding - formQuery += (first ? '' : ' AND ') + 'cm:content.' + propName + ':"' + propValue + '"'; - } - first = false; - } - } - } - } - - if (formQuery.length !== 0 || ftsQuery.length !== 0) - { - // extract data type for this search - advanced search query is type specific - ftsQuery = 'TYPE:"' + formJson.datatype + '"' + - (formQuery.length !== 0 ? ' AND (' + formQuery + ')' : '') + - (ftsQuery.length !== 0 ? ' AND (' + ftsQuery + ')' : ''); - } - } - - if (ftsQuery.length !== 0) - { - // Filter queries - var fqs = []; - if (params.filters) - { - var filters = []; - if (params.encodedFilters) - { - var encodedFilters = params.encodedFilters.split(","); - for(var i=0; i 1) - { - // special case for some filters e.g. TYPE content or folder - switch (filterParts[0]) - { - case "TYPE": - { - ftsQuery += ' AND +TYPE:"' + filterParts[1] + '"'; - break; - } - default: - { - // facet filtering selection - reduce query results - // bracket each filter part within the attribute statement - ftsQuery += ' AND (' + filterParts[0] + ':('; - for (var p=1; p 0 ) - { - if (params.containerId !== null && params.containerId.length > 0) - { - // using PATH to restrict to container and site - path = SITES_SPACE_QNAME_PATH; - path += "cm:" + search.ISO9075Encode(params.siteId) + "/"; - path += "cm:" + search.ISO9075Encode(params.containerId) + "/"; - } - else - { - // use SITE syntax to restrict to specific site - site = "SITE:\"" + params.siteId + "\"" ; - } - } - else - { - if (params.containerId !== null && params.containerId.length > 0) - { - // using PATH to restrict to container and site - path = SITES_SPACE_QNAME_PATH; - path += "*/"; - path += "cm:" + search.ISO9075Encode(params.containerId) + "/"; - } - else - { - // use SITE syntax to restrict to specific site - site = "SITE:\"_ALL_SITES_\"" ; - } - } - } - - // root node - generally used for overridden Repository root in Share - if (params.repo && rootNode !== null) - { - ftsQuery = 'PATH:"' + rootNode.qnamePath + '//*" AND (' + ftsQuery + ')'; - } - else if (path !== null) - { - fqs.push('PATH:"' + path + '/*"'); - } - else if (site !== null) - { - fqs.push(site); - } - - fqs.push('-TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"st:site"' + - ' AND -ASPECT:"st:siteContainer" AND -ASPECT:"sys:hidden" AND -cm:creator:System AND -QNAME:comment\\-*'); - - // sort field - expecting field to in one of the following formats: - // - short QName form such as: cm:name - // - pseudo cm:content field starting with "." such as: .size - // - any other directly supported search field such as: TYPE - var sortColumns = []; - var sort = params.sort; - if (sort != null && sort.length != 0) - { - var asc = true; - var separator = sort.indexOf("|"); - if (separator != -1) - { - asc = (sort.substring(separator + 1) == "true"); - sort = sort.substring(0, separator); - } - var column; - if (sort.charAt(0) == '.') - { - // handle pseudo cm:content fields - column = "@{http://www.alfresco.org/model/content/1.0}content" + sort; - } - else if (sort.indexOf(":") != -1) - { - // handle attribute field sort - column = "@" + utils.longQName(sort); - } - else - { - // other sort types e.g. TYPE - column = sort; - } - sortColumns.push( - { - column: column, - ascending: asc - }); - } - - if (logger.isLoggingEnabled()) - logger.log("Query:\r\n" + ftsQuery + "\r\nSortby: " + (sort != null ? sort : "")); - - // perform fts-alfresco language query - var qt = getQueryTemplate(); - var queryDef = { - query: ftsQuery, - language: "fts-alfresco", - page: { - maxItems: params.maxResults > 0 ? params.maxResults + 1 : params.pageSize, - skipCount: params.maxResults > 0 ? 0 : params.startIndex - }, - templates: qt.template, - defaultField: "keywords", - defaultOperator: qt.operator, - onerror: "no-results", - sort: sortColumns, - fieldFacets: params.facetFields != null ? params.facetFields.split(",") : null, - filterQueries: fqs, - searchTerm: params.term, - spellCheck: params.spell - }; - - // Configure search term highlighting... - if (params.highlightFields) - { - var fields = []; - var highlightFields = params.highlightFields.split(","); - for (var i = 0; i < highlightFields.length; i++) - { - fields.push({ - field: highlightFields[i] - }); - } - queryDef.highlight = { - prefix: params.highlightPrefix, - postfix: params.highlightPostfix, - snippetCount: params.highlightSnippetCount, - fragmentSize: params.highlightFragmentSize, - usePhraseHighlighter: params.highlightUsePhraseHighlighter, - mergeContiguous: params.highlightMergeContiguous, - fields: fields - }; - - if (params.highlightMaxAnalyzedChars) - { - queryDef.highlight.maxAnalyzedChars = params.highlightMaxAnalyzedChars; - } - } - - var rs = search.queryResultSet(queryDef); - nodes = rs.nodes; - } - else - { - // failed to process the search string - empty list returned - var rs = {}; - nodes = []; - } - - if (params.maxResults > 0) - { - return processResults( - nodes, - params.maxResults, - params.startIndex, - rootNode, - rs.meta); - } - else - { - return processResultsSinglePage( - nodes, - params.startIndex, - rootNode, - rs.meta); - } -} - -/** - * Return the fts-alfresco query template to use. - * The default searches name, title, descripton, calendar, link, full text and tag fields. - * It is configurable via the .config.xml attached to this webscript. - */ -function getQueryTemplate() -{ - var t = - [{ - field: "keywords", - template: "%(cm:name cm:title cm:description ia:whatEvent ia:descriptionEvent lnk:title lnk:description TEXT TAG)" - }], - xml = new XML(config.script), - qt = xml["default-query-template"]; - if (qt != null && qt.length() != 0) - { - t[0].template = qt.toString(); - } - - // get default fts operator from the config - // - // TODO: common search lib - for both live and standard e.g. to get values like this... - // - var operator = "AND", - cf = xml["default-operator"]; - if (cf != null && cf.length != 0) - { - operator = cf.toString(); - } - - return { - template: t, - operator: operator - }; -} - -/* -* Helper method used to determine whether the property is tied to a list of properties. -* -* @param formJSON the list of the properties provided to the form -* @param prop propertyname -* @return true if it is tied to a list of properties, false otherwise -*/ -function isListProperty(formJson, prop) -{ - return prop.indexOf('isListProperty') != -1 || prop+'_isListProperty' in formJson; -} - -/** - * Helper method used to determine whether the property is tied to categories. - * - * @param formJSON the list of the properties provided to the form - * @param prop propertyname - * @return true if it is tied to categories, false otherwise - */ -function isCategoryProperty(formJson, prop) -{ - return prop.indexOf('usesubcats') != -1 || prop.indexOf('isCategory') != -1 || - prop+'_usesubcats' in formJson || prop+'_isCategory' in formJson; -} - -/** - * Helper method used to construct lucene query fragment for a default category property. - * - * @param cats the selected categories (array of string noderef) - * @param useSubCats boolean that indicates if should search also in subcategories - * @return lucene query with default category property - */ -function processDefaultCategoryProperty(cats, useSubCats) -{ - var firstCat = true; - var catQuery = ""; - for (var i = 0; i < cats.length; i++) - { - var cat = cats[i]; - var catNode = search.findNode(cat); - if (catNode) - { - catQuery += (firstCat ? '' : ' OR ') + "PATH:\"" + catNode.qnamePath + (useSubCats ? "//*\"" : "/member\"" ); - - firstCat = false; - } - } - return catQuery; -} - -/** - * Helper method used to construct lucene query fragment for a custom category property. - * - * @param propName property name - * @param cats the selected categories (array of string noderef) - * @param useSubCats boolean that indicates if should search also in subcategories - * @return lucene query with custom category property - */ -function processCustomCategoryProperty(propName, cats, useSubCats) -{ - var catQuery = ""; - - // Prepare the query that will be used to load all the noderefs for the selected categories values - // (and their subcategories if selected) - var selectedCatsQuery = ""; - for (var i = 0; i < cats.length; i++) - { - var cat = cats[i]; - var catNode = search.findNode(cat); - if (catNode) - { - selectedCatsQuery += "+PATH:\"" + catNode.qnamePath + (useSubCats ? "//." : '') + "\" "; - } - } - - if (selectedCatsQuery.length !== 0) - { - // Load all the noderefs for the selected categories values - var queryDefCat = { - query: selectedCatsQuery, - language: "fts-alfresco", - onerror: "no-results" - }; - var rs = search.queryResultSet(queryDefCat); - var selectedCatNodes = rs.nodes; - - // Create lucene query with custom category property - if (selectedCatNodes && selectedCatNodes.length !== 0) - { - for (var j = 0; j < selectedCatNodes.length; j++) - { - var selectedCatNode = selectedCatNodes[j]; - catQuery += (j == 0 ? '':' OR ') + escapeQName(propName) + ':' + selectedCatNode.id; - } - } - } - - return catQuery; -} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/sites/site-identifier-used.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/sites/site-identifier-used.get.desc.xml deleted file mode 100644 index 05bbe8c03b..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/sites/site-identifier-used.get.desc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Site Identifiers In Use - Determines whether or not the supplied site identifiers (the title and shortName attributes) are already being used or note - /slingshot/site-identifier-used?shortName={shortName?} - /slingshot/site-identifier-used?title={title?} - argument - user - required - limited_support - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/sites/site-identifier-used.get.js b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/sites/site-identifier-used.get.js deleted file mode 100644 index 1e19c112c8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/sites/site-identifier-used.get.js +++ /dev/null @@ -1,33 +0,0 @@ -// See SHA-1612 -// This WebScript has been added to support the ability to determine whether or not a site title or shortName -// has already been used. It runs with admin privileges but does not return anything other than a true/false -// response to prevent exploratory disclosure of private data. -function main() -{ - var foundMatch = false; - - var shortName = args["shortName"]; - var title = args["title"]; - - var useShortName = !!shortName; - - // Get the list of sites - var sites = siteService.findSites(shortName || title, -1); - if (sites && sites.length) - { - for (var i=0; i - movewikipage - Wiki - Page details - /slingshot/wiki/page/{siteId}/{pageTitle} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.ftl deleted file mode 100644 index ff80f35c67..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.ftl +++ /dev/null @@ -1,9 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ -<#if result.error?exists> - "error" : "${result.error}" -<#else> - "title" : "${result.title}" - -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.properties deleted file mode 100644 index cea23d209e..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=This page has been moved -page-moved-here=here -page-not-found=The Wiki page could not be found diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_de.properties deleted file mode 100755 index 971a261909..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_de.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=Diese Seite wurde verschoben nach -page-moved-here=hier -page-not-found=Die Wiki-Seite wurde nicht gefunden diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_es.properties deleted file mode 100755 index 48be2932ca..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_es.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=La p\u00e1gina se ha movido a -page-moved-here=aqu\u00ed -page-not-found=No se ha podido encontrar la p\u00e1gina Wiki diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_fr.properties deleted file mode 100755 index d32d9d3ced..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_fr.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=Cette page a \u00e9t\u00e9 d\u00e9plac\u00e9e -page-moved-here=ici -page-not-found=La page du wiki est introuvable diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_it.properties deleted file mode 100755 index 34851435f1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_it.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=La pagina \u00e8 stata spostata -page-moved-here=qui -page-not-found=Impossibile trovare la pagina Wiki diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_ja.properties deleted file mode 100755 index 7f13a64179..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_ja.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=\u3053\u306e\u30da\u30fc\u30b8\u306f\u79fb\u52d5\u3055\u308c\u307e\u3057\u305f -page-moved-here=\u3053\u3053 -page-not-found=Wiki \u30da\u30fc\u30b8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_nb.properties deleted file mode 100755 index 20991f2f05..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_nb.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=Denne siden er flyttet -page-moved-here=hit -page-not-found=Kan ikke finne Wiki-siden diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_nl.properties deleted file mode 100755 index 101c317e12..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_nl.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=Deze pagina is -page-moved-here=hierheen verplaatst -page-not-found=Kan de wiki-pagina niet vinden diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_pt_BR.properties deleted file mode 100644 index b639d0d633..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_pt_BR.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=Essa p\u00e1gina foi movida -page-moved-here=aqui -page-not-found=N\u00e3o foi poss\u00edvel encontrar a p\u00e1gina de Wiki diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_ru.properties deleted file mode 100755 index cdddba2be6..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_ru.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=\u042d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0430 -page-moved-here=\u0441\u044e\u0434\u0430 -page-not-found=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0430 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_zh_CN.properties deleted file mode 100755 index e0afdc9d78..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post_zh_CN.properties +++ /dev/null @@ -1,3 +0,0 @@ -page-moved=\u6b64\u9875\u9762\u5df2\u79fb\u5230 -page-moved-here=\u6b64\u5904 -page-not-found=\u65e0\u6cd5\u627e\u5230\u6b64\u7ef4\u57fa\u9875\u9762 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.delete.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.delete.desc.xml deleted file mode 100644 index b2040f4e9f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.delete.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - wikidelete - Wiki - Deletes page - /slingshot/wiki/page/{siteId}/{pageTitle} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.delete.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.delete.json.ftl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.desc.xml deleted file mode 100644 index e76c291155..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - wikipage - Wiki - Page details - /slingshot/wiki/page/{siteId}/{pageTitle} - argument - user - required - internal - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.html.ftl deleted file mode 100644 index aea7be95a8..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.html.ftl +++ /dev/null @@ -1 +0,0 @@ -${result.page.contents} diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.json.404.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.json.404.ftl deleted file mode 100644 index 2ca3373415..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.json.404.ftl +++ /dev/null @@ -1,9 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "permissions": - { - "create": ${container.hasPermission("CreateChildren")?string}, - "edit": ${container.hasPermission("Write")?string} - } -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.json.ftl deleted file mode 100644 index 99d861850d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.json.ftl +++ /dev/null @@ -1,51 +0,0 @@ -<#macro dateFormat date>${xmldate(date)} -<#escape x as jsonUtils.encodeJSONString(x)> -{ -<#if result.page??> - <#assign page = result.page> - <#assign node = result.node> - "name": "${page.systemName}", - "title": "<#if page.title?has_content>${page.title}<#else>${page.systemName?replace("_", " ")}", - "pagetext": "${page.contents}", - "pageList": [ - <#list result.pageList as p> - "${p}"<#if p_has_next>, - - ]<#if !result.minWikiData>, - <#if !result.minWikiData> - "tags": [ - <#list result.tags as tag> - "${tag}"<#if tag_has_next>, - - ], - "links": [ - <#list result.links as link> - "${link}"<#if link_has_next>, - - ], - <#if node.hasAspect("cm:versionable")> - "versionhistory": [ - <#list node.versionHistory as record> - { - "name": "${record.name}", - "title": "${record.title!""}", - "version": "${record.versionLabel}", - "versionId": "${record.id}", - "date": "<@dateFormat record.createdDate />", - "author": "${record.creator}" - }<#if record_has_next>, - - ], - - "permissions": - { - "create": ${result.container.hasPermission("CreateChildren")?string}, - "edit": ${node.hasPermission("Write")?string}, - "delete": ${node.hasPermission("Delete")?string} - } - -<#else> - "error" : "${result.error!""}" - -} - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.mediawiki.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.mediawiki.ftl deleted file mode 100644 index dd63b57841..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.mediawiki.ftl +++ /dev/null @@ -1,6 +0,0 @@ -<#if result.page??> -${result.page.contents} -<#else> -<#-- An error occured --> -${result.error!""} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.properties deleted file mode 100644 index 10f930f611..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=The Wiki Page could not be found diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_de.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_de.properties deleted file mode 100755 index 4c58483a7e..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_de.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=Die Wiki-Seite wurde nicht gefunden diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_es.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_es.properties deleted file mode 100755 index bf63bcc354..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_es.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=No se ha podido encontrar la p\u00e1gina Wiki diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_fr.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_fr.properties deleted file mode 100755 index 7fb0341755..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_fr.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=La page du wiki est introuvable diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_it.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_it.properties deleted file mode 100755 index 19e07713cf..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_it.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=Impossibile trovare la pagina Wiki diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_ja.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_ja.properties deleted file mode 100755 index 82b202d8ef..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_ja.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=Wiki \u30da\u30fc\u30b8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_nb.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_nb.properties deleted file mode 100755 index 382f8fa033..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_nb.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=Kan ikke finne Wiki-siden diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_nl.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_nl.properties deleted file mode 100755 index 0e554f3606..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_nl.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=Kan de wiki-pagina niet vinden diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_pt_BR.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_pt_BR.properties deleted file mode 100644 index a3dff3cbac..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_pt_BR.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=N\u00e3o foi poss\u00edvel encontrar a p\u00e1gina de Wiki diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_ru.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_ru.properties deleted file mode 100755 index 89d866f9f4..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_ru.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0430 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_zh_CN.properties b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_zh_CN.properties deleted file mode 100755 index c1a07df32f..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.get_zh_CN.properties +++ /dev/null @@ -1 +0,0 @@ -page-not-found=\u65e0\u6cd5\u627e\u5230\u6b64\u7ef4\u57fa\u9875\u9762 diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.put.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.put.desc.xml deleted file mode 100644 index c166c0fb36..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.put.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - wikipage - Wiki - Page details - /slingshot/wiki/page/{siteId}/{pageTitle} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.put.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.put.json.ftl deleted file mode 100644 index 57c6a00648..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/page.put.json.ftl +++ /dev/null @@ -1,10 +0,0 @@ -<#assign page = result.page> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "name": "${page.systemName}", - "title": "${page.title}", - "pagetext": "${page.contents}", - <#assign tags><#list page.tags as tag>"${tag}"<#if tag_has_next>, - "tags": <#noescape>[${tags}] -} - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.desc.xml deleted file mode 100644 index 61b5f6e48d..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - wikipage - Wiki - Page details - /slingshot/wiki/pages/{siteId} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.json.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.json.ftl deleted file mode 100644 index 7daa61877c..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.json.ftl +++ /dev/null @@ -1,77 +0,0 @@ -<#macro dateFormat date>${xmldate(date)} -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalPages": ${wiki.pages?size?c}, - "permissions": - { - "create": ${wiki.container.hasPermission("CreateChildren")?string} - }, - "pages": - [ - <#if pageMetaOnly> - <#list wiki.pages as p> - <#assign page = p.page> - { - "name": "${p.name}", - "title": "<#if p.title?has_content>${p.title}<#else>${p.name?replace("_", " ")}", - }<#if p_has_next>, - - <#else> - <#list wiki.pages?sort_by(['modified'])?reverse as p> - <#assign node = p.node> - <#assign page = p.page> - { - "name": "${p.name}", - "title": "<#if p.title?has_content>${p.title}<#else>${p.name?replace("_", " ")}", - "text": "${page.contents}", - "tags": [ - <#list p.tags as tag> - "${tag}"<#if tag_has_next>, - - ], - "createdOn": "${formatDateISO8601(p.created)}", - <#if p.createdBy??> - <#assign createdBy = (p.createdBy.properties.firstName!"" + " " + p.createdBy.properties.lastName!"")?trim> - <#assign createdByUser = p.createdBy.properties.userName> - <#else> - <#assign createdBy=""> - <#assign createdByUser=""> - - "createdBy": "${createdBy}", - "createdByUser": "${createdByUser}", - "modifiedOn": "${formatDateISO8601(p.modified)}", - <#if p.modifiedBy??> - <#assign modifiedBy = (p.modifiedBy.properties.firstName!"" + " " + p.modifiedBy.properties.lastName!"")?trim> - <#assign modifiedByUser = p.modifiedBy.properties.userName> - <#else> - <#assign modifiedBy=""> - <#assign modifiedByUser=""> - - "modifiedBy": "${modifiedBy}", - "modifiedByUser": "${modifiedByUser}", - "permissions": - { - "edit": ${node.hasPermission("Write")?string}, - "delete": ${node.hasPermission("Delete")?string} - } - }<#if p_has_next>, - - - ], - "pageTitles": - [ - <#if wiki.pageTitles??> - <#list wiki.pageTitles as title> - "${title}"<#if title_has_next>, - - - ] -} - - -<#function formatDateISO8601 dateItem> - <# local temp=${.locale} --> - <#setting locale="en_US"> - <#return dateItem?datetime?string("yyyy-MM-dd'T'HH:mm:ss.SSSZ")> - <# setting locale=temp --> - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.rss.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.rss.ftl deleted file mode 100644 index df17aac703..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/pagelist.get.rss.ftl +++ /dev/null @@ -1,26 +0,0 @@ - - - - Alfresco - Wiki Page - ${shareUrl}/proxy/alfresco-feed/slingshot/wiki/pages/${siteId}?format=rss - Alfresco Wiki Page - Recent Changes - <#assign locale_original=.locale><#setting locale="en_US">${date?string("EEE, dd MMM yyyy HH:mm:ss Z")}<#setting locale=locale_original> - <#assign locale_original=.locale><#setting locale="en_US">${date?string("EEE, dd MMM yyyy HH:mm:ss Z")}<#setting locale=locale_original> - Alfresco ${server.edition} v${server.version} - - Alfresco - Wiki Page Recent Changes - ${shareUrl}/proxy/alfresco-feed/slingshot/wiki/pages/${siteId}?format=rss - ${shareUrl}/proxy/alfresco/images/logo/AlfrescoLogo200.png - - <#list wiki.pages?sort_by(['modified'])?reverse as p> - <#assign node = p.node> - <#assign page = p.page> - - ${(page.title!"")?html} - ${shareUrl}/page/site/${siteId}/wiki-page?title=${page.systemName?url('UTF-8')} - <#assign locale_original=.locale><#setting locale="en_US">${page.modifiedAt?string("EEE, dd MMM yyyy HH:mm:ss Z")}<#setting locale=locale_original> - ${node.id} - - - - diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.desc.xml b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.desc.xml deleted file mode 100644 index 5ffbf6f12a..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - wikipage - Wiki - Page details - /slingshot/wiki/version/{siteId}/{pageTitle}/{versionId} - argument - user - required - internal - \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.html.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.html.ftl deleted file mode 100644 index 51a16e9af1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.html.ftl +++ /dev/null @@ -1 +0,0 @@ -${content} \ No newline at end of file diff --git a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.mediawiki.ftl b/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.mediawiki.ftl deleted file mode 100644 index 51a16e9af1..0000000000 --- a/amps/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/version.get.mediawiki.ftl +++ /dev/null @@ -1 +0,0 @@ -${content} \ No newline at end of file diff --git a/amps/share-services/src/test/java/org/alfresco/ShareServicesTestSuite.java b/amps/share-services/src/test/java/org/alfresco/ShareServicesTestSuite.java deleted file mode 100644 index b51b379af7..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/ShareServicesTestSuite.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2021 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco; - -import org.alfresco.util.testing.category.DBTests; -import org.alfresco.util.testing.category.NonBuildTests; -import org.junit.experimental.categories.Categories; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Categories.class) -@Categories.ExcludeCategory({DBTests.class, NonBuildTests.class}) -@Suite.SuiteClasses({ - org.alfresco.repo.web.scripts.permission.PermissionServiceTest.class, - org.alfresco.repo.web.scripts.search.AdvancedSearchTest.class, - org.alfresco.repo.web.scripts.ReadOnlyTransactionInGetSlingshotApiTest.class, - org.alfresco.repo.wiki.WikiServiceImplTest.class, - org.alfresco.slingshot.documentlibrary.FolderTemplateTest.class, - org.alfresco.slingshot.web.scripts.SlingshotContentGetTest.class, -}) -public class ShareServicesTestSuite -{ -} diff --git a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/ReadOnlyTransactionInGetSlingshotApiTest.java b/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/ReadOnlyTransactionInGetSlingshotApiTest.java deleted file mode 100644 index 6803e04584..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/ReadOnlyTransactionInGetSlingshotApiTest.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts; - -import java.text.MessageFormat; -import java.util.List; - -import org.alfresco.repo.node.archive.NodeArchiveService; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -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.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.context.ApplicationContext; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * Set of tests that ensure Slingshot GET APIs are run successfully in a read-only - * transaction (ALF-10179). - * - * Some webscripts have a side effect of creating a "container" these tests - * are to ensure this is handled gracefully in a way that allows the main - * transaction to be declared as readonly for performance reasons. - * - * @see ReadOnlyTransactionInGetRestApiTest - * @author Gavin Cornwell - * @author Matt Ward - * @since 5.1 - */ -public class ReadOnlyTransactionInGetSlingshotApiTest extends BaseWebScriptTest -{ - private static final String TEST_SITE_NAME = "readOnlyTestSite"; - - private static final String URL_GET_SITE_DATALISTS = "/slingshot/datalists/lists/site/" + TEST_SITE_NAME + "/dataLists"; - private static final String URL_GET_SITE_WIKI = "/slingshot/wiki/pages/" + TEST_SITE_NAME; - private static final String URL_GET_SITE_WIKI_PAGE = "/slingshot/wiki/page/" + TEST_SITE_NAME + "/AWikiPage"; - private static final String URL_GET_SITE_WIKI_PAGE_VERSION = "/slingshot/wiki/version/" + TEST_SITE_NAME + "/AWikiPage/123456789"; - private static final String URL_GET_DOCLIB_CATEGORYNODE = "/slingshot/doclib/categorynode/node/{0}"; - private static final String URL_GET_DOCLIB_TREENODE = "/slingshot/doclib/treenode/site/" + TEST_SITE_NAME + "/documentLibrary"; - private static final String URL_GET_DOCLIB_NODE = "/slingshot/doclib/node/{0}"; - private static final String URL_GET_DOCLIB2_NODE = "/slingshot/doclib2/node/{0}"; - private static final String URL_GET_DOCLIB_LOCATION = "/slingshot/doclib/node/{0}/location"; - private static final String URL_GET_DOCLIB_DOCLIST = "/slingshot/doclib/doclist/documents/site/" + TEST_SITE_NAME + "/documentLibrary"; - private static final String URL_GET_DOCLIB2_DOCLIST = "/slingshot/doclib2/doclist/documents/site/" + TEST_SITE_NAME + "/documentLibrary"; - private static final String URL_GET_DOCLIB_IMAGES = "/slingshot/doclib/images/site/" + TEST_SITE_NAME + "/documentLibrary"; - - private SiteService siteService; - private NodeService nodeService; - private TransactionService transactionService; - private NodeArchiveService nodeArchiveService; - - private NodeRef testSiteNodeRef; - private String testSiteNodeRefString; - - private boolean logEnabled = false; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - ApplicationContext appContext = getServer().getApplicationContext(); - - this.siteService = (SiteService)appContext.getBean("SiteService"); - this.nodeService = (NodeService)appContext.getBean("NodeService"); - this.transactionService = (TransactionService)appContext.getBean("TransactionService"); - this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService"); - - // set admin as current user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // delete the test site if it's still hanging around from previous runs - SiteInfo site = siteService.getSite(TEST_SITE_NAME); - if (site != null) - { - siteService.deleteSite(TEST_SITE_NAME); - nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef())); - } - - // create the test site, this should create a site but it won't have any containers created - SiteInfo siteInfo = this.siteService.createSite("collaboration", TEST_SITE_NAME, "Read Only Test Site", - "Test site for ReadOnlyTransactionRestApiTest", SiteVisibility.PUBLIC); - this.testSiteNodeRef = siteInfo.getNodeRef(); - this.testSiteNodeRefString = this.testSiteNodeRef.toString().replace("://", "/"); - - // ensure there are no containers present at the start of the test - List children = nodeService.getChildAssocs(this.testSiteNodeRef); - assertTrue("The test site should not have any containers", children.isEmpty()); - } - - /* (non-Javadoc) - * @see junit.framework.TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - - SiteInfo site = siteService.getSite(TEST_SITE_NAME); - // use retrying transaction to delete the site - this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - // delete the test site - siteService.deleteSite(TEST_SITE_NAME); - - return null; - } - }); - nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef())); - - AuthenticationUtil.clearCurrentSecurityContext(); - } - - public void testGetSiteDataLists() throws Exception - { - // TODO: Fixme - This REST API still requires a readwrite transaction to be successful - - Response response = sendRequest(new GetRequest(URL_GET_SITE_DATALISTS), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetSiteWiki() throws Exception - { - Response response = sendRequest(new GetRequest(URL_GET_SITE_WIKI), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetSiteWikiPage() throws Exception - { - Response response = sendRequest(new GetRequest(URL_GET_SITE_WIKI_PAGE), 404); - logResponse(response); - assertEquals(Status.STATUS_NOT_FOUND, response.getStatus()); - } - - public void testGetSiteWikiPageVersion() throws Exception - { - Response response = sendRequest(new GetRequest(URL_GET_SITE_WIKI_PAGE_VERSION), 404); - logResponse(response); - assertEquals(Status.STATUS_NOT_FOUND, response.getStatus()); - } - - public void testGetDoclibTreeNode() throws Exception - { - // TODO: Fixme - This REST API still requires a readwrite transaction to be successful - - Response response = sendRequest(new GetRequest(URL_GET_DOCLIB_TREENODE), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclibDoclist() throws Exception - { - // TODO: Fixme - This REST API still requires a readwrite transaction to be successful - - Response response = sendRequest(new GetRequest(URL_GET_DOCLIB_DOCLIST), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclib2Doclist() throws Exception - { - // TODO: Fixme - This REST API still requires a readwrite transaction to be successful - - Response response = sendRequest(new GetRequest(URL_GET_DOCLIB2_DOCLIST), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclibImages() throws Exception - { - // TODO: Fixme - This REST API still requires a readwrite transaction to be successful - - Response response = sendRequest(new GetRequest(URL_GET_DOCLIB_IMAGES), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclibCategoryNode() throws Exception - { - Response response = sendRequest(new GetRequest(MessageFormat.format(URL_GET_DOCLIB_CATEGORYNODE, - testSiteNodeRefString)), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclibNode() throws Exception - { - Response response = sendRequest(new GetRequest(MessageFormat.format(URL_GET_DOCLIB_NODE, - testSiteNodeRefString)), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclib2Node() throws Exception - { - Response response = sendRequest(new GetRequest(MessageFormat.format(URL_GET_DOCLIB2_NODE, - testSiteNodeRefString)), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - public void testGetDoclibNodeLocation() throws Exception - { - Response response = sendRequest(new GetRequest(MessageFormat.format(URL_GET_DOCLIB_LOCATION, - testSiteNodeRefString)), 200); - logResponse(response); - assertEquals(Status.STATUS_OK, response.getStatus()); - } - - private void logResponse(Response response) - { - if (this.logEnabled) - { - try - { - System.out.println(response.getContentAsString()); - } - catch (Exception e) - { - System.err.println("Unable to log response: " + e.toString()); - } - } - } -} diff --git a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/permission/PermissionServiceTest.java b/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/permission/PermissionServiceTest.java deleted file mode 100644 index b9a53f5ffa..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/permission/PermissionServiceTest.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.permission; - -import java.util.HashSet; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.model.FileFolderService; -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.security.AccessStatus; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; -import org.json.JSONArray; -import org.json.JSONObject; -import org.json.JSONException; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * Test for RestAPI permission services - * - * @author alex.mukha - * @since 4.2.3 - */ -public class PermissionServiceTest extends BaseWebScriptTest -{ - private MutableAuthenticationService authenticationService; - private AuthenticationComponent authenticationComponent; - private PersonService personService; - private NodeService nodeService; - private PermissionService permissionService; - private FileFolderService fileFolderService; - private SiteService siteService; - - private static final String USER_ONE = "USER_ONE_" + GUID.generate(); - private static final String USER_TWO = "USER_TWO_" + GUID.generate(); - private static final String USER_THREE = "USER_THREE_" + GUID.generate(); - private static final String URL_DOCLIB_PERMISSIONS = "/slingshot/doclib/permissions"; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService"); - this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent"); - this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService"); - this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService"); - this.permissionService = (PermissionService)getServer().getApplicationContext().getBean("PermissionService"); - this.fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService"); - this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService"); - - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - // Create users - createUser(USER_ONE); - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - - // Clear the users - deleteUser(USER_ONE); - } - - /** - * Test for MNT-11725 - */ - public void testDowngradePermissions() throws Exception - { - NodeRef rootNodeRef = this.nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - NodeRef folderRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.ALFRESCO_URI, "testFolder"), - ContentModel.TYPE_FOLDER).getChildRef(); - permissionService.setPermission(folderRef, USER_ONE, PermissionService.COORDINATOR, true); - permissionService.setInheritParentPermissions(folderRef, false); - - authenticationComponent.setCurrentUser(USER_ONE); - - // JSON fromat - // {"permissions": - // [{"authority":"userA", - // "role":"Consumer"}, - // {"authority":"userA", - // "role":"Coordinator", - // "remove":true}], - // "isInherited":true} - - /* negative test, we are first deleting the coordinator role and then try to add consumer */ - JSONObject changePermission = new JSONObject(); - JSONArray permissions = new JSONArray(); - // First delete permission, then add - JSONObject addPermission = new JSONObject(); - addPermission.put("authority", USER_ONE); - addPermission.put("role", PermissionService.CONSUMER); - JSONObject removePermission = new JSONObject(); - removePermission.put("authority", USER_ONE); - removePermission.put("role", PermissionService.COORDINATOR); - removePermission.put("remove","true"); - permissions.put(removePermission); - permissions.put(addPermission); - changePermission.put("permissions", permissions); - changePermission.put("isInherited", "true"); - - sendRequest(new PostRequest(URL_DOCLIB_PERMISSIONS + - "/" + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getProtocol() + - "/" + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getIdentifier() + - "/" + folderRef.getId(), changePermission.toString(), "application/json"), Status.STATUS_INTERNAL_SERVER_ERROR); - - /* positive test */ - changePermission = new JSONObject(); - permissions = new JSONArray(); - // First add permission, then delete - addPermission = new JSONObject(); - addPermission.put("authority", USER_ONE); - addPermission.put("role", PermissionService.CONSUMER); - removePermission = new JSONObject(); - removePermission.put("authority", USER_ONE); - removePermission.put("role", PermissionService.COORDINATOR); - removePermission.put("remove","true"); - permissions.put(addPermission); - permissions.put(removePermission); - changePermission.put("permissions", permissions); - changePermission.put("isInherited", "true"); - - sendRequest(new PostRequest(URL_DOCLIB_PERMISSIONS + - "/" + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getProtocol() + - "/" + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getIdentifier() + - "/" + folderRef.getId(), changePermission.toString(), "application/json"), Status.STATUS_OK); - - AccessStatus accessStatus = permissionService.hasPermission(folderRef, PermissionService.CONSUMER); - assertTrue("The permission was not set correctly", accessStatus == AccessStatus.ALLOWED); - - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - nodeService.deleteNode(folderRef); - } - - private void createUser(String userName) - { - if (this.authenticationService.authenticationExists(userName) == false) - { - this.authenticationService.createAuthentication(userName, "PWD".toCharArray()); - - PropertyMap properties = new PropertyMap(4); - properties.put(ContentModel.PROP_USERNAME, userName); - properties.put(ContentModel.PROP_FIRSTNAME, "firstName"); - properties.put(ContentModel.PROP_LASTNAME, "lastName"); - properties.put(ContentModel.PROP_EMAIL, "email@email.com"); - properties.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - - this.personService.createPerson(properties); - } - } - - private void deleteUser(String username) - { - this.personService.deletePerson(username); - if(this.authenticationService.authenticationExists(username)) - { - this.authenticationService.deleteAuthentication(username); - } - } - - /** - * Test for MNT-15509 Grant or/and Deny the same permission on multiple ancestors of a - * file and check if the file has duplicate inherited permissions - */ - public void testMultipleInheritedPermissions() throws Exception - { - // Create the site - String siteName = GUID.generate(); - siteService.createSite("Testing", siteName, siteName, null, SiteVisibility.PUBLIC); - - // Ensure we have a doclib - NodeRef siteContainer = siteService.createContainer(siteName, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null); - - // Create Folder1 - // Give USER_ONE COORDINATOR role to Folder1 - // Give USER_TWO CONTRIBUTOR role to Folder1 - // Deny USER_THREE CONSUMER role to Folder1 - NodeRef folder1 = fileFolderService.create(siteContainer, "Folder1", ContentModel.TYPE_FOLDER).getNodeRef(); - permissionService.setPermission(folder1, USER_ONE, PermissionService.COORDINATOR, true); - permissionService.setPermission(folder1, USER_TWO, PermissionService.CONTRIBUTOR, true); - permissionService.setPermission(folder1, USER_THREE, PermissionService.CONSUMER, false); - permissionService.setInheritParentPermissions(folder1, true); - - // Create Folder2 in Folder1 - // Give USER_ONE COORDINATOR role to Folder2 - // Deny USER_TWO CONTRIBUTOR role to Folder2 - // Give USER_THREE CONSUMER role to Folder2 - NodeRef folder2 = fileFolderService.create(folder1, "Folder2", ContentModel.TYPE_FOLDER).getNodeRef(); - permissionService.setPermission(folder2, USER_ONE, PermissionService.COORDINATOR, true); - permissionService.setPermission(folder2, USER_TWO, PermissionService.CONTRIBUTOR, false); - permissionService.setPermission(folder2, USER_THREE, PermissionService.CONSUMER, true); - permissionService.setInheritParentPermissions(folder2, true); - - // Create Folder3 in Folder2 - // Give USER_ONE CONSUMER role to Folder3 twice - NodeRef folder3 = fileFolderService.create(folder2, "Folder3", ContentModel.TYPE_FOLDER).getNodeRef(); - permissionService.setPermission(folder3, USER_ONE, PermissionService.CONSUMER, true); - permissionService.setPermission(folder3, USER_ONE, PermissionService.CONSUMER, true); - permissionService.setPermission(folder3, USER_ONE, PermissionService.COORDINATOR, true); - permissionService.setInheritParentPermissions(folder3, true); - - // Get Folder3's inherited permissions - Response response = sendRequest( - new GetRequest(URL_DOCLIB_PERMISSIONS + "/" + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getProtocol() + "/" - + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE.getIdentifier() + "/" + folder3.getId()), Status.STATUS_OK); - - JSONObject jsonResponse = new JSONObject(response.getContentAsString()); - - //Check if the request returns duplicate direct permissions - HashSet directPermissions = new HashSet<>(); - JSONArray directPermissionsArray = jsonResponse.getJSONArray("direct"); - for (int i = 0; i < directPermissionsArray.length(); i++) - { - AccessPermission permission = new AccessPermission(directPermissionsArray.getJSONObject(i)); - - assertTrue(directPermissions.add(permission)); - } - - //used to check allow/deny permission inheritance - AccessPermission denyPermissionInheritedTest = null; - AccessPermission allowPermissionInheritedTest = null; - - // Check if the request returns duplicate inherited permissions - HashSet inheritedPermissions = new HashSet<>(); - JSONArray inheritedPermissionsArray = jsonResponse.getJSONArray("inherited"); - for (int i = 0; i < inheritedPermissionsArray.length(); i++) - { - AccessPermission permission = new AccessPermission(inheritedPermissionsArray.getJSONObject(i)); - if (USER_TWO.equals(permission.getAuthority().getName()) && PermissionService.CONTRIBUTOR.equals(permission.getRole())) - { - denyPermissionInheritedTest = permission; - } - if (USER_THREE.equals(permission.getAuthority().getName()) && PermissionService.CONSUMER.equals(permission.getRole())) - { - allowPermissionInheritedTest = permission; - } - assertTrue(inheritedPermissions.add(permission)); - } - - // Check if on folder3 USER_TWO inherits DENY for CONTRIBUTOR role from - // folder 2 although on folder 1 was ALLOW - assertNull(denyPermissionInheritedTest); - - // Check if on folder3 USER_THREE inherits ALLOW for CONSUMER role from - // folder 2 although on folder 1 was DENY - assertNotNull(allowPermissionInheritedTest); - } -} - -class AccessPermission -{ - private PermissionAuthority authority; - private String role; - - public AccessPermission(JSONObject jsonPermission) throws JSONException - { - authority = new PermissionAuthority(jsonPermission.getJSONObject("authority")); - role = jsonPermission.getString("role"); - } - - public PermissionAuthority getAuthority() - { - return this.authority; - } - - public String getRole() - { - return this.role; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof AccessPermission)) - { - return false; - } - - return (role.equals(((AccessPermission) obj).getRole()) && authority.equals(((AccessPermission) obj).getAuthority())); - } - - @Override - public int hashCode() - { - return authority.hashCode() + role.hashCode(); - } -} - -class PermissionAuthority -{ - private String name; - private String displayName; - - public PermissionAuthority(JSONObject jsonAuth) throws JSONException - { - name = jsonAuth.getString("name"); - displayName = jsonAuth.getString("displayName"); - } - - public String getName() - { - return this.name; - } - - public String getDisplayName() - { - return this.displayName; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof PermissionAuthority)) - { - return false; - } - - return (name.equals(((PermissionAuthority) obj).getName()) && displayName.equals(((PermissionAuthority) obj).getDisplayName())); - } - - @Override - public int hashCode() - { - return name.hashCode() + displayName.hashCode(); - } -} diff --git a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/search/AdvancedSearchTest.java b/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/search/AdvancedSearchTest.java deleted file mode 100644 index 728e10b59a..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/search/AdvancedSearchTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.search; - -import java.io.IOException; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationComponent; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.model.FileFolderService; -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.SearchService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.transaction.TransactionService; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Ignore; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - - -@Ignore("This test doesn't pass on HEAD-BUG-FIX and isn't included in a test suite.") -public class AdvancedSearchTest extends BaseWebScriptTest -{ - private static final String TEST_FILE_NAME1 = "qwe iop.txt"; - private static final String TEST_FILE_NAME2 = "qwe yu iop.txt"; - private static final String TEST_IN_SITES_FILE_NAME = "qwesiteiop"; - private static final String SEARCH_NAME = "qwe iop"; - private static final String SEARCH_IN_SITES = "qwesiteiop"; - private static final String TEST_FOLDER = "test_folder-" + System.currentTimeMillis(); - - private TransactionService transactionService; - private NodeService nodeService; - private FileFolderService fileFolderService; - private SearchService searchService; - private NamespaceService namespaceService; - private AuthenticationComponent authenticationComponent; - private NodeRef testNodeRef1; - private NodeRef testNodeRef2; - private NodeRef folderNodeRef; - private NodeRef rootNodeRef; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - this.transactionService = (TransactionService) getServer().getApplicationContext().getBean("TransactionService"); - this.nodeService = (NodeService) getServer().getApplicationContext().getBean("NodeService"); - this.fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService"); - this.authenticationComponent = (AuthenticationComponent) getServer().getApplicationContext().getBean("authenticationComponent"); - this.searchService = (SearchService) getServer().getApplicationContext().getBean("SearchService"); - this.namespaceService = (NamespaceService) getServer().getApplicationContext().getBean("namespaceService"); - - this.authenticationComponent.setSystemUserAsCurrentUser(); - - this.rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - - List results = searchService.selectNodes(this.rootNodeRef, "/app:company_home", null, namespaceService, false); - if (results.size() == 0) - { - throw new AlfrescoRuntimeException("Can't find /app:company_home"); - } - - NodeRef companyHomeNodeRef = results.get(0); - - folderNodeRef = fileFolderService.create(companyHomeNodeRef, TEST_FOLDER, ContentModel.TYPE_FOLDER).getNodeRef(); - - testNodeRef1 = fileFolderService.create(folderNodeRef, TEST_FILE_NAME1, ContentModel.TYPE_CONTENT).getNodeRef(); - testNodeRef2 = fileFolderService.create(folderNodeRef, TEST_FILE_NAME2, ContentModel.TYPE_CONTENT).getNodeRef(); - - - assertNotNull(testNodeRef1); - assertNotNull(testNodeRef2); - } - - private void deleteNodeIfExists(NodeRef nodeRef) - { - if (nodeService.exists(nodeRef)) - { - nodeService.deleteNode(nodeRef); - } - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - RetryingTransactionCallback deleteCallback = new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - deleteNodeIfExists(testNodeRef1); - deleteNodeIfExists(testNodeRef2); - deleteNodeIfExists(folderNodeRef); - return null; - } - - }; - this.transactionService.getRetryingTransactionHelper().doInTransaction(deleteCallback); - this.authenticationComponent.clearCurrentSecurityContext(); - } - - public void testSearchFile() throws IOException, JSONException - { - //Name search without quotes - String url = "/slingshot/search?site=&term=&tag=&maxResults=251&sort=&query={\"prop_cm_name\":\"" + SEARCH_NAME + "\",\"datatype\":\"cm:content\"}&repo=true&rootNode=alfresco://company/home"; - Response res = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject result = new JSONObject(res.getContentAsString()); - assertEquals(2, result.getInt("totalRecords")); - - url = "/slingshot/search?site=&term=&tag=&maxResults=251&sort=&query={\"prop_cm_name\":\"\\\"" + SEARCH_NAME + "\\\"\",\"datatype\":\"cm:content\"}&repo=true&rootNode=alfresco://company/home"; - res = sendRequest(new GetRequest(url), Status.STATUS_OK); - result = new JSONObject(res.getContentAsString()); - assertEquals(1, result.getInt("totalRecords")); - } - - public void testSearchInSites() throws IOException, JSONException - { - List results = searchService.selectNodes(this.rootNodeRef, "/app:company_home/st:sites", null, namespaceService, false); - if (results.size() == 0) - { - throw new AlfrescoRuntimeException("Can't find /app:company_home/st:sites"); - } - - NodeRef sitesNodeRef = results.get(0); - - long time = System.currentTimeMillis(); - - NodeRef sitefolderNodeRef = fileFolderService.create(sitesNodeRef, TEST_FOLDER, ContentModel.TYPE_FOLDER).getNodeRef(); - NodeRef nodeRef = fileFolderService.create(sitefolderNodeRef, TEST_IN_SITES_FILE_NAME + time, ContentModel.TYPE_CONTENT).getNodeRef(); - // String url = "/slingshot/search?site=&term=" + SEARCH_NAME + "&tag=&maxResults=251&sort=&query=&repo=false&rootNode=alfresco%3A%2F%2Fcompany%2Fhome&pageSize=50&startIndex=0"; - String url = "/slingshot/search?site=&term=&tag=&maxResults=251&sort=&query={\"prop_cm_name\":\"" + SEARCH_IN_SITES + time + "\",\"datatype\":\"cm:content\"}&repo=true&rootNode=alfresco://company/home"; - Response res = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject result = new JSONObject(res.getContentAsString()); - assertEquals(1, result.getInt("totalRecords")); - - deleteNodeIfExists(nodeRef); - deleteNodeIfExists(sitefolderNodeRef); - - } - -} diff --git a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/wiki/WikiRestApiTest.java b/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/wiki/WikiRestApiTest.java deleted file mode 100644 index abf39ca381..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/repo/web/scripts/wiki/WikiRestApiTest.java +++ /dev/null @@ -1,1009 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.web.scripts.wiki; - -import java.util.Date; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.transaction.UserTransaction; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.node.archive.NodeArchiveService; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.security.authentication.AuthenticationComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteRole; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.cmr.wiki.WikiPageInfo; -import org.alfresco.service.cmr.wiki.WikiService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.PropertyMap; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * Unit Test to test the Wiki Web Script API - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiRestApiTest extends BaseWebScriptTest -{ - @SuppressWarnings("unused") - private static Log logger = LogFactory.getLog(WikiRestApiTest.class); - - private MutableAuthenticationService authenticationService; - private AuthenticationComponent authenticationComponent; - private TransactionService transactionService; - private BehaviourFilter policyBehaviourFilter; - private PersonService personService; - private NodeService nodeService; - private NodeService internalNodeService; - private SiteService siteService; - private WikiService wikiService; - private NodeArchiveService nodeArchiveService; - - private static final String USER_ONE = "UserOneSecondToo"; - private static final String USER_TWO = "UserTwoSecondToo"; - private static final String USERDETAILS_FIRSTNAME = "FirstName123"; - private static final String USERDETAILS_LASTNAME = "LastName123"; - private static final String SITE_SHORT_NAME_WIKI = "WikiSiteShortNameTest"; - - private static final String PAGE_TITLE_ONE = "TestPageOne"; - private static final String PAGE_TITLE_TWO = "Test_Page_Two"; - private static final String PAGE_TITLE_THREE = "Still_Test_Page_Three"; - private static final String PAGE_CONTENTS_ONE = "http://google.com/"; - private static final String PAGE_CONTENTS_TWO = "http://alfresco.com/"; - private static final String PAGE_CONTENTS_THREE = "http://share.alfresco.com/"; - private static final String PAGE_CONTENTS_LINK = "Text text [[TestPageOne|P1]] [[Test_Page_Two|P2]] [[Invalid|Invalid]] text"; - - private static final String URL_WIKI_BASE = "/slingshot/wiki/page"; - private static final String URL_WIKI_LIST = URL_WIKI_BASE + "s/" + SITE_SHORT_NAME_WIKI; - private static final String URL_WIKI_FETCH = URL_WIKI_BASE + "/" + SITE_SHORT_NAME_WIKI + "/"; // plus title - private static final String URL_WIKI_UPDATE = URL_WIKI_BASE + "/" + SITE_SHORT_NAME_WIKI + "/"; // plus title - private static final String URL_WIKI_DELETE = URL_WIKI_BASE + "/" + SITE_SHORT_NAME_WIKI + "/"; // plus title - private static final String URL_WIKI_RENAME = URL_WIKI_BASE + "/" + SITE_SHORT_NAME_WIKI + "/"; // plus title - private static final String URL_WIKI_VERSION = "/slingshot/wiki/version/" + SITE_SHORT_NAME_WIKI + "/"; - - - // General methods - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService"); - this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent"); - this.policyBehaviourFilter = (BehaviourFilter)getServer().getApplicationContext().getBean("policyBehaviourFilter"); - this.transactionService = (TransactionService)getServer().getApplicationContext().getBean("transactionService"); - this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService"); - this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService"); - this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService"); - this.wikiService = (WikiService)getServer().getApplicationContext().getBean("WikiService"); - this.internalNodeService = (NodeService)getServer().getApplicationContext().getBean("nodeService"); - this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService"); - - // Authenticate as user - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - - // Create test site - // - only create the site if it doesn't already exist - SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_WIKI); - if (siteInfo == null) - { - this.siteService.createSite("WikiSitePreset", SITE_SHORT_NAME_WIKI, "WikiSiteTitle", "TestDescription", SiteVisibility.PUBLIC); - } - - // Ensure the links container is there - if(!siteService.hasContainer(SITE_SHORT_NAME_WIKI, "wiki")) - { - siteService.createContainer(SITE_SHORT_NAME_WIKI, "wiki", null, null); - } - - // Create users - createUser(USER_ONE, SiteModel.SITE_COLLABORATOR); - createUser(USER_TWO, SiteModel.SITE_COLLABORATOR); - - // Do tests as inviter user - this.authenticationComponent.setCurrentUser(USER_ONE); - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - - // admin user required to delete user - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - - SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_WIKI); - if (siteInfo != null) - { - // delete the site - siteService.deleteSite(SITE_SHORT_NAME_WIKI); - nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef())); - } - - // delete the users - if(personService.personExists(USER_ONE)) - { - personService.deletePerson(USER_ONE); - } - if(this.authenticationService.authenticationExists(USER_ONE)) - { - this.authenticationService.deleteAuthentication(USER_ONE); - } - - if(personService.personExists(USER_TWO)) - { - personService.deletePerson(USER_TWO); - } - if(this.authenticationService.authenticationExists(USER_TWO)) - { - this.authenticationService.deleteAuthentication(USER_TWO); - } - } - - private void createUser(String userName, String role) - { - // if user with given user name doesn't already exist then create user - if (this.authenticationService.authenticationExists(userName) == false) - { - // create user - this.authenticationService.createAuthentication(userName, "password".toCharArray()); - - // create person properties - PropertyMap personProps = new PropertyMap(); - personProps.put(ContentModel.PROP_USERNAME, userName); - personProps.put(ContentModel.PROP_FIRSTNAME, USERDETAILS_FIRSTNAME); - personProps.put(ContentModel.PROP_LASTNAME, USERDETAILS_LASTNAME); - personProps.put(ContentModel.PROP_EMAIL, "FirstName123.LastName123@email.com"); - personProps.put(ContentModel.PROP_JOBTITLE, "JobTitle123"); - personProps.put(ContentModel.PROP_JOBTITLE, "Organisation123"); - - // create person node for user - this.personService.createPerson(personProps); - } - - // add the user as a member with the given role - this.siteService.setMembership(SITE_SHORT_NAME_WIKI, userName, role); - } - - - // Test helper methods - - private JSONObject getPages(String filter, String username) throws Exception - { - String origUser = this.authenticationComponent.getCurrentUserName(); - if (username != null) - { - this.authenticationComponent.setCurrentUser(username); - filter = "myPages"; - } - - String url = URL_WIKI_LIST; - if (filter == null) - { - filter = "all"; - } - url += "?filter=" + filter; - url += "&startIndex=0&page=1&pageSize=4"; - - Response response = sendRequest(new GetRequest(url), 200); - JSONObject result = new JSONObject(response.getContentAsString()); - - if (username != null) - { - this.authenticationComponent.setCurrentUser(origUser); - } - - return result; - } - - private JSONObject getPage(String name, int expectedStatus) throws Exception - { - Response response = sendRequest(new GetRequest(URL_WIKI_FETCH + name), expectedStatus); - if (expectedStatus == Status.STATUS_OK) - { - JSONObject result = new JSONObject(response.getContentAsString()); - if (result.has("page")) - { - return result.getJSONObject("page"); - } - return result; - } - else if (expectedStatus == Status.STATUS_NOT_FOUND) - { - JSONObject result = new JSONObject(response.getContentAsString()); - return result; - } - else - { - return null; - } - } - - /** - * Fetches the content of a page at a given version - * Note - not JSON based. - */ - private String getPageAtVersion(String name, String version, int expectedStatus) throws Exception - { - Response response = sendRequest(new GetRequest(URL_WIKI_VERSION + name + "/" + version), expectedStatus); - if (expectedStatus == Status.STATUS_OK) - { - return response.getContentAsString(); - } - else if (expectedStatus == Status.STATUS_NOT_FOUND) - { - return response.getContentAsString(); - } - else - { - return null; - } - } - - /** - * Creates a single wiki page based on the supplied details - */ - private JSONObject createOrUpdatePage(String title, String contents, String version, int expectedStatus) - throws Exception - { - return createOrUpdatePage(null, title, contents, version, expectedStatus); - } - - /** - * Creates a single wiki page based on the supplied details - */ - private JSONObject createOrUpdatePage(String pageName, String title, String contents, String version, int expectedStatus) throws Exception - { - String name = null; - if (pageName == null) - { - name = title.replace(' ', '_'); - } - else - { - name = pageName; - } - - JSONObject json = new JSONObject(); - json.put("site", SITE_SHORT_NAME_WIKI); - json.put("title", title); - json.put("pagecontent", contents); - json.put("tags", ""); - json.put("page", "wiki-page"); // TODO Is this really needed? - - if (version == null || "force".equals(version)) - { - // Allow the save as-is, no versioning check - json.put("forceSave", "true"); // Allow the save as-is - } - else - { - if ("none".equals(version)) - { - // No versioning - } - else - { - json.put("currentVersion", version); - } - } - - Response response = sendRequest(new PutRequest(URL_WIKI_UPDATE + name, json.toString(), "application/json"), expectedStatus); - if (expectedStatus == Status.STATUS_OK) - { - JSONObject result = new JSONObject(response.getContentAsString()); - if (result.has("page")) - { - return result.getJSONObject("page"); - } - return result; - } - else - { - return null; - } - } - - /** - * Renames the page - */ - private JSONObject renamePage(String oldTitle, String newTitle, int expectedStatus) throws Exception - { - String name = oldTitle.replace(' ', '_'); - - JSONObject json = new JSONObject(); - json.put("site", SITE_SHORT_NAME_WIKI); - json.put("name", newTitle); - json.put("page", "wiki-page"); // TODO Is this really needed? - - Response response = sendRequest(new PostRequest(URL_WIKI_RENAME + name, json.toString(), "application/json"), expectedStatus); - if (expectedStatus == Status.STATUS_OK) - { - JSONObject result = new JSONObject(response.getContentAsString()); - return result; - } - else - { - return null; - } - } - - /** - * Deletes the page - */ - private JSONObject deletePage(String title, int expectedStatus) throws Exception - { - String name = title.replace(' ', '_'); - - Response response = sendRequest(new DeleteRequest(URL_WIKI_DELETE + name), expectedStatus); - if (expectedStatus == Status.STATUS_OK) - { - JSONObject result = new JSONObject(response.getContentAsString()); - return result; - } - else - { - return null; - } - } - - /** - * Monkeys with the created date on a wiki page - */ - private void pushPageCreatedDateBack(String name, int daysAgo) throws Exception - { - NodeRef container = siteService.getContainer(SITE_SHORT_NAME_WIKI, "wiki"); - NodeRef node = nodeService.getChildByName(container, ContentModel.ASSOC_CONTAINS, name); - - Date created = (Date)nodeService.getProperty(node, ContentModel.PROP_CREATED); - Date newCreated = new Date(created.getTime() - daysAgo*24*60*60*1000); - - UserTransaction txn = transactionService.getUserTransaction(); - txn.begin(); - - this.policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); - internalNodeService.setProperty(node, ContentModel.PROP_CREATED, newCreated); - this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); - - txn.commit(); - - // Now chance something else on the node to have it re-indexed - nodeService.setProperty(node, ContentModel.PROP_CREATED, newCreated); - nodeService.setProperty(node, ContentModel.PROP_DESCRIPTION, "Forced change"); - } - - - // Tests - - /** - * Creating, editing, fetching and deleting a link - */ - public void testCreateEditDeleteEntry() throws Exception - { - JSONObject page; - JSONObject permissions; - String name; - - - // None to start with - page = getPages(null, null); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("totalPages")); - assertEquals(0, page.getInt("totalPages")); - - - // Won't be there to start with - page = getPage(PAGE_TITLE_ONE, Status.STATUS_NOT_FOUND); - - // Create - page = createOrUpdatePage(PAGE_TITLE_ONE, PAGE_CONTENTS_ONE, null, Status.STATUS_OK); - name = PAGE_TITLE_ONE.replace(' ', '_'); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("title")); - - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_ONE, page.getString("title")); - assertEquals(PAGE_CONTENTS_ONE, page.getString("pagetext")); - assertEquals(0, page.getJSONArray("tags").length()); - - - // Fetch - page = getPage(name, Status.STATUS_OK); - - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_ONE, page.getString("title")); - assertEquals(PAGE_CONTENTS_ONE, page.getString("pagetext")); - assertEquals(0, page.getJSONArray("tags").length()); - assertEquals(0, page.getJSONArray("links").length()); - - // Check the permissions - assertEquals(true, page.has("permissions")); - permissions = page.getJSONObject("permissions"); - assertEquals(true, permissions.getBoolean("create")); - assertEquals(true, permissions.getBoolean("edit")); - assertEquals(true, permissions.getBoolean("delete")); - - - // Edit - // We should get a simple message - page = createOrUpdatePage(PAGE_TITLE_ONE, "M"+PAGE_CONTENTS_ONE, null, Status.STATUS_OK); - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_ONE, page.getString("title")); - assertEquals("M"+PAGE_CONTENTS_ONE, page.getString("pagetext")); - assertEquals(0, page.getJSONArray("tags").length()); - - - - // Fetch - page = getPage(name, Status.STATUS_OK); - - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_ONE, page.getString("title")); - assertEquals("M"+PAGE_CONTENTS_ONE, page.getString("pagetext")); - assertEquals(0, page.getJSONArray("tags").length()); - assertEquals(0, page.getJSONArray("links").length()); - - - // Fetch as a different user, permissions different - this.authenticationComponent.setCurrentUser(USER_TWO); - page = getPage(name, Status.STATUS_OK); - - // Check the basics - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_ONE, page.getString("title")); - assertEquals("M"+PAGE_CONTENTS_ONE, page.getString("pagetext")); - assertEquals(0, page.getJSONArray("tags").length()); - assertEquals(0, page.getJSONArray("links").length()); - - // Different user in the site, can edit but not delete - assertEquals(true, page.has("permissions")); - permissions = page.getJSONObject("permissions"); - assertEquals(true, permissions.getBoolean("create")); - assertEquals(true, permissions.getBoolean("edit")); - assertEquals(false, permissions.getBoolean("delete")); - - this.authenticationComponent.setCurrentUser(USER_ONE); - - - // Delete - page = deletePage(name, Status.STATUS_NO_CONTENT); - assertEquals(null, page); // No response - - - // Fetch, will have gone - page = getPage(name, Status.STATUS_NOT_FOUND); - - // On a page that isn't there, you do get permissions - assertEquals(true, page.has("permissions")); - permissions = page.getJSONObject("permissions"); - assertEquals(true, permissions.getBoolean("create")); - assertEquals(true, permissions.getBoolean("edit")); - assertEquals(false, permissions.has("delete")); // No delete for non existing page - - - // Can't delete again - deletePage(name, Status.STATUS_NOT_FOUND); - } - - public void testRenaming() throws Exception - { - JSONObject page; - String name; - String name2; - - - // Create a page - page = createOrUpdatePage(PAGE_TITLE_TWO, PAGE_CONTENTS_ONE, null, Status.STATUS_OK); - name = PAGE_TITLE_TWO.replace(' ', '_'); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("title")); - - - // Fetch it and check - page = getPage(name, Status.STATUS_OK); - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_TWO, page.getString("title")); - - - // Have it renamed - page = renamePage(PAGE_TITLE_TWO, PAGE_TITLE_THREE, Status.STATUS_OK); - name2 = PAGE_TITLE_THREE.replace(' ', '_'); - assertEquals(PAGE_TITLE_THREE, page.getString("title")); - - - // Fetch it at the new address - page = getPage(name2, Status.STATUS_OK); - assertEquals(name2, page.getString("name")); - assertEquals(PAGE_TITLE_THREE, page.getString("title")); - - - // Get the old one, and ensure we see the "has been moved" - page = getPage(name, Status.STATUS_OK); - assertEquals(name, page.getString("name")); - assertEquals(PAGE_TITLE_TWO, page.getString("title")); - assertEquals("This page has been moved [["+PAGE_TITLE_THREE+"|here]].", page.getString("pagetext")); - - - // Ensure you can't rename onto an existing page - page = createOrUpdatePage(PAGE_TITLE_ONE, PAGE_CONTENTS_THREE, null, Status.STATUS_OK); - String name1 = PAGE_TITLE_ONE.replace(' ', '_'); - - // Check the rename won't work - renamePage(PAGE_TITLE_THREE, PAGE_TITLE_ONE, Status.STATUS_CONFLICT); - - // Check that the pages weren't changed - page = getPage(name2, Status.STATUS_OK); - assertEquals(name2, page.getString("name")); - assertEquals(PAGE_TITLE_THREE, page.getString("title")); - - page = getPage(name1, Status.STATUS_OK); - assertEquals(name1, page.getString("name")); - assertEquals(PAGE_TITLE_ONE, page.getString("title")); - } - - public void testRenamePageWithEmptyTitle() throws Exception - { - JSONObject page; - String name = System.currentTimeMillis()+""; - String name2 = System.currentTimeMillis()+1+""; - - // Create a page - page = createOrUpdatePage(name, name, null, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("title")); - - // Fetch it and check - page = getPage(name, Status.STATUS_OK); - assertEquals(name, page.getString("name")); - assertEquals(name, page.getString("title")); - - //update title - SiteInfo site = siteService.getSite(SITE_SHORT_NAME_WIKI); - WikiPageInfo pageInfo = wikiService.getWikiPage(site.getShortName(), name); - NodeRef pageRef = pageInfo.getNodeRef(); - nodeService.setProperty(pageRef, ContentModel.PROP_TITLE, ""); - - // Fetch it and check - page = getPage(name, Status.STATUS_OK); - JSONArray versions = page.getJSONArray("versionhistory"); - - int maxVersionIndex = versions.length()-1; - double vNum = Double.parseDouble(versions.getJSONObject(maxVersionIndex).getString("version")); - String newTitle =versions.getJSONObject(maxVersionIndex).getString("title"); - for (int i = versions.length()-2; i>=0; i--) - { - JSONObject version = versions.getJSONObject(i); - String ver = version.getString("version"); - if (Double.parseDouble(ver)>vNum) - { - maxVersionIndex = i; - vNum = Double.parseDouble(ver); - newTitle =versions.getJSONObject(maxVersionIndex).getString("title"); - } - } - assertEquals(name, page.getString("name")); - assertEquals("", newTitle); - - renamePage(name, name2, Status.STATUS_OK); - - // Fetch it at the new address - page = getPage(name2, Status.STATUS_OK); - assertEquals(name2, page.getString("name")); - assertEquals(name2, page.getString("title")); - } - - public void testVersioning() throws Exception - { - WikiPageInfo wikiInfo; - JSONObject page; - JSONArray versions; - String name; - - // Create a page - page = createOrUpdatePage(PAGE_TITLE_TWO, PAGE_CONTENTS_ONE, null, Status.STATUS_OK); - name = PAGE_TITLE_TWO.replace(' ', '_'); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("title")); - - - // Check it was versioned by default - wikiInfo = wikiService.getWikiPage(SITE_SHORT_NAME_WIKI, name); - assertNotNull(wikiInfo); - assertEquals(true, nodeService.hasAspect(wikiInfo.getNodeRef(), ContentModel.ASPECT_VERSIONABLE)); - - // Check the JSON for versioning - page = getPage(name, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("versionhistory")); - - versions = page.getJSONArray("versionhistory"); - assertEquals(1, versions.length()); - assertEquals("1.0", versions.getJSONObject(0).get("version")); - assertEquals(USER_ONE, versions.getJSONObject(0).get("author")); - - - // Fetch it at this version - String content = getPageAtVersion(name, "1.0", Status.STATUS_OK); - assertEquals(PAGE_CONTENTS_ONE, content); - - - // Upload a new copy without a version flag, denied - createOrUpdatePage(PAGE_TITLE_TWO, "Changed Contents", "none", Status.STATUS_CONFLICT); - - - // Upload a new copy with the appropriate version, allowed - String PAGE_CONTENTS_CHANGED = "Changed Contents 2"; - page = createOrUpdatePage(PAGE_TITLE_TWO, PAGE_CONTENTS_CHANGED, "1.0", Status.STATUS_OK); - - page = getPage(name, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("versionhistory")); - - versions = page.getJSONArray("versionhistory"); - assertEquals(2, versions.length()); - assertEquals("1.1", versions.getJSONObject(0).get("version")); - assertEquals(USER_ONE, versions.getJSONObject(0).get("author")); - assertEquals("1.0", versions.getJSONObject(1).get("version")); - assertEquals(USER_ONE, versions.getJSONObject(1).get("author")); - - - // Check the version contents - content = getPageAtVersion(name, "1.1", Status.STATUS_OK); - assertEquals(PAGE_CONTENTS_CHANGED, content); - content = getPageAtVersion(name, "1.0", Status.STATUS_OK); - assertEquals(PAGE_CONTENTS_ONE, content); - - - // Upload a new copy with the force flag, allowed - String PAGE_CONTENTS_CHANGED3 = "Changed Contents 3"; - page = createOrUpdatePage(PAGE_TITLE_TWO, PAGE_CONTENTS_CHANGED3, "force", Status.STATUS_OK); - - page = getPage(name, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("versionhistory")); - - versions = page.getJSONArray("versionhistory"); - assertEquals(3, versions.length()); - assertEquals("1.2", versions.getJSONObject(0).get("version")); - assertEquals(USER_ONE, versions.getJSONObject(0).get("author")); - assertEquals("1.1", versions.getJSONObject(1).get("version")); - assertEquals(USER_ONE, versions.getJSONObject(1).get("author")); - assertEquals("1.0", versions.getJSONObject(2).get("version")); - assertEquals(USER_ONE, versions.getJSONObject(2).get("author")); - - // Check the version contents - content = getPageAtVersion(name, "1.2", Status.STATUS_OK); - assertEquals(PAGE_CONTENTS_CHANGED3, content); - content = getPageAtVersion(name, "1.1", Status.STATUS_OK); - assertEquals(PAGE_CONTENTS_CHANGED, content); - content = getPageAtVersion(name, "1.0", Status.STATUS_OK); - assertEquals(PAGE_CONTENTS_ONE, content); - - // You get an empty string back for invalid versions - content = getPageAtVersion(name, "1.4", Status.STATUS_OK); - assertEquals("", content); - } - - public void testLinks() throws Exception - { - JSONObject page; - JSONArray links; - String name; - String name2; - - // Create a page with no links - page = createOrUpdatePage(PAGE_TITLE_TWO, PAGE_CONTENTS_TWO, null, Status.STATUS_OK); - name = PAGE_TITLE_TWO.replace(' ', '_'); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("title")); - - - // Check, won't have any links shown - page = getPage(name, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("links")); - links = page.getJSONArray("links"); - assertEquals(0, links.length()); - - - // Create a page with links - // Should have links to pages 1 and 2 - page = createOrUpdatePage(PAGE_TITLE_THREE, PAGE_CONTENTS_LINK, null, Status.STATUS_OK); - name2 = PAGE_TITLE_THREE.replace(' ', '_'); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("title")); - - // Check - page = getPage(name2, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("links")); - - links = page.getJSONArray("links"); - assertEquals(3, links.length()); - assertEquals(PAGE_TITLE_ONE, links.getString(0)); - assertEquals(name, links.getString(1)); - assertEquals("Invalid", links.getString(2)); - - - // Create the 1st page, now change - page = createOrUpdatePage(PAGE_TITLE_ONE, PAGE_CONTENTS_ONE, null, Status.STATUS_OK); - - page = getPage(name2, Status.STATUS_OK); - assertEquals("Incorrect JSON: " + page.toString(), true, page.has("links")); - - links = page.getJSONArray("links"); - assertEquals(3, links.length()); - assertEquals(PAGE_TITLE_ONE, links.getString(0)); - assertEquals(name, links.getString(1)); - assertEquals("Invalid", links.getString(2)); - } - - /** - * Listing - */ - public void testOverallListing() throws Exception - { - JSONObject pages; - JSONArray entries; - - // Initially, there are no events - pages = getPages(null, null); - assertEquals("Incorrect JSON: " + pages.toString(), true, pages.has("totalPages")); - assertEquals(0, pages.getInt("totalPages")); - - - // Add two links to get started with - createOrUpdatePage(PAGE_TITLE_ONE, PAGE_CONTENTS_ONE, null, Status.STATUS_OK); - createOrUpdatePage(PAGE_TITLE_TWO, PAGE_CONTENTS_TWO, null, Status.STATUS_OK); - - // Check again - pages = getPages(null, null); - - // Should have two links - assertEquals("Incorrect JSON: " + pages.toString(), true, pages.has("totalPages")); - assertEquals(2, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(2, entries.length()); - // Sorted by newest created first - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(1).getString("title")); - - - // Add a third, which is internal, and created by the other user - this.authenticationComponent.setCurrentUser(USER_TWO); - JSONObject page3 = createOrUpdatePage(PAGE_TITLE_THREE, PAGE_CONTENTS_THREE, null, Status.STATUS_OK); - String name3 = PAGE_TITLE_THREE.replace(' ', '_'); - createOrUpdatePage(PAGE_TITLE_THREE, "UD"+PAGE_CONTENTS_THREE, null, Status.STATUS_OK); - this.authenticationComponent.setCurrentUser(USER_ONE); - - - // Check now, should have three links - pages = getPages(null, null); - assertEquals(3, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(3, entries.length()); - assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(1).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(2).getString("title")); - - - // Ask for filtering by user - pages = getPages(null, USER_ONE); - assertEquals(2, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(2, entries.length()); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(1).getString("title")); - - pages = getPages(null, USER_TWO); - assertEquals(1, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(1, entries.length()); - assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(0).getString("title")); - - - - // Ask for filtering by recently added docs - pages = getPages("recentlyAdded", null); - assertEquals(3, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(3, entries.length()); - assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(1).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(2).getString("title")); - - // Push one back into the past - pushPageCreatedDateBack(name3, 10); - - pages = getPages("recentlyAdded", null); - assertEquals(2, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(2, entries.length()); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(1).getString("title")); - - - // Now for recently modified ones - pages = getPages("recentlyModified", null); - assertEquals(3, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(3, entries.length()); - assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(1).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(2).getString("title")); -// assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(2).getString("title")); - - - // Change the owner+creator of one of the pages to System, ensure that - // this doesn't break anything in the process - String pageTwoName = entries.getJSONObject(1).getString("name"); - WikiPageInfo pageTwo = wikiService.getWikiPage(SITE_SHORT_NAME_WIKI, pageTwoName); - nodeService.setProperty(pageTwo.getNodeRef(), ContentModel.PROP_OWNER, AuthenticationUtil.SYSTEM_USER_NAME); - nodeService.setProperty(pageTwo.getNodeRef(), ContentModel.PROP_CREATOR, AuthenticationUtil.SYSTEM_USER_NAME); - nodeService.setProperty(pageTwo.getNodeRef(), ContentModel.PROP_MODIFIER, AuthenticationUtil.SYSTEM_USER_NAME); - - // Check the listing still works (note - order will have changed) - pages = getPages("recentlyModified", null); - assertEquals(3, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(3, entries.length()); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(1).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(2).getString("title")); - - - // Delete User Two, who owns the 3rd page, and ensure that this - // doesn't break anything - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - personService.deletePerson(USER_TWO); - this.authenticationComponent.setCurrentUser(USER_ONE); - - // Check the listing still works - pages = getPages("recentlyModified", null); - assertEquals(3, pages.getInt("totalPages")); - - entries = pages.getJSONArray("pages"); - assertEquals(3, entries.length()); - assertEquals(PAGE_TITLE_TWO, entries.getJSONObject(0).getString("title")); - assertEquals(PAGE_TITLE_THREE, entries.getJSONObject(1).getString("title")); - assertEquals(PAGE_TITLE_ONE, entries.getJSONObject(2).getString("title")); - - - // Now hide the site, and remove the user from it, won't be allowed to see it - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - SiteInfo site = siteService.getSite(SITE_SHORT_NAME_WIKI); - site.setVisibility(SiteVisibility.PRIVATE); - siteService.updateSite(site); - siteService.removeMembership(SITE_SHORT_NAME_WIKI, USER_ONE); - this.authenticationComponent.setCurrentUser(USER_ONE); - - sendRequest(new GetRequest(URL_WIKI_LIST), Status.STATUS_NOT_FOUND); - } - - public void test_MNT11595() throws Exception - { - final String user = "wikiUser"; - - try - { - // admin authentication - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - - MutableAuthenticationService mas = (MutableAuthenticationService) getServer().getApplicationContext().getBean("authenticationService"); - - // create user - createUser(user, SiteModel.SITE_MANAGER); - - assertTrue(personService.personExists(user)); - - // invite user to a site with 'Manager' role - siteService.setMembership(SITE_SHORT_NAME_WIKI, user, SiteRole.SiteManager.toString()); - - // user authentication - this.authenticationComponent.setCurrentUser(user); - - // create wiki page by user ('Manager' role) - WikiPageInfo wikiPage = this.wikiService.createWikiPage(SITE_SHORT_NAME_WIKI, "test wiki page", - "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill"); - - String uri = "/slingshot/wiki/page/" + SITE_SHORT_NAME_WIKI + "/Main_Page?alf_ticket=" + mas.getCurrentTicket() + "application/json"; - - Response responseManagerRole = sendRequest(new GetRequest(uri), 404); - JSONObject resultManagerRole = new JSONObject(responseManagerRole.getContentAsString()); - JSONObject permissionsManagerRole = resultManagerRole.getJSONObject("permissions"); - assertTrue(permissionsManagerRole.getBoolean("create")); - assertTrue(permissionsManagerRole.getBoolean("edit")); - - // admin authentication - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - - // change user role - 'Consumer' role - siteService.setMembership(SITE_SHORT_NAME_WIKI, user, SiteRole.SiteConsumer.toString()); - - // user authentication - this.authenticationComponent.setCurrentUser(user); - - Response responseConsumerRole = sendRequest(new GetRequest(uri), 404); - JSONObject resultConsumerRole = new JSONObject(responseConsumerRole.getContentAsString()); - JSONObject permissionsConsumerRole = resultConsumerRole.getJSONObject("permissions"); - assertFalse(permissionsConsumerRole.getBoolean("create")); - assertFalse(permissionsConsumerRole.getBoolean("edit")); - } - finally - { - this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName()); - - if (personService.personExists(user)) - { - personService.deletePerson(user); - } - - if (this.authenticationService.authenticationExists(user)) - { - this.authenticationService.deleteAuthentication(user); - } - } - } - - public void testXSSInjection() throws Exception - { - WikiPageInfo wikiPage = null; - WikiPageInfo wikiPageNew = null; - try{ - wikiPage = this.wikiService.createWikiPage(SITE_SHORT_NAME_WIKI, "test_wiki", "[[Test]]"); - wikiPageNew = this.wikiService.createWikiPage(SITE_SHORT_NAME_WIKI, "Test", "test_content"); - Pattern LINK_PATTERN_MATCH = Pattern.compile("\\[\\[([^\\|\\]]+)"); - Matcher m = LINK_PATTERN_MATCH.matcher(wikiPage.getContents()); - while (m.find()) - { - String link = m.group(1); - link += "?title="; - WikiPageInfo wikiPage2 = this.wikiService.getWikiPage(SITE_SHORT_NAME_WIKI, link); - WikiPageInfo wikiPage1 = this.wikiService.getWikiPage(SITE_SHORT_NAME_WIKI, StringEscapeUtils.unescapeHtml(link)); - assertEquals(wikiPage2, wikiPage1); - } - - } - finally{ - this.wikiService.deleteWikiPage(wikiPage); - this.wikiService.deleteWikiPage(wikiPageNew); - } - } -} \ No newline at end of file diff --git a/amps/share-services/src/test/java/org/alfresco/repo/wiki/WikiServiceImplTest.java b/amps/share-services/src/test/java/org/alfresco/repo/wiki/WikiServiceImplTest.java deleted file mode 100644 index 3ca4da883e..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/repo/wiki/WikiServiceImplTest.java +++ /dev/null @@ -1,883 +0,0 @@ -/* - * Copyright 2005 - 2021 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.wiki; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.site.SiteModel; -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.repository.ContentReader; -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.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -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.wiki.WikiPageInfo; -import org.alfresco.service.cmr.wiki.WikiService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ApplicationContextHelper; -import org.alfresco.util.PropertyMap; -import org.alfresco.util.testing.category.FrequentlyFailingTests; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.springframework.context.ApplicationContext; - -/** - * Test cases for {@link WikiServiceImpl}. - * - * @author Nick Burch - * @since 4.0 - */ -public class WikiServiceImplTest -{ - private static final String TEST_SITE_PREFIX = "WikiSiteTest"; - private static final long ONE_DAY_MS = 24*60*60*1000; - - private static final ApplicationContext testContext = ApplicationContextHelper.getApplicationContext( - new String[] { "classpath:alfresco/application-context.xml", - "classpath:alfresco/web-scripts-application-context.xml" }); - - // injected services - private static MutableAuthenticationService AUTHENTICATION_SERVICE; - private static BehaviourFilter BEHAVIOUR_FILTER; - private static WikiService WIKI_SERVICE; - private static ContentService CONTENT_SERVICE; - @SuppressWarnings("unused") - private static DictionaryService DICTIONARY_SERVICE; - private static NodeService NODE_SERVICE; - private static NodeService PUBLIC_NODE_SERVICE; - private static PersonService PERSON_SERVICE; - private static RetryingTransactionHelper TRANSACTION_HELPER; - @SuppressWarnings("unused") - private static TransactionService TRANSACTION_SERVICE; - private static PermissionService PERMISSION_SERVICE; - private static SiteService SITE_SERVICE; - private static TaggingService TAGGING_SERVICE; - - private static final String TEST_USER = WikiServiceImplTest.class.getSimpleName() + "_testuser"; - private static final String ADMIN_USER = AuthenticationUtil.getAdminUserName(); - - private static SiteInfo WIKI_SITE; - private static SiteInfo ALTERNATE_WIKI_SITE; - - /** - * Temporary test nodes (created during a test method) that need deletion after the test method. - */ - private List testNodesToTidy = new ArrayList(); - /** - * Temporary test nodes (created BeforeClass) that need deletion after this test class. - */ - private static List CLASS_TEST_NODES_TO_TIDY = new ArrayList(); - - @BeforeClass public static void initTestsContext() throws Exception - { - AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService"); - BEHAVIOUR_FILTER = (BehaviourFilter)testContext.getBean("policyBehaviourFilter"); - WIKI_SERVICE = (WikiService)testContext.getBean("WikiService"); - CONTENT_SERVICE = (ContentService)testContext.getBean("ContentService"); - DICTIONARY_SERVICE = (DictionaryService)testContext.getBean("dictionaryService"); - NODE_SERVICE = (NodeService)testContext.getBean("nodeService"); - PUBLIC_NODE_SERVICE = (NodeService)testContext.getBean("NodeService"); - PERSON_SERVICE = (PersonService)testContext.getBean("personService"); - TRANSACTION_HELPER = (RetryingTransactionHelper)testContext.getBean("retryingTransactionHelper"); - TRANSACTION_SERVICE = (TransactionService)testContext.getBean("TransactionService"); - PERMISSION_SERVICE = (PermissionService)testContext.getBean("permissionService"); - SITE_SERVICE = (SiteService)testContext.getBean("siteService"); - TAGGING_SERVICE = (TaggingService)testContext.getBean("TaggingService"); - - // Do the setup as admin - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - createUser(TEST_USER); - - // We need to create the test site as the test user so that they can contribute content to it in tests below. - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - createTestSites(); - } - - @Test public void createNewEntry() throws Exception - { - WikiPageInfo page; - - // Nothing to start with - PagingResults results = - WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), new PagingRequest(10)); - assertEquals(0, results.getPage().size()); - - - // Get with an arbitrary name gives nothing - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), "madeUp"); - assertEquals(null, page); - - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), "madeUp2"); - assertEquals(null, page); - - // Create one - page = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "Title", "This Is Some Content"); - - - // Ensure it got a noderef, and the correct site - assertNotNull(page.getNodeRef()); - assertNotNull(page.getSystemName()); - - NodeRef container = PUBLIC_NODE_SERVICE.getPrimaryParent(page.getNodeRef()).getParentRef(); - NodeRef site = PUBLIC_NODE_SERVICE.getPrimaryParent(container).getParentRef(); - assertEquals(WIKI_SITE.getNodeRef(), site); - - // Ensure the content was correctly set up - ContentReader reader = CONTENT_SERVICE.getReader(page.getNodeRef(), ContentModel.PROP_CONTENT); - assertEquals("This Is Some Content", reader.getContentString()); - assertEquals(MimetypeMap.MIMETYPE_HTML, reader.getMimetype()); - assertEquals("UTF-8", reader.getEncoding()); - - - - // Check the details on the object - assertEquals("Title", page.getTitle()); - assertEquals("This Is Some Content", page.getContents()); - assertEquals(ADMIN_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - - - // Fetch it, and check the details - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals("Title", page.getTitle()); - assertEquals("This Is Some Content", page.getContents()); - assertEquals(ADMIN_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - - - // Mark it as done with - testNodesToTidy.add(page.getNodeRef()); - } - - @Test public void createUpdateDeleteEntry() throws Exception - { - WikiPageInfo page; - - // Run as the test user instead - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - - - // Create a page - page = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "Title", "This Is Some Content"); - testNodesToTidy.add(page.getNodeRef()); - - - // Check it - assertEquals("Title", page.getSystemName()); - assertEquals("Title", page.getTitle()); - assertEquals("This Is Some Content", page.getContents()); - assertEquals(TEST_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - - - // Change it - page.setTitle("New Title"); - page.setContents("This is new content"); - - page = WIKI_SERVICE.updateWikiPage(page); - assertEquals("New_Title", page.getSystemName()); // Name has underscores - assertEquals("New_Title", page.getTitle()); - - - // Fetch, and check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals("New_Title", page.getSystemName()); // Name has underscores - assertEquals("New_Title", page.getTitle()); - assertEquals("This is new content", page.getContents()); - assertEquals(TEST_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - - - // Delete it - WIKI_SERVICE.deleteWikiPage(page); - - // Check it went - assertEquals(null, WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName())); - - - // Create a new node with spaces in title - page = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "Title Space", "This Is Some Content"); - testNodesToTidy.add(page.getNodeRef()); - - // Check it - assertEquals("Title_Space", page.getSystemName()); - assertEquals("Title_Space", page.getTitle()); - assertEquals("This Is Some Content", page.getContents()); - assertEquals(TEST_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - - - // Edit it without renaming - page.setContents("Changed contents"); - page = WIKI_SERVICE.updateWikiPage(page); - - // Check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals("Title_Space", page.getSystemName()); - assertEquals("Title_Space", page.getTitle()); - assertEquals("Changed contents", page.getContents()); - assertEquals(TEST_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - - - // Now edit with renaming - page.setTitle("Alternate Title"); - page = WIKI_SERVICE.updateWikiPage(page); - - // Check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals("Alternate_Title", page.getSystemName()); - assertEquals("Alternate_Title", page.getTitle()); - assertEquals("Changed contents", page.getContents()); - assertEquals(TEST_USER, page.getCreator()); - assertEquals(0, page.getTags().size()); - } - - /** - * Ensures that when we try to write an entry to the - * container of a new site, it is correctly setup for us. - * This test does it's own transactions - */ - @Test public void newContainerSetup() throws Exception - { - final String TEST_SITE_NAME = "WikiTestNewTestSite"; - - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - if(SITE_SERVICE.getSite(TEST_SITE_NAME) != null) - { - SITE_SERVICE.deleteSite(TEST_SITE_NAME); - } - SITE_SERVICE.createSite( - TEST_SITE_PREFIX, TEST_SITE_NAME, "Test", "Test", SiteVisibility.PUBLIC); - - // Won't have the container to start with - assertFalse(SITE_SERVICE.hasContainer(TEST_SITE_NAME, WikiServiceImpl.WIKI_COMPONENT)); - - // Create a link - WIKI_SERVICE.createWikiPage( - TEST_SITE_NAME, "Title", "TextTextText"); - - // It will now exist - assertTrue(SITE_SERVICE.hasContainer(TEST_SITE_NAME, WikiServiceImpl.WIKI_COMPONENT)); - - // It'll be a tag scope too - NodeRef container = SITE_SERVICE.getContainer(TEST_SITE_NAME, WikiServiceImpl.WIKI_COMPONENT); - assertTrue(TAGGING_SERVICE.isTagScope(container)); - - // Tidy up - SITE_SERVICE.deleteSite(TEST_SITE_NAME); - return null; - } - }); - } - - @Test - @Category(FrequentlyFailingTests.class) // SHA-2473 Probably has not been run since we broke up the monolith and now fails. - public void tagging() throws Exception - { - WikiPageInfo page; - final String TAG_1 = "link_tag_1"; - final String TAG_2 = "link_tag_2"; - final String TAG_3 = "link_tag_3"; - - // Create one without tagging - page = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "Title", "This Is Some Content"); - testNodesToTidy.add(page.getNodeRef()); - - // Check - assertEquals(0, page.getTags().size()); - - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals(0, page.getTags().size()); - - - // Update it to have tags - page.getTags().add(TAG_1); - page.getTags().add(TAG_2); - page.getTags().add(TAG_1); - assertEquals(3, page.getTags().size()); - WIKI_SERVICE.updateWikiPage(page); - - // Check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals(2, page.getTags().size()); - assertEquals(true, page.getTags().contains(TAG_1)); - assertEquals(true, page.getTags().contains(TAG_2)); - assertEquals(false, page.getTags().contains(TAG_3)); - - - // Update it to have different tags - page.getTags().remove(TAG_2); - page.getTags().add(TAG_3); - page.getTags().add(TAG_1); - WIKI_SERVICE.updateWikiPage(page); - - // Check it as-is - assertEquals(3, page.getTags().size()); // Includes duplicate tag until re-loaded - assertEquals(true, page.getTags().contains(TAG_1)); - assertEquals(false, page.getTags().contains(TAG_2)); - assertEquals(true, page.getTags().contains(TAG_3)); - - // Now load and re-check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals(2, page.getTags().size()); // Duplicate now gone - assertEquals(true, page.getTags().contains(TAG_1)); - assertEquals(false, page.getTags().contains(TAG_2)); - assertEquals(true, page.getTags().contains(TAG_3)); - - - // Update it to have no tags - page.getTags().clear(); - WIKI_SERVICE.updateWikiPage(page); - - // Check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals(0, page.getTags().size()); - - - // Update it to have tags again - page.getTags().add(TAG_1); - page.getTags().add(TAG_2); - page.getTags().add(TAG_3); - WIKI_SERVICE.updateWikiPage(page); - - // Check - page = WIKI_SERVICE.getWikiPage(WIKI_SITE.getShortName(), page.getSystemName()); - assertEquals(3, page.getTags().size()); - assertEquals(true, page.getTags().contains(TAG_1)); - assertEquals(true, page.getTags().contains(TAG_2)); - assertEquals(true, page.getTags().contains(TAG_3)); - - // Tidy - WIKI_SERVICE.deleteWikiPage(page); - } - - /** - * Tests for listing the wiki pages of a site, possibly by user or date range - */ - @Test public void pagesListing() throws Exception - { - PagingRequest paging = new PagingRequest(10); - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - - // Nothing to start with - PagingResults results = - WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(0, results.getPage().size()); - - // Add a few - WikiPageInfo pageA = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "TitleA", "ContentA"); - WikiPageInfo pageB = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "TitleB", "ContentB"); - WikiPageInfo pageC = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "TitleC", "ContentC"); - testNodesToTidy.add(pageA.getNodeRef()); - testNodesToTidy.add(pageB.getNodeRef()); - testNodesToTidy.add(pageC.getNodeRef()); - - // Check now, should be newest first - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(3, results.getPage().size()); - assertEquals("TitleC", results.getPage().get(0).getTitle()); - assertEquals("TitleB", results.getPage().get(1).getTitle()); - assertEquals("TitleA", results.getPage().get(2).getTitle()); - - // Add one more, as a different user, and drop the page size - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - WikiPageInfo pageD = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "TitleD", "ContentD"); - testNodesToTidy.add(pageD.getNodeRef()); - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - - paging = new PagingRequest(3); - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(3, results.getPage().size()); - assertEquals("TitleD", results.getPage().get(0).getTitle()); - assertEquals("TitleC", results.getPage().get(1).getTitle()); - assertEquals("TitleB", results.getPage().get(2).getTitle()); - - paging = new PagingRequest(3, 3); - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(1, results.getPage().size()); - assertEquals("TitleA", results.getPage().get(0).getTitle()); - - - // Now check filtering by user - paging = new PagingRequest(10); - - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), TEST_USER, paging); - assertEquals(3, results.getPage().size()); - assertEquals("TitleC", results.getPage().get(0).getTitle()); - assertEquals("TitleB", results.getPage().get(1).getTitle()); - assertEquals("TitleA", results.getPage().get(2).getTitle()); - - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), ADMIN_USER, paging); - assertEquals(1, results.getPage().size()); - assertEquals("TitleD", results.getPage().get(0).getTitle()); - - - // Now check filtering by date range - // Arrange it so that the orders are: - // Created -> C B A D - // Modified -> D C B A - pushAuditableDatesBack(pageB, 10, 0); - pushAuditableDatesBack(pageC, 100, 10); - pushAuditableDatesBack(pageD, 0, 100); - pageA.setContents("UpdatedContentsA"); - pageA = WIKI_SERVICE.updateWikiPage(pageA); - - - Date today = new Date(); - Date tomorrow = new Date(today.getTime()+ONE_DAY_MS); - Date yesterday = new Date(today.getTime()-ONE_DAY_MS); - Date twoWeeksAgo = new Date(today.getTime()-14*ONE_DAY_MS); - - - // Check by created date - - // Very recent ones - results = WIKI_SERVICE.listWikiPagesByCreated(WIKI_SITE.getShortName(), yesterday, tomorrow, paging); - assertEquals(2, results.getPage().size()); - assertEquals("TitleD", results.getPage().get(0).getTitle()); - assertEquals("TitleA", results.getPage().get(1).getTitle()); - - // Fairly old ones - results = WIKI_SERVICE.listWikiPagesByCreated(WIKI_SITE.getShortName(), twoWeeksAgo, yesterday, paging); - assertEquals(1, results.getPage().size()); - assertEquals("TitleB", results.getPage().get(0).getTitle()); - - // Fairly old to current - results = WIKI_SERVICE.listWikiPagesByCreated(WIKI_SITE.getShortName(), twoWeeksAgo, tomorrow, paging); - assertEquals(3, results.getPage().size()); - assertEquals("TitleD", results.getPage().get(0).getTitle()); - assertEquals("TitleA", results.getPage().get(1).getTitle()); - assertEquals("TitleB", results.getPage().get(2).getTitle()); - - - // Check by modified date - - // Very recent ones - results = WIKI_SERVICE.listWikiPagesByModified(WIKI_SITE.getShortName(), yesterday, tomorrow, paging); - assertEquals(2, results.getPage().size()); - assertEquals("TitleA", results.getPage().get(0).getTitle()); - assertEquals("TitleB", results.getPage().get(1).getTitle()); - - // Fairly old ones - results = WIKI_SERVICE.listWikiPagesByModified(WIKI_SITE.getShortName(), twoWeeksAgo, yesterday, paging); - assertEquals(1, results.getPage().size()); - assertEquals("TitleC", results.getPage().get(0).getTitle()); - - // Fairly old to current - results = WIKI_SERVICE.listWikiPagesByModified(WIKI_SITE.getShortName(), twoWeeksAgo, tomorrow, paging); - assertEquals(3, results.getPage().size()); - assertEquals("TitleA", results.getPage().get(0).getTitle()); - assertEquals("TitleB", results.getPage().get(1).getTitle()); - assertEquals("TitleC", results.getPage().get(2).getTitle()); - - - // Bring C back to current and re-check - pageC.setContents("Changed C"); - pageC = WIKI_SERVICE.updateWikiPage(pageC); - - // Order doesn't change, sorting is by created date not modified date - results = WIKI_SERVICE.listWikiPagesByModified(WIKI_SITE.getShortName(), twoWeeksAgo, tomorrow, paging); - assertEquals(3, results.getPage().size()); - assertEquals("TitleA", results.getPage().get(0).getTitle()); - assertEquals("TitleB", results.getPage().get(1).getTitle()); - assertEquals("TitleC", results.getPage().get(2).getTitle()); - - - // Tidy - paging = new PagingRequest(10); - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - for (WikiPageInfo link : results.getPage()) - { - PUBLIC_NODE_SERVICE.deleteNode(link.getNodeRef()); - } - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - for (WikiPageInfo link : results.getPage()) - { - PUBLIC_NODE_SERVICE.deleteNode(link.getNodeRef()); - } - } - - /** - * Checks that the correct permission checking occurs on fetching - * links listings (which go through canned queries) - */ - @Test public void pagesListingPermissionsChecking() throws Exception - { - PagingRequest paging = new PagingRequest(10); - PagingResults results; - - // Nothing to start with in either site - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(0, results.getPage().size()); - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - assertEquals(0, results.getPage().size()); - - // Double check that we're only allowed to see the 1st site - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override public Void execute() throws Throwable - { - assertEquals(true, SITE_SERVICE.isMember(WIKI_SITE.getShortName(), TEST_USER)); - assertEquals(false, SITE_SERVICE.isMember(ALTERNATE_WIKI_SITE.getShortName(), TEST_USER)); - return null; - } - }); - - - // Now become the test user - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - - - // Add two events to one site and three to the other - // Note - add the events as a different user for the site that the - // test user isn't a member of! - WikiPageInfo pageA = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "TitleA", "ContentA"); - WikiPageInfo pageB = WIKI_SERVICE.createWikiPage( - WIKI_SITE.getShortName(), "TitleB", "ContentB"); - testNodesToTidy.add(pageA.getNodeRef()); - testNodesToTidy.add(pageB.getNodeRef()); - - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - WikiPageInfo pagePrivA = WIKI_SERVICE.createWikiPage( - ALTERNATE_WIKI_SITE.getShortName(), "PrivTitleA", "Contents A"); - WikiPageInfo pagePrivB = WIKI_SERVICE.createWikiPage( - ALTERNATE_WIKI_SITE.getShortName(), "PrivTitleB", "Contents B"); - WikiPageInfo pagePrivC = WIKI_SERVICE.createWikiPage( - ALTERNATE_WIKI_SITE.getShortName(), "PrivTitleC", "Contents C"); - testNodesToTidy.add(pagePrivA.getNodeRef()); - testNodesToTidy.add(pagePrivB.getNodeRef()); - testNodesToTidy.add(pagePrivC.getNodeRef()); - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - - - // Check again, as we're not in the 2nd site won't see any there - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(2, results.getPage().size()); - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - assertEquals(0, results.getPage().size()); - - - // Join the site, now we can see both - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - SITE_SERVICE.setMembership(ALTERNATE_WIKI_SITE.getShortName(), TEST_USER, SiteModel.SITE_COLLABORATOR); - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - return null; - } - }); - - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(2, results.getPage().size()); - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - assertEquals(3, results.getPage().size()); - - - // Explicitly remove their permissions from one node, check it vanishes from the list - PERMISSION_SERVICE.setInheritParentPermissions(pagePrivC.getNodeRef(), false); - PERMISSION_SERVICE.clearPermission(pagePrivC.getNodeRef(), TEST_USER); - - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(2, results.getPage().size()); - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - assertEquals(2, results.getPage().size()); - - - // Leave, they go away again - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - SITE_SERVICE.removeMembership(ALTERNATE_WIKI_SITE.getShortName(), TEST_USER); - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - return null; - } - }); - - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - assertEquals(2, results.getPage().size()); - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - assertEquals(0, results.getPage().size()); - - - // Tidy - paging = new PagingRequest(10); - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - results = WIKI_SERVICE.listWikiPages(WIKI_SITE.getShortName(), paging); - for (WikiPageInfo link : results.getPage()) - { - PUBLIC_NODE_SERVICE.deleteNode(link.getNodeRef()); - } - results = WIKI_SERVICE.listWikiPages(ALTERNATE_WIKI_SITE.getShortName(), paging); - for (WikiPageInfo link : results.getPage()) - { - PUBLIC_NODE_SERVICE.deleteNode(link.getNodeRef()); - } - } - - - // -------------------------------------------------------------------------------- - - - /** - * Alters the created date on a wiki page for testing - */ - private void pushAuditableDatesBack(WikiPageInfo page, int createdDaysAgo, int modifiedDaysAgo) throws Exception - { - final NodeRef node = page.getNodeRef(); - - final Date created = page.getCreatedAt(); - final Date newCreated = new Date(created.getTime() - createdDaysAgo*ONE_DAY_MS); - final Date modified = page.getModifiedAt(); - final Date newModified = new Date(modified.getTime() - modifiedDaysAgo*ONE_DAY_MS); - - // Update the created date - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - BEHAVIOUR_FILTER.disableBehaviour(ContentModel.ASPECT_AUDITABLE); - NODE_SERVICE.setProperty(node, ContentModel.PROP_CREATED, newCreated); - NODE_SERVICE.setProperty(node, ContentModel.PROP_MODIFIED, newModified); - return null; - } - }, false, true); - - // Change something else too in the public nodeservice, to force a re-index - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - BEHAVIOUR_FILTER.disableBehaviour(ContentModel.ASPECT_AUDITABLE); - PUBLIC_NODE_SERVICE.setProperty(node, ContentModel.PROP_CREATED, newCreated); - PUBLIC_NODE_SERVICE.setProperty(node, ContentModel.PROP_MODIFIED, newModified); - PUBLIC_NODE_SERVICE.setProperty(node, ContentModel.PROP_DESCRIPTION, "Forced Change"); - return null; - } - }, false, true); - - // Check it was taken - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - assertEquals(newCreated, NODE_SERVICE.getProperty(node, ContentModel.PROP_CREATED)); - assertEquals(newCreated, PUBLIC_NODE_SERVICE.getProperty(node, ContentModel.PROP_CREATED)); - assertEquals(newModified, NODE_SERVICE.getProperty(node, ContentModel.PROP_MODIFIED)); - assertEquals(newModified, PUBLIC_NODE_SERVICE.getProperty(node, ContentModel.PROP_MODIFIED)); - return null; - } - }, false, true); - - // Update the object itself - ((WikiPageInfoImpl)page).setCreatedAt(newCreated); - ((WikiPageInfoImpl)page).setModifiedAt(newModified); - } - - private static void createTestSites() throws Exception - { - final WikiServiceImpl privateWikiPageService = (WikiServiceImpl)testContext.getBean("wikiService"); - - WIKI_SITE = TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public SiteInfo execute() throws Throwable - { - SiteInfo site = SITE_SERVICE.createSite( - TEST_SITE_PREFIX, - WikiServiceImplTest.class.getSimpleName() + "_testSite" + System.currentTimeMillis(), - "test site title", "test site description", - SiteVisibility.PUBLIC); - privateWikiPageService.getSiteWikiContainer(site.getShortName(), true); - CLASS_TEST_NODES_TO_TIDY.add(site.getNodeRef()); - return site; - } - }); - - // Create the alternate site as admin - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - ALTERNATE_WIKI_SITE = TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public SiteInfo execute() throws Throwable - { - SiteInfo site = SITE_SERVICE.createSite( - TEST_SITE_PREFIX, - WikiServiceImplTest.class.getSimpleName() + "_testAltSite" + System.currentTimeMillis(), - "alternate site title", "alternate site description", - SiteVisibility.PRIVATE); - privateWikiPageService.getSiteWikiContainer(site.getShortName(), true); - CLASS_TEST_NODES_TO_TIDY.add(site.getNodeRef()); - return site; - } - }); - AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER); - } - - /** - * By default, all tests are run as the admin user. - */ - @Before public void setAdminUser() - { - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - } - - @After public void deleteTestNodes() throws Exception - { - performDeletionOfNodes(testNodesToTidy); - } - - @AfterClass public static void deleteClassTestNodesAndUsers() throws Exception - { - performDeletionOfNodes(CLASS_TEST_NODES_TO_TIDY); - deleteUser(TEST_USER); - } - - /** - * Deletes the specified NodeRefs, if they exist. - * @param nodesToDelete - */ - private static void performDeletionOfNodes(final List nodesToDelete) - { - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - - for (NodeRef node : nodesToDelete) - { - if (NODE_SERVICE.exists(node)) - { - // st:site nodes can only be deleted via the SiteService - if (NODE_SERVICE.getType(node).equals(SiteModel.TYPE_SITE)) - { - - SiteInfo siteInfo = SITE_SERVICE.getSite(node); - SITE_SERVICE.deleteSite(siteInfo.getShortName()); - } - else - { - NODE_SERVICE.deleteNode(node); - } - } - } - - return null; - } - }); - } - - private static void createUser(final String userName) - { - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - if (!AUTHENTICATION_SERVICE.authenticationExists(userName)) - { - AUTHENTICATION_SERVICE.createAuthentication(userName, "PWD".toCharArray()); - } - - if (!PERSON_SERVICE.personExists(userName)) - { - PropertyMap ppOne = new PropertyMap(); - ppOne.put(ContentModel.PROP_USERNAME, userName); - ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); - ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); - ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); - ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - - PERSON_SERVICE.createPerson(ppOne); - } - - return null; - } - }); - } - - private static void deleteUser(final String userName) - { - TRANSACTION_HELPER.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - if (PERSON_SERVICE.personExists(userName)) - { - PERSON_SERVICE.deletePerson(userName); - } - - return null; - } - }); - } -} diff --git a/amps/share-services/src/test/java/org/alfresco/slingshot/documentlibrary/FolderTemplateTest.java b/amps/share-services/src/test/java/org/alfresco/slingshot/documentlibrary/FolderTemplateTest.java deleted file mode 100644 index 546b384eb8..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/slingshot/documentlibrary/FolderTemplateTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2005 - 2021 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.slingshot.documentlibrary; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import javax.transaction.UserTransaction; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -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.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.GUID; -import org.alfresco.util.testing.category.FrequentlyFailingTests; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.junit.experimental.categories.Category; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * JUnit test for folder-templates API - * - * @author alex.mukha - * @since 4.2.4 - */ -public class FolderTemplateTest extends BaseWebScriptTest -{ - private AuthenticationComponent authenticationComponent; - private Repository repositoryHelper; - private NodeService nodeService; - private TransactionService transactionService; - private SearchService searchService; - private FileFolderService fileFolderService; - private NodeRef companyHome; - private NodeRef template; - private NodeRef destination; - private String templateName; - private String destinationName; - private UserTransaction txn; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent"); - this.repositoryHelper = (Repository)getServer().getApplicationContext().getBean("repositoryHelper"); - this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService"); - this.transactionService = (TransactionService) getServer().getApplicationContext().getBean("TransactionService"); - this.searchService = (SearchService) getServer().getApplicationContext().getBean("SearchService"); - this.fileFolderService = (FileFolderService) getServer().getApplicationContext().getBean("FileFolderService"); - - this.authenticationComponent.setSystemUserAsCurrentUser(); - - txn = transactionService.getUserTransaction(); - txn.begin(); - - companyHome = this.repositoryHelper.getCompanyHome(); - - // Create template folder - Map propsTemplate = new HashMap(1); - templateName = "templateFolder" + GUID.generate(); - propsTemplate.put(ContentModel.PROP_NAME, templateName); - template = nodeService.createNode(companyHome, ContentModel.ASSOC_CHILDREN, QName.createQName(templateName), ContentModel.TYPE_FOLDER, propsTemplate).getChildRef(); - - // Create destination - Map propsDestination = new HashMap(1); - destinationName = "destinationFolder" + GUID.generate(); - propsTemplate.put(ContentModel.PROP_NAME, destinationName); - destination = nodeService.createNode(companyHome, ContentModel.ASSOC_CHILDREN, QName.createQName(destinationName), ContentModel.TYPE_FOLDER, propsDestination).getChildRef(); - - AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); - } - - @Override - protected void tearDown() throws Exception - { - txn.rollback(); - } - - /** - * Test for MNT-11909 - * @throws Exception - */ - @SuppressWarnings("unchecked") - @Category(FrequentlyFailingTests.class) // SHA-2473 Probably has not been run since we broke up the monolith and now fails. - public void testFolderTemplatesPost() throws Exception - { - String url = "/slingshot/doclib/folder-templates"; - String newName = "FolderName" + GUID.generate(); - String newDescription = "FolderDescription" + GUID.generate(); - String newTitle = "FolderTitle" + GUID.generate(); - - JSONObject body = new JSONObject(); - body.put("sourceNodeRef", template.toString()); - body.put("parentNodeRef", destination.toString()); - body.put("prop_cm_name", newName); - body.put("prop_cm_description", newDescription); - body.put("prop_cm_title", newTitle); - - Response response = sendRequest(new PostRequest(url, body.toString(), "application/json"), Status.STATUS_OK); - - // Check the new folder - String newFolderQuery = "/app:company_home/" + destinationName + "/" + newName; - ResultSet result = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, newFolderQuery); - if (result.length() == 0) - { - fail("The folder with name " + newName + " was not created in " + destinationName); - } - FileInfo newFolder = fileFolderService.getFileInfo(result.getRow(0).getNodeRef()); - assertNotNull("The folder is not found.", newFolder); - assertTrue("The node should be a folder.", newFolder.isFolder()); - assertEquals("The folder's name should be " + newName + - ", but was " + newFolder.getName(), - newName, newFolder.getName()); - assertEquals("The folder's description should be " + newDescription + - ", but was " + newFolder.getProperties().get(ContentModel.PROP_DESCRIPTION), - newDescription, newFolder.getProperties().get(ContentModel.PROP_DESCRIPTION)); - assertEquals("The folder's title should be " + newTitle + - ", but was " + newFolder.getProperties().get(ContentModel.PROP_TITLE), - newTitle, newFolder.getProperties().get(ContentModel.PROP_TITLE)); - - // check the response - JSONParser jsonParser = new JSONParser(); - Object contentJsonObject = jsonParser.parse(response - .getContentAsString()); - JSONObject jsonData = (JSONObject) contentJsonObject; - String persistedObject = (String) jsonData.get("persistedObject"); - assertEquals("The response's persistedObject should be " - + newFolder.getNodeRef().toString() + " but it was " - + persistedObject, newFolder.getNodeRef().toString(), - persistedObject); - } -} diff --git a/amps/share-services/src/test/java/org/alfresco/slingshot/web/scripts/SlingshotContentGetTest.java b/amps/share-services/src/test/java/org/alfresco/slingshot/web/scripts/SlingshotContentGetTest.java deleted file mode 100644 index f500bf0cd2..0000000000 --- a/amps/share-services/src/test/java/org/alfresco/slingshot/web/scripts/SlingshotContentGetTest.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2005 - 2020 Alfresco Software Limited. - * - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of the paid license agreement will prevail. - * Otherwise, the software is provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.slingshot.web.scripts; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.repository.*; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; -import org.json.JSONObject; -import org.junit.Assert; -import org.springframework.extensions.webscripts.TestWebScriptServer; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Test for SlingshotContentGet web script - * @author alex.mukha - * @since 5.0.0 - */ -public class SlingshotContentGetTest extends BaseWebScriptTest -{ - private MutableAuthenticationService authenticationService; - private AuthenticationComponent authenticationComponent; - private PersonService personService; - private SiteService siteService; - private NodeService nodeService; - private ContentService contentService; - private PermissionService permissionService; - - private static final String USER_ONE = "SlingshotContentGetTestOne"; - private static final String URL_SITES = "/api/sites"; - private static final String URL_CONTENT_DOWNLOAD = "/slingshot/node/content/workspace/SpacesStore/"; - private List createdSites = new ArrayList(1); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService"); - this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent"); - this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService"); - this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService"); - this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService"); - this.permissionService = (PermissionService)getServer().getApplicationContext().getBean("PermissionService"); - this.contentService = (ContentService)getServer().getApplicationContext().getBean("ContentService"); - AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); - createUser(USER_ONE); - } - - private void createUser(String userName) - { - if (!this.authenticationService.authenticationExists(userName)) - { - this.authenticationService.createAuthentication(userName, "PWD".toCharArray()); - - PropertyMap ppOne = new PropertyMap(5); - ppOne.put(ContentModel.PROP_USERNAME, userName); - ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); - ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); - ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); - ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - - this.personService.createPerson(ppOne); - } - } - private void deleteUser(String username) - { - this.personService.deletePerson(username); - if(this.authenticationService.authenticationExists(username)) - { - this.authenticationService.deleteAuthentication(username); - } - } - - - private JSONObject createSite(String sitePreset, String shortName, String title, String description, SiteVisibility visibility, int expectedStatus) - throws Exception - { - JSONObject site = new JSONObject(); - site.put("sitePreset", sitePreset); - site.put("shortName", shortName); - site.put("title", title); - site.put("description", description); - site.put("visibility", visibility.toString()); - TestWebScriptServer.Response response = sendRequest(new TestWebScriptServer.PostRequest(URL_SITES, site.toString(), "application/json"), expectedStatus); - this.createdSites.add(shortName); - return new JSONObject(response.getContentAsString()); - } - - @Override - protected void tearDown() throws Exception - { - super.tearDown(); - AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); - // Clear the user - deleteUser(USER_ONE); - // Tidy-up any site's create during the execution of the test - for (String shortName : this.createdSites) - { - sendRequest(new TestWebScriptServer.DeleteRequest(URL_SITES + "/" + shortName), 0); - } - // Clear the list - this.createdSites.clear(); - this.authenticationComponent.clearCurrentSecurityContext(); - } - - public void testDownloadBySiteMemberFromPrivateSite() throws Exception - { - String shortName = GUID.generate(); - // Create a new site - createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PRIVATE, 200); - - // Ensure we have th document library - NodeRef docLib = siteService.createContainer(shortName, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null); - - NodeRef doc = nodeService.createNode(docLib, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS, ContentModel.TYPE_CONTENT).getChildRef(); - nodeService.setProperty(doc, ContentModel.PROP_CONTENT, new ContentData(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, null)); - nodeService.setProperty(doc, ContentModel.PROP_TITLE, "title"); - ContentWriter writer = contentService.getWriter(doc, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent("test"); - - String uri = URL_CONTENT_DOWNLOAD + doc.getId() + "?a=true"; - sendRequest(new GetRequest(uri), 200); - } - - public void testDownloadByNonSiteMemberFromPrivateSite() throws Exception - { - String shortName = GUID.generate(); - // Create a new site - createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PRIVATE, 200); - - NodeRef docLib = siteService.createContainer(shortName, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null); - NodeRef doc = nodeService.createNode(docLib, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS, ContentModel.TYPE_CONTENT).getChildRef(); - nodeService.setProperty(doc, ContentModel.PROP_CONTENT, new ContentData(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, null)); - nodeService.setProperty(doc, ContentModel.PROP_TITLE, "title"); - ContentWriter writer = contentService.getWriter(doc, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent("test"); - - permissionService.setPermission(doc, USER_ONE, PermissionService.CONSUMER, true); - - AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE); - - String uri = URL_CONTENT_DOWNLOAD + doc.getId() + "?a=true"; - sendRequest(new GetRequest(uri), 200); - } - - /** - * MNT-16380 - */ - public void testRelativePath() throws Exception - { - Repository repositoryHelper = (Repository) getServer().getApplicationContext().getBean("repositoryHelper"); - NodeRef companyHome = repositoryHelper.getCompanyHome(); - - NodeRef rootFolder = createNode(companyHome, "rootFolder", ContentModel.TYPE_FOLDER); - - NodeRef doc1 = createNodeWithTextContent(rootFolder, "doc1", ContentModel.TYPE_CONTENT, "doc1 file content"); - - NodeRef folderX = createNode(rootFolder, "X", ContentModel.TYPE_FOLDER); - NodeRef folderY = createNode(folderX, "Y", ContentModel.TYPE_FOLDER); - NodeRef folderZ = createNode(folderY, "Z", ContentModel.TYPE_FOLDER); - - NodeRef doc2 = createNodeWithTextContent(folderZ, "doc2", ContentModel.TYPE_CONTENT, "doc2 file content"); - - // uri with relative path at the end - String uri = URL_CONTENT_DOWNLOAD + doc1.getId() + "/X/Y/Z/doc2"; - TestWebScriptServer.Response resp = sendRequest(new GetRequest(uri), 200); - - // check if we really have doc2 as target - Assert.assertEquals("doc2 file content", resp.getContentAsString()); - - nodeService.deleteNode(rootFolder); - } - - public NodeRef createNodeWithTextContent(NodeRef parentNode, String nodeCmName, QName nodeType, String content) - { - NodeRef nodeRef = createNode(parentNode, nodeCmName, nodeType); - - // If there is any content, add it. - if (content != null) - { - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(content); - } - return nodeRef; - - } - - private NodeRef createNode(NodeRef parentNode, String nodeCmName, QName nodeType) - { - QName childName = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, nodeCmName); - - Map props = new HashMap(); - props.put(ContentModel.PROP_NAME, nodeCmName); - ChildAssociationRef childAssoc = nodeService - .createNode(parentNode, ContentModel.ASSOC_CONTAINS, childName, nodeType, props); - return childAssoc.getChildRef(); - } -} diff --git a/data-model/pom.xml b/data-model/pom.xml index 2e478b4c22..f1f7707bd7 100644 --- a/data-model/pom.xml +++ b/data-model/pom.xml @@ -73,6 +73,43 @@ + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jibx + + maven-jibx-plugin + + + [1.2.5,) + + + bind + + + + + true + true + + + + + + + + + @@ -208,25 +245,6 @@ org.apache.tika tika-core ${dependency.tika.version} - - - - javax.activation - activation - - - javax.xml.bind - jaxb-api - - - com.sun.activation - javax.activation - - - javax.activation - javax.activation-api - - org.apache.tika @@ -265,19 +283,6 @@ com.sun.activation javax.activation - - - javax.xml.bind - jaxb-api - - - javax.activation - activation - - - javax.activation - javax.activation-api - diff --git a/packaging/docker-alfresco/pom.xml b/packaging/docker-alfresco/pom.xml index 74f099d844..fcb6702531 100644 --- a/packaging/docker-alfresco/pom.xml +++ b/packaging/docker-alfresco/pom.xml @@ -128,7 +128,7 @@ - build-docker-images + communityDocker @@ -157,7 +157,7 @@ - push-docker-images + internal diff --git a/packaging/pom.xml b/packaging/pom.xml index 12adfb73b4..815138a064 100644 --- a/packaging/pom.xml +++ b/packaging/pom.xml @@ -10,18 +10,40 @@ 11.28-SNAPSHOT - - war - distribution - docker-alfresco - - + + fullBuild + + true + + + war + distribution + docker-alfresco + + + + community + + war + distribution + + + + communityDocker + + war + distribution + docker-alfresco + + all-tas-tests + distribution tests + diff --git a/packaging/war/pom.xml b/packaging/war/pom.xml index 1080a9ea8c..b491e26091 100644 --- a/packaging/war/pom.xml +++ b/packaging/war/pom.xml @@ -183,6 +183,7 @@ maven-war-plugin + 3.3.1 @@ -249,4 +250,23 @@ + + + + + m2e + + + commons-logging + commons-logging + + runtime + + + mysql + mysql-connector-java + + + + diff --git a/pom.xml b/pom.xml index 77c6fbee15..2a07d27b74 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,6 @@ repository remote-api packaging - amps @@ -26,7 +25,6 @@ 1 0 - ${acs.version.major}.0.0 Community community @@ -36,9 +34,9 @@ quay.io 11 - ${java.version} - ${java.version} - ${java.version} + 11 + 11 + 11 ${project.build.directory}/alf_data @@ -64,7 +62,6 @@ 8.18 1.68 3.9.0 - 1.10.19 20210307 1.4-DBCP330 2.8.0 @@ -85,12 +82,8 @@ 3.4.1.Final 3.7.1 5.16.1 - 1.20 1.2.5 4.0.3 - 3.38.0 - 1.0.52 - 3.1.1 2.3.3 2.3.3 @@ -104,13 +97,10 @@ 1.1.4 3.2.1.3 - 1.4.0.1 - 7.0.0 - 2.2.0 + 1.4.0 - 42.2.20 - 8.0.24 - 8 + 42.2.19 + 8.0.23 2.7.2 3.0.44 3.3.0 @@ -120,22 +110,6 @@ 1.6 1.5 2.6 - - - 61616 - 5672 - 5432 - 5431 - 3306 - 3307 - - ${basedir}/target/alf_test_data - org.alfresco.repo.domain.dialect.MySQLInnoDBDialect - alfresco - alfresco - alfresco - localhost - alfresco-test @@ -315,6 +289,7 @@ spring-webscripts ${dependency.webscripts.version} tests + test org.alfresco.surf @@ -359,11 +334,6 @@ commons-codec 1.15 - - commons-lang - commons-lang - 2.6 - commons-io commons-io @@ -458,6 +428,7 @@ org.springframework spring-test ${dependency.spring.version} + test org.springframework @@ -497,16 +468,6 @@ jackson-databind ${dependency.jackson-databind.version} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${dependency.jackson.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${dependency.jackson.version} - com.fasterxml.jackson.core jackson-annotations @@ -630,11 +591,6 @@ junrar 7.4.0 - - com.github.fge - json-schema-validator - 2.2.6 - org.jsoup @@ -645,7 +601,7 @@ org.apache.commons commons-compress - ${dependency.apache-compress.version} + 1.20 org.apache.commons @@ -657,57 +613,68 @@ org.postgresql postgresql ${dependency.postgresql.version} + test mysql mysql-connector-java ${dependency.mysql.version} + test org.mariadb.jdbc mariadb-java-client ${dependency.mariadb.version} + test org.alfresco.tas utility ${dependency.tas-utility.version} + test io.rest-assured rest-assured ${dependency.rest-assured.version} + test org.alfresco.tas restapi ${dependency.tas-restapi.version} + test org.alfresco.tas cmis ${dependency.tas-cmis.version} + test org.alfresco.tas email ${dependency.tas-email.version} + test org.alfresco.tas webdav ${dependency.tas-webdav.version} + test org.alfresco.tas ftp ${dependency.tas-ftp.version} + test org.alfresco.test dataprep ${dependency.tas-dataprep.version} + test joda-time @@ -720,29 +687,27 @@ javax.servlet javax.servlet-api 3.0.1 + provided junit junit - 4.13.2 + 4.13.1 test org.antlr gunit ${dependency.antlr.version} - - - org.mockito - mockito-all - ${dependency.mockito-all.version} + test org.mockito mockito-core ${dependency.mockito-core.version} + test commons-dbcp @@ -821,37 +786,7 @@ org.apache.camel camel-mock ${dependency.camel.version} - - - org.apache.taglibs - taglibs-standard-spec - ${dependency.apache.taglibs.version} - - - org.apache.taglibs - taglibs-standard-impl - ${dependency.apache.taglibs.version} - - - org.apache.taglibs - taglibs-standard-jstlel - ${dependency.apache.taglibs.version} - - - org.reflections - reflections - 0.9.12 - - - - io.swagger - swagger-parser - ${dependency.swagger-parser.version} - - - org.projectlombok - lombok - 1.18.6 + test @@ -872,25 +807,10 @@ docker-maven-plugin 0.34.1 - - maven-surefire-plugin - 2.22.2 - - true - alphabetical - - --illegal-access=permit - - - maven-jar-plugin 3.2.0 - - maven-war-plugin - 3.2.2 - org.apache.maven.plugins maven-javadoc-plugin @@ -906,17 +826,8 @@ maven-dependency-plugin 3.1.2 - - maven-assembly-plugin - 3.3.0 - - - org.alfresco.maven.plugin - alfresco-maven-plugin - ${alfresco.maven-plugin.version} - true - + diff --git a/repository/pom.xml b/repository/pom.xml index 4f61039d6b..69703bf0b4 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -841,14 +841,17 @@ org.apache.taglibs taglibs-standard-spec + ${dependency.apache.taglibs.version} org.apache.taglibs taglibs-standard-impl + ${dependency.apache.taglibs.version} org.apache.taglibs taglibs-standard-jstlel + ${dependency.apache.taglibs.version} @@ -865,6 +868,7 @@ org.reflections reflections + 0.9.12 test @@ -1024,6 +1028,57 @@ license-maven-plugin 2.0.0 + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-surefire-plugin + + + [2.14,) + + + test + + + + + + + + + org.jibx + + maven-jibx-plugin + + + [1.2.5,) + + + bind + + + + + true + true + + + + + + + diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index df0fad8408..2c4fff11d6 100644 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -7,15 +7,14 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../../" source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh" if isBranchBuild && [ "${TRAVIS_BRANCH}" = "master" ] && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] ; then - # update ":latest" image tags on remote repositories by using the maven *push-docker-images* profile - PROFILES="-Ppush-docker-images" + # update ":latest" image tags on remote repositories by using the maven *internal* profile + PROFILES="-Pinternal" else - # build the ":latest" image tags locally with the maven *build-docker-images* profile - PROFILES="-Pbuild-docker-images" + # build the ":latest" image tags locally with the maven *communityDocker* profile + PROFILES="-PcommunityDocker" fi -# Build the current project -mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}" -Pags +mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}" popd diff --git a/scripts/travis/cleanup_cache.sh b/scripts/travis/cleanup_cache.sh index e7439e121b..33b940e2cd 100644 --- a/scripts/travis/cleanup_cache.sh +++ b/scripts/travis/cleanup_cache.sh @@ -16,5 +16,4 @@ rm -rf "${HOME}/.m2/repository/org/alfresco/content-services*" rm -rf "${HOME}/.m2/repository/org/alfresco/content-services-community" rm -rf "${HOME}/.m2/repository/org/alfresco/tas/alfresco-community-repo-*-test" rm -rf "${HOME}/.m2/repository/org/alfresco/tas/alfresco-enterprise-repo-*-test" -rm -rf "${HOME}/.m2/repository/org/alfresco/alfresco-governance-services*" diff --git a/scripts/travis/init.sh b/scripts/travis/init.sh index 8692d8d1eb..2eb4e3f158 100644 --- a/scripts/travis/init.sh +++ b/scripts/travis/init.sh @@ -14,6 +14,9 @@ if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" --password-stdin quay.io fi +# not helpful in this script +# export HOST_IP=$(hostname -I | cut -f1 -d' ') + popd set +vex echo "=========================== Finishing Init Script ==========================" diff --git a/scripts/travis/maven_release.sh b/scripts/travis/maven_release.sh index d4db16324f..beb01fb830 100755 --- a/scripts/travis/maven_release.sh +++ b/scripts/travis/maven_release.sh @@ -12,9 +12,8 @@ git config user.email "${GIT_EMAIL}" # Run the release plugin - with "[skip ci]" in the release commit message mvn -B \ - -Pall-tas-tests \ - -Pags \ - "-Darguments=-Pall-tas-tests -Pags -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \ + -PfullBuild,all-tas-tests \ + "-Darguments=-PfullBuild,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \ release:clean release:prepare release:perform \ -DscmCommentPrefix="[maven-release-plugin][skip ci] " \ -Dusername="${GIT_USERNAME}" \ diff --git a/scripts/travis/trigger_travis.sh b/scripts/travis/trigger_travis.sh new file mode 100755 index 0000000000..a0fc6b83cb --- /dev/null +++ b/scripts/travis/trigger_travis.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -ev + +USER=${1} +REPO=${2} +BRANCH=${3} + +if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + echo "Downstream projects shouldn't be triggered from PR builds" + exit 1 +fi + +if ! git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${USER}/${REPO}.git" "${BRANCH}" ; then + echo "Branch \"${BRANCH}\" not found on the downstream repository ${USER}/${REPO}. Exiting..." + exit 0 +fi + + +URL="https://api.travis-ci.com/repo/${USER}%2F${REPO}/requests" +BODY="{ +\"request\": { + \"branch\":\"${BRANCH}\" +}}" + +printf "Travis API call:\n URL: %s\n Body: %s\n\n" "${URL}" "${BODY}" + +curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -H "Travis-API-Version: 3" \ + -H "Authorization: token ${TRAVIS_ACCESS_TOKEN}" \ + -d "${BODY}" \ + "${URL}" \ + | tee /tmp/travis-request-output.txt + +cat /tmp/travis-request-output.txt + +if grep -q '"@type": "error"' /tmp/travis-request-output.txt; then + echo "Error when triggering build..." + exit 2 +fi +if grep -q 'access denied' /tmp/travis-request-output.txt; then + echo "Access denied when triggering build..." + exit 3 +fi + +exit 0 +